How to find the intensity of those pixels of which I know the position without doing it once at a time
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
EL
am 17 Mär. 2017
Kommentiert: Image Analyst
am 18 Mär. 2017
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 Kommentare
Akzeptierte Antwort
Image Analyst
am 17 Mär. 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 Kommentare
Image Analyst
am 18 Mär. 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
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!