[英]BoofCV polygon drawing equivalent for Android
https://boofcv.org/index.php?title=Example_Fit_Polygon 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.上面的这个链接提供了一些图像检测,并提供了很好的例子,但它不适用于我需要的 android。 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
例如,drawPolygon 将顶点作为这些
List<PointIndex_I32> vertexes = ShapeFittingOps.fitPolygon(c.external,true, minSide,cornerPenalty);
and the true boolean is loop, and g2 is java.awt.Graphics2D.真正的布尔值是循环,g2 是 java.awt.Graphics2D。 The documentation for VisualizeShapes are provided here: http://boofcv.org/javadoc/boofcv/gui/feature/VisualizeShapes.html
VisualizeShapes 的文档在此处提供: 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.问题是 VisualizeShapes 给了我一个错误,因为它不是 android 开发支持的库,我需要某种方法来找到与 android 上的多边形拟合检测等效的方法。
The Android demonstration app is a good place to start when looking for stuff like that.在寻找此类内容时,Android 演示应用程序是一个不错的起点。 MiscUtil.java has something similar to what you're looking for.
MiscUtil.java与您要查找的内容类似。
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);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.