Edge detection and area measurement I am a novice in image processing. As a part of my school project, I have to do the following steps in Matlab on the below image.

 


Detect the edges of a leaf.
Calculate the area of a leaf (excluding the stem portion)


My friend suggested me an idea of calculating the total number of pixels in the leaf (excluding stem portion) divided by the number of pixels per cm2.

But I don't know how to do these in Matlab. Someone, please guide me.
Here's my suggestion:


Convert the image to grayscale
Define a threshold and binarize image (only black and white)
To remove the stem apply an erode operator (the size will depend on your image)


Function syntax: https://www.mathworks.com/help/images/ref/imerode.html


apply a dilation operator (same size as in previous step)


Function "imopen" combines both steps: https://www.mathworks.com/help/images/ref/imopen.html


Sum all over the columns (considering that leaf pixels have value 1 and if you are using Matlab colsum=sum(a) )
Sum the previous vector and you will have the area ( area=sum(colsum) )