MATLAB: How to find intersection point

intersection point

Hi, I have an image with 4 colors.
I want to find the intersection points between four colors. How can I do that?
Thanks

Best Answer

Maybe as follows,
A=imdilate(img==color1, ones(3));
B=imdilate(img==color2, ones(3));
C=imdilate(img==color3, ones(3));
D=imdilate(img==color4, ones(3));
S=regionprops(A & B & C & D,'Centroid');
locations=vertcat(S.Centroid),