Effacer les filtres
Effacer les filtres

Grouping similar pixels in bins

5 vues (au cours des 30 derniers jours)
Muzammil Behzad
Muzammil Behzad le 19 Juil 2016
Commenté : Muzammil Behzad le 19 Juil 2016
Hi,
Can someone tell me how do I divide the pixels in an image into let's say 16 bins? For example we have a grayscale image [0-255], I want all the pixels between 0-15 to be let's say in group 1, 16-31 in group 2 and so on. Importantly, I want to have the location of the pixels in each group like I should know let's say what is the location of pixels in i-th group. I can write a for loop but I need to know if there's a function that does that.
Thanks in advance.

Réponse acceptée

Guillaume
Guillaume le 19 Juil 2016
binnedimage = imquantize(grayimage, 15:16:255) %16 bins of size 16.
You can then use find to get the location in each group:
binpixels = arrayfun(@(val) find(binnedimage == val), 1:16, 'UniformOutput', false) %using linear indices
  1 commentaire
Muzammil Behzad
Muzammil Behzad le 19 Juil 2016
Thanks a lot!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Image Processing Toolbox 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!

Translated by