Borrar filtros
Borrar filtros

How to know how many channels my image saved in .mat file has?

3 visualizaciones (últimos 30 días)
Sara Salimi
Sara Salimi el 29 de Dic. de 2016
Respondida: Walter Roberson el 29 de Dic. de 2016
Hi,
I have a stack of medical images saved in mat files. My question is how can I know how many channels it has, or it is grayscale or not?
Your help is appreciated
Thanks in advance

Respuestas (1)

Walter Roberson
Walter Roberson el 29 de Dic. de 2016
I have an array with 600 elements here. How can I know what its height and width is, and how many channels it has? Is it 60 by 10 with 1 channel? Is it 25 by 6 with 4 channels? Are the height and width and number of channels stored in the first 4 elements of the array and the actual data is in the last 596 elements of the array?
"or it is grayscale or not"
Once you have figured out the number of elements in the data array, then if the number of elements is not divisible by 3 then it is not RGB; if the number of elements is not divisible by 4 then it is not RGBA or CMYK. However, the reverse cannot be said: if the number of elements is divisible by 3 then it is not necessarily RGB and if it is divisible by 4 then it is not necessarily RGBA or CMYK.
If the data is composed entirely of non-negative integral values, then it might be pseudo-color (indexed image).

Categorías

Más información sobre Import, Export, and Conversion en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by