Ask Your Question

Revision history [back]

Function ConvexHull not work in Android

    // In C++
    ...
    convexHull( Mat(v[layer]), v[layer], false );
    v[layer]=v[layer]; // OK

    // In Java (Android)
    ...
    MatOfInt mOi=new MatOfInt();
    Imgproc.convexHull( matOfPoint, mOi );
    List<Point> l = new ArrayList<Point>();
    for (int i=0; i<mOi.toArray().length-1; i+=2) // Neither with toList()
        l.add(new Point(mOi.toArray()[i],mOi.toArray()[i+1]));
    maOfPoint.fromList(l);

The problem is that it works, but not with the desired result. Generates random polygons. Thanks for your attention and greetings. WS