Search code examples
matlabcomputer-visionfeature-detectionmatlab-cvstsurf

Number of key points using SURF detector in matlab


i tried to count the number of key points that are matched between referenced image and query image i need to calculate the number of inliers points matching , any one can tell me any function can calculate that ...

in this example there is a function can show matched points :

figure;
showMatchedFeatures(boxImage, sceneImage, inlierBoxPoints, ...
    inlierScenePoints, 'montage');
title('Matched Points (Inliers Only)');

how can i count the matched feature number? like count(matchedfeature)=?

my example link as follow http://www.mathworks.com/help/vision/examples/object-detection-in-a-cluttered-scene-using-point-feature-matching.html


Solution

  • If you are following that example, you may have then a variable in the workspace called boxPairs, that came out from matchFeatures(boxFeatures, sceneFeatures);.

    As the same itself says, that function is matching the points of the 2 images. boxPairs is a Npointsmatched x 2 index matrix. size(boxPairs,1) will give you the amount of matched points.

    If you want the amount of matched points after the geometric transform, that eliminates the outliers

    (in [tform, inlierBoxPoints, inlierScenePoints] = ... estimateGeometricTransform(matchedBoxPoints, matchedScenePoints, 'affine');)

    then just get size(inlierBoxPoints,1). This size should be smaller or equal the previous one.