-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconv_vid.m
41 lines (35 loc) · 962 Bytes
/
conv_vid.m
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
clear
close all
vidObj = VideoReader('../modis-expts/modis_images/output_new.mp4');
vidFrames = read(vidObj);
vidlength =size(vidFrames, 4);
framesize = read(vidObj, 1);
%vidlength = vidObj.NumFrames;
for ii = 1 : vidlength -1
tmp = double(rgb2gray(vidFrames(:,:,:,ii)));
tmp = imresize(tmp, 0.5);
[nrow, ncol] = size(tmp);
L(:,ii) = reshape(tmp, [], 1);
end
% size(framesize)
% vidlength
%
% vid1 = zeros(size(framesize, 1) * size(framesize, 2), vidlength);
% vid2 = zeros(size(framesize, 1) * size(framesize, 2), vidlength);
% vid3 = zeros(size(framesize, 1) * size(framesize, 2), vidlength);
%
% % i = 1;
% % while hasFrame(vidObj)
% % frame = readFrame(vidObj);
% %
% % i = i +1;
% % end
%
% i=1;
% while hasFrame(vidObj)
% tmp = readFrame(vidObj);
% vid1(:, i) = reshape(tmp(:, :, 1), [], 1);
% vid2(:, i) = reshape(tmp(:, :, 2), [], 1);
% vid3(:, i) = reshape(tmp(:, :, 3), [], 1);
% i = i+1;
% end