MATLAB Answers


32 bits effect on tif images

Asked by Soum
on 12 Feb 2014
Latest activity Commented on by Walter Roberson
on 13 Feb 2014
why when I convert my gray images to 32 bits by using uint32 instruction they get 'sombre',what can I do?
my images '*.tif*' are gray with points dark 'microscopic images ',when I show them under Matlab
they appear so sombre ,this is after I converted them to Unit32.


Could you post an example?
Image Analyst
on 13 Feb 2014
What does sombre mean?

Sign in to comment.


1 Answer

Answer by Anand
on 12 Feb 2014

If you're problem is that you are converting to uint32 with a direct cast like uint32(im) and then calling imshow for display, the solution is simple. Use the display range of imshow.
im = imread('cameraman.tif');
figure,imshow(uint32(im));title('sombre image');
figure,imshow(uint32(im),[]);title('bright image');


on 13 Feb 2014
You need to provide more details. What 'treatment'? Could you post some code for that? How are you converting to UINT32.
Try rescaling the image to the full dynamic range of the data type.
im = imread('cameraman.tif');
imd = double(im);
imnorm = (imd-min(imd(:)))./(max(imd(:))-min(imd(:)));
range = getrangefromclass(uint32(1))
imu = uint32( imnorm*(range(2)-range(1)) + range(1) );
Please show the code you used.

Sign in to comment.