Clear Filters
Clear Filters

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

1 view (last 30 days)
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

Accepted Answer

Geoff Hayes
Geoff Hayes on 18 Jun 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).

More Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!