how to identify grayscale image as an RGB image
Show older comments
I am working on grayscale image as input image to cnn network that take RGB image how I can identify grayscale image as an
RGB
Accepted Answer
More Answers (2)
Walter Roberson
on 30 Dec 2022
1 vote
CNN are fed by data stores not by individual images. The recommended practice is to use an augmented image data store. Those permit you to specify the required image size and whether the image should be automatically converted to rgb or to gray. So just by adding the call to the augmented store creation and passing the augmented store instead of the image store, the size and color are automatically fixed up for you.
Sulaymon Eshkabilov
on 30 Dec 2022
Edited: Sulaymon Eshkabilov
on 30 Dec 2022
Grayscale image has one channel and RGB has three channels. How to distinguish them is to use size() fcn.
D = imread(ImageFile1); % RGB
[R1, C1, Channel]=size(D); Channel = 3
D = imread(ImageFile2); % Grayscale
[R2, C2, Channel2]=size(D); Channel2 = 1
1 Comment
malak alsmadi
on 30 Dec 2022
Categories
Find more on Image Processing and Computer Vision 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!