How can I remove shadows in image segmentation?

조회 수: 6 (최근 30일)
emmegi
emmegi 2015년 4월 25일
댓글: hoyzer24 2015년 9월 17일
I'm a beginner user of MATLAB. I'm working on a project about fruit segmentation. I took pictures of different fruits with a white background. I used HSV thresholding, then morphologic operations. My problem is that i'm not be able to remove shadows in inferior part so this makes the object bigger than real and my results are not so accurate.
Do you have ave any suggestions? Should I use different threshold?
I = imread('limone_prova.jpg');
if true
clc;
clear all;
close all;
workspace;
I = imread('limone_prova2.jpg'); figure(1); imshow (I,'InitialMagnification',17)
%crop I_crop=imcrop(I, [873.5 411.5 2910 2232]);
I_HSV=rgb2hsv(I_crop); H=I_HSV(:,:,1); %Hue S=I_HSV(:,:,2); %Saturation V=I_HSV(:,:,3); %Value
thr_S=(S > 0.20);
open_S = bwareaopen(thr_S, 6000);
se = strel('disk',15); closeMask = imclose(open_S, se);
mask = uint8(closeMask); mask = cast(mask, class(I_crop)); mask_R = mask .* I_crop(:,:,1); mask_G = mask .* I_crop(:,:,2); mask_B = mask .* I_crop(:,:,3); mask_RGB = cat(3, mask_R, mask_G, mask_B);
figure; imshow(mask_RGB) end

채택된 답변

Payam Ahmadvand
Payam Ahmadvand 2015년 5월 3일
Shadow removing is a challenging topics and you cannot remove the shadow just by a threshold!
A method base on segmentation "The Shadow Meets the Mask: Pyramid-Based Shadow Removal" www.cs.huji.ac.il/~danix/ShadowRemoval/shadow_eg08.pdf
A method based on entropy minimization "Recovery of Chromaticity Image Free from Shadows via Illumination Invariance" https://www.cs.sfu.ca/~mark/ftp/Iccv03ColorWkshp/iccv03wkshp.pdf
  댓글 수: 2
emmegi
emmegi 2015년 5월 3일
Thank you for your suggestions, I'll study this papers and I'll try to fix the problem.
hoyzer24
hoyzer24 2015년 9월 17일
You found some answers concerning this? I would also be interested ;)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by