Big Tiff Grayscale image looks unsharp/ Grayvalue is not shown properly
50 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Henrik
el 26 de Nov. de 2024 a las 10:10
Comentada: Henrik
el 28 de Nov. de 2024 a las 7:36
Hey Guys,
I have to process Tiff images with Matlab and its working well. But when I load bigger Tiff pictures and display them with imshow, they look unscharp/ very noisy/like there is an error with the grayscale. When I open them with Windows foto viewer etc. they look great. I've tried a few things, but nothing really works:
im = Tiff(image_path, 'r');
setDirectory(im, 3);
image = read(im);
imshow(image);
imshow(image, []); % looks a bit better but still bad
minValue = double(min(image(:)));
maxValue = double(max(image(:)));
imshow(image,[minValue maxValue]); % no difference to imshow(image, []);
functions like imadjust change it, but it doesn't look better.
0 comentarios
Respuesta aceptada
DGM
el 27 de Nov. de 2024 a las 9:56
Movida: DGM
el 27 de Nov. de 2024 a las 10:07
It's hard to know without seeing the image. A TIFF can contain just about anything. It can be on an odd numeric scale. It can be lossy compressed. It can contain downsampled preview images. It might not even be a true grayscale image, but rather a gray-ish image expressed in some colorspace. It might even be an indexed-color image.
If I had to guess, I'd suspect either it's indexed-color or a preview. I'm not sure what would be typical for a BigTIFF.
For example, this is trying to read an indexed-color TIFF, both with and without respect for its color table.
% get the particular image in the file
im = Tiff('canoe.tif', 'r');
setDirectory(im, 1);
% let's say we blindly assume it's grayscale
inpict = read(im);
imshow(inpict)
% instead, use the specified color table
CT = getTag(im,'ColorMap');
imshow(inpict,CT);
Más respuestas (1)
Walter Roberson
el 27 de Nov. de 2024 a las 12:02
When imshow is asked to display an image that is larger than the figure size, it displays a downscale version of the image. The result is not going to be as crisp as expected.
imshow is not taking action to deliberately downscale: it is just creating an image() object, and image objects are in data coordinates, and multiple data coordinates map per output pixel if the image is too large.
The only real alternative is to display the image with 1:1 pixel mapping and a scroll bar to allow the user to select the portion of the image to display
1 comentario
DGM
el 27 de Nov. de 2024 a las 13:13
If the display scaling is causing aliasing issues, the non-default 'interpolation','bilinear' option might help to some degree. There are plenty of conceivable cases where it either wouldn't help enough to matter at reduced scale, or it causes reduced sharpness at unity-scale.
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!