Sam
Sam

Reputation: 405

Detecting overlapped elliptical regions in image (MATLAB)

I have a multiple plants in a single binary image. How would I identify each leaf in the image assuming that each leaf is approximately elliptical? example input: https://i.sstatic.net/O0djn.png

I was thinking a good place to start would be finding the tip of each leaf and then getting the center of each plant. Then I could fit the curves starting from the tip and then going to the center. I've been looking online and saw something involving a watershed method, but I do not know where to begin with that idea.

Upvotes: 1

Views: 658

Answers (2)

Cape Code
Cape Code

Reputation: 3574

I would do something like this (I is your binary image)

I=bwmorph(bwmorph(I, 'bridge'), 'clean');

SK=bwmorph(I, 'skel', Inf);
endpts = bwmorph(SK,'endpoints');
props=regionprops(I, 'All');

And then connect every segment from the centroids listed in props.centroid to the elements of endpts that should give you your leaves (petals?).

A bit of filtering is probably necessary, bwmorph is your friend. Have fun!

Upvotes: 2

DCS
DCS

Reputation: 3384

You should be aware that these things are tricky to get working robustly - there will always be a failure case.

This said, I think your idea is not bad.

You could start as follows:

  1. Identify the boundary curve of each plant (i.e. pixels with both foreground and background in their neighbourhood).

  2. Compute the centroid of each plant.

  3. Convert each plant boundary to a polar coordinate system, with the centroid as the origin. This amounts to setting up a coordinate system with the distance of each boundary curve point on the Y axis and the angle on the X axis.

  4. In this representation of the boundary curve, try to identify maxima; these are the tips of the leaves. You will probably need to do some smoothing. Use the parts of the curve before and after the maxima the start fitting your ellipses or some other shape.

Generally, a polar coordinate system is always useful for analysing stuff thats roughly circular.

To fit you ellipses, once you have a rough initial position, I would probably try an EM-style approach.

Upvotes: 3

Related Questions