SURF matching

SURF descriptor will extract one vector with length 64. If i want to match between two regions, how am i going to match this two descriptor?i search a lot of information and mostly they use euclidean distance to get the value. if i use euclidean distance, how can i going to do that? by minus each 64 value with other 64 values in the other region? or each one value compare with other 64 value?if 64 * 64 =4096, then the process will be very time consuming! anyone pls answer me?!

2 Comments

Jan
Jan on 15 Aug 2011
Please post more details, most of all the code you have created already.
km g
km g on 16 Aug 2011
length=20*s/2;
g=fspecial('gaussian',[(2*length)+1 (2*length)+1],3.3*s);
theta=-direction*pi/180;
[diy,dix]=ndgrid(-length-1:length+1,-length-1:length+1);
test(1:200,1:200)=0;
for m=1:size(dix,1)
for n=1:size(dix,2)
test(r+diy(m,n),c+dix(m,n))=z1(r+diy(m,n),c+dix(m,n));
end
end
for m=1:size(diy,1)
for n=1:size(diy,2)
newx(m,n)=(dix(m,n)*cos(theta))-(diy(m,n)*sin(theta));
newy(m,n)=(dix(m,n)*sin(theta))+(diy(m,n)*cos(theta));
end
end
cox=round(c+newx);
coy=round(r+newy);
cox=cox(:);
coy=coy(:);
test2(1:200,1:200)=0;
for cc=1:size(cox,1)
newmapping(cc)= z1(coy(cc),cox(cc));
test2(coy(cc),cox(cc))=z1(coy(cc),cox(cc));
end
newmapping=reshape(newmapping,23,23);
figure,imshow(test,[]);
figure,imshow(test2,[]);
figure,imshow(newmapping,[]);
% g=g(:);
sizec=2*s;
sizer=2*s;
%
% nhaarx(1:200,1:200)=NaN;
% nhaary(1:200,1:200)=NaN;
for cc=2:22
for rr=2:22
nhaarx(rr-1,cc-1)=(boxintegral(rr-sizer/2,cc,newmapping,sizec/2,sizer)-boxintegral(rr-sizer/2,cc-sizec/2,newmapping,sizec/2,sizer));
nhaary(rr-1,cc-1)=(boxintegral(rr,cc-sizec/2,newmapping,sizec,sizer/2)-boxintegral(rr-sizer/2,cc-sizec/2,newmapping,sizec,sizer/2));
end
end
%
% figure,imshow(nhaarx,[]);
% figure,imshow(nhaary,[]);
for m=1:size(nhaarx,1)
for n=1:size(nhaary,2)
if dix(m,n)==0 || diy(m,n)==0
nhaarx(m,n)=NaN;
nhaary(m,n)=NaN;
end
end
end
q=1;
for m=1:size(nhaarx,1)
for n=1:size(nhaarx,2)
if isnan(nhaarx(m,n))==0 && isnan(nhaary(m,n))==0
newregionxx(q,1)=nhaarx(m,n);
newregionyy(q,1)=nhaary(m,n);
q=q+1;
end
end
end
si=sqrt(size(newregionxx,1)*size(newregionxx,2));
newregionx=reshape(newregionxx(:,1),si,si);
newregiony=reshape(newregionyy(:,1),si,si);
figure,imshow(newregionx,[]);
figure,imshow(newregiony,[]);
p=1;
gap=20*s/4;
for m=1:gap:size(newregionx,1)
for n=1:gap:size(newregiony,1)
[sumx,sumax,sumy,sumay]=getvector(m,n,gap,newregionx,newregiony);
sx(p)=sumx;
sy(p)=sumy;
sax(p)=sumax;
say(p)=sumay;
p=p+1;
end
end
descriptorv(1:16)=sx(:);
descriptorv(17:32)=sy(:);
descriptorv(33:48)=sax(:);
descriptorv(49:64)=say(:);
descriptorvv(1:16)=sy(:);
descriptorvv(17:32)=sx(:);
descriptorvv(33:48)=say(:);
descriptorvv(49:64)=sax(:);

Sign in to comment.

Answers (1)

David Young
David Young on 15 Aug 2011
The Euclidean distance between vectors A and B is computed simply using
norm(A-B)
This applies to SURF descriptor vectors too.

5 Comments

km g
km g on 15 Aug 2011
but is the SURF invariant to the rotation? lets say i need to compare two images which one image will be 90 degree rotated. so the dx of the first image will become dy of the second images. if this case happen do u think that the SURF still able to match the interest point?
David Young
David Young on 15 Aug 2011
If you compute the SURF features correctly, they are independent of rotation. The image patches from which the description vectors are computed should have been rotated so that the same axis is aligned with the dominant image gradient the the position and scale of the feature.
km g
km g on 16 Aug 2011
in the process of getting descriptor, we need to do the mapping according to the direction of the interest point. so do we need to do the rotation of the process of getting dy and dx also?what i mean is do i need to rotate the (-1,1) kernel according to the direction?
David Young
David Young on 17 Aug 2011
You can either rotate the image patch, or you can rotate the kernels, but not both.
km g
km g on 18 Aug 2011
if i rotate the image patch, then do i need to compute the integral image again for the rotated image patch?or i directly use the integral image of that part by using the one that compute earlier?

Sign in to comment.

Asked:

on 15 Aug 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!