How to find the intensity of those pixels of which I know the position without doing it once at a time
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I need to find and print on my workspace the intensity values of those pixels which are greater than a certain value. I have already found a way to create an array indicating the position of these pixels(I have done a table in which are identified row and column of each pixel), but I can't use the function x = I(row, column). What I'm saying is that it works if I put 2 numbers relative to the position, but I was hoping to create a list of every intensity value with just a few commands, without doing everything once at a time by hand. Also because I have many images to process and values change every time Is there a way to do it?
Thanks in advance.
0 commentaires
Réponse acceptée
Image Analyst
le 17 Mar 2017
Yes, simply threshold and use the resulting mask:
mask = grayImage > someValue; % A 2-D logical image.
imshow(mask); % Display what you're going to extract.
extractedIntensityValues = grayImage(mask); % A 1-D vector (list) of the intensity values in the mask.
2 commentaires
Image Analyst
le 18 Mar 2017
Actually you didn't need find(). As you can see from the small demo below, it will give the same values either way. Using find() just adds time because it has to do another operation to get the linear indexes, which aren't needed:
m = uint8(magic(15)) % Sample image
mask = m > 220 % Create mask
extracted1 = m(mask) % Extract values via logical mask
mask = find(m > 220) % Create mask
extracted2 = m(mask) % Extract values via linear indices
Plus de réponses (0)
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!