Commit aab390c5 authored by mworchel's avatar mworchel Committed by Alexander Alekhin

Add mask support to SimpleBlobDetector

parent 88b689bc
......@@ -304,11 +304,10 @@ void SimpleBlobDetectorImpl::findBlobs(InputArray _image, InputArray _binaryImag
#endif
}
void SimpleBlobDetectorImpl::detect(InputArray image, std::vector<cv::KeyPoint>& keypoints, InputArray)
void SimpleBlobDetectorImpl::detect(InputArray image, std::vector<cv::KeyPoint>& keypoints, InputArray mask)
{
CV_INSTRUMENT_REGION()
//TODO: support mask
keypoints.clear();
Mat grayscaleImage;
if (image.channels() == 3 || image.channels() == 4)
......@@ -372,6 +371,11 @@ void SimpleBlobDetectorImpl::detect(InputArray image, std::vector<cv::KeyPoint>&
KeyPoint kpt(sumPoint, (float)(centers[i][centers[i].size() / 2].radius) * 2.0f);
keypoints.push_back(kpt);
}
if (!mask.empty())
{
KeyPointsFilter::runByPixelsMask(keypoints, mask.getMat());
}
}
Ptr<SimpleBlobDetector> SimpleBlobDetector::create(const SimpleBlobDetector::Params& params)
......
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