MATLAB - How to eliminate shadowed background on an image -
i trying process picture. there rgb leaf photograph , want exract leaf's only.
the procedure follow is
- i read image file
- convert grayscale
- apply 5x5 median filter
- convert bw


as see shadow on bottom right corner sticks bw image. there method select leaf only.
i = imread(files{404}); hcsc = vision.colorspaceconverter; hcsc.conversion = 'rgb intensity'; ig = step(hcsc, i); medfilt= vision.medianfilter([f f]); ig = step(medfilt, ig); @ = vision.autothresholder; ibw = step(at, ig);
instead of converting grayscale image, convert hsv , take v part. results better now.
i = imread(files{404}); = rgb2hsv(i); ig = i(:,:,3); medfilt= vision.medianfilter([f f]); ig = step(medfilt, ig); @ = vision.autothresholder; ibw = step(at, ig); 
Comments
Post a Comment