How to make one video out of 3 images?

2 ビュー (過去 30 日間)
Teshan Rezel
Teshan Rezel 2022 年 3 月 13 日
コメント済み: Teshan Rezel 2022 年 3 月 14 日
Hi folks,
I'm trying to create a single image out of 3 different images, then collate the subsequent images into a video. I'm also trying to write some text onto the middle of the 3 images, that changes with each subsequent frame. I have made the following start but am having limited luck getting it to work!
mainImg = imread([imageMainFolder imageMainFiles(j).name]);
mainImg = mainImg(:,:,1:3);
cropImg = imread([cropsFolder cropFiles(j).name]);
threshImg = im2uint8(imread([threshFolder threshFiles(j).name]));
h = figure;
h(1) = subplot(2, 2, 1);
image(cropImg, "Parent", h(1));
h(2) = subplot(2, 2, 2);
image(threshImg, "Parent", h(2));
h(3) = subplot(2, 2, 3:4);
image(mainImg, "Parent", h(3));
myText = ['Temperature = ' num2str(myTemp(j)) '$^{o}C$'];
RGB = insertText(h, [50 50], myText, 'FontSize',18,'BoxColor', 'black','BoxOpacity',1,'TextColor','white');
image(RGB, 'Parent', axes);
axes.Visible = 'off';
writeVideo(writerObj, RGB);
this is placed inside a loop for j. I close the writerObj when the loop ends.
I'm sure my syntax is wrong so I'd appreciate any advice on how to fix it!

採用された回答

Image Analyst
Image Analyst 2022 年 3 月 13 日
See attached example. See the second half where I create a movie from images in a folder. The first half deals with extracting frames from an existing movie, getting the mean colors, and (optionally) saving the individual frames to disk.
With only 3 images, you'll need to adjust your FrameRate to be something like 1 or 2 seconds.
  2 件のコメント
Image Analyst
Image Analyst 2022 年 3 月 13 日
Attached is another, simpler example where I make a movie from the current figure being displayed.
Teshan Rezel
Teshan Rezel 2022 年 3 月 14 日
@Image Analyst fantastic solution as ever, thank you!

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

その他の回答 (0 件)

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by