MATLAB: My image is RGB image but when I used size function it showed me grayscale image.

digital image processingimage processingMATLABmatlab function

I have an image. When I open it using windows photo viewer it showed RGB image but when I use size function of Matlab for finding color channel it showed me "1". That's mean it is the grayscale image. The image also attached.
My Matlab code is:
[rows, columns, numberOfColorChannels] = size('test.jpg');
Output is: numberOfColorChannels is "1"

Best Answer

There is no problem, you just did not actually read the image into MATLAB. It works perfectly for me:
>> [img,map] = imread('test.jpg');
>> size(img)
ans =
96 200 3
Or alternatively:
>> S = imfinfo('test.jpg');
>> S.ColorType
ans = truecolor
Nope, not a grayscale image at all.