필터 지우기
필터 지우기

Making a video by selecting png images

조회 수: 1 (최근 30일)
Joydeb Saha
Joydeb Saha 2021년 9월 8일
답변: Image Analyst 2021년 9월 8일
How can I make a video by selecting png images from a folder? Also how can I save the video?
the files are: abc_20190304_0001.png to abc_20190304_0095.png

답변 (2개)

Walter Roberson
Walter Roberson 2021년 9월 8일
Loop over the files by constructing their names. Or read the directory and loop over the files returned by dir().
A common challenge when using information returned by dir() is that numbers are usually sorted in an order people do not expect. abc1.png abc10.png abc11.png abc12.png ... abc19.png abc2.png abc20.png abc21.png and so on. However, I see that in your case the filenames use 4 digit number suffixes with 0 fill, and under that circumstance, you can use the order returned by dir() [though in theory you should sort() the file names, in practice you do not need to if you are using NTFS or any of the common Mac or Linux file systems.]
Use videoWriter() to create a movie object. Read one input file at a time and writeVideo() it to the movie object. https://www.mathworks.com/help/matlab/ref/videowriter.html

Image Analyst
Image Analyst 2021년 9월 8일
I do this in the attached example. I take a video and then write all the frame to disk as individual files. Then I reconstruct a new image by reading in all the frames from the disk and making them into a new movie/video.

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by