From d17b33131c14864bd1eae275f49a3f148e21cf29 Mon Sep 17 00:00:00 2001 From: Leo Chan Date: Thu, 22 Oct 2020 01:53:21 -0400 Subject: 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. --- SD-VBS/common/toolbox/lagrcv/test/test_lk_disp.m | 49 ++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 SD-VBS/common/toolbox/lagrcv/test/test_lk_disp.m (limited to 'SD-VBS/common/toolbox/lagrcv/test/test_lk_disp.m') 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 @@ +addpath /u/ikkjin/Matlab/Toolbox/lagrcv + +%Iprev=imread('/Projects/LAGR/logs/Test5/left_APIrun530-1/l24Aug05-abacination-1124876208.403311.ppm'); +%Icur=imread('/Projects/LAGR/logs/Test5/left_APIrun530-1/l24Aug05-abacination-1124876208.670013.ppm'); +Iprev=imread('img0.ppm'); +Icur=imread('img1.ppm'); + +Iprev=rgb2gray(Iprev); +Icur=rgb2gray(Icur); + +tic + [ features numvalid ] = goodFeaturesToTrack(Iprev, 0.3, 10); +toc +subplot(1,2,1);imshow(Iprev) +hold on +scatter(features(2,:),features(1,:),'r') + +Ipyr=getPyramid(Iprev, 3); +Jpyr=getPyramid(Icur, 3); +tic +[dxPyr2 dyPyr2]=calcGradientPyrMex(Ipyr,3); +toc +tic +[dxPyr dyPyr]=calcSobelPyrMex(Ipyr,3); +toc + +features=features(:,1:211); +for i=20 + features2=[features(2,:); features(1,:)]; +tic + [ newpoints status pyr1 ] = calcOpticalFlowPyrLK(Iprev,Icur,features, i); +toc +tic + [newpoints2 status]=calcOptFlowLKPyrMex(Ipyr, dxPyr, dyPyr, Jpyr, double(features2), 4, 0.03, i); +toc + newpoints2=[newpoints2(2,:); newpoints2(1,:)]; +features_out=features(:,find(status)); +newpoints=newpoints(:,find(status)); +newpoints2=newpoints2(:,find(status)); +subplot(1,2,1);imshow(Iprev);hold on +quiver(features_out(2,:),features_out(1,:), newpoints(2,:)-features_out(2,:), newpoints(1,:)-features_out(1,:),0,'r');hold off +subplot(1,2,2);imshow(Iprev);hold on +quiver(features_out(2,:),features_out(1,:), newpoints2(2,:)-features_out(2,:), newpoints2(1,:)-features_out(1,:),0,'r');hold off +%subplot(1,2,2);imshow(Icur);hold on +%scatter(newpoints2(2,:),newpoints2(1,:),'r');hold off +%sum(sum((newpoints-newpoints2).^2)) + +pause +end -- cgit v1.2.2