Remove shadow and unwanted background
2 ビュー (過去 30 日間)
古いコメントを表示
How can I remove the shadow and extract only the object. I have try imadjust() . But the shadow is still there and during imbinarize(),it will include the shadow..so I cant minus it
Is it possible to make it into the desired picture ?
Before:
Desire
0 件のコメント
回答 (1 件)
Joseph Cheng
2021 年 6 月 8 日
to get your started you can see that the tissue and the shadow area have similar values in all the color channels. you can do a bit of comparison of each of the color channels to generate a mask of those which are not gray and white:
img = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/645980/image.jpeg');
mtemp = double(img)./median(double(img),3);
subplot(311),imagesc(mtemp)
mtemp = mtemp-1;
subplot(312),imagesc(mtemp)
mtemp2 = abs(mtemp)<=.30;
mask = all(mtemp2,3);
subplot(313),imagesc(mask)
[row col N]=size(img);
for ind = 1:3
tempimg = img(:,:,ind);
tempimg(mask) = 255;
nimg(:,:,ind) = tempimg;
end
figure,imagesc(nimg)
axis equal
axis tight
which you can use a bit of imerode, bwfill, etc to edit the mask or generate something different.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!