How to make one video out of 3 images?

6 Ansichten (letzte 30 Tage)
Teshan Rezel
Teshan Rezel am 13 Mär. 2022
Kommentiert: Teshan Rezel am 14 Mär. 2022
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!

Akzeptierte Antwort

Image Analyst
Image Analyst am 13 Mär. 2022
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 Kommentare
Image Analyst
Image Analyst am 13 Mär. 2022
Attached is another, simpler example where I make a movie from the current figure being displayed.
Teshan Rezel
Teshan Rezel am 14 Mär. 2022
@Image Analyst fantastic solution as ever, thank you!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by