필터 지우기
필터 지우기

non-green extraction problem from image

조회 수: 1 (최근 30일)
mehmet oztu
mehmet oztu 2015년 9월 3일
댓글: Image Analyst 2015년 9월 5일
Hello, I'm trying to extract non-green from images, however It fails and does not give me a proper result. Do you know the reason? Why does it result with non-proper image? Thanks a lot.
Please see below orjinal image and result, also my matlab code.
orjinal and segmented image:
my code:
al1 = imread('image');
tex=single(al1);
%
r=single(al1(:,:,1));
g=single(al1(:,:,2));
b=single(al1(:,:,3));
ExGreen=2*g-r-b;
ExRed=1.4*r-g-b;
dev=imsubtract(ExGreen,ExRed);
% otsu thresholding
thres_level = multithresh(dev); % automatic thresholding
%b_w = im2bw(dev,thres_level);
seg_I = imquantize(dev,thres_level);
%
RGB = label2rgb(seg_I,'gray');
RGB2 = single(bwareaopen(RGB,1000));
% remove the only background
BW = RGB2(:,:,1);
BW = uint8(imfill(BW,'holes'));
leaves_only = al1;
for a = 1:3
leaves_only(:,:,a) = leaves_only(:,:,a).*BW;
end
figure;
axis off
title('RGB Segmented Image')
k=imfuse(al1, leaves_only,'montage');
imshow(k)

답변 (2개)

Image Analyst
Image Analyst 2015년 9월 3일
Try the Color Thresholder app on the Apps tab.
Or else see my color segmentation tutorials in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862

Image Analyst
Image Analyst 2015년 9월 3일
Try the attached m-file where I extract the non-green parts.
  댓글 수: 3
mehmet oztu
mehmet oztu 2015년 9월 4일
thanks Image Analyst, I found out a solution.
Image Analyst
Image Analyst 2015년 9월 5일
You're welcome. I just came back here because I noticed you have not marked it as Accepted. Are we done now, or do you still need help?

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

Community Treasure Hunt

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

Start Hunting!

Translated by