Android: cannot draw the interior of contours
Hello,
I don't know if this is a bug or a mistake by me but i cannot draw the interior of the contours of an image. My input image is this:
I am using the Android version of OpenCv and the following code snippet for contour detection:
Mat canny = new Mat();
Imgproc.Canny(in_grayImg, canny, 100, 200);
List<MatOfPoint> contours = new LinkedList<MatOfPoint>();
Mat hierarchy = new Mat();
Imgproc.findContours(canny, contours, hierarchy, Imgproc.RETR_CCOMP,
Imgproc.CHAIN_APPROX_SIMPLE);
These are the detected contours drawn with
Imgproc.drawContours(canny, contours, -1, new Scalar(255));
According to the API using the drawContours with a negative thickness value draws the interior of the contours. However the following code to draw the contours results in the same image as before:
Imgproc.drawContours(canny, contours, -1, new Scalar(255), -1);
I also tried using the detected hierarchy but the result is unchanged:
Imgproc.drawContours(canny, contours, -1, new Scalar(255), -1, 8, hierarchy, 2, new Point(0, 0));
I really don't know what I am doing wrong and it seems to me that a negative thickness value is simply ignored.
Thanks in advance and best regards,
Josef