Whether the RGB image which has been transformed into the Grayscale still have a 3D matrix?

1 visualizzazione (ultimi 30 giorni)
excuse me, i want to ask, i have saved grayscale images before, but why that still have 3D matrix and not 2D matrix although the image has been my saved as grayscale? because I intend to creating the image matrix X using grayscale image still need to use permute and tell permute that i want to transpose the 1st and 2nd dimension

Risposta accettata

Geoff Hayes
Geoff Hayes il 18 Giu 2016
Alvindra - how are you creating the grayscale image? Which function are you using to do this conversion from RGB?
If you are expecting or need a 2D image, then just convert the 3D into one. For example, if gsImage is your grayscale image then
if ndims(gsImage) == 3
% covert the 3D into a 2D image
gsImage = gsImage(:,:,1);
end
The above assumes that gsImage(:,:,1) is identical to gsImage(:,:,2) and to gsImage(:,:,3).

Più risposte (0)

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by