# Finding intersections of objects in a single contour

Hello,

I have an image of leaves (seen from above) that can partly recover each other.

http://img11.hostingpics.net/pics/793...

I found the contour of the image (in red on the image) and what I want to do now is to find where two leaves intersect. What I've done so far is to:

• consider a point with index i in the contour c, say c[i], which has two coordinates x and y,
• compute the angle of the vector (c[i-1], c[i]) with the half line (x > 0), which I denote ang[i], this returns an angle between 0 and 360,
• do the previous step for the B angles ang[i], ang[i-1], ang[i-2] and average the result, this gives me the mean direction before c[i],
• do the same for the B angles ang[i+1], ang[i+2], ang[i+3], etc. and average the result, this gives me the mean direction after c[i],
• flag (in blue on the image) c[i] as a potential intersection if the difference between the mean direction after and before is greater than a deviation angle D.

I've tried many values of B and D, but due to the different natures of the intersections between leaves, I never manage to recover them all, and uniquely them. Here is an example of output:

http://img11.hostingpics.net/pics/381...

Is something wrong with the method I tried? Is there any other approach less naive and more robust I could try?

Many thanks.

edit retag close merge delete

## Comments

How about doing some skeletization first on the segmentation and then looking for joints as a starter? Then project those joints towards the edge in a closest distance manner?

Hello Steve, thanks for the suggestion, how do you think I could perform this first step of skeletization? Is there something useful already implemented in OpenCV? I failed to find any so far.