MATLAB processes AVI video files as images of any size per frame

Source: Internet
Author: User

This function is mainly used for imresize.



Code:

CLC; clear; Video = mmreader ('d: \ videotest \ Video 1. avi'); nframes = video. numberofframes; % get the number of frames H = video. height; % to get the height W = video. width; % to get the width rate = video. framerate; % preallocate movie structure. moV (1: nframes) = struct ('cdata', zeros (H, W, 3, 'int8'), 'colormap', []); % get each frame for I = 1: nframes mov (I ). CDATA = read (video, I); P = mov (I ). CDATA;
Format requirements in % imresize () []: [height and width]
Q = imresize (p, [720 960]); disp ('current Number of frames: '), DISP (I); imshow (P), title ('original image '); % Show Original Image if I <10 imwrite(q,strcat('{', int2str( I },'.jpg '), 'jpg'); % write else if I >=10 & I <100 then '), 'jpg '); else imwrite(q,strcat('00', int2str( I },'.jpg '), 'jpg'); End endend


MATLAB processes AVI video files as images of any size per frame

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.