white background only in the video

5 ビュー (過去 30 日間)
muhammad choudhry
muhammad choudhry 2021 年 4 月 21 日
コメント済み: muhammad choudhry 2021 年 5 月 7 日
Hi,
I am makign the video from the images, code run fine and making a video but that video is just white background instead of the images. Does anyone know what I am doign wrong here. Below is the code.
Code:
imgFile = dir('*.jpg') ;
%N = length(imgFile) ;
v = VideoWriter('newfile.avi');
%v.Quality = 95;
open(v)
imgFile = dir('*.jpg') ;
for i = 1:179
img = imgFile(i).name
frame = getframe(gcf);
writeVideo(v,frame);
end
close(v);

採用された回答

Swatantra Mahato
Swatantra Mahato 2021 年 5 月 5 日
Hi muhammad,
Note that gcf opens an empty figure if a figure is not already open, in which case the empty figure would be captured by "getframe" function and written to the video file throughout the loop.
You can refer to the examples provided in the documentation for the "writeVideo" function for reference on adding images to a video file using "writeVideo".
Hope this helps
  1 件のコメント
muhammad choudhry
muhammad choudhry 2021 年 5 月 7 日
Thanks.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by