I am trying to use MSER algorithm in OpenCV 3.0.0 beta to extract text regions from an image. At the end I need a binary mask with the detected MSER regions, but the algorit
I found the solution! Just loop over all the points and draw them!
void mserExtractor (const Mat& image, Mat& mserOutMask){
Ptr<MSER> mserExtractor = MSER::create();
vector<vector<cv::Point>> mserContours;
vector<KeyPoint> mserKeypoint;
vector<cv::Rect> mserBbox;
mserExtractor->detectRegions(image, mserContours, mserBbox);
for (vector<cv::Point> v : mserContours){
for (cv::Point p : v){
mserOutMask.at<uchar>(p.y, p.x) = 255;
}
}
}