Is there any robust solution to match two images and find the percentage of match between them in MATLAB ?
1 view (last 30 days)
Show older comments
meghna bhatt
on 15 Jul 2013
Commented: Walter Roberson
on 28 Aug 2016
Problem description -
->say we already have some no of template(base) images in one folder
Input -
- Image to find its perfect matching image
Output -
-Matched Image (if found)
-Otherwise Message - no matching found
I need robust solution to this ..
I have tried using SURF Features but its not giving me robust output meaning it sometimes gives wrong match - though it its giving quite good result but not 100 %
Here is the rough logic of my current algorithm :
Input_Image_gray = rgb2gray(Input_Image);
Input_keys = detectSURFFeatures(Input_Image_gray);
[Input_features Input_validPts] = extractFeatures(Input_Image_gray, Input_keys);
----iterate for loop for the Template images we have in a Folder
templateImage=templateImagesArray{loopCounter};
ref_img_gray = rgb2gray(templateImage);
ref_keys=detectSURFFeatures(ref_img_gray);
[~, MATCH_METRIC] = matchFeatures(ref_features,Input_features ,'MatchThreshold',3);
-- Calculate percentage for each image on the base of MATCH_MATRIC
if percentage > 50
display the matched Image
otherwise display message - no matching image fond
----end loop
please share if any body has any idea regarding how to achieve this
Thanks in advance..
0 Comments
Accepted Answer
Alex Taylor
on 15 Jul 2013
When solving registration problems, there is typically not any one algorithm that will be robust 100% of the time. That said, you may find that you can achieve very good results with a particular dataset if you choose your algorithm appropriately.
As far as which algorithm to use, you should consider the following questions:
1) What types of geometric deformations do you expect are present in your data? 2) Do the images in your dataset have strong features in terms of Corners, SURF features, etc. 3) Are all the images in your dataset collected with a similar sensor? 4) Are all of the images in your dataset illuminated the same?
You have mentioned already that there is skew present in your images. The presence of shear means that you require an affine model to solve the registration.
You will not be able to use normxcorr2, because there is no known correlation based approach for resolving shear.
If you are getting good results with feature based approach using SURF and estimateGeometricTransform in CVST, I would see if you can tune the feature matching and RANSAC steps to get the kind of robustness you are looking for. SURF is an appropriate algorithm for solving affine registration problems.
2 Comments
More Answers (1)
Image Analyst
on 15 Jul 2013
If you're searching for a "perfect matching image" simply subtract the two images:
diffImage = double(image1) - double(image2);
perfectMatch = (sum(diffImage(:)) == 0);
You can use nnz if you want to find the percentage that aren't the very same pixel value. Only use SURF if you want to compare approximate matches, not exact matches.
4 Comments
See Also
Categories
Find more on Geometric Transformation and Image Registration 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!