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

1 次查看(过去 30 天)
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

采纳的回答

Geoff Hayes
Geoff Hayes 2016-6-18
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).

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by