Fast Java library for circle recognition [closed]

我们两清 提交于 2019-11-28 05:42:08

问题


I'm looking for a Java library for circle recognition in a supplied bitmap. My Java knowledge is too basic to implement eg. Hough transform efficiently (Java newbie).

Thanks!


回答1:


You might want to have a look at the implementation in ImageJ, see here.




回答2:


Sorry for posting this answer many years after the fact, but that question was asked again in 2012 and then closed for being a duplicate. As I said in my answer to that duplicate, I think the answer given here is overkill for such a simple problem, so is my simpler solution:

  • Find all connected green blobs. This is not completely trivial, but not that hard either.
  • For each blob, find the point with the minimum x-coordinate and the one with the maximum x-coordinate and do the same in y. Then you easily get the dimension of the bounding box for the blob. If the x and y dimensions are different, you don't have a circle. However, you should allow for some small differences since drawing a circle with pixels will result in an imperfect circle.
  • Finally, if you have a circle, the center of the bounding box is (approximately) the circle's center and the radius is half the bounding box width. You can draw such a circle and see how many of the green pixels fit in/out of your circle. Again, you must allow for some imperfections.


来源:https://stackoverflow.com/questions/556108/fast-java-library-for-circle-recognition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!