what does an image of size 512*512*4 mean?

21 visualizaciones (últimos 30 días)
talayeh ghodsi
talayeh ghodsi el 20 de Jun. de 2020
Comentada: Shiv srikakolum el 25 de Nov. de 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?

Respuesta aceptada

John D'Errico
John D'Errico el 20 de Jun. de 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 comentarios
Walter Roberson
Walter Roberson el 24 de Nov. de 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.)
Shiv srikakolum
Shiv srikakolum el 25 de Nov. de 2021
@Image Analyst Thank You

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by