資源簡介
圖像SURF特征提取,用于圖像拼接和篡改檢測,注釋比較詳細,程序很好理解
代碼片段和文件信息
%?Example?3?Affine?registration
%?Load?images
clear?all;
I1=im2double(imread(‘TestImages/lena1.png‘));
I2=im2double(imread(‘TestImages/lena2.png‘));
%?I1=im2double(imread(‘sky\A1.png‘));
%?I2=im2double(imread(‘sky\A2.png‘));
%?Get?the?Key?Points
Options.upright=true;
Options.tresh=0.0001;
Ipts1=OpenSurf(I1Options);
Ipts2=OpenSurf(I2Options);
%?Put?the?landmark?descriptors?in?a?matrix
D1?=?reshape([Ipts1.descriptor]64[]);
D2?=?reshape([Ipts2.descriptor]64[]);
%?Find?the?best?matches
err=zeros(1length(Ipts1));
cor1=1:length(Ipts1);
cor2=zeros(1length(Ipts1));
for?i=1:length(Ipts1)
????distance=sum((D2-repmat(D1(:i)[1?length(Ipts2)])).^21);
????[err(i)cor2(i)]=min(distance);
end
%?Sort?matches?on?vector?distance
[err?ind]=sort(err);
cor1=cor1(ind);
cor2=cor2(ind);
%?Make?vectors?with?the?coordinates?of?the?best?matches
Pos1=[[Ipts1(cor1).y]‘[Ipts1(cor1).x]‘];
Pos2=[[Ipts2(cor2).y]‘[Ipts2(cor2).x]‘];
Pos1=Pos1(1:30:);
Pos2=Pos2(1:30:);
%?Show?both?images
I?=?zeros([size(I11)?size(I12)*2?size(I13)]);
I(:1:size(I12):)=I1;?I(:size(I12)+1:size(I12)+size(I22):)=I2;
figure?imshow(I);?hold?on;
%?Show?the?best?matches
for?i=1:30;
plot([Pos1(i2)?Pos2(i2)+size(I12)]‘[Pos1(i1)?Pos2(i1)]‘‘-‘);
plot([Pos1(i2)?Pos2(i2)+size(I12)]‘[Pos1(i1)?Pos2(i1)]‘‘o‘);
end
%?Calculate?affine?matrix
Pos1(:3)=1;?Pos2(:3)=1;
M=Pos1‘/Pos2‘;
%?Add?subfunctions?to?Matlab?Search?path
functionname=‘OpenSurf.m‘;
functiondir=which(functionname);
functiondir=functiondir(1:end-length(functionname));
addpath([functiondir?‘/WarpFunctions‘])
%?Warp?the?image
I1_warped=affine_warp(I1M‘bicubic‘);
%?Show?the?result
figure
subplot(131)?imshow(I1);title(‘Figure?1‘);
subplot(132)?imshow(I2);title(‘Figure?2‘);
subplot(133)?imshow(I1_warped);title(‘Warped?Figure?1‘);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????1888??2020-09-12?22:47??OpenSURF\example1006.m
?????文件????????1208??2020-09-12?22:47??OpenSURF\example2.m
?????文件????????1938??2020-09-12?22:47??OpenSURF\example3.m
?????文件????????3778??2020-09-12?22:47??OpenSURF\OpenSurf.m
?????文件????????5632??2020-09-12?22:47??OpenSURF\Thumbs.db
?????文件?????????603??2020-09-12?22:47??OpenSURF\SubFunctions\FastHessian_BuildDerivative.m
?????文件????????1699??2020-09-12?22:47??OpenSURF\SubFunctions\FastHessian_buildResponsela
?????文件????????1877??2020-09-12?22:47??OpenSURF\SubFunctions\FastHessian_buildResponseMap.m
?????文件????????2353??2020-09-12?22:47??OpenSURF\SubFunctions\FastHessian_getIpoints.m
?????文件?????????455??2020-09-12?22:47??OpenSURF\SubFunctions\FastHessian_getLaplacian.m
?????文件?????????450??2020-09-12?22:47??OpenSURF\SubFunctions\FastHessian_getResponse.m
?????文件????????2478??2020-09-12?22:47??OpenSURF\SubFunctions\FastHessian_interpolateExtremum.m
?????文件????????1680??2020-09-12?22:47??OpenSURF\SubFunctions\FastHessian_isExtremum.m
?????文件?????????738??2020-09-12?22:47??OpenSURF\SubFunctions\FastHessian_Responsela
?????文件?????????791??2020-09-12?22:47??OpenSURF\SubFunctions\IntegralImage_BoxIntegral.m
?????文件?????????494??2020-09-12?22:47??OpenSURF\SubFunctions\IntegralImage_HaarX.m
?????文件?????????556??2020-09-12?22:47??OpenSURF\SubFunctions\IntegralImage_HaarY.m
?????文件?????????796??2020-09-12?22:47??OpenSURF\SubFunctions\IntegralImage_IntegralImage.m
?????文件????????1089??2020-09-12?22:47??OpenSURF\SubFunctions\PaintSURF.m
?????文件????????1554??2020-09-12?22:47??OpenSURF\SubFunctions\SurfDesc
?????文件????????3636??2020-09-12?22:47??OpenSURF\SubFunctions\SurfDesc
?????文件????????2921??2020-09-12?22:47??OpenSURF\SubFunctions\SurfDesc
?????文件???????75288??2020-09-12?22:47??OpenSURF\TestImages\043.png
?????文件???????81918??2020-09-12?22:47??OpenSURF\TestImages\044.png
?????文件???????15904??2020-09-12?22:47??OpenSURF\TestImages\fish1.png
?????文件???????15428??2020-09-12?22:47??OpenSURF\TestImages\fish2.png
?????文件??????239755??2020-09-12?22:47??OpenSURF\TestImages\lena1.png
?????文件??????211716??2020-09-12?22:47??OpenSURF\TestImages\lena2.png
?????文件???????19555??2020-09-12?22:47??OpenSURF\TestImages\lena20.jpg
?????文件??????113463??2020-09-12?22:47??OpenSURF\TestImages\lena21.jpg
?????文件????????5296??2020-09-12?22:47??OpenSURF\TestImages\test.png
............此處省略6個文件信息
評論
共有 條評論