📄 sift_demo4.m
字号:
% SIFT_DEMO4 Demonstrate SIFT code (s)% This compares our and D. Lowe's implementation. Not perfect,% but close.I=imreadbw('data/circle.pgm') ;[f,d,gss,dogss] = sift(I,'verbosity',1,'boundarypoint',0) ; d = uint8(512*d) ;[lf,ld] = siftread('data/circle.sift') ; ld = uint8(ld) ;matches = siftmatch(d,ld) ; figure(1) ; clf ; colormap gray ;subplot(2,1,1) ;imagesc(I) ; hold on ;plotsiftframe(f,'style','arrow') ;title('This implementation') ;subplot(2,1,2) ;imagesc(I) ; hold on ;plotsiftframe(lf,'style','arrow') ;title('D. Lowe''s implementation') ;figure(2) ; clf ; colormap gray; plotmatches(I,I,f,lf,matches) ;title('This implementation and Lowe''s matches') ;figure(3) ; clf ; colormap gray ;imagesc(I) ; hold on ;lh = plotsiftframe(lf,'style','arrow') ; hold on ;h = plotsiftframe(f,'style','arrow');set(lh,'LineWidth',2) ;set(h,'Color','r','LineWidth',1); title('This implementation and Lowe''s') ;% difference in th, ordered by scaledf = f(:,matches(1,:))-lf(:,matches(2,:)) ;df(4,:)=mod(df(4,:)+pi,2*pi)-pi ;%df=abs(df) ;% keep only inlier matchessel=find(sum(df.^2)<1) ;df=df(:,sel) ;figure(5) ; clf ;K=min(9,size(matches,2)) ;for k=1:K tightsubplot(K,k) ; hold on ; h=plotsiftdescriptor(d(:,matches(1,k))) ; lh=plotsiftdescriptor(ld(:,matches(2,k))) ; set(h,'LineWidth',2) ; set(lh,'Color','r') ; axis tight;axis square;axis off;end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -