Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void fillHoles(Mat image)
- {
- Mat bin;
- threshold(thresholdImg, bin, 50, 255, THRESH_BINARY | THRESH_OTSU);
- cv::Mat mask = cv::Mat::zeros(image.rows + 2, image.cols + 2, CV_8U);
- cv::floodFill(bin, mask, cv::Point(0,0), 255, 0, cv::Scalar(), cv::Scalar(), 4 + (255 << 8) + cv::FLOODFILL_MASK_ONLY);
- mask(Range(1, mask.rows - 1), Range(1, mask.cols-1)).copyTo(imgOut);
- imgOut = ~imgOut;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement