extract regions detected by watershed segmentation
Mostra commenti meno recenti
Hello,
I have found this code in image processing toolbox of matlab for image segmentation through watershed function:
Really, I gaven't understood the code, and I want to extract regions detected after segmentation with the function watershed and represent each region with its dominant color. So can you help me?
I want to extract those regions, so where find them?
Thanks
1 Commento
Image Analyst
il 22 Mag 2013
Related to her other question: http://www.mathworks.com/matlabcentral/answers/65055-dominant-color-for-an-rgb-image
Risposte (2)
Image Analyst
il 22 Mag 2013
Once you have the binary image, you simply call regionprops() for each color channel to get the color for that color channel in each labeled region. See my demos for examples: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Now do your marker controled watershed segmentation
% to get your binary image. Then:
labeledImage = bwlabel(binaryImage);
% Make color measureents.
measurementsRed = regionprops(labeledImage, redChannel, 'MeanIntensity');
measurementsGreen = regionprops(labeledImage, greenChannel, 'MeanIntensity');
measurementsBlue = regionprops(labeledImage, blueChannel, 'MeanIntensity');
3 Commenti
Image Analyst
il 22 Mag 2013
Your response should have been a comment to my answer, not a new, additional answer to your question.
That is a horribly convoluted, slow, and inefficient way of getting the mean color. I suggest you follow my example. Regionprops() is built for doing this and I suggest you let it do its job. Even if you did want to do it yourself without regionprops, you wouldn't do it like that, but I'm not going to tell you the more efficient way to do it because you should use regionprops.
Then, when it comes time to call label2rgb, you need to make sure coul is a floating point variable in the range of 0 to 1.
mariem farhat
il 22 Mag 2013
mariem farhat
il 22 Mag 2013
mariem farhat
il 22 Mag 2013
Modificato: mariem farhat
il 22 Mag 2013
Categorie
Scopri di più su Region and Image Properties in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!