Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I got it working doing:

MatOfPoint approxf1 = new MatOfPoint();
Imgproc.approxPolyDP(newMtx, approx, 0.02 * peri, true);
// All these lines are to print the contour (optional)
approx.convertTo(approxf1, CvType.CV_32S);
List<MatOfPoint> contourTemp = new ArrayList<>();
Imgproc.drawContours(img, contourTemp, 0, new Scalar(0, 255, 0), 2);