diff options
| author | Leo Chan <leochanj@live.unc.edu> | 2020-10-22 01:53:21 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-22 01:56:35 -0400 |
| commit | d17b33131c14864bd1eae275f49a3f148e21cf29 (patch) | |
| tree | 0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/common/toolbox/lagrcv/test/test_lk_disp.m | |
| parent | 601ed25a4c5b66cb75315832c15613a727db2c26 (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-x | SD-VBS/common/toolbox/lagrcv/test/test_lk_disp.m | 49 |
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 @@ | |||
| 1 | addpath /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'); | ||
| 5 | Iprev=imread('img0.ppm'); | ||
| 6 | Icur=imread('img1.ppm'); | ||
| 7 | |||
| 8 | Iprev=rgb2gray(Iprev); | ||
| 9 | Icur=rgb2gray(Icur); | ||
| 10 | |||
| 11 | tic | ||
| 12 | [ features numvalid ] = goodFeaturesToTrack(Iprev, 0.3, 10); | ||
| 13 | toc | ||
| 14 | subplot(1,2,1);imshow(Iprev) | ||
| 15 | hold on | ||
| 16 | scatter(features(2,:),features(1,:),'r') | ||
| 17 | |||
| 18 | Ipyr=getPyramid(Iprev, 3); | ||
| 19 | Jpyr=getPyramid(Icur, 3); | ||
| 20 | tic | ||
| 21 | [dxPyr2 dyPyr2]=calcGradientPyrMex(Ipyr,3); | ||
| 22 | toc | ||
| 23 | tic | ||
| 24 | [dxPyr dyPyr]=calcSobelPyrMex(Ipyr,3); | ||
| 25 | toc | ||
| 26 | |||
| 27 | features=features(:,1:211); | ||
| 28 | for i=20 | ||
| 29 | features2=[features(2,:); features(1,:)]; | ||
| 30 | tic | ||
| 31 | [ newpoints status pyr1 ] = calcOpticalFlowPyrLK(Iprev,Icur,features, i); | ||
| 32 | toc | ||
| 33 | tic | ||
| 34 | [newpoints2 status]=calcOptFlowLKPyrMex(Ipyr, dxPyr, dyPyr, Jpyr, double(features2), 4, 0.03, i); | ||
| 35 | toc | ||
| 36 | newpoints2=[newpoints2(2,:); newpoints2(1,:)]; | ||
| 37 | features_out=features(:,find(status)); | ||
| 38 | newpoints=newpoints(:,find(status)); | ||
| 39 | newpoints2=newpoints2(:,find(status)); | ||
| 40 | subplot(1,2,1);imshow(Iprev);hold on | ||
| 41 | quiver(features_out(2,:),features_out(1,:), newpoints(2,:)-features_out(2,:), newpoints(1,:)-features_out(1,:),0,'r');hold off | ||
| 42 | subplot(1,2,2);imshow(Iprev);hold on | ||
| 43 | quiver(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 | |||
| 48 | pause | ||
| 49 | end | ||
