Commit 6132943a authored by Alexander Alekhin's avatar Alexander Alekhin Committed by Alexander Alekhin

xfeatures2d: validate keypoints mask for SURF

parent 25ded913
......@@ -944,6 +944,19 @@ void SURF_Impl::detectAndCompute(InputArray _img, InputArray _mask,
integral(mask1, msum, CV_32S);
}
fastHessianDetector( sum, msum, keypoints, nOctaves, nOctaveLayers, (float)hessianThreshold );
if (!mask.empty())
{
for (size_t i = 0; i < keypoints.size(); )
{
Point pt(keypoints[i].pt);
if (mask.at<uchar>(pt.y, pt.x) == 0)
{
keypoints.erase(keypoints.begin() + i);
continue; // keep "i"
}
i++;
}
}
}
int i, j, N = (int)keypoints.size();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment