How do make the guide?

조회 수: 2 (최근 30일)
Marquel Dwi Putranto
Marquel Dwi Putranto 2016년 3월 18일
편집: B.k Sumedha 2016년 3월 18일
1. After performing the Video (.avi) (Axes1)
proyek=guidata(gcbf);
axes(handles.axes1);
[a,b] = uigetfile('*.avi');
Vid = VideoReader (a);
VidFrame = read(Vid);
numFrame = get(Vid, 'NumberofFrames');
mov1(numFrame) = struct('cdata',[],'colormap',[]);
for i = 1:numFrame
f = VidFrame (:,:,:,i);
mov1(i).cdata=f;
mov1(i).colormap=[];
end;
movie(mov1,1);
set(proyek.figure1,'CurrentAxes',proyek.axes1);
set(imshow(Vid));
set(proyek.figure1,'Userdata',movie);
set(proyek.axes1,'Userdata',movie);
2. how to take images from Video?
3. then save the picture in the file
4. find a picture of the beginning and end of the save?
5. so appeared to Axes2 for pictures of the start and Axes3?

답변 (1개)

B.k Sumedha
B.k Sumedha 2016년 3월 18일
I hope you are looking for something like this.
1) First create a folder named 'Frames'(without quotes) in your current directory.
Then you can do the following part :
close all
clear all
clc
delete('Frames\*.jpg');
[filename pathname] = uigetfile({'*.avi'},'Select A Video File');
I = VideoReader([pathname,filename]);
implay([pathname,filename]);
pause(3);
nFrames = I.numberofFrames;
vidHeight = I.Height;
vidWidth = I.Width;
mov(1:nFrames) = ...
struct('cdata', zeros(vidHeight, vidWidth, 3, 'uint8'),...
'colormap', []);
WantedFrames = 50;
for k = 1:WantedFrames
mov(k).cdata = read( I, k);
mov(k).cdata = imresize(mov(k).cdata,[256,256]);
imwrite(mov(k).cdata,['Frames\',num2str(k),'.jpg']);
end
  댓글 수: 2
Marquel Dwi Putranto
Marquel Dwi Putranto 2016년 3월 18일
How Getsnapshot?
B.k Sumedha
B.k Sumedha 2016년 3월 18일
편집: B.k Sumedha 2016년 3월 18일
What do you mean by snapshot?
Snapshot can be taken when your trying a Live Video.

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

Community Treasure Hunt

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

Start Hunting!

Translated by