how to access each superpixel individually?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have followed the procedure and really impressed by the work https://in.mathworks.com/help/images/ref/superpixels.html?s_tid=srchtitle. My question is how to access each superpixel individually like a regular pixel because I would like to perform certain operations on each pixel individually.
0 commentaires
Réponses (1)
Guillaume
le 13 Avr 2017
The thing is that despite the name, a superpixel is nothing like a pixel. It's not square, it's just an arbitrarily shaped region of the image that has been determined to be similar.
You can mask the original image to keep only the portion corresponding to a given superpixel with:
%L = superpixels(originalimage, N);
originalimage(L == superpixelindex)
And certainly you can perform operations on that portion of the image. You could also use regionprops to extract the list of pixel indices belonging to each superpixel:
regionprops(L, 'PixelList')
but there's no way to get an individual superpixel value the same way you can a single pixel value.
6 commentaires
Image Analyst
le 15 Avr 2017
Guillaume - you're right. I was looking at the last "outputImage" in the help demo where the super pixels have been replaced by the mean value, but the original superpixels is basically just a description of where the various ROI outlines are - a boundaryMask. If you applied that to the original image it's possible to get a whole range of colors or gray levels instead of a single one.
Ad, I have no idea. If you have 200 superpixels, then the max value of L should be 200 and the number of elements of allIntensities should also be 200. What is the max value of L for you?
Your variables are badly named. What is I? Is that the labeled image or the original image? Don't just call it I - that's a really lousy name. And what's the point of S? You can get both MeanIntensity and PixelList all in the same call to regionprops() if you really think you need PixelList (though I'm not convinced you do because you have the labeled image which is better in most cases).
Voir également
Catégories
En savoir plus sur Red dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!