短视频商城源码,比较图片

2020-10-29 17:44:48 浏览数 (1)

短视频商城源码,比较图片功能实现的相关代码如下

代码语言:javascript复制
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);

以上就是短视频商城源码,比较图片实现的相关代码 更多内容欢迎关注之后的文章

0 人点赞