I am trying to find the difference between two images, using Matlab. The classic built in function that Matlab provides for this is because the two images don't have the same dimensions (The objects in the images are the same, but in the second image other objects are introduced). i need to use a metric or function can calculate the number of matching feature between two images and give me a value to decide according to threshold ..
source = imread('source.png'); target = imread('target.png'); source = rgb2gray(source); target = rgb2gray(target); sourcePoints=detectSURFFeatures(source,'MetricThreshold',100.0,'NumOctaves',1,'N umScaleLevels',6); targetPoints=detectSURFFeatures(target,'MetricThreshold',100.0,'NumOctaves',1,'NumScaleLevels',6); [sourceFeatures,sourcePoints]=extractFeatures(source,sourcePoints,'SURFSize',64); [targetFeatures,targetPoints]=extractFeatures(target,targetPoints,'SURFSize',64); boxPairs = matchFeatures(sourceFeatures, targetFeatures); matchedSourcePoints = sourcePoints(boxPairs(:, 1), :); matchedTargetPoints = targetPoints(boxPairs(:, 2), :); % IS there any metric can used to make accurate decision if there is a match or not instead of percentage because its not accurate as required numPairs = length(boxpairs); %the number of pairs percentage = numPairs/100; if percentage >= 0.40 disp('We have this'); else disp('We do not have this'); disp(percentage); end
IS there any metric can used to make accurate decision if there is a match or not instead of percentage because its not accurate as required