I have an application using OpenCV and im trying to implement floodfill after using canny edge and use findcontours and boundingrect to get colored letters and segment each words or line of words.
I already implemented it but I dont see the result of floodfill, the result image is only canny edge. I tried to remove canny and use floodfill but i get a lighter color (white-ish) of the image.
here is my code (after canny edge - floodfill part):
Imgproc.morphologyEx(mask, morByte, Imgproc.MORPH_DILATE, kernel);
Imgproc.findContours(morByte, contour2, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_NONE);
Imgproc.floodFill(morByte, flooded, flood, new Scalar(255,255,255), new Rect(), lowerDiff, upperDiff, 4);
I tried this (current implemented floodfill line). I also tried to change flooded variable to mask based on this and it's an error/crashes.
I also tried to change my code based from this but I get this error:
CvException [org.opencv.core.CvException: cv::Exception: /build/master_pack-android/opencv/modules/imgproc/src/floodfill.cpp:556: error: (-215) mask.rows == size.height+2 && mask.cols == size.width+2 in function int cv::floodFill(cv::InputOutputArray, cv::InputOutputArray, cv::Point, cv::Scalar, cv::Rect*, cv::Scalar, cv::Scalar, int)