Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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/793244img2.jpg

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/381717fillednewedge6130J21C1S179Sha.jpg

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

Many thanks.