histogram and intensity of images
Show older comments
Hello. I have a tif image and plot the histogram (its generally 12 bit grayscale, max value =4095)
I want to be able to do 2 things that I am struggling with.
1: I use the following to obtain and count the number of "saturated pixels" . But how can i modify it to say count the number of pixels above a certain value i.e.3500 counts
[maxval1,idx]=max(IM(:))
[row,col]=ind2sub(size(image), idx)
%count elements
n=numel(row)
2: After plotting a histogram of the intensities using
[counts,x] = imhist(IM,maxval);
stem(x,counts,'b');
xlim([0 maxval]);
ylim([0 max(counts)]);
(where I have allowed the axes to scale automatically to the max values), how can I superimpose on top of this in a different colour only part of the histogram that has intensities 3500 to 4095?
Thanks for any help. Jason
3 Comments
Jason
on 14 Feb 2014
Jason
on 14 Feb 2014
Image Analyst
on 14 Feb 2014
You can simplify the first two lines to a single line by adding options to find() to extract the first element.
id = find(x>3700, 1, 'first');
Accepted Answer
More Answers (0)
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!