what does an image of size 512*512*4 mean?
22 次查看(过去 30 天)
显示 更早的评论
Hi every body.
I have an image of size 512*512 in .tif format. when i use imread to import it in matlab, the output is 512*512*4. what does that 4 mean? how can i convert it to 512*512?
0 个评论
采纳的回答
John D'Errico
2020-6-20
This is a 4 channel image. For example, typically we think of an image as represented by {R,G,B} code values for each pixel location. In that case, you will see a 512x512x3 array. That represents a standard COLOR image.
If you want only a 512x512 array, then you will lose all color information. This can be done using a tool like rgb2gray, IF you were starting with an RGB image. The result will be a grayscale image, so only one channel.
But you have a 4 channel image. This can means several things. Does it represent perhaps CMYK code values? Those could be essentially printer drive values, used by many color printers. Or is this a hyper-spectral image of some ilk, thus sampling 4 different wavelengths of light? So if you have a 512x512x4 array, you need to know what the numbers represent. And only you know what they mean.
4 个评论
Walter Roberson
2021-11-24
The most common 512 x 512 x 4 .tiff representations would probably be: RGBA (RGB + alpha), CMYK (better for printers), and RGBNr where Nr here refers to Near-Infrared.
CYMK can be determined by the colorspace information in the TIFF headers.
RGBA can be determined by examine of the information about alpha values in the TIFF headers.
RGBNr is more difficult to determine: it is stored as RGB together with "additional data", but there is no particular header to examine to determine what the "additional data" means (RGBA also has the alpha stored as "additional data", but can be picked out by careful reading of some of the standard headers, if I recall correctly.)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Read, Write, and Modify Image 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!