Big Tiff Grayscale image looks unsharp/ Grayvalue is not shown properly

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.

 Accepted Answer

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);

More Answers (1)

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 Comment

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.

Sign in to comment.

Categories

Find more on Convert Image Type in Help Center and File Exchange

Products

Release

R2024a

Asked:

on 26 Nov 2024

Commented:

on 28 Nov 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!