I am trying to process a picture. There is an RGB leaf photograph and I want to exract the leaf's itself only.
The procedure I follow is
- I read image from file
- Convert to grayscale
- Apply 5x5 median filter
- Convert to BW
As you see the shadow on the bottom right corner sticks to the BW image. Is there a method to select the leaf only.
I = imread(files{404});
hcsc = vision.ColorSpaceConverter;
hcsc.Conversion = 'RGB to intensity';
Ig = step(hcsc, I);
medFilt= vision.MedianFilter([f f]);
Ig = step(medFilt, Ig);
at = vision.Autothresholder;
Ibw = step(at, Ig);
Instead of converting to grayscale image, I convert it to HSV and take its V part. It results better now.