java从点的arraylist中识别圆 [英] java circle recognition from an arraylist of points

查看:21
本文介绍了java从点的arraylist中识别圆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个来自画布上徒手画的点的数组列表.我想知道是否有一个简单的算法来检测该形状是否代表一个圆形.我已经对此进行了一些研究,我指出的主要项目是霍夫变换或具有位图图像,但这两者似乎都有些结束我需要它的顶部.任何指向算法或实现的指针都会非常有帮助.

I currently have an arraylist of points from a freehand drawing on a canvas. I was wondering if there is a simple algorithm to detect if that shape represents a circle.I have already researched this a little and the main items I am pointed at are either the Hough transform or having bitmap images but both of these seem a little over the top for what I need it for. Any pointers to algorithms or implementation would be very helpful.

预先感谢sansoms,

thanks in advance sansoms,

推荐答案

如果您不知道用户想要画什么(例如,圆形、椭圆、直线或矩形),您可以使用一些基本的寻找与手绘点最匹配的形状的优化算法.

If you do not know what the user wanted to draw (e.g., a circle, an ellipse, a line, or a rectangle), you could use some basic optimization algorithm to find the shape best matching the hand-drawn points.

  • 对于每个基本形状(椭圆形、矩形、三角形、直线等),创建该形状的随机实例并测量误差 w.r.t.给定的点
  • 优化每个形状(单独),直到获得与给定点最匹配的椭圆、与点最匹配的矩形、最佳三角形等.
  • 选择误差最小的形状并绘制

这篇关于java从点的arraylist中识别圆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆