minor refactoring

This commit is contained in:
Anatoly Baksheev 2011-02-21 16:50:19 +00:00
parent b97d8fd656
commit efe16c6f3e
2 changed files with 13 additions and 14 deletions

View File

@ -63,14 +63,14 @@ namespace cv { namespace gpu
} }
}; };
void call(const DevMem2D_<float> src, const float* rot, void call(const DevMem2D_<float3> src, const float* rot,
const float* transl, DevMem2D_<float> dst) const float* transl, DevMem2D_<float3> dst)
{ {
cudaSafeCall(cudaMemcpyToSymbol(crot0, rot, sizeof(float) * 3)); cudaSafeCall(cudaMemcpyToSymbol(crot0, rot, sizeof(float) * 3));
cudaSafeCall(cudaMemcpyToSymbol(crot1, rot + 3, sizeof(float) * 3)); cudaSafeCall(cudaMemcpyToSymbol(crot1, rot + 3, sizeof(float) * 3));
cudaSafeCall(cudaMemcpyToSymbol(crot2, rot + 6, sizeof(float) * 3)); cudaSafeCall(cudaMemcpyToSymbol(crot2, rot + 6, sizeof(float) * 3));
cudaSafeCall(cudaMemcpyToSymbol(ctransl, transl, sizeof(float) * 3)); cudaSafeCall(cudaMemcpyToSymbol(ctransl, transl, sizeof(float) * 3));
transform((const DevMem2D_<float3>)src, (DevMem2D_<float3>)dst, TransformOp()); transform(src, dst, TransformOp());
} }
} // namespace transform_points } // namespace transform_points
@ -99,8 +99,8 @@ namespace cv { namespace gpu
} }
}; };
void call(const DevMem2D_<float> src, const float* rot, void call(const DevMem2D_<float3> src, const float* rot,
const float* transl, const float* proj, DevMem2D_<float> dst) const float* transl, const float* proj, DevMem2D_<float2> dst)
{ {
cudaSafeCall(cudaMemcpyToSymbol(crot0, rot, sizeof(float) * 3)); cudaSafeCall(cudaMemcpyToSymbol(crot0, rot, sizeof(float) * 3));
cudaSafeCall(cudaMemcpyToSymbol(crot1, rot + 3, sizeof(float) * 3)); cudaSafeCall(cudaMemcpyToSymbol(crot1, rot + 3, sizeof(float) * 3));
@ -108,7 +108,7 @@ namespace cv { namespace gpu
cudaSafeCall(cudaMemcpyToSymbol(ctransl, transl, sizeof(float) * 3)); cudaSafeCall(cudaMemcpyToSymbol(ctransl, transl, sizeof(float) * 3));
cudaSafeCall(cudaMemcpyToSymbol(cproj0, proj, sizeof(float) * 3)); cudaSafeCall(cudaMemcpyToSymbol(cproj0, proj, sizeof(float) * 3));
cudaSafeCall(cudaMemcpyToSymbol(cproj1, proj + 3, sizeof(float) * 3)); cudaSafeCall(cudaMemcpyToSymbol(cproj1, proj + 3, sizeof(float) * 3));
transform((const DevMem2D_<float3>)src, (DevMem2D_<float2>)dst, ProjectOp()); transform(src, dst, ProjectOp());
} }
} // namespace project_points } // namespace project_points

View File

@ -52,9 +52,9 @@ void cv::gpu::projectPoints(const GpuMat&, const Mat&, const Mat&,
#else #else
namespace cv { namespace gpu { namespace transform_points { namespace cv { namespace gpu { namespace transform_points
void call(const DevMem2D_<float> src, const float* rot, {
const float* transl, DevMem2D_<float> dst); void call(const DevMem2D_<float3> src, const float* rot, const float* transl, DevMem2D_<float3> dst);
}}} }}}
void cv::gpu::transformPoints(const GpuMat& src, const Mat& rvec, const Mat& tvec, void cv::gpu::transformPoints(const GpuMat& src, const Mat& rvec, const Mat& tvec,
@ -73,9 +73,9 @@ void cv::gpu::transformPoints(const GpuMat& src, const Mat& rvec, const Mat& tve
} }
namespace cv { namespace gpu { namespace project_points { namespace cv { namespace gpu { namespace project_points
void call(const DevMem2D_<float> src, const float* rot, {
const float* transl, const float* proj, DevMem2D_<float> dst); void call(const DevMem2D_<float3> src, const float* rot, const float* transl, const float* proj, DevMem2D_<float2> dst);
}}} }}}
void cv::gpu::projectPoints(const GpuMat& src, const Mat& rvec, const Mat& tvec, void cv::gpu::projectPoints(const GpuMat& src, const Mat& rvec, const Mat& tvec,
@ -92,8 +92,7 @@ void cv::gpu::projectPoints(const GpuMat& src, const Mat& rvec, const Mat& tvec,
Rodrigues(rvec, rot); Rodrigues(rvec, rot);
dst.create(src.size(), CV_32FC2); dst.create(src.size(), CV_32FC2);
project_points::call(src, rot.ptr<float>(), tvec.ptr<float>(), project_points::call(src, rot.ptr<float>(), tvec.ptr<float>(), camera_mat.ptr<float>(), dst);
camera_mat.ptr<float>(), dst);
} }
#endif #endif