java - Calculate percentage similarity of two images using OpenCV -
i able find matching features using bewlow shown code. want calculate percentage similarity between 2 images. new opencv. kind of highly appreciated.
featuredetector detector = featuredetector.create(featuredetector.orb); descriptorextractor extractor = descriptorextractor .create(descriptorextractor.orb); detector.detect(image1, keypoints1); detector.detect(image2, keypoints2); extractor.compute(image1, keypoints1, descriptors1); extractor.compute(image2, keypoints2, descriptors2); descriptormatcher matcher = descriptormatcher .create(descriptormatcher.bruteforce_hamming); matofdmatch matches = new matofdmatch(); matcher.match(descriptors1, descriptors2, matches);
is there other library available serving same purpose?
i don't think can compute percentage per se using feature points. can compute "score of similarity".
first of all, want filter out bad matches have, in way (i use homography transformation geometrically validate matches). then, can establish own way of computing "score of similarity".
for instance, can sum hamming distances between matches have. , use position of feature points: suppose feature point ai on image a has correspondence bi on image b. coordinates of ai (xa, ya) , of bi (xb, yb). images similar, possibly want (xa, ya) close possible (xb, yb). score like:
score = hammingdist / distancebetween(point(xa, ya), point(xb, yb))
and of course, might want put more weight on hammingdist
or on distancebetween
; need experiment.
Comments
Post a Comment