-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathFrameReader.m
More file actions
64 lines (56 loc) · 1.49 KB
/
FrameReader.m
File metadata and controls
64 lines (56 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
clc;
clear all;
close all;
% obj = VideoReader('myVideo2.avi');
% vid = readFrame(obj);
% nFrame = size(vid,122);
% for k = 1 : nFrame
% newname = strcat(num2str(k),'.jpg');
% imwrite(vid(:,:,:,k), newname);
% pause(0.1);
% end
vid=VideoReader('myVideo2.avi');
numFrames = vid.NumberOfFrames;
n=numFrames;
for i = 1:1:n
frames = read(vid,i);
imwrite(frames,['Frame\Image' int2str(i), '.png']);
im(i)=image(frames);
end
% vidObj = VideoReader('myVideo2.avi');
% vidObj.CurrentTime = 0.1;
% frames = vidObj.CurrentTime;
% for f = 1: frames
% thisframe = readFrame(vidObj,f);
% figure(1);
% imagesc(thisframe);
% thisfile = sprintf('frame_%04d.jpg',f);
% imwrite(thisframe,thisfile);
% end
%
% vidHeight = vidObj.Height;
% vidWidth = vidObj.Width;
%
% s = struct('cdata',zeros(vidHeight,vidWidth,3,'uint8'),...
% 'colormap',[]);
%
% s = struct('cdata',zeros(vidHeight,vidWidth,3,'uint8'),...
% 'colormap',[]);
%
% whos s
% image(s(1).cdata)
% set(gcf,'position',[150 150 vidObj.Width vidObj.Height]);
% set(gca,'units','pixels');
% set(gca,'position',[0 0 vidObj.Width vidObj.Height]);
% movie(s,1,vidObj.FrameRate);
%
% vidObj.CurrentTime = 0.1;
% currAxes = axes;
% while hasFrame(vidObj)
% vidFrame = readFrame(vidObj);
% % image(vidFrame, 'Parent', currAxes);
% % currAxes.Visible = 'off';
% % pause(1/v.FrameRate);
% end
%
% whos vidFrame