32 bits effect on tif images
Mostrar comentarios más antiguos
hi;
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.
2 comentarios
Walter Roberson
el 12 de Feb. de 2014
Could you post an example?
Image Analyst
el 13 de Feb. de 2014
What does sombre mean?
Respuestas (1)
Anand
el 12 de Feb. de 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');
3 comentarios
Anand
el 13 de Feb. de 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) );
Walter Roberson
el 13 de Feb. de 2014
Please show the code you used.
Ivo Marten Glück
el 9 de Mayo de 2020
Editada: Ivo Marten Glück
el 9 de Mayo de 2020
I have a very similar problem. I'm using the following code to generate a 32-bit TIFF image. I can read the resulting image into Matlab using imread, however it is not depicted correctly after opening in ImageJ and cannot be read by Adobe Illustrator. Any idea what is wrong?
heigth = round((max(y_coords)-min(y_coords))/pixel_size_image);
width = round((max(x_coords)-min(x_coords))/pixel_size_image);
im = hist3([y_coords,x_coords],[heigth width]);
imG = imgaussfilt(im, pixel_size_image/5);
figure; imshow(imG);
range = getrangefromclass(uint32(1));
I32 = uint32( imG*(range(2)-range(1)) + range(1) );
t = Tiff(strcat(SR_image_name, '.tiff'),'w');
tagstruct.ImageLength = size(I32,1);
tagstruct.ImageWidth = size(I32,2);
tagstruct.Photometric = Tiff.Photometric.MinIsBlack;
tagstruct.BitsPerSample = 32;
tagstruct.SamplesPerPixel = 1;
tagstruct.RowsPerStrip = 16;
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
tagstruct.Software = 'MATLAB';
t.setTag(tagstruct)
t.write(I32);
t.close()
Many thanks!
Categorías
Más información sobre Convert Image Type en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!