how do get a color region?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
Image Analyst
2015년 11월 22일
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
Image Analyst
2015년 11월 23일
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.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!