how to remove straight lines or non-curvical lines in a canny image

后端 未结 2 1638
暖寄归人
暖寄归人 2020-12-02 01:33

I have a canny edge image

I want to remove all line except the lines that look like a semi-circle/ellipse or a \'C\'. Tried Hough Circle transforms, it detects all

2条回答
  •  北海茫月
    2020-12-02 01:47

    1. Find contours from edge.
    2. Get bounding box.
    3. Calculate ratio of size of diagonal of bounding box to size of contour.

    This value will be close to '1' for straight edges. The higher the value of this ratio, the curvy the edge is going to be. It can roughly but quite accurately estimate curliness of the edge.

    Happy coding

提交回复
热议问题