gpt4 book ai didi

java - 安卓 : OpenCv comparing two images issue

转载 作者:行者123 更新时间:2023-12-01 06:23:36 26 4
gpt4 key购买 nike

我想在android中比较两个图像的百分比,这是我的代码

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 and 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 two images
MatOfDMatch matches = new MatOfDMatch();
matcher.match(descriptors1,descriptors2 ,matches);

例如我的方法输出应该是:

Images is 90% same

但是我不知道在 matcher.match(descriptors1,descriptors2 ,matches); 方法之后我应该做什么,你能告诉我吗?

最佳答案

我记得方法 match() 必须返回 doublefloat 的值。我对面部比较做了同样的事情,我做了(根据你的情况):

double value = matcher.match(descriptors1,descriptors2 ,matches);

围绕此问题有 2 个类似的问题。一探究竟。一定有用。 奥 git _a OpenCV filtering ORB matches

关于java - 安卓 : OpenCv comparing two images issue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29384792/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com