what does an image of size 512*512*4 mean?
14 views (last 30 days)
Show older comments
talayeh ghodsi
on 20 Jun 2020
Commented: Shiv srikakolum
on 25 Nov 2021
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 Comments
Accepted Answer
John D'Errico
on 20 Jun 2020
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 Comments
Walter Roberson
on 24 Nov 2021
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.)
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!