MATLAB Answers


How to find the point where most lines intersect in a binary image?

Asked by Aon
on 14 Sep 2018
Latest activity Commented on by Image Analyst
on 16 Sep 2018
In a multi-line binary image with different slopes and center points. How do you find the coordinate where most lines intersect? (it should be close where the red arrow points)
Thanks in advance


So basically you have a set of points where the lines meet? That would be relevant information to include in the original submission... or perhaps you tried this after posting the Q.
Yes with the help of InterX function I now have an array with the intersectpoints. Is it possible to find the cluster with only the array?
Yep, see the latest comment on the answer for two methods. Id try hist3 first

Sign in to comment.

2 Answers

Answer by jonas
on 14 Sep 2018
Edited by jonas
on 15 Sep 2018
 Accepted Answer

A good solution would be to identify each line by e.g. Hough transform, determine each intersection (e.g. InterX ) and then find the cluster with the highest density of intersections using e.g hist3.
In this case, it seems the point of interest is also the point with the highest density of white pixels, so you could apply some smoothing filter and then find the highest value in the matrix. Here's an example using a very simple 10x10 pixel average.


Show 1 older comment
Nice! You could put the intersections in a binary matrix, smooth it and find the highest value in the resulting matrix, just like I did in the original answer.
Better yet, use hist3 to find the bin with highest density of points. Something like
and adjust the bin size to get the desired resolution.
hist3 worked very well! Thank you very much for the help.
Nice! My pleasure

Sign in to comment.

Answer by Image Analyst
on 15 Sep 2018


hist3 helped me very well but I will read more about dbscan also. Thank you!
Alternatively you could threshold the blurred image and use regionprops to find the weighted centroid of the region.

Sign in to comment.