1

https://boofcv.org/index.php?title=Example_Fit_Polygon

This link above gives does some image detection, and provides good example but it is not for android which is what I need. What I'm really stuck on right now is there any equivalent for this

        VisualizeShapes.drawPolygon(vertexes,true,g2);

in Andriod. If there is can someone help me how to draw it like on the method with those paramters. For example, the drawPolygon takes vertexes as these

 List<PointIndex_I32> vertexes = ShapeFittingOps.fitPolygon(c.external,true, minSide,cornerPenalty);

and the true boolean is loop, and g2 is java.awt.Graphics2D. The documentation for VisualizeShapes are provided here: http://boofcv.org/javadoc/boofcv/gui/feature/VisualizeShapes.html

The issue is that VisualizeShapes is giving me an error because it not a supported library for android development and I need some way to find equivalent to polygonFitting detection on android.

Nish R
  • 51
  • 5

1 Answers1

1

The Android demonstration app is a good place to start when looking for stuff like that. MiscUtil.java has something similar to what you're looking for.

public static void renderPolygon(Polygon2D_F64 s, Path path , Canvas canvas , Paint paint ) {
    path.reset();
    for (int j = 0; j < s.size(); j++) {
        Point2D_F64 p = s.get(j);
        if (j == 0)
            path.moveTo((float) p.x, (float) p.y);
        else
            path.lineTo((float) p.x, (float) p.y);
    }
    Point2D_F64 p = s.get(0);
    path.lineTo((float) p.x, (float) p.y);
    path.close();
    canvas.drawPath(path, paint);
}
lessthanoptimal
  • 2,722
  • 2
  • 23
  • 25
  • Can you help me with [this](https://stackoverflow.com/questions/56366012/boofcv-canny-process-function-is-taking-a-lot-of-time)? – Phenomenal One May 30 '19 at 03:38