Question

I need some help, I have to make a project about leaves.

I want to make it by MATLAB.

my input is an image of one leaf (with a white background) and I need to know two things about the leaf:

1) find the lobed leaf (the pixels of each lobed leaf):

  • Lay the leaf on a table or work space where you can examine it.

  • Look at the leaf you are trying to identify. If the leaf looks like it has fingers, these are considered lobes. There can be anywhere from two to many lobes on a leaf.

  • Distinguish pinnate leaves from palmate leaves by looking at the veins on the underside of the leaf. If the veins all come from the same place at the base of the leaf it is considered palmately lobed. If they are formed at various places on the leaf from one centre line, the leaf is pinnately lobed.

  • Identify the type of leaf by using a leaf dictionary.

enter image description here

2) find approximately the number of bumps of the leaf:

in other words, find the "swollen points" of each leaf. enter image description here

these are examples of leaves:

enter image description here enter image description here enter image description here

Was it helpful?

Solution

I've found some leaves examples in here.

Here is my attempt to solve the problem. In the images that I've found, the background is completely black. If it is not so in your images, you should use Otsu's thresholding method.

I assumed that there can be only 3 types of leaves, according to your image: enter image description here

The idea is to do blob analysis. I use the morphological operation of opening, to separate the leaves. If there is only one blob after the opening, I assume it is not compound. If the leaves are not compound, I analyze the solidity of the blobs. Non-solid enough means they are lobed.

Here are some examples:

enter image description here enter image description here enter image description here enter image description here

function IdentifyLeaf(dirName,fileName)

    figure();
    im = imread(fullfile(dirName,fileName));
    subplot(1,3,1); imshow(im);

%   thresh = graythresh( im(:,:,2));
    imBw = im(:,:,2) > 0;
    subplot(1,3,2);imshow(imBw);

    radiusOfStrel = round( size(im,1)/20 ) ;
    imBwOpened = imopen(imBw,strel('disk',radiusOfStrel));

    subplot(1,3,3);imshow(imBwOpened);

    rpOpened = regionprops(imBwOpened,'Area');
    if numel(rpOpened)>1
        title('Pinnately Compound');
    else
        rp = regionprops(imBw,'Area','Solidity');
        %Leave only largest blob
        area = [rp.Area];
        [~,maxIndex] = max(area);
        rp = rp(maxIndex);

        if rp.Solidity < 0.9
            title('Pinnately Lobed');
        else
            title('Pinnately Veined');
        end
    end
end

OTHER TIPS

I would approach this problem by converting it from 2d to 1d by scanning in a vector the perimeter of the leaf using "right hand on the wall" -algorithm.

From that data, I presume, one can find a dominant axis of symmetry (e.g. fitting a line); the distance of the perimeter would be calculated from that axis and then one could simply use a threshold+filtering to find local maxima and minima to reveal the number lobes/fingers... The histogram of distance could differentiate between pinnately lobed and pinnately compound leaves.

Another single metrics to check the curvature of the perimeter (from two extreme points) would be http://en.wikipedia.org/wiki/Sinuosity

Recognizing veins is unfortunately a complete different topic.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top