How can I find an approximate intersection of two lines in a binary image?

Illustration
thaka - 2022-03-03T13:47:22+00:00
Question: How can I find an approximate intersection of two lines in a binary image?

I'd like to find the coordinates of the intersection of lines in a binary image. What's a good way to do this?

Expert Answer

Profile picture of Kshitij Singh Kshitij Singh answered . 2025-11-20

I guess I'd try thresholding

binaryImage = grayImage < 128

Then call bwmorph to skeletonize

skelImage = bwmorph(binaryImage, 'skel', inf);

Then call bwmorph again to find crossing points.

crossings = bwmorph(skelImage, 'branchpoints');

This is untested, so give it a shot and let me know how it goes. There is a possibility you could get spurious branchpoints depending on how ragged your thick lines are.


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!