summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/toolbox/lagrcv/test/test_lk_disp.m
diff options
context:
space:
mode:
authorLeo Chan <leochanj@live.unc.edu>2020-10-22 01:53:21 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2020-10-22 01:56:35 -0400
commitd17b33131c14864bd1eae275f49a3f148e21cf29 (patch)
tree0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/common/toolbox/lagrcv/test/test_lk_disp.m
parent601ed25a4c5b66cb75315832c15613a727db2c26 (diff)
Squashed commit of the sb-vbs branch.
Includes the SD-VBS benchmarks modified to: - Use libextra to loop as realtime jobs - Preallocate memory before starting their main computation - Accept input via stdin instead of via argc Does not include the SD-VBS matlab code. Fixes libextra execution in LITMUS^RT.
Diffstat (limited to 'SD-VBS/common/toolbox/lagrcv/test/test_lk_disp.m')
-rwxr-xr-xSD-VBS/common/toolbox/lagrcv/test/test_lk_disp.m49
1 files changed, 49 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/lagrcv/test/test_lk_disp.m b/SD-VBS/common/toolbox/lagrcv/test/test_lk_disp.m
new file mode 100755
index 0000000..2d55fe3
--- /dev/null
+++ b/SD-VBS/common/toolbox/lagrcv/test/test_lk_disp.m
@@ -0,0 +1,49 @@
1addpath /u/ikkjin/Matlab/Toolbox/lagrcv
2
3%Iprev=imread('/Projects/LAGR/logs/Test5/left_APIrun530-1/l24Aug05-abacination-1124876208.403311.ppm');
4%Icur=imread('/Projects/LAGR/logs/Test5/left_APIrun530-1/l24Aug05-abacination-1124876208.670013.ppm');
5Iprev=imread('img0.ppm');
6Icur=imread('img1.ppm');
7
8Iprev=rgb2gray(Iprev);
9Icur=rgb2gray(Icur);
10
11tic
12 [ features numvalid ] = goodFeaturesToTrack(Iprev, 0.3, 10);
13toc
14subplot(1,2,1);imshow(Iprev)
15hold on
16scatter(features(2,:),features(1,:),'r')
17
18Ipyr=getPyramid(Iprev, 3);
19Jpyr=getPyramid(Icur, 3);
20tic
21[dxPyr2 dyPyr2]=calcGradientPyrMex(Ipyr,3);
22toc
23tic
24[dxPyr dyPyr]=calcSobelPyrMex(Ipyr,3);
25toc
26
27features=features(:,1:211);
28for i=20
29 features2=[features(2,:); features(1,:)];
30tic
31 [ newpoints status pyr1 ] = calcOpticalFlowPyrLK(Iprev,Icur,features, i);
32toc
33tic
34 [newpoints2 status]=calcOptFlowLKPyrMex(Ipyr, dxPyr, dyPyr, Jpyr, double(features2), 4, 0.03, i);
35toc
36 newpoints2=[newpoints2(2,:); newpoints2(1,:)];
37features_out=features(:,find(status));
38newpoints=newpoints(:,find(status));
39newpoints2=newpoints2(:,find(status));
40subplot(1,2,1);imshow(Iprev);hold on
41quiver(features_out(2,:),features_out(1,:), newpoints(2,:)-features_out(2,:), newpoints(1,:)-features_out(1,:),0,'r');hold off
42subplot(1,2,2);imshow(Iprev);hold on
43quiver(features_out(2,:),features_out(1,:), newpoints2(2,:)-features_out(2,:), newpoints2(1,:)-features_out(1,:),0,'r');hold off
44%subplot(1,2,2);imshow(Icur);hold on
45%scatter(newpoints2(2,:),newpoints2(1,:),'r');hold off
46%sum(sum((newpoints-newpoints2).^2))
47
48pause
49end