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

  1. i read image file
  2. convert grayscale
  3. apply 5x5 median filter
  4. convert bw

enter image description here

enter image description here

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); 

enter image description here


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -