I have a list of grayscale images. They are stored in R via EBimage with the following code:
Normaltrain<-list.files(path="folderl",pattern='jpeg',all.files=T,full.names=T)
Normaltrainpics<-list()
for (i in 1:169) {Normaltrainpics[[i]]<-readImage(Normaltrain[i])}
They are stored as images with the following attributes:
Image
colormode: Grayscale
storage.mode: double
dim: X Y
nb.total.frames: 1
nb.render.frames: 1
How do I convert all of these images into rgb, or at least give them the dimensions [x,y,3]? I have done a for loop with
channel(Normaltrainingpics[[i]],'rgb')
but dimensions remain the same. Thanks.
https://rdrr.io/bioc/EBImage/man/channel.html According to this resource: "rgb" converts a Grayscale image or an array into a Color image, replicating RGB channels.
for (i in 1:150) {toRGB(Normaltrainingpics[[i]])}
seems to have done the trick.