How to convert videos into frames

조회 수: 2 (최근 30일)
vijay chander
vijay chander 2014년 2월 23일
댓글: vijay chander 2014년 2월 23일
My matlab code is this
video = VideoReader('video1.avi'); for i = 1:video.NumberOfFrames img = read(video,i); imwrite(img,sprintf('img%d.jpg',i)); end
fprintf('Please wait....');
filebase = dir('*.jpg');
num_files = nume1(filebase);
images = cell(1, num_files);
MS=cell(1,num_files);
for k = 1:num_files
images{k} = imread(filebase(k).name);
[rows columns color]=size(images{1});
if (color==3)
MS{k}=image_enhancement_sw(images{k});
M(k)=im2frame(MS{k});
else
MS{k}=gray_level_images(images{k});
end
end
movie(M)
but i cant able to execute the code
im getting the following error
can anyone please help me with dis.....
??? The file requires the following codec(s) to be installed on your system: h264
Error in ==> VideoReader.VideoReader>VideoReader.init at 423 obj.VideoReaderImpl = audiovideo.mmreader(fullName);
Error in ==> VideoReader.VideoReader>VideoReader.VideoReader at 133 obj.init(fileName);
Error in ==> eg at 1 video = VideoReader('video1.avi');

답변 (2개)

Image Analyst
Image Analyst 2014년 2월 23일
I do this in second half of my demo. Follow what I did in the attached m-file.

Dipten
Dipten 2014년 2월 23일
편집: Dipten 2014년 2월 23일
in this vidFrames hold and store your all frames. You can use a Frame by using mov(i).data
readerobj = mmreader('dd.avi');
vidFrames = read(readerobj);
numFrames = get(readerobj, 'numberOfFrames');
For i=1:numFrames-1
mov(i).data=vidFrames(:,:,:,i).
end
  댓글 수: 1
vijay chander
vijay chander 2014년 2월 23일
??? Error using ==> Untitled at 1 The file requires the following codec(s) to be installed on your system: h264
still im getting this error

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by