How to compose more than 2images in a folder ?

1 回表示 (過去 30 日間)
Jenifer NG
Jenifer NG 2022 年 7 月 15 日
コメント済み: Image Analyst 2022 年 7 月 15 日
Dear All,
I have 10 images in a folder need to be composed.
I found the function imfuse() but it is work for only 2 images.
Could anyone have any solutions for my case ?
I attached 10 images
Thanks and regards!

採用された回答

KSSV
KSSV 2022 年 7 月 15 日
imgFiles = dir('*jpg') ;
N = length(imgFiles) ;
I1 = imread(imgFiles(1).name) ;
I2 = imread(imgFiles(2).name) ;
If = imfuse(I1,I2) ;
for i = 3:N
I = imread(imgFiles(i).name)
If = imfuse(I,If) ;
end
imshow(If)
  1 件のコメント
Jenifer NG
Jenifer NG 2022 年 7 月 15 日
Wow it's working

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2022 年 7 月 15 日
Maybe you just want to sum the images to get the average
imgFiles = dir('*.png') ;
numFiles = length(imgFiles);
for k = 1 : numFiles
thisImage = double(imread(imgFiles(i).name))
if k == 1
sumImage = thisImage;
else
sumImage = sumImage + thisImage;
end
end
averageImage = uint8(sumImage / numFiles);
imshow(averageImage, []);
or maybe you might be interested imshowpair or imtile
  2 件のコメント
Jenifer NG
Jenifer NG 2022 年 7 月 15 日
Thanks for your code,
Actually, I have this raw image as attached image.
I want to create serveral images for training model.
Image Analyst
Image Analyst 2022 年 7 月 15 日
OK, just thought I'd offer. It sounds like @KSSV's solution is working for you.

サインインしてコメントする。

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by