Matching two images by extracting surf features

9 views (last 30 days)
I want to compare the two images and recover the transformed image by extracting surf features. But I got the recovered image as a blank image. My code is given below
Iin = imread('H:\mainproject\matlabtry\OpenSURF_version1c\A.bmp'); imshow(Iin); title('Base image');
Iin=imresize(Iin,[512 512]);
% Iout = imresize(Iin, 0.7); figure;
% Iout = imrotate(Iout, 31);
Iout=imread('H:\mainproject\matlabtry\OpenSURF_version1c\A1.bmp');imshow(Iout); title('Transformed image');
Iout=imresize(Iout,[512 512]);
% detect and extract features from both images
ptsIn = detectSURFFeatures(Iin);
ptsOut = detectSURFFeatures(Iout);
[featuresIn validPtsIn] = extractFeatures(Iin, ptsIn);
[featuresOut validPtsOut] = extractFeatures(Iout, ptsOut);
% match feature vectors
index_pairs = matchFeatures(featuresIn, featuresOut);
% get matching points
matchedPtsIn = validPtsIn(index_pairs(:,1));
matchedPtsOut = validPtsOut(index_pairs(:,2));
cvexShowMatches(Iin,Iout,matchedPtsIn,matchedPtsOut);
title('Matched SURF points, including outliers');
% compute the transformation matrix using RANSAC
gte = vision.GeometricTransformEstimator;
gte.Transform = 'Nonreflective similarity';
[tform inlierIdx] = step(gte, matchedPtsOut.Location, ...
matchedPtsIn.Location);
cvexShowMatches(Iin,Iout,matchedPtsIn(inlierIdx),...
matchedPtsOut(inlierIdx),'inliersIn','inliersOut');
title('Matching inliers');
% recover the original image Iin from Iout
agt = vision.GeometricTransformer;
Ir = step(agt, im2single(Iout), tform);
figure; imshow(Ir); title('Recovered image');
input images are
</matlabcentral/answers/uploaded_files/34230/recovered%20image.jpg> anyone please help me to solve this problem

Answers (0)

Categories

Find more on Image Processing and Computer Vision in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!