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

6 ビュー (過去 30 日間)
Henrik
Henrik 2024 年 11 月 26 日
コメント済み: Henrik 2024 年 11 月 28 日
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.

採用された回答

DGM
DGM 2024 年 11 月 27 日
移動済み: DGM 2024 年 11 月 27 日
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);
  1 件のコメント
Henrik
Henrik 2024 年 11 月 28 日
Hey, Thanks a Lot!! It works now and you were absolutly right

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2024 年 11 月 27 日
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 件のコメント
DGM
DGM 2024 年 11 月 27 日
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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by