-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrunOpticalFlow2D.m
More file actions
executable file
·33 lines (26 loc) · 969 Bytes
/
Copy pathrunOpticalFlow2D.m
File metadata and controls
executable file
·33 lines (26 loc) · 969 Bytes
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
function runOpticalFlow2D
img1 = double( imread( '../../data/basketball/frame13.png' ) ) / 255;
%img2 = circshift( img1, [2 2] );
img2 = double( imread( '../../data/basketball/frame14.png' ) ) / 255;
%img1 = double( imread( '../../data/Yosemite/frame10.png' ) ) / 255;
%img2 = double( imread( '../../data/Yosemite/frame11.png' ) ) / 255;
%img1 = double( imread( '../../data/Dumptruck/frame10.png' ) ) / 255;
%img2 = double( imread( '../../data/Dumptruck/frame11.png' ) ) / 255;
tic;
eta = 1d-3;
profile on
[du,dv] = opticalFlow2D( img1, img2, eta );
profile off
timeTaken = toc;
profile viewer
interped2 = ofInterp2D( img2, du, dv );
close all;
figure, imshow( img1, [] );
title('img1', 'FontSize', 20 );
figure, imshow( img2, [] );
title('img2', 'FontSize', 20 );
figure, imshow( interped2, [min(img1(:)) max(img1(:))] );
title('interped2', 'FontSize', 20 );
´
disp([ 'Time taken (s): ', num2str(timeTaken) ]);
end