Matlab imread grayscale import has bad contrast

조회 수: 1 (최근 30일)
Jacob
Jacob 2014년 8월 12일
댓글: Geoff Hayes 2014년 8월 14일
I'm trying to import a series of grayscale TIFF images. The pixels span the full range of values, from pure white to pure black. This can be seen when the image is viewed in a desktop program such as paint. However, when imread in Matlab is used to import the image, the contrast is greatly reduced: instead of spanning from 0 to 255 like it ought to, it covers only 70 to 95, for example. The range is different for each imported file.
The image is definitely grayscale, as imread outputs a 2D matrix.
Is there some trick that needs to be used, so that the image has the proper contrast after import?
  댓글 수: 17
Jacob
Jacob 2014년 8월 14일
I'm just driven by curiosity now. The map is the same as what was stored under the Colormap property. 256x3 array ranging from 0 to 1. Seems to be divided into blocks of 24 rows where it would start at zero and either be all zeros for the next 24 rows; or start at zero and irregularly increase towards 1. For some reason, loading the image using imshow in the command line displays it properly without the contrast issue. I think I may still stick with csv but it's interesting that the TIFF worked in the command prompt.
Geoff Hayes
Geoff Hayes 2014년 8월 14일
Jacob - so what happens if you do the following:
[img,map] = imread('yourTifFile.tif');
imshow(img);
At this point, is the image displaying the poor contrast? If so, then do the following
colormap(map)
What does the image look like now that you are using the colour map that is associated with the image?
Maybe the integers in the 2D img matrix are NOT colours but indices into the colour map that comes with the image.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by