Saturation limit on 16 bit image in MATLAB
11 views (last 30 days)
Show older comments
I have a series of images and I am trying to decide if its saturated or not. This is the intensity levels i got with code below after uploading iamges. The images are grayscale mono:
34960 of 65535a.u.
34608 of 65535a.u.
34976 of 65535a.u.
34912 of 65535a.u.
48528 of 65535a.u.
65504 of 65535a.u.
65504 of 65535a.u.
65504 of 65535a.u.
63792 of 65535a.u.
34912 of 65535a.u.
34784 of 65535a.u.
It seems to me that maybe 3 of the images might be at saturation but I am not sure. The images was saved as 16 bit (although camera only allows 12 bit). The Vimba program (Allied Vision GiGE camera) allows images to be saved as 16 bit tiff images. I want to use 16 bit becuase something weird happens to 12 bit images uploaded into 8 or 16 bit in MATLAB. I use imread to upload image into uint16 matrix.
With 16 bit we have the range 2^16 = 65536.
I used this code to check saturation levels:
int_value = max(max(grayImage_orig));
if int_value < 2^(bitValue)-2
disp('image not saturated')
disp([num2str(int_value),' of ',num2str(2^(bitValue)-1), 'a.u.'])
else
disp(['image is saturated',' max value:',num2str(2^(bitValue)-2)])
return
end
I am a little worried that 65504 might be maximal value but it should be 65536. Am I wrong?
Thanks!
3 Comments
Bjorn Gustavsson
on 13 Oct 2022
Was the intensities up to 2^12-1 in your saturated image? Then that seems like a natural upper limit if you read out the image with 12 bits AD.
Answers (1)
Bjorn Gustavsson
on 11 Oct 2022
To just look at the maximum pixel-intensity is not the best of ways to handle this. For science-grade cameras you typically get the proper image out (compared to regular photography-cameras where no one outside of the producers knows what goes on in terms of image-processing before we get our hands on the images). That means that the raw images typically have a couple of dead and hot pixels, there might be a couple of pixels impaced by "cosmic rays" that lead to full-well-intensities, In my field of research we sometimes have a couple of bright stars saturating the images, etc. These few-pixel imperfections will all lead to false positives in your max-intensity-test. What you have to do instead is to look at how large fraction of the images are within a couple of counts from 65535, and then judge the saturation from that number.
HTH
0 Comments
See Also
Categories
Find more on GigE Vision Hardware 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!