Wednesday, November 9, 2016

Convert-Video-to-Sequence-of-Frames

Convert-Video-to-Sequence-of-Frames

By studying this article, one can understand that how to read frame by frame from video using MATLAB.

Convert-Video-to-Sequence-of-Frames


% Program to read frames from a given video 

clear all; clc;
inputvideo = VideoReader('E:/videos/aa.mp4');

%informatin of video 
disp(inputvideo);

%number of frames in video 
no_of_frames = inputvideo.NumberOfFrames; 

%read and write operations frame by frame 
for i = 1 : no_of_frames
    
    frame = read(inputvideo,i);
    frame = rgb2gray(frame);
    strr = 'E:/videos/images/';
    str = int2str(i);
    filename = strcat(strr,'frame',str,'.jpg');
    imwrite(frame,filename,'BitDepth',8);
end


The output of the above code is shown below:

Summary of Multimedia Reader Object for 'aa.mp4'.

  Video Parameters:  29.93 frames per second, RGB24 1920x1080.
                     446 total video frames available.




Follow us on Facebook :



4 comments:

  1. really useful for beginners with no idea with videos

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. really useful for beginners with no idea with videos

    ReplyDelete
  4. Thank you for the sharing your valuable knowledge naveen

    ReplyDelete

Python-environment-for-deep-learning-in-windows

Python is increasingly becoming a popular programming language for machine learning and deep learning. If you want to use python for train...