资源简介
很好的实现特征点的粗匹配,适用于用harris算子提取的角点
代码片段和文件信息
%%%file2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%ncc算法%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function res=match(a1cnt1r1c1a2cnt2r2c2)
% res=match(a1a2)
% 将从a1寻找a2中的最佳匹配点,得到从a2中抽取的res,也就是单向搜索
% [result1cnt1r11c11]=harris(a1);
% [result2cnt2r22c22]=harris(a2);%可以保证想匹配哪些点就匹配哪些
% figure;
% imshow(result1);title(‘result1角点位置‘);
% figure;title(‘result2角点位置‘);
% imshow(result2);
win=[1/9 1/9 1/9;1/9 1/9 1/9;1/9 1/9 1/9];
u1=filter2(wina1);
u2=filter2(wina2); %求均值
a1=double(a1);
a2=double(a2);
A=filter2(win(a1-u1).^2);%求方差
B=filter2(win(a2-u2).^2);
[m1n1]=size(a1);
[m2n2]=size(a2);
res1=zeros(m1n1);
res2=zeros(m2n2); %寻找的匹配的点
for s=1:cnt1
max=0; p=0;q=0;i=r1(s1);j=c1(s1); %p.q存放坐标
for v=1:cnt2
m=r2(v1);n=c2(v1);
u1(ij)=(a1(i-1j-1)+a1(i-1j)+a1(i-1j+1)+a1(ij-1)+a1(ij)+a1(ij+1)+a1(i+1j-1)+a1(i+1j)+a1(i+1j+1))/9;%%求均值
u2(mn)=(a2(m-1n-1)+a2(m-1n)+a2(m-1
- 上一篇:简单的Matlab帧间分差算法
- 下一篇:随机网络编码matlab程序
评论
共有 条评论