在不使用估算的情况下使用合成全景图 [英] using compose panorama without estimateTransform
问题描述
我尝试在不使用EstimateTransform的情况下使用合成全景图... 它与EstimateTransform配合得很好
I try to use compose panorama without estimateTransform... It works very well with the estimateTransform
stitcher.estimateTransform(imgs);
stitcher.composePanorama(pano);
但是我发现了另一种计算imagerotation等的方法,这就是为什么我想像这样使用composepanorama:
But I found another way to compute the imagerotation etc, thats why I want to use composepanorama like this:
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);
但是每次我尝试这个时,都会出现此错误:
But everytime I trie this I get this error:
Error: Assertion failed (imgs.size() == imgs_.size()) in unknown function, file ......\src\opencv\modules\stitching\src\stitcher.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_
是在以下位置初始化的:
So if the global vector imgs_
is not initialized you'll get that assertion error. Since imgs_
is initialized in:
Stitcher::Status Stitcher::estimateTransform(InputArrayOfArrays images, const std::vector<std::vector<Rect> > &rois)
{
images.getUMatVector(imgs_);
这就是为什么如果不在composePanorama
之前调用estimateTransform
则代码崩溃的原因.
that is why your code is crashing if you don't call estimateTransform
before composePanorama
.
这篇关于在不使用估算的情况下使用合成全景图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!