MATLAB Answers

I'm trying to create a video using 96 images and I keep getting the error below.

4 ビュー (過去 30 日間)
Tiana Johnson
Tiana Johnson 2020 年 6 月 12 日
回答済み: Navya Seelam 2020 年 6 月 16 日
I'm not sure how to correct the wrror because the image(s) does exist. Here's the error I keep getting: Error using imreadget_full_filename (line 566) File "01.png" does not exist. Error in imread (line 375) fullname = get_full_filename(filename)
My code is as follows:
images = cell(96,1);
images{1} = imread('01.png');
images{2} = imread('02.png');
images{3} = imread('03.png');
images{4} = imread('04.png');
images{5} = imread('05.png');
images{6} = imread('06.png');
images{7} = imread('07.png');
images{8} = imread('08.png');
images{9} = imread('09.png');
images{10} = imread('10.png');
images{11} = imread('11.png');
images{12} = imread('12.png');
images{13} = imread('13.png');
images{14} = imread('14.png');
images{15} = imread('15.png');
images{16} = imread('16.png');
images{17} = imread('17.png');
images{18} = imread('18.png');
images{19} = imread('19.png');
images{20} = imread('20.png');
images{21} = imread('21.png');
images{22} = imread('22.png');
images{23} = imread('23.png');
images{24} = imread('24.png');
images{25} = imread('25.png');
images{26} = imread('26.png');
images{27} = imread('27.png');
images{28} = imread('28.png');
images{29} = imread('29.png');
images{30} = imread('30.png');
images{31} = imread('31.png');
images{32} = imread('32.png');
images{33} = imread('33.png');
images{34} = imread('34.png');
images{35} = imread('35.png');
images{36} = imread('36.png');
images{37} = imread('37.png');
images{38} = imread('38.png');
images{39} = imread('39.png');
images{40} = imread('40.png');
images{41} = imread('41.png');
images{42} = imread('42.png');
images{43} = imread('43.png');
images{44} = imread('44.png');
images{45} = imread('45.png');
images{46} = imread('46.png');
images{47} = imread('48.png');
images{47} = imread('47.png');
images{48} = imread('48.png');
images{49} = imread('49.png');
images{50} = imread('50.png');
images{51} = imread('51.png');
images{52} = imread('52.png');
images{53} = imread('53.png');
images{54} = imread('54.png');
images{55} = imread('55.png');
images{56} = imread('56.png');
images{57} = imread('57.png');
images{58} = imread('58.png');
images{59} = imread('59.png');
images{60} = imread('60.png');
images{61} = imread('61.png');
images{62} = imread('62.png');
images{63} = imread('63.png');
images{64} = imread('64.png');
images{65} = imread('65.png');
images{66} = imread('66.png');
images{67} = imread('67.png');
images{68} = imread('68.png');
images{69} = imread('69.png');
images{70} = imread('70.png');
images{71} = imread('71.png');
images{72} = imread('72.png');
images{73} = imread('73.png');
images{74} = imread('74.png');
images{75} = imread('75.png');
images{76} = imread('76.png');
images{77} = imread('77.png');
images{78} = imread('78.png');
images{79} = imread('79.png');
images{80} = imread('80.png');
images{81} = imread('81.png');
images{82} = imread('82.png');
images{83} = imread('83.png');
images{84} = imread('84.png');
images{85} = imread('85.png');
images{86} = imread('86.png');
images{87} = imread('87.png');
images{88} = imread('88.png');
images{89} = imread('89.png');
images{90} = imread('90.png');
images{91} = imread('91.png');
images{92} = imread('92.png');
images{93} = imread('93.png');
images{94} = imread('94.png');
images{95} = imread('95.png');
images{96} = imread('96.png');
writerObj = VideoWriter('C:\Users\tiana\Videos\myVideo.avi');
writerObj.FrameRate = 3;
open(writerObj);
for u = 1:length(images)
frame = im2frame(images{u});
for v = 1:writerObj.FrameRate(u)
writeVideo(writerObj, frame);
end
end
close(writerObj)

  0 件のコメント

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

採用された回答

Navya Seelam
Navya Seelam 2020 年 6 月 16 日
Make sure the folder containing the .png files is added to the MATLAB search path. You can use addpath to do the same.

  0 件のコメント

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

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by