Closes #6349 - a bug in cuda::meanShiftSegmentation

This commit is contained in:
Hamdi Sahloul 2018-08-21 14:46:00 +09:00
parent e9a1ccb89a
commit 7b90a1e85a
2 changed files with 3 additions and 3 deletions

View File

@ -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.
@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 sr Color window radius.
@param minsize Minimum segment size. Smaller segments are merged.

View File

@ -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
_dst.create(src.size(), src.type());
Mat dst = _dst.getMat();
Mat dst(src.size(), src.type());
for (int y = 0; y < nrows; ++y)
{
@ -389,6 +388,7 @@ void cv::cuda::meanShiftSegmentation(InputArray _src, OutputArray _dst, int sp,
dstcol[3] = 255;
}
}
dst.copyTo(_dst);
}
#endif // #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)