java - Android : OpenCv comparing two images issue -
i want compare 2 image in percent in android , here codes
mat img1 = highgui.imread("storage/external_sd/a.png"); mat img2 = highgui.imread("storage/external_sd/b.png"); matofkeypoint keypoints1 = new matofkeypoint(); matofkeypoint keypoints2 = new matofkeypoint(); mat descriptors1 = new mat(); mat descriptors2 = new mat(); //definition of orb keypoint detector , descriptor extractors featuredetector detector = featuredetector.create(featuredetector.orb); descriptorextractor extractor = descriptorextractor.create(descriptorextractor.orb); //detect keypoints detector.detect(img1, keypoints1); detector.detect(img2, keypoints2); //extract descriptors extractor.compute(img1, keypoints1, descriptors1); extractor.compute(img2, keypoints2, descriptors2); //definition of descriptor matcher descriptormatcher matcher = descriptormatcher.create(descriptormatcher.bruteforce_hamming); //match points of 2 images matofdmatch matches = new matofdmatch(); matcher.match(descriptors1,descriptors2 ,matches);
for example method out put should :
images 90% same
but dont know should after matcher.match(descriptors1,descriptors2 ,matches);
method, can please advise me ?
as remember method match()
must return value of double
or float
. did same thing face comparison , did (according case):
double value = matcher.match(descriptors1,descriptors2 ,matches);
there 2 similar questions around this. check out. must useful. opencv filtering orb matches opencv - java - no match 2 opposite images using descriptormatcher
Comments
Post a Comment