Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

So how about the following (assuming I want all the points but only on the external contour)?

Mat cannyMat = new Mat();
List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
Mat hierarchy = new Mat();
MatOfInt hull = new MatOfInt();

Imgproc.Canny(originalMat, cannyMat, threshold1, threshold2);
Imgproc.findContours(cannyMat, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CV_CHAIN_APPROX_NONE);
Imgproc.convexHull(contours.get(0), hull);

Assuming that's correct, how do I then convert the hull back to a Mat that can be overlaid over originalMat?