Cannot get .tif image to display
조회 수: 3 (최근 30일)
이전 댓글 표시
I am currently working at lab that uses bead-based analysis. I have a .tif image that is 16-bit with the following parameters
Filename: [1x81 char]
FileModDate: '31-Aug-2011 08:45:41'
FileSize: 2754432
Format: 'tif'
FormatVersion: []
Width: 1344
Height: 1024
BitDepth: 16
ColorType: 'grayscale'
FormatSignature: [73 73 42 0]
ByteOrder: 'little-endian'
NewSubFileType: 0
BitsPerSample: 16
Compression: 'Uncompressed'
PhotometricInterpretation: 'BlackIsZero'
StripOffsets: 8
SamplesPerPixel: 1
RowsPerStrip: 1024
StripByteCounts: 2752512
XResolution: 72
YResolution: 72
ResolutionUnit: 'Inch'
Colormap: []
PlanarConfiguration: 'Chunky'
TileWidth: []
TileLength: []
TileOffsets: []
TileByteCounts: []
Orientation: 1
FillOrder: 1
GrayResponseUnit: 0.0100
MaxSampleValue: 65535
MinSampleValue: 0
Thresholding: 1
Offset: 2752520
ImageDescription: [1x1696 char]
UnknownTags: [1x1 struct]
If I use a program called ImageJ (freeware) to open the image, I see beads displayed. When I run the following code on my image, it displays a black screen. I feel like the imread fails to attain color data for each pixel and that is why this is happening. Is there any way I could get the beads to display properly on the image without having to call ImageJ?
close all
clear all%
x = imread('image.tif'); % The x returns a 1344 by 1024 matrix (M by N)
info = imfinfo('image.tif');
display(info)
imshow(x)
Thank you in advance for your assistance.
댓글 수: 0
답변 (2개)
Walter Roberson
2012년 9월 19일
You have the problem that you are dealing with a 16 bit grayscale image but you do not use a colormap to put grayscale in effect, and you might not be able to use a colormap that big on your system (some Windows versions don't support more than 256 colors apparently.)
If you were to im2double() your data, then color interpolation could be used on it to allow a smaller colormap. Because your data would be datatype uint16, MATLAB would try to use each value as a color index rather than as a relative value that can use colormap interpolation; im2double() would switch it to use relative values.
Alternately, you can convert your image to RGB by using
rgbimage = cat(3, x, x, x);
and then
imshow(rgbimage)
without needing any colormap.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!