mirror of
https://github.com/opencv/opencv.git
synced 2025-01-22 09:36:59 +08:00
Closes #6349 - a bug in cuda::meanShiftSegmentation
This commit is contained in:
parent
e9a1ccb89a
commit
7b90a1e85a
@ -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,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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,
|
|||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user