mirror of
https://github.com/opencv/opencv.git
synced 2024-11-29 05:29:54 +08:00
Merge pull request #12373 from alalek:issue_12365
This commit is contained in:
commit
07808c8d5d
@ -407,27 +407,25 @@ void cv::pyrMeanShiftFiltering( InputArray _src, OutputArray _dst,
|
||||
cv::Size size = src.size();
|
||||
const uchar* sptr = src.ptr();
|
||||
int sstep = (int)src.step;
|
||||
uchar* mask = 0;
|
||||
int mstep = 0;
|
||||
uchar* dptr;
|
||||
int dstep;
|
||||
float sp = (float)(sp0 / (1 << level));
|
||||
sp = MAX( sp, 1 );
|
||||
|
||||
cv::Mat m;
|
||||
if( level < max_level )
|
||||
{
|
||||
cv::Size size1 = dst_pyramid[level+1].size();
|
||||
cv::Mat m( size.height, size.width, CV_8UC1, mask0.ptr() );
|
||||
m = cv::Mat(size.height, size.width, CV_8UC1, mask0.ptr());
|
||||
dstep = (int)dst_pyramid[level+1].step;
|
||||
dptr = dst_pyramid[level+1].ptr() + dstep + cn;
|
||||
mstep = (int)m.step;
|
||||
mask = m.ptr() + mstep;
|
||||
//cvResize( dst_pyramid[level+1], dst_pyramid[level], CV_INTER_CUBIC );
|
||||
cv::pyrUp( dst_pyramid[level+1], dst_pyramid[level], dst_pyramid[level].size() );
|
||||
m.setTo(cv::Scalar::all(0));
|
||||
|
||||
for( i = 1; i < size1.height-1; i++, dptr += dstep - (size1.width-2)*3, mask += mstep*2 )
|
||||
for( i = 1; i < size1.height-1; i++, dptr += dstep - (size1.width-2)*3)
|
||||
{
|
||||
uchar* mask = m.ptr(1 + i * 2);
|
||||
for( j = 1; j < size1.width-1; j++, dptr += cn )
|
||||
{
|
||||
int c0 = dptr[0], c1 = dptr[1], c2 = dptr[2];
|
||||
@ -437,16 +435,16 @@ void cv::pyrMeanShiftFiltering( InputArray _src, OutputArray _dst,
|
||||
}
|
||||
|
||||
cv::dilate( m, m, cv::Mat() );
|
||||
mask = m.ptr();
|
||||
}
|
||||
|
||||
dptr = dst_pyramid[level].ptr();
|
||||
dstep = (int)dst_pyramid[level].step;
|
||||
|
||||
for( i = 0; i < size.height; i++, sptr += sstep - size.width*3,
|
||||
dptr += dstep - size.width*3,
|
||||
mask += mstep )
|
||||
dptr += dstep - size.width*3
|
||||
)
|
||||
{
|
||||
uchar* mask = m.empty() ? NULL : m.ptr(i);
|
||||
for( j = 0; j < size.width; j++, sptr += 3, dptr += 3 )
|
||||
{
|
||||
int x0 = j, y0 = i, x1, y1, iter;
|
||||
|
Loading…
Reference in New Issue
Block a user