How to find the intensity of those pixels of which I know the position without doing it once at a time
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Image Analyst
2017-3-17
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 个评论
Image Analyst
2017-3-18
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
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!