Identify Lobed and bumps of Leaves
Asked Answered
P

2

7

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

Pediform answered 6/10, 2012 at 11:44 Comment(10)
1 should be fairly simple with a white background. 2 might be more difficult, depending on the leaf and lighting conditions. Can you give us an example of the images you would use?Ceilidh
there is no problem of lighting conditions. I don't know how to explain it, but you can assume that there is no problem of lighting conditions. (I am trying how to explain it, so wait please)Pediform
There are always problems with lighting conditions. The bumps would probably be easier to see with light coming from the side than with light coming from straight above, for example.Ceilidh
I found it! I have something like the Macbeth Color Checker: ae5d.com/macbeth.htmlPediform
Ah, I see. That can definitely be helpful :)Ceilidh
yes :]] so what do you say? how can I do these two things in matlab? thank you very much!Pediform
Could you please upload some example images on white background? By the way, I think that @Ceilidh meant the direction of the light and not color calibration.Margalit
Also, is it possible to physically rip out one leaf, flatten it and photograph it on a white/black background? This will greatly simplify the problem, as it will remove the 3D aspect.Margalit
@Andrey, I am updating the topic right now (I will photograph the leaf on a white background (I found some examples of images). wait please, and thank you too!Pediform
-1: There is no attempt here to solve the problem or state what has been done so far. It's amazing how bad MATLAB questions which include images also get upvotes. Take the photos out of this question and it would be closed.Claver
M
8

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
Margalit answered 6/10, 2012 at 12:54 Comment(5)
@Andey, WOW! it's a good starting for me! thank for your help. I am trying to do what you and Aki suggested me. thank you very much! you helped me every time! thankssss!!Pediform
@AlonShmiel, Be-Hatzlaha! (Good luck)Margalit
I know hebrew, I am from Israel :-P TODA!Pediform
Good one Andrey!Alexalexa
@YonatanSimson thanks :-) Though today I'd probably solve it with DLMargalit
F
3

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.

Fields answered 6/10, 2012 at 12:47 Comment(1)
thank you very nuch! I am trying right now to do what you and Andrey suggested me. I will update you!Pediform

© 2022 - 2024 — McMap. All rights reserved.