Advertisement
Guest User

Untitled

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