Ask Your Question

Revision history [back]

Hey, here's my solution to convert between the two:

List<MatOfPoints> data = new ArrayList<MatOfPoints>();
List<MatOfPoint2f> matrix = new ArrayList<MatOfPoint2f>();

Imgproc.findCountours(src,data,new Mat(),Imgproc.RETR_LIST,Imgproc.CHAIN_APPROX_SIMPLE);

for(int i = 0; i < data.size(); i++){
    MatOfPoint2f myPt = new MatOfPoint2f();
    data.get(i).convertTo(myPt, CvType.CV_32FC2);
    matrix.add(myPt);
}