how do get a color region?

2 Ansichten (letzte 30 Tage)
Tan Wen Kun
Tan Wen Kun am 22 Nov. 2015
Kommentiert: Image Analyst am 23 Nov. 2015
I want to get something like like apple.jpg without using watershed.
How to get the color piece after I done edge detection, imclose and rgb2label.
My result is elephant.jpg how can turn it like apple.jpg

Akzeptierte Antwort

Image Analyst
Image Analyst am 22 Nov. 2015
You're going to have to use a better segmentation routine to get the elephant. Perhaps get gray things. Compute the HSV image from rgb2hsv() and look as the s image:
hsvImage = rgb2hsv(rgbImage);
sImage = hsvImage(:,:, 2);
% Binarize to find low saturation (gray) pixels.
binaryImage = sImage < 0.3;
That's just a guess, because you didn't attach the original RGB image. Elephants can sometimes blend in well with their surroundings so it might be tough to get it all, particularly if it's obscured by branches or other elephants or trucks or walls or whatever. If you get a noisy outline, you can clean it up with activecontour(), demo attached.
See my File Exchange which has several color segmentation demos: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
  4 Kommentare
Tan Wen Kun
Tan Wen Kun am 23 Nov. 2015
This is original image~can you show me how to get a good segmentation?
Image Analyst
Image Analyst am 23 Nov. 2015
The code I gave you above should work to get the elephants in a colored background. There is a full blown demo on my File Exchange page: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
But I know of no way to have the program determine where one elephant starts and another stops. You could do edge detection, but the problem is there are going to be tons of edges everywhere, not just at the overlap line.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by