Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Identify Lobed and bumps of Leaves

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 hereenter image description hereenter image description here

like image 342
Alon Shmiel Avatar asked Oct 06 '12 11:10

Alon Shmiel


1 Answers

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 hereenter image description hereenter image description hereenter 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
like image 107
Andrey Rubshtein Avatar answered Oct 06 '22 03:10

Andrey Rubshtein