How to floodfill an image with java api
I got it working fine when I did it with C++, it was like:
Mat floodFilled = cv::Mat::zeros(src.rows + 2, src.cols + 2, CV_8U);
floodFill(src, floodFilled, cv::Point(0, 0), 0, 0, cv::Scalar(), cv::Scalar(), 4 + (255 << 8) + cv::FLOODFILL_MASK_ONLY);
floodFilled = cv::Scalar::all(255) - floodFilled;
Mat temp;
floodFilled(Rect(1, 1, src.cols - 2, src.rows - 2)).copyTo(temp);
floodFilled = temp;
imshow("5. Floodfill", floodFilled);
But I can't reproduce this in java because some features does not exist there, like these lines:
floodFilled = cv::Scalar::all(255) - floodFilled;
I can't subtract a matrix from a scalar this way.
floodFilled(Rect(1, 1, src.cols - 2, src.rows - 2)).copyTo(temp);
this constructor does not exist either.
The output image was exactly the same as the input one.
So, I want to be able to do the same thing that I did in C++, with java instead. Thanks in advance.