RMSE for SIFT Algorithm

조회 수: 5 (최근 30일)
Mary
Mary 2021년 9월 28일
댓글: Mary 2021년 10월 11일
I work with the vl_sift algorithm.How can I calculate RMSE to match two images? second image is projective transform to the first image.
I1 = imread('filename');
T = projective2d([0.89 1.24 0.002;
-0.95 1 0.0025;
0 0 1]);
I2 = imwarp(I1(400:800,400:800),T);

답변 (1개)

yanqi liu
yanqi liu 2021년 9월 29일
sir,please check the follow code to get some information,same as vl_feat
clc; clear all; close all;
I = imread('cameraman.tif');
I=imresize(I, [1e3 1e3], 'bilinear');
T = projective2d([0.89 1.24 0.002;
-0.95 1 0.0025;
0 0 1]);
J = imwarp(I(400:800,400:800),T);
% Reading the reference Image
C=J;
boxImage = C;
figure; imshow(boxImage);
title('Image of a Box');
%Reading the target image
II = I;
CC=II;
sceneImage = CC;
figure;
imshow(sceneImage);
title('Image of a Cluttered Scene');
%Detect feature images
boxPoints = detectSURFFeatures(boxImage);
scenePoints = detectSURFFeatures(sceneImage);
%Visualize the strongest feature points found in the reference image.
figure;
imshow(boxImage);
title('100 Strongest Feature Points from Box Image');
hold on;
plot(boxPoints.selectStrongest(100));
%Visualize the strongest feature points found in the target image.
figure;
imshow(sceneImage);
title('300 Strongest Feature Points from Scene Image');
hold on;
plot(scenePoints.selectStrongest(300));
%Extract feature descriptors at the interest points in both images.
[boxFeatures, boxPoints] = extractFeatures(boxImage, boxPoints);
[sceneFeatures, scenePoints] = extractFeatures(sceneImage, scenePoints);
%Match the features using their descriptors.
boxPairs = matchFeatures(boxFeatures, sceneFeatures);
%Display putatively matched features.
matchedBoxPoints = boxPoints(boxPairs(:, 1), :);
matchedScenePoints = scenePoints(boxPairs(:, 2), :);
figure;
title('Putatively Matched Points (Including Outliers)');
%This is line 46 where the compiler is indicating an error*
showMatchedFeatures(boxImage, sceneImage, matchedBoxPoints,...
matchedScenePoints,'montage');
%estimateGeometricTransform calculates the transformation relating the matched points,
%while eliminating outliers. This transformation allows us to localize the object in the scene.
[tform, inlierBoxPoints, inlierScenePoints] = estimateGeometricTransform(matchedBoxPoints, ...
matchedScenePoints, 'affine');
%Display the matching point pairs with the outliers removed
figure;
showMatchedFeatures(boxImage, sceneImage, inlierBoxPoints,...
inlierScenePoints, 'montage');
title('Matched Points (Inliers Only)');
%Get the bounding polygon of the reference image.
boxPolygon = [1, 1;... % top-left
size(boxImage, 2), 1;... % top-right
size(boxImage, 2), size(boxImage, 1);... % bottom-right
1, size(boxImage, 1);... % bottom-left
1, 1]; % top-left again to close the polygon
% Transform the polygon into the coordinate system of the target image. The transformed polygon indicates the location of the object in the scene.
newBoxPolygon = transformPointsForward(tform, boxPolygon);
%Display the detected object.
figure();
imshow(sceneImage);
hold on;
line(newBoxPolygon(:, 1), newBoxPolygon(:, 2), 'Color', 'y');
title('Detected Box');
  댓글 수: 1
Mary
Mary 2021년 10월 11일
Thank you so much dear friend. But I needed the RMSE error. Regards

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Feature Detection and Extraction에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by