Ask Your Question

How can I detect center of road(as a line) if contours for road are drawn.

asked 2016-07-01 01:55:17 -0600

u93482963 gravatar image

I am interested in obtaining a center line of road. I am working on video frames(bgr). Then applying threshold,erosion and canny edge detection.

Further I am applying sobel derivative and then finally drawing contours.

I am thinking of taking small strips along y axis, obtaining x coordinates and the finding the mean of these x coordinates. But so far I have not come across any function which would allow me to do this.

Also if I get these values how should I store them ?

edit retag flag offensive close merge delete


So, you have the border lines and want to compute from them the center line? Or do you currently have nothing and want to detect all the road lines?

Guanta gravatar imageGuanta ( 2016-07-02 12:01:48 -0600 )edit

Yes. I do have the edges of the road. But now I am not sure how to proceed. And also the contours I have drawn aren't conforming to roads.

u93482963 gravatar imageu93482963 ( 2016-07-02 13:22:00 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-07-03 07:56:01 -0600

Guanta gravatar image

updated 2016-07-03 08:02:13 -0600

If you have the road lines correctly detected and just want the middle line, then you can do like the famous stroke width transform (SWT). Basically from each point on the line walk in the direction of the gradient until you hit the gradient from the other line (which points (roughly) in the opposite direction). When you have have found the end point of your line, then you can just take the midpoint of it. Do this for each point and you got the line in between of the other two lines.

image description

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-07-01 01:55:17 -0600

Seen: 2,203 times

Last updated: Jul 03 '16