Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find intersections in binary image lines?

I have a binary image with curved lines as shown below, but I would like to know how I can find where they would intersect if they are extended.

So could you give me some ides on how i could:

  • extend the line endpoints in the same direction,
  • how to find the intersections?

I have thought about using hough transform to find lines, then intersection, but in some images my line endpoints are not exactly straight. Is there a way to maybe only find the direction of the line at the end of it instead of over the whole line, as it is a binary image?

Thanks for any help cab

like image 675
Alex Avatar asked Jul 12 '11 11:07

Alex


1 Answers

Applying a dilation and then an erosion will extend your endpoints like this:

(*Code in Mathematica*)
Erosion[Dilation[i, 10], 10]

enter image description here

A full solution could be something like this:

r = Dilation[MorphologicalBranchPoints[
   Thinning[Binarize@Erosion[Dilation[i, 10], 10], 10]] // Colorize, 3]
ImageAdd[i, r]

enter image description here

like image 192
Dr. belisarius Avatar answered Sep 22 '22 21:09

Dr. belisarius