how to convert 1 channel grayscale image into 3 channel?
6 views (last 30 days)
Show older comments
I have to train my images through vgg16, for which i need to convert my 1 channel grayscale images to 3 channel. i have used rgbimage=I(:,:,[1 1 1]) also repmat, but when i apply this command it changes my image into binary. I just need to change number of channels by keeping it grayscale. Help please!
1 Comment
Answers (1)
Jan
on 30 Jul 2018
These are equivalent and working:
RGB = repmat(I, [1, 1, 3])
RGB = I(:, :, [1, 1, 1])
RGB = repelem(I, [1, 1, 3])
They do not change the class of the image or the values. Your impression, that this changes your "image to binary" is not correct. Either the observation is not correct or another command is responsible for the effect. Please post the relevant part of the code and mention, why you assume, that the image is changed.
2 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!