meanShiftFilteringGPU: performance and bug with type conversions

pull/13383/head
Anatoly Baksheev 15 years ago
parent f9cbb36b5e
commit 2a385be0ef
  1. 2
      modules/gpu/include/opencv2/gpu/gpu.hpp
  2. 14
      modules/gpu/src/cuda/imgproc.cu
  3. 6
      modules/gpu/src/imgproc_gpu.cpp

@ -333,7 +333,7 @@ namespace cv
CV_EXPORTS void remap(const GpuMat& src, const GpuMat& xmap, const GpuMat& ymap, GpuMat& dst);
CV_EXPORTS void meanShiftFiltering_GPU(const GpuMat& src, GpuMat& dst, float sp, float sr, TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1));
CV_EXPORTS void meanShiftFiltering_GPU(const GpuMat& src, GpuMat& dst, int sp, int sr, TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1));
//////////////////////////////// StereoBM_GPU ////////////////////////////////

@ -138,12 +138,12 @@ namespace imgproc
if( count == 0 )
break;
icount = 1./count;
int x1 = floor(sx*icount);
int y1 = floor(sy*icount);
s0 = floor(s0*icount);
s1 = floor(s1*icount);
s2 = floor(s2*icount);
icount = 1.f/count;
int x1 = __float2int_rz(sx*icount);
int y1 = __float2int_rz(sy*icount);
s0 = __float2int_rz(s0*icount);
s1 = __float2int_rz(s1*icount);
s2 = __float2int_rz(s2*icount);
int norm2 = (s0 - c.x) * (s0 - c.x) + (s1 - c.y) * (s1 - c.y) + (s2 - c.z) * (s2 - c.z);
@ -166,7 +166,7 @@ namespace imgproc
namespace cv { namespace gpu { namespace impl
{
extern "C" void meanShiftFiltering_gpu(const DevMem2D& src, DevMem2D dst, float sp, float sr, int maxIter, float eps)
extern "C" void meanShiftFiltering_gpu(const DevMem2D& src, DevMem2D dst, int sp, int sr, int maxIter, float eps)
{
dim3 grid(1, 1, 1);
dim3 threads(32, 16, 1);

@ -48,7 +48,7 @@ using namespace cv::gpu;
#if !defined (HAVE_CUDA)
void cv::gpu::remap(const GpuMat& /*src*/, const GpuMat& /*xmap*/, const GpuMat& /*ymap*/, GpuMat& /*dst*/) { throw_nogpu(); }
void cv::gpu::meanShiftFiltering_GPU(const GpuMat&, GpuMat&, float, float, TermCriteria ) { throw_nogpu(); }
void cv::gpu::meanShiftFiltering_GPU(const GpuMat&, GpuMat&, int, int, TermCriteria ) { throw_nogpu(); }
#else /* !defined (HAVE_CUDA) */
@ -58,7 +58,7 @@ namespace cv { namespace gpu
{
extern "C" void remap_gpu(const DevMem2D& src, const DevMem2D_<float>& xmap, const DevMem2D_<float>& ymap, DevMem2D dst);
extern "C" void meanShiftFiltering_gpu(const DevMem2D& src, DevMem2D dst, float sp, float sr, int maxIter, float eps);
extern "C" void meanShiftFiltering_gpu(const DevMem2D& src, DevMem2D dst, int sp, int sr, int maxIter, float eps);
}
}}
@ -75,7 +75,7 @@ void cv::gpu::remap(const GpuMat& src, const GpuMat& xmap, const GpuMat& ymap, G
void cv::gpu::meanShiftFiltering_GPU(const GpuMat& src, GpuMat& dst, float sp, float sr, TermCriteria criteria)
void cv::gpu::meanShiftFiltering_GPU(const GpuMat& src, GpuMat& dst, int sp, int sr, TermCriteria criteria)
{
if( src.empty() )
CV_Error( CV_StsBadArg, "The input image is empty" );

Loading…
Cancel
Save