I have this code that detects vegetation from a picture. i want to remove it. how should i do that?

조회 수: 1 (최근 30일)
Image1 = im2double(imread('image\8.jpg'));
g=rgb2gray(Image1);
[row column page] = size(Image1)
mask = Image1(:,:,2) > Image1(:,:,1) & Image1(:,:,2) > Image1(:,:,3);
Image2 = Image1 .* mask(:,:,[1 1 1]);
figure,imshow(Image2);
title('light green');
mask = Image2(:,:,2) + 20 > Image2(:,:,1) & Image2(:,:,2) + 20 > Image2(:,:,3);
Image3 = Image2 .* mask(:,:,[1 1 1]);
figure,imshow(Image3);
title('dark green');

채택된 답변

Image Analyst
Image Analyst 2016년 2월 3일
See my color segmentation demos in my File Exchange http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
Or else search on the tag "leaf".
Or else use imseggeodesic(). Look up examples in the help for it.
  댓글 수: 2
charuleelaa vanilavarasu
charuleelaa vanilavarasu 2016년 2월 3일
i tried your demo. For some reason it's not working for my own images. it does not ask me the option to choose the color but works for the demo
Image Analyst
Image Analyst 2016년 2월 3일
Set a breakpoint on the call to menu(). Chances are you clicked somewhere and that popup dialog box then went underneath whatever you clicked on.

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2016년 2월 3일
Remember when you im2double() you change the data to the range 0 to 1. Your value +20 suggests you are still thinking in terms of uint8 values in the range 0 to 255. If so then the corresponding increment in 0 to 1 range would be 20/255 rather than 20.

카테고리

Help CenterFile Exchange에서 Agriculture에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by