필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
Sara Salimi
Sara Salimi 2016년 12월 29일
답변: Walter Roberson 2016년 12월 29일
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

답변 (1개)

Walter Roberson
Walter Roberson 2016년 12월 29일
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).

카테고리

Help CenterFile Exchange에서 Import, Export, and Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by