Filter löschen
Filter löschen

problem with videoWriter not closing (2)

2 Ansichten (letzte 30 Tage)
Teshan Rezel
Teshan Rezel am 1 Apr. 2022
Kommentiert: Teshan Rezel am 4 Apr. 2022
Hi folks,
This is a followup to my original question, found here!
I am creating a video and having trouble with the videoWriter not closing, or taking a very long time to close.
It appears it doesn't actually get to the close(writeObj) statement as I left the programme running over 2 days and had no video files written.
May I please ask how to fix this? The code is as follows:
writerObj = VideoWriter(mainVideoName);
writerObj.FrameRate = 10;
for j = 1 : numMainImages
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'];
annotation('textbox', [0.4, 0.55, 0,0], 'string', myText, "FitBoxToText","on");
h(2).Colormap = gray(256);
for k = 1:3
h(k).XAxis.Visible = "off";
h(k).YAxis.Visible = 'off';
thisFrame = getframe(gca);
writeVideo(writerObj, thisFrame);

Akzeptierte Antwort

yanqi liu
yanqi liu am 2 Apr. 2022
yes,sir,may be use
to make all handler close
  1 Kommentar
Teshan Rezel
Teshan Rezel am 4 Apr. 2022
hi @yanqi liu I'm afraid this doesn't work either, as the code never actually makes it to the close(writerObj) line.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)




Community Treasure Hunt

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

Start Hunting!

Translated by