Ask Your Question

How can I detect curved line?

asked 2020-08-25 02:30:56 -0500

prgrmmr gravatar image

image description 1. How Can I extract curved lines in the following image using Opencv? 2. How to extract only horizontal lines? inside -30 to +30 degrees

I need to detect horizontal lines from the following image including curved lines. I did like these steps. Color - Grayscale - GaussianBlur(to remove noise) - CannyEdge - HoughLineP But I get both of horizontal and vertical lines, and i cannot detect curved lines.

Please help, any Idea

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2020-08-27 05:48:30 -0500

kbarni gravatar image

Curve detection is not simple in image processing. AFAIK there is no standard way for doing it (like the Hough transform for line detection).

Probably the easiest way to detect a simple (quadratic) curve is the RANSAC algorithm: select 3 random points from the list of points with strong gradients (i.e. the points which lie probably on a curve/line). Then get the parameters of the curve C which passes through these 3 points: ax²+bx+c=0. Then check the number of points with strong gradients along the curve C. If it's above a certain threshold then consider this a detection and remove the points from the list (to avoid detecting the curve again). Then repeat the process (many-many times).

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-08-25 02:30:56 -0500

Seen: 247 times

Last updated: Aug 27