How to find endpoints of lines in OpenCV?

前端 未结 4 740
滥情空心
滥情空心 2021-01-19 00:42

I have an image made up of lines; how can I find the endpoints with OpenCV?

The lines are about 20 pixels wide. They turn, branch, and can be at angles (although mos

4条回答
  •  迷失自我
    2021-01-19 00:58

    The easiest way for me would be to thin the image to 1px thickness and then use hit and miss transform to detect the endpoints. Unfortunately, none of these functions are implemented in OpenCV. Thinning can also be obtained with hit or miss transform. All you need is thoroughly described in the following link: http://homepages.inf.ed.ac.uk/rbf/HIPR2/thin.htm

    Let me know if you have any problems with this, as I have it all implemented. Hit or miss transform might be really old and simple, but it's a very powerful tool.

提交回复
热议问题