Is there any robust solution to match two images and find the percentage of match between them in MATLAB ?

1 visualizzazione (ultimi 30 giorni)
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..

Risposta accettata

Alex Taylor
Alex Taylor il 15 Lug 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 Commenti
meghna bhatt
meghna bhatt il 16 Lug 2013
Modificato: meghna bhatt il 16 Lug 2013
Thanks Alex for your response,
I think your approach is good and I am already using SURF option
I also think SURF will be best suited for my requirements
answers of the questions you just specified are :
let me explain
1)Yes My input data will have its quality deformed and distorted some time as the medium is scanner to capture the form
2)Yes Images in Dataset has not that much strong features that are identical compare to others
3)No all the images in my dataset collected are either of Scanner or Camera Captured Images
4)Any extra illumination does not applied on the image but in case of camera captured image it will be there in different variation
Here only issue is result should be Accurate - means if not matched then algorithm should be able to tell that there is no match found rather giving the wrong matched image
meghna bhatt
meghna bhatt il 16 Lug 2013
Modificato: meghna bhatt il 16 Lug 2013
Hey , My another problem is performance
When I am using SURF Method and matchFeatures it is taking huge time to give output
I found the two internal methods of MATLAB which are bottlenecks for slow performance through profiler
cvalgMatchFeatures>metricSSD repmat
why these are taking so much time?if any body knows please share...

Accedi per commentare.

Più risposte (1)

Image Analyst
Image Analyst il 15 Lug 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 Commenti

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by