You should use the SimpleBlobDetector class in OpenCV 2.4. You pretty much create an object of type SimpleBlobDetector , and then call the detect(cv::Mat input, vector<cv::KeyPoint> keypoints, cv::Mat mask) function detect(cv::Mat input, vector<cv::KeyPoint> keypoints, cv::Mat mask) using the cv :: Mat image as input, an empty vector for key points and another cv :: Mat as an additional mask for a specific area of ββthe image to search for key points.
Note that the cv :: Mat object took over the processing of images and memory for all previously separated image and matrix classes in earlier versions of OpenCV.
source share