Commit 7b90a1e8 authored by Hamdi Sahloul's avatar Hamdi Sahloul

Closes #6349 - a bug in cuda::meanShiftSegmentation

parent e9a1ccb8
...@@ -639,7 +639,7 @@ CV_EXPORTS void meanShiftProc(InputArray src, OutputArray dstr, OutputArray dsts ...@@ -639,7 +639,7 @@ CV_EXPORTS void meanShiftProc(InputArray src, OutputArray dstr, OutputArray dsts
/** @brief Performs a mean-shift segmentation of the source image and eliminates small segments. /** @brief Performs a mean-shift segmentation of the source image and eliminates small segments.
@param src Source image. Only CV_8UC4 images are supported for now. @param src Source image. Only CV_8UC4 images are supported for now.
@param dst Segmented image with the same size and type as src (host memory). @param dst Segmented image with the same size and type as src (host or gpu memory).
@param sp Spatial window radius. @param sp Spatial window radius.
@param sr Color window radius. @param sr Color window radius.
@param minsize Minimum segment size. Smaller segments are merged. @param minsize Minimum segment size. Smaller segments are merged.
......
...@@ -372,8 +372,7 @@ void cv::cuda::meanShiftSegmentation(InputArray _src, OutputArray _dst, int sp, ...@@ -372,8 +372,7 @@ void cv::cuda::meanShiftSegmentation(InputArray _src, OutputArray _dst, int sp,
} }
// Create final image, color of each segment is the average color of its pixels // Create final image, color of each segment is the average color of its pixels
_dst.create(src.size(), src.type()); Mat dst(src.size(), src.type());
Mat dst = _dst.getMat();
for (int y = 0; y < nrows; ++y) for (int y = 0; y < nrows; ++y)
{ {
...@@ -389,6 +388,7 @@ void cv::cuda::meanShiftSegmentation(InputArray _src, OutputArray _dst, int sp, ...@@ -389,6 +388,7 @@ void cv::cuda::meanShiftSegmentation(InputArray _src, OutputArray _dst, int sp,
dstcol[3] = 255; dstcol[3] = 255;
} }
} }
dst.copyTo(_dst);
} }
#endif // #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) #endif // #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment