Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/128.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.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
C++ C++;openCV视频到全景_C++_Opencv_360 Panorama - Fatal编程技术网

C++ C++;openCV视频到全景

C++ C++;openCV视频到全景,c++,opencv,360-panorama,C++,Opencv,360 Panorama,我正在尝试通过将第n-1帧与第n帧缝合,从视频中创建全景图。 我的问题是(大约20帧)之后,图片的右侧变得非常模糊,我不知道该怎么处理它 主要内容: frames=getVideoFrames(); stichPair(帧[1],帧[0],全景[0]); 对于(int i=2;i检测(左图像,关键点1); 轻快->检测(右图像,关键点2); brisk->compute(左图像、关键点、描述符); brisk->compute(右图像、关键点、描述符); //找到两个最近的匹配项 匹配器->kn

我正在尝试通过将第n-1帧与第n帧缝合,从视频中创建全景图。 我的问题是(大约20帧)之后,图片的右侧变得非常模糊,我不知道该怎么处理它

主要内容:

frames=getVideoFrames();
stichPair(帧[1],帧[0],全景[0]);
对于(int i=2;i
stichPair:

Ptr<FeatureDetector> brisk = BRISK::create(20, 3, 1.0f);
    Ptr<DescriptorMatcher> matcher = BFMatcher::create("BruteForce-Hamming");
// find features
    brisk->detect(leftImage, keypoints_1);
    brisk->detect(rightImage, keypoints_2);
    brisk->compute(leftImage, keypoints_1, descriptors_1);
    brisk->compute(rightImage, keypoints_2, descriptors_2);

    // Find two nearest matches
    matcher->knnMatch(descriptors_1, descriptors_2, matches, 2);

    //filter bad matches
    const float ratio = 0.6;
    for (int i = 0; i < matches.size(); ++i)
    {
        if (matches[i][0].distance / matches[i][1].distance < ratio)
        {
            good_matches.push_back(matches[i][0]);
        }
    }

    for (size_t i = 0; i < good_matches.size(); i++)
    {
        leftImage_matchedKPs.push_back(keypoints_1[good_matches[i].queryIdx].pt);
        rightImage_matchedKPs.push_back(keypoints_2[good_matches[i].trainIdx].pt);
    }

    H = findHomography(Mat(rightImage_matchedKPs), Mat(leftImage_matchedKPs), RANSAC, 5);
    warpPerspective(rightImage, rightImageWarped, H, Size(4000, 1280)); // fixed size

    panorama = rightImageWarped.clone();
    roi = Mat(panorama, Rect(0, 0, leftImage.cols, leftImage.rows));
    leftImage.copyTo(roi);
}
Ptr brisk=brisk::create(20,3,1.0f);
Ptr matcher=BFMatcher::create(“BruteForce Hamming”);
//查找特征
轻快->检测(左图像,关键点1);
轻快->检测(右图像,关键点2);
brisk->compute(左图像、关键点、描述符);
brisk->compute(右图像、关键点、描述符);
//找到两个最近的匹配项
匹配器->knnMatch(描述符_1,描述符_2,匹配,2);
//过滤错误匹配
常量浮动比率=0.6;
对于(int i=0;i


模糊度来自图像的比例因子。缩放来自一些不可避免的漂移,这些漂移要么是由于配准中的小错误,要么是因为您试图在2D图像上构建3D场景。缝合中使用的透视同形图仅适用于平面场景,或者如果摄影机中心因纯旋转而改变。您可以尝试在透视中使用INTER_CUBIC或INTER_LANCZOS4,但文档仅讨论INTER_LINEAR和INTER_NEAREST,因此,其他的可能不存在ist扭曲…与INTER_CUBIC或INTER_Lanczos4相同的结果模糊度来自图像的比例因子。缩放来自一些不可避免的漂移,这些漂移要么是由于配准中的小错误,要么是因为您试图在2D图像上构建3D场景。缝合中使用的透视同形图仅适用于平面场景,或者如果摄影机中心因纯旋转而改变。您可以尝试在透视中使用INTER_CUBIC或INTER_LANCZOS4,但文档仅讨论INTER_LINEAR和INTER_NEAREST,因此,其他的可能不存在ist翘曲…与INTER_CUBIC或INTER_LANCZOS4的结果相同
Ptr<FeatureDetector> brisk = BRISK::create(20, 3, 1.0f);
    Ptr<DescriptorMatcher> matcher = BFMatcher::create("BruteForce-Hamming");
// find features
    brisk->detect(leftImage, keypoints_1);
    brisk->detect(rightImage, keypoints_2);
    brisk->compute(leftImage, keypoints_1, descriptors_1);
    brisk->compute(rightImage, keypoints_2, descriptors_2);

    // Find two nearest matches
    matcher->knnMatch(descriptors_1, descriptors_2, matches, 2);

    //filter bad matches
    const float ratio = 0.6;
    for (int i = 0; i < matches.size(); ++i)
    {
        if (matches[i][0].distance / matches[i][1].distance < ratio)
        {
            good_matches.push_back(matches[i][0]);
        }
    }

    for (size_t i = 0; i < good_matches.size(); i++)
    {
        leftImage_matchedKPs.push_back(keypoints_1[good_matches[i].queryIdx].pt);
        rightImage_matchedKPs.push_back(keypoints_2[good_matches[i].trainIdx].pt);
    }

    H = findHomography(Mat(rightImage_matchedKPs), Mat(leftImage_matchedKPs), RANSAC, 5);
    warpPerspective(rightImage, rightImageWarped, H, Size(4000, 1280)); // fixed size

    panorama = rightImageWarped.clone();
    roi = Mat(panorama, Rect(0, 0, leftImage.cols, leftImage.rows));
    leftImage.copyTo(roi);
}