diff options
Diffstat (limited to 'SD-VBS/benchmarks/stitch/src/matlab/main.m')
| -rwxr-xr-x | SD-VBS/benchmarks/stitch/src/matlab/main.m | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/stitch/src/matlab/main.m b/SD-VBS/benchmarks/stitch/src/matlab/main.m new file mode 100755 index 0000000..9be8504 --- /dev/null +++ b/SD-VBS/benchmarks/stitch/src/matlab/main.m | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | Icur_list=readData('capitol'); | ||
| 2 | Icur=Icur_list{1}; | ||
| 3 | %Icur=Icur(1:150,:,:); | ||
| 4 | [x y v]=harris(Icur); | ||
| 5 | interestPntsCur=getANMS(x, y, v, 24); | ||
| 6 | Fcur=extractFeatures(Icur, interestPntsCur(:,1), interestPntsCur(:,2)); | ||
| 7 | |||
| 8 | for id=2:length(Icur_list) | ||
| 9 | Iprev=Icur; | ||
| 10 | Fprev=Fcur; | ||
| 11 | interestPntsPrev=interestPntsCur; | ||
| 12 | Icur=Icur_list{id}; | ||
| 13 | %Icur=Icur(1:150,:,:); | ||
| 14 | [x y v]=harris(Icur); | ||
| 15 | %showInterestPoints(I, x, y) | ||
| 16 | interestPntsCur=getANMS(x, y, v, 16); | ||
| 17 | %showInterestPoints(I, interestPnts(:,1), interestPnts(:,2)) | ||
| 18 | Fcur=extractFeatures(Icur, interestPntsCur(:,1), interestPntsCur(:,2)); | ||
| 19 | matchedPntsIdx=matchFeatures(Fprev, Fcur); | ||
| 20 | matchedPntsPrev=interestPntsPrev(matchedPntsIdx(:,1),:); | ||
| 21 | matchedPntsCur=interestPntsCur(matchedPntsIdx(:,2),:); | ||
| 22 | |||
| 23 | %subplot(1,2,1);showInterestPoints(Iprev, matchedPntsPrev(:,1), matchedPntsPrev(:,2));axis image | ||
| 24 | %subplot(1,2,2);showInterestPoints(Icur, matchedPntsCur(:,1), matchedPntsCur(:,2));axis image | ||
| 25 | %drawnow | ||
| 26 | %pause; | ||
| 27 | %printImage(['featureMatching' int2str(id-1) '_' int2str(id)]); | ||
| 28 | [retH retPntsIdx]=ransac(matchedPntsPrev, matchedPntsCur, 10000, 100); | ||
| 29 | subplot(2,2,1);showInterestPoints(Iprev, matchedPntsPrev(retPntsIdx,1), matchedPntsPrev(retPntsIdx,2));axis image | ||
| 30 | subplot(2,2,2);showInterestPoints(Icur, matchedPntsCur(retPntsIdx,1), matchedPntsCur(retPntsIdx,2));axis image | ||
| 31 | T=maketform('projective', retH'); | ||
| 32 | Tfn_Mat=T; | ||
| 33 | [nr nc nd]=size(Iprev); | ||
| 34 | Itrans=imtransform(Iprev,T,'XData', [1 nc], 'YData', [1 nr],'FillValues',[0;0;0]); | ||
| 35 | subplot(2,2,3);imshow(Itrans) | ||
| 36 | subplot(2,2,4);imagesc(rgb2gray(abs(Icur-Itrans))) | ||
| 37 | drawnow | ||
| 38 | pause; | ||
| 39 | printImage(['ransac' int2str(id-1) '_' int2str(id)]); | ||
| 40 | end | ||
| 41 | |||
| 42 | %[Itrans2 XData YData]=imtransform(Iprev,T,'FillValues',[0;0;0]); | ||
| 43 | %for the fast iteration | ||
| 44 | %[Itrans2 XData2 YData2]=imtransform(Iprev,T,'XData', [-2*nc 2*nc], 'YData', [-2*nr 2*nr],'FillValues',[0;0;0]); | ||
| 45 | |||
| 46 | %h=imshow(Itrans); | ||
| 47 | |||
