mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
@@ -625,7 +625,8 @@ icvFetchContour( schar *ptr,
|
||||
|
||||
/*
|
||||
trace contour until certain point is met.
|
||||
returns 1 if met, 0 else.
|
||||
returns 1 if met and this is the last contour
|
||||
encountered by a raster scan reaching the point, 0 else.
|
||||
*/
|
||||
static int
|
||||
icvTraceContour( schar *ptr, int step, schar *stop_ptr, int is_hole )
|
||||
@@ -668,14 +669,39 @@ icvTraceContour( schar *ptr, int step, schar *stop_ptr, int is_hole )
|
||||
break;
|
||||
}
|
||||
|
||||
if( i3 == stop_ptr || (i4 == i0 && i3 == i1) )
|
||||
if (i3 == stop_ptr) {
|
||||
if (!(*i3 & 0x80)) {
|
||||
/* it's the only contour */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* check if this is the last contour */
|
||||
/* encountered during a raster scan */
|
||||
schar *i5;
|
||||
int t = s;
|
||||
while (true)
|
||||
{
|
||||
t = (t - 1) & 7;
|
||||
i5 = i3 + deltas[t];
|
||||
if (*i5 != 0)
|
||||
break;
|
||||
if (t == 0)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if( (i4 == i0 && i3 == i1) )
|
||||
break;
|
||||
|
||||
i3 = i4;
|
||||
s = (s + 4) & 7;
|
||||
} /* end of border following loop */
|
||||
}
|
||||
return i3 == stop_ptr;
|
||||
else {
|
||||
return i3 == stop_ptr;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1101,6 +1101,7 @@ static bool ipp_sqrDistance(const Mat& src, const Mat& tpl, Mat& dst)
|
||||
buffer.allocate( bufSize );
|
||||
|
||||
status = CV_INSTRUMENT_FUN_IPP(ippiSqrDistanceNorm, src.ptr(), (int)src.step, srcRoiSize, tpl.ptr(), (int)tpl.step, tplRoiSize, dst.ptr<Ipp32f>(), (int)dst.step, funCfg, buffer);
|
||||
dst = cv::max(dst, 0); // handle edge case from rounding in variance computation which can result in negative values
|
||||
return status >= 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user