How do make the guide?

3 次查看(过去 30 天)
Marquel Dwi Putranto
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 个评论
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by