フィルターのクリア

How to combine multiple images into an array

13 ビュー (過去 30 日間)
Tarek Hajj Shehadi
Tarek Hajj Shehadi 2021 年 10 月 17 日
編集済み: Dave B 2021 年 10 月 17 日
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
I=cat(3,img1,img2,img3,img4,img5,img6,img7)
but this returned a cell of size 256x256x21

採用された回答

Dave B
Dave B 2021 年 10 月 17 日
編集済み: Dave B 2021 年 10 月 17 日
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).
I=cat(3,img1(:,:,1),img2(:,:,1),img3(:,:,1),img4(:,:,1),img5(:,:,1),img6(:,:,1),img7(:,:,1))
I=cat(3,im2gray(img1),im2gray(img2),im2gray(img3),im2gray(img4),im2gray(img5),im2gray(img6),im2gray(img7))

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeModify Image Colors についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by