mirror of
https://github.com/opencv/opencv.git
synced 2024-12-01 14:59:54 +08:00
Merge pull request #2764 from hbadino:Feature_3692
This commit is contained in:
commit
165789bfcd
@ -1029,18 +1029,6 @@ void filterSpecklesImpl(cv::Mat& img, int newVal, int maxSpeckleSize, int maxDif
|
|||||||
T dp = *dpp;
|
T dp = *dpp;
|
||||||
int* lpp = labels + width*p.y + p.x;
|
int* lpp = labels + width*p.y + p.x;
|
||||||
|
|
||||||
if( p.x < width-1 && !lpp[+1] && dpp[+1] != newVal && std::abs(dp - dpp[+1]) <= maxDiff )
|
|
||||||
{
|
|
||||||
lpp[+1] = curlabel;
|
|
||||||
*ws++ = Point2s(p.x+1, p.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( p.x > 0 && !lpp[-1] && dpp[-1] != newVal && std::abs(dp - dpp[-1]) <= maxDiff )
|
|
||||||
{
|
|
||||||
lpp[-1] = curlabel;
|
|
||||||
*ws++ = Point2s(p.x-1, p.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( p.y < height-1 && !lpp[+width] && dpp[+dstep] != newVal && std::abs(dp - dpp[+dstep]) <= maxDiff )
|
if( p.y < height-1 && !lpp[+width] && dpp[+dstep] != newVal && std::abs(dp - dpp[+dstep]) <= maxDiff )
|
||||||
{
|
{
|
||||||
lpp[+width] = curlabel;
|
lpp[+width] = curlabel;
|
||||||
@ -1053,6 +1041,18 @@ void filterSpecklesImpl(cv::Mat& img, int newVal, int maxSpeckleSize, int maxDif
|
|||||||
*ws++ = Point2s(p.x, p.y-1);
|
*ws++ = Point2s(p.x, p.y-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( p.x < width-1 && !lpp[+1] && dpp[+1] != newVal && std::abs(dp - dpp[+1]) <= maxDiff )
|
||||||
|
{
|
||||||
|
lpp[+1] = curlabel;
|
||||||
|
*ws++ = Point2s(p.x+1, p.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( p.x > 0 && !lpp[-1] && dpp[-1] != newVal && std::abs(dp - dpp[-1]) <= maxDiff )
|
||||||
|
{
|
||||||
|
lpp[-1] = curlabel;
|
||||||
|
*ws++ = Point2s(p.x-1, p.y);
|
||||||
|
}
|
||||||
|
|
||||||
// pop most recent and propagate
|
// pop most recent and propagate
|
||||||
// NB: could try least recent, maybe better convergence
|
// NB: could try least recent, maybe better convergence
|
||||||
p = *--ws;
|
p = *--ws;
|
||||||
|
Loading…
Reference in New Issue
Block a user