Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- filepath = 'C:\\bf4 2013-12-07 02-22-08-62.avi';
- clc;
- try
- v_handle = VideoReader(filepath);
- % video_frames = read(v_handle);
- catch err
- error('prog:input', 'Invalid filepath! Enter as ''C:\\filelocation\\file.avi'' ');
- end
- numFrames = v_handle.NumberOfFrames;
- tic;
- %Big as possible that can still run in your memory
- PartitionSize = 500;
- total = zeros(v_handle.Height, v_handle.Width, 3);
- for n=1:PartitionSize:numFrames
- stop = n+PartitionSize - 1;
- if(stop > numFrames)
- stop = numFrames;
- end
- A = read(v_handle, [n stop]);
- %Automatically converted to double by MATLAB
- B = sum(A,4);
- total = total + B;
- end
- total = total./numFrames;
- toc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement