Matlab to convert video into image frame, image frame composition video

Source: Internet
Author: User

First, Matlab to break the video into an image frame

Percent read video file
[Filename,pathname]=uigetfile (' *. * ', ' choose a video ');
Path = [pathname filename];
Xyloobj = Videoreader (path);
start = 1;
Nframes = Xyloobj.numberofframes;    % gets the total number of video frames for
k = start:nframes% traversal per frame 
B1 = Read (Xyloobj, k);
B1 = Imresize (b1,[240,425]); The pixel size of the% transform image
Imwrite (b1,strcat (' 03052\ ', Num2str (k), '. jpg '), ' jpg ');% ' 03052\ ' The 03052 folder end in the current directory


Second, MATLAB image frame synthesis Video


Path = ' whitecar2\ ';                  % ' whitecar2\ ' is the WhiteCar2 folder under the current directory
writerobj = videowriter (' Car.avi ');   % save the generated video as a video
open (writerobj) called ' Car.avi ';
For i = 57:100
   frame = Imread (strcat (Path,num2str (i), '. jpg '));% reads the image from the folder
   Writevideo (writerobj,frame);
End
Close (writerobj);


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.