removal of shadow area

3 visualizaciones (últimos 30 días)
SHOBA MOHAN
SHOBA MOHAN el 7 de En. de 2018
Comentada: Monisha Gowda el 12 de Abr. de 2020
I have used adaptive thresholding technique to distinguish foreground and background pixel as per the attachment in the link. https://www.mathworks.com/matlabcentral/fileexchange/8647-local-adaptive-thresholding?focused=6119920&tab=function
I have incorporated connected component analysis to the threshold coding.
I am attaching input and thresholded image here. Can anyone suggest me how to remove the shadow part alone.
function bw=adaptivethreshold(IM,ws,C,tm)
if (nargin<3)
error('You must provide the image IM, the window size ws, and C.');
elseif (nargin==3)
tm=0;
elseif (tm~=0 && tm~=1)
error('tm must be 0 or 1.');
end
IM=mat2gray(IM);
if tm==0
mIM=imfilter(IM,fspecial('average',ws),'replicate');
else
mIM=medfilt2(IM,[ws ws]);
end
sIM=mIM-IM-C;
bw=im2bw(sIM,0);
bw=imcomplement(bw);
Test Code:
clear;
close all;
% im1=imread('inputimage.jpg');
im2=imread('foregroundimage.jpg');
% bwim1=adaptivethreshold(im1,11,0.03,0);
bwim2=adaptivethreshold(im2,15,0.02,0);
% ModeFilterFunction = @(x) mode(x(:));
% modeImage = nlfilter(bwim2, [3 3], ModeFilterFunction);
CC = bwconncomp(bwim2,8);
S = regionprops(CC, 'Area');
L = labelmatrix(CC);
BW2 = ismember(L, find([S.Area] >= 100));
subplot(2, 2, 3);
imshow(BW2, []);
subplot(2,2,1);
imshow(im2);
subplot(2,2,2);
imshow(bwim2);
  3 comentarios
SHOBA MOHAN
SHOBA MOHAN el 8 de En. de 2018
Sorry for inconvenience now I am attaching foreground image. Thanks for the response.
Monisha Gowda
Monisha Gowda el 12 de Abr. de 2020
Hi, Have you done it. I am also looking for the same. Can you help me on this?

Iniciar sesión para comentar.

Respuestas (1)

Malhar Ashtaputre
Malhar Ashtaputre el 8 de En. de 2018
Kindly go through following link for help in shadow removing:
  1 comentario
Maisha Maimuna
Maisha Maimuna el 8 de Sept. de 2019
Hello Malhar Ashtaputre,
have you got the solution? I am stuck with the same problem.

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by