what do I get by calling 'PixelIdxList'?
Show older comments
Hi! I recently using 'PixelIdxList' in the 'regionprop' function to calculate the color of the particle I labeled. But I don't really understand what color that 'PixelIdxList' gives?
I mean, I extract the 'PixelIdxList' from a RGB image, and calculate the mean value of pixels. But as we know, RGB image has red, green and blue in its array. When I calculate the mean(PixelIdxList) in an RGB image, I only get one value. So what colour does this mean value present?
My goal is to generate the mean grey value from the RGB image. Can I use this mean value from PixelIdxList?
Thank you!
3 Comments
marwa ben salah
on 28 May 2018
Bonsoir s'il vous plait comment je peux converti les pixels de stats(i).area en image en matlab par exemple j'ai le resultat comme suit cc# 1 - area 202965 nuemoro de pixel et taille j'aime l'affiche dans une image binaire
Walter Roberson
on 28 May 2018
Approximate translation:
Good evening please how I can convert the pixels of stats (i) .area to image in matlab for example I have the result as follows cc # 1 - area 202965 nuemoro of pixel and size I like the poster in a binary image
Image Analyst
on 28 May 2018
marwa, you can't convert an area (a single scalar), or a list of pixel values in an irregularly-shaped blob, into an image - you need more than that. See my Image Segmentation Tutorial to see how you can crop out the regions from the image into sub-images using the bounding box from regionprops(), and imcrop(). Start your own question with your own image if you need more help.
Accepted Answer
More Answers (1)
Image Analyst
on 4 Nov 2017
0 votes
PixelIdxList is the linear index of pixels in the blob.
From what you say, it appears you want the PixelValues measurement instead.
4 Comments
Ziming Zhong
on 5 Nov 2017
Edited: Ziming Zhong
on 5 Nov 2017
Image Analyst
on 5 Nov 2017
That's right, but notice how it's mean(I(idx)) where idx is the linear indexes of pixels in the blob, not mean(PixelIdxList) like you said. You don't have the I in there like the blog did. The blog computes the mean of the intensities whereas you compute the mean of the locations (linear indexes).
Ziming Zhong
on 5 Nov 2017
Edited: Ziming Zhong
on 5 Nov 2017
Image Analyst
on 6 Nov 2017
No. You wrote the code incorrectly. See Walter's answer for the correct version. Again, your code is not correct.
Categories
Find more on Region and Image Properties in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
