使用compose全景而不使用estimateTransform

using compose panorama without estimateTransform

本文关键字:estimateTransform compose 全景 使用      更新时间:2023-10-16

我尝试在没有估计变换的情况下使用合成全景。。。它与estimateTransform 配合得很好

stitcher.estimateTransform(imgs);
stitcher.composePanorama(pano);

但我找到了另一种计算图像旋转等的方法,这就是为什么我想使用这样的组合norama:

vector<Mat> imgs;
 imgs.push_back(image1);
 imgs.push_back(image2);
 imgs.push_back(image3);
 imgs.push_back(image4);
 imgs.push_back(image5);
 imgs.push_back(image6);   
stitcher.composePanorama(Inputimages,pano);

但每次我尝试这个,我都会得到这个错误:

Error: Assertion failed (imgs.size() == imgs_.size()) in unknown function, file ......srcopencvmodulesstitchingsrcstitcher.cpp , line 128

如果进入stitcher.cpp:

Stitcher::Status Stitcher::composePanorama(InputArrayOfArrays images, OutputArray pano)
{
    LOGLN("Warping images (auxiliary)... ");
    std::vector<UMat> imgs;
    images.getUMatVector(imgs);
    if (!imgs.empty())
    {
        CV_Assert(imgs.size() == imgs_.size());

因此,如果全局向量imgs_没有初始化,就会出现断言错误。由于imgs_在中初始化

Stitcher::Status Stitcher::estimateTransform(InputArrayOfArrays images, const std::vector<std::vector<Rect> > &rois)
{
    images.getUMatVector(imgs_);

这就是为什么如果不在composePanorama之前调用estimateTransform,代码就会崩溃。

相关文章:
  • 没有找到相关文章