How to write video in to frames

1 visualización (últimos 30 días)
Algorithms Analyst
Algorithms Analyst el 26 de Mzo. de 2013
Hi every one
I have implement some algorithm now i want to save the results of this algorithm into some folder how can I do it?
let say my result is
myvideo=result; writeobj=Videowriter(myvideo);
how to do ahead.
thanks
  4 comentarios
Walter Roberson
Walter Roberson el 26 de Mzo. de 2013
So result is H x W x number_of_frames ?
Algorithms Analyst
Algorithms Analyst el 26 de Mzo. de 2013
Editada: Walter Roberson el 26 de Mzo. de 2013
no......
let say that I have a video
clc
close all
clear all
%%Declaring Background,current and equivalent grayscale frames
source='campus.avi';
vidobj=VideoReader(source);
frames=vidobj.Numberofframes;
for f=1:frames
thisframe=read(vidobj,f);
figure(1);imagesc(thisframe);title('Input Video Sequence');
level=graythresh(thisframe);
bwimg=im2bw(thisframe,level);
figure(2);imagesc(bwimg)
%%%Now here I want to save individual frame of my result bwimg....
end

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 26 de Mzo. de 2013
shows an example of reading a video to extract the frames. Beyond that you would use imwrite() to save each frame to a file.
  3 comentarios
Walter Roberson
Walter Roberson el 26 de Mzo. de 2013
Taking into account your code:
thisfile = sprintf('frame_%04d.jpg', f);
imwrite(bwimg, thisfile);
Algorithms Analyst
Algorithms Analyst el 28 de Mzo. de 2013
Where these frames will be saved as I did it like that...but i m not sure where are they saving
clc
close all
clear all
source='Intellegent.avi';
vidobj=VideoReader(source);
frames=vidobj.Numberofframes;
for f=1:frames
thisframe=read(vidobj,f);
figure(1);imagesc(thisframe);
for K=1:size(thisframe,3)
itframe=thisframe(:,:,K);
thisfile = sprintf('frame_%04d.jpg', K);
imwrite( thisframe, thisfile );
end
end

Iniciar sesión para comentar.

Categorías

Más información sobre 3-D Volumetric Image Processing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by