Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Opencv java匹配查找器_Java_Opencv_Matching_Orb - Fatal编程技术网

Opencv java匹配查找器

Opencv java匹配查找器,java,opencv,matching,orb,Java,Opencv,Matching,Orb,我想知道如何找到比赛距离,但过了一段时间,我的比赛没有比赛。我用Haar检测器检测人脸,接下来我要做的是将一个新的检测与模板图像匹配,如果距离足够小,它会附加新的检测图像。问题是,经过几次迭代后,匹配列表为空 @Override public void match(List<Template> listOfTemplates, List<Template> listOfDetections) { FeatureDetector Fdetector = Featur

我想知道如何找到比赛距离,但过了一段时间,我的比赛没有比赛。我用Haar检测器检测人脸,接下来我要做的是将一个新的检测与模板图像匹配,如果距离足够小,它会附加新的检测图像。问题是,经过几次迭代后,匹配列表为空

@Override
public void match(List<Template> listOfTemplates, List<Template> listOfDetections) {
    FeatureDetector Fdetector = FeatureDetector.create(FeatureDetector.ORB);
    DescriptorExtractor Fdescriptor = DescriptorExtractor.create(DescriptorExtractor.ORB);
    DescriptorMatcher matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE);
    for (Template template : listOfTemplates) {


        MatOfKeyPoint templateKeyPoints=new MatOfKeyPoint();
        Mat templateDescriptors=new Mat();
        Fdetector.detect(template.image, templateKeyPoints);
        Fdescriptor.compute(template.image, templateKeyPoints, templateDescriptors);

        for (Template detection : listOfDetections) {
            MatOfKeyPoint detectionKeyPoints=new MatOfKeyPoint();
            Mat detectionDescriptors=new Mat(); 

            Fdetector.detect(detection.image, detectionKeyPoints);
            Fdescriptor.compute(detection.image, detectionKeyPoints, detectionDescriptors);
            MatOfDMatch matches=new MatOfDMatch();
            if (detectionDescriptors.cols() <= templateDescriptors.cols()) {
                matcher.match(detectionDescriptors,templateDescriptors , matches);
            } else {
                matcher.match(templateDescriptors, detectionDescriptors, matches);
            }
            List<DMatch> matchlist=matches.toList();
            for (DMatch dMatch : matchlist) {
                if (dMatch.distance<80) {
                        template.IdOfContourMatcher =listOfDetections.indexOf(detection);   
                }
                    System.out.println(dMatch.distance);
            }



        }


    }

}
@覆盖
公共无效匹配(模板列表、检测列表){
FeatureDetector Fdetector=FeatureDetector.create(FeatureDetector.ORB);
DescriptorExtractor fddescriptor=DescriptorExtractor.create(DescriptorExtractor.ORB);
DescriptorMatcher matcher=DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE);
用于(模板:listOfTemplates){
MatOfKeyPoint templateKeyPoints=新的MatOfKeyPoint();
Mat templateDescriptors=新Mat();
Fdetector.detect(template.image,templateKeyPoints);
计算(template.image、templateKeyPoints、templateDescriptor);
用于(模板检测:listOfDetections){
MatOfKeyPoint DETECTION KEYPOINTS=新的MatOfKeyPoint();
Mat检测描述符=新Mat();
Fdetector.detect(detection.image,detectionKeyPoints);
Fdescriptor.compute(detection.image、detectionKeyPoints、detectionDescriptor);
MatOfDMatch matches=新的MatOfDMatch();
if(detectionDescriptors.cols()