Ask Your Question

grouping/joining collinear segments

asked 2017-09-06 03:23:59 -0500

fj_abbasi gravatar image

I am working on road extraction from the image. As a result of HoughLineP applied on the binary image shown below, I have small segments. what I want is to is to group the collinear segments and draw a center line, But i couldn't figure out how can I group the segments based on there proximity/connectivity, Or is there anyother approach to join collinear segments?

orignal edges HoughLines

edit retag flag offensive close merge delete


I am wondering if a binary pixel based classification between roads and other would not be a faster solution, combined with a thinning algorithm... You would need alot less fixes afterwards I guess

StevenPuttemans gravatar imageStevenPuttemans ( 2017-09-06 03:36:04 -0500 )edit

You mean filtering out pixel values of roads? In that case i guess it may give good result in one particular image but I will have to set the threshold values for every image, which is not desired thing.

fj_abbasi gravatar imagefj_abbasi ( 2017-09-06 04:08:55 -0500 )edit

oh well, it depends on the amount of variance. You can learn your ideal thresholds over a set of training images?

StevenPuttemans gravatar imageStevenPuttemans ( 2017-09-06 04:36:53 -0500 )edit

I guess it' will be difficult t to learn an ideal threshold as images are from different regions, though i have NIR as well and I can mask out vegetation from the images( images are from the agricultural areas). I followed an approach from a paper link which is based on finding center pixel from a distance transformed image. following that approach I have these segments as shown in the images.

fj_abbasi gravatar imagefj_abbasi ( 2017-09-06 04:55:14 -0500 )edit

I think you can get better results preprocessing your source image .

1) - Groupe small lines based on orientation , distance ... etc 2)- use line iterator and accumulate points for each group. 3) - fit line

Ziri gravatar imageZiri ( 2017-09-06 05:40:21 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-09-06 05:54:14 -0500

Ziri gravatar image

This is the result I got preprocessing image :

image description

Auto thresholding :

image description

Hough Lines (Standard)result using Opencv demonstrator :

image description

Hough Lines (Gradient based)result using Opencv demonstrator :

image description

edit flag offensive delete link more


These are the results which i can achieve by playing around with HoughLineP parameters but i need more accuracy (line following the curvature), what I could think was to group the small segments somehow and fit a centerline maybe.

fj_abbasi gravatar imagefj_abbasi ( 2017-09-06 06:30:15 -0500 )edit

Then instead of fitline you'll have to implement your function to fit curve using polynomial regression or other methods.

Ziri gravatar imageZiri ( 2017-09-06 08:35:54 -0500 )edit

to fit a line I have to group the pixel belonging to each road in the image and I have no idea how to group them.

fj_abbasi gravatar imagefj_abbasi ( 2017-09-06 10:32:53 -0500 )edit

lines belonging to same group will have "same" slop. and small distance from each other .

Ziri gravatar imageZiri ( 2017-09-06 20:18:25 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2017-09-06 03:23:59 -0500

Seen: 613 times

Last updated: Sep 06 '17