Find intersections of a series of image curves: Matlab
I have an image with a row of lines as shown below:
I would like to know if there is any method for finding the intersections of all strings.
I checked another post where they suggest a way to find intersections, but once an image is segmented, I assume it has noise or something like that ... I'll start with a simple image to find each intersection.
My main idea was to solve the "system of equations", but I think it would be too difficult for an image with many intersections, I don't know if there is any method for finding all intersections.
source to share
I'm assuming you don't have linear equations. I used skeletonization and filtering to detect small areas with more than one line crossing them. I'm not sure if it will be that easy for a noisy image, but it's worth trying:
im = im2double(rgb2gray(imread('lines.png')));
% binarize black lines
bw = im == 0;
% skelatonize lines
sk = bwmorph(bw,'skel',inf);
% filter skeleton with 3X3 ones filter
A = imfilter(double(sk),ones(3));
% find blobs greater than 4 - more than one line crossing the filter
B = A > 4;
% get centroids of detected blobs
C = regionprops(B,'Centroid');
Cent = reshape([C.Centroid],2,[]).';
% plot
imshow(im)
hold on;
plot(Cent(:,1),Cent(:,2),'gx','LineWidth',2)
source to share