How to combine multiple images into an array

9 views (last 30 days)
Tarek Hajj Shehadi
Tarek Hajj Shehadi on 17 Oct 2021
Edited: Dave B on 17 Oct 2021
I have a set of 7 images each of size 256x256x3 but since these images are all in gray scale then the channels "3" are useless. My question is how can I combine these seven images in an array or cell of size 256x256x7?
I tried using the cat function
but this returned a cell of size 256x256x21

Accepted Answer

Dave B
Dave B on 17 Oct 2021
Edited: Dave B on 17 Oct 2021
You can convert a 'greyscale' RGB image to a 2D image in a few ways. For instance: you could just take one channel (like the red channel) if the red and green and blue channels are all identical, or you could take the mean or use im2gray (if the signal you're interested in is gray but the data are in color).

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by