Message Boards Message Boards

1
|
293 Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Counting points on a leaf in Wolfram

Hi everybody,

I am a beginner in Mathematica and would like to ask how I can count the points on a leaf. Is there a specific method or function for this?
I would appreciate any guidance.

Thank you!

The code I wrote and the result I got is:

img = Import["path/to/your/leaf_image.jpg"];

bwImg = Binarize[img];

spots = MorphologicalComponents[bwImg];

numSpots = Max[spots];ImageCollage[{img, Colorize[spots]}]
Attachment

Attachment

POSTED BY: Flora Vosoughi
2 Replies

Not perfect but you could use color based segmentation

mask = Binarize[ColorDetect[img, ColorsNear[Brown]], .1]

mask

Then use the centers of the morphological components

HighlightImage[img, 
 ComponentMeasurements[MorphologicalComponents[mask], "Centroid"]]

components

Thank you very much for your guidance.

I have tested 3 images and obtained the results and errors. I would greatly appreciate it if you could kindly review them and provide your feedback.

Attachment

Attachment

Attachment

Attachment

Attachment

POSTED BY: Flora Vosoughi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract