c++ - Stitcher 类 OpenCV

标签 c++ opencv image-stitching

我有两个重叠区域大约为 25% 的图像 - 但拼接失败。 我该如何处理这个问题?

我尝试使用 orb 和 surf,并更改了阈值。还有其他我应该考虑的选择吗?

Mat pano;
Stitcher stitcher = Stitcher::createDefault(try_use_gpu=false);
//Stitcher::Status status = stitcher.stitch(imgs, pano);

//stitcher.setWarper(new PlaneWarper());
stitcher.setWarper(new SphericalWarper());
stitcher.setFeaturesFinder(new detail::SurfFeaturesFinder(1000,3,4,3,4));
//stitcher.setFeaturesFinder(new detail::OrbFeaturesFinder());
stitcher.setRegistrationResol(0.1);
stitcher.setSeamEstimationResol(0.1);
stitcher.setCompositingResol(0.6);
stitcher.setPanoConfidenceThresh(1);
stitcher.setWaveCorrection(true);
stitcher.setWaveCorrectKind(detail::WAVE_CORRECT_HORIZ);
stitcher.setFeaturesMatcher(new detail::BestOf2NearestMatcher(false,0.3));
stitcher.setBundleAdjuster(new detail::BundleAdjusterRay());
tstart = clock();      
Stitcher::Status status = stitcher.stitch(imgs, pano);

最佳答案

25% 重叠肯定是不够的。 40% 会给出更好的结果,但仍然不够好。如果您想要良好的重叠,请尝试使用 60% 到 80% 之间的值。重要的是,您要拼接在一起的序列中的下一张图像与前一张图像的中心区域重叠,因为存在/不应该有任何失真。例如,在 80% 重叠的情况下,不仅会发生这种情况,而且两个图像的中心区域也非常接近,因此您可以忽略失真并找到大量匹​​配项,前提是图像的纹理质量允许。我的建议是先看看图书馆本身提供的样本。您可以在 https://github.com/Itseez/opencv/tree/master/samples/cpp/stitcher.cpp 找到最新版本和 https://github.com/Itseez/opencv/blob/master/samples/cpp/stitching_detailed.cpp .然后深入挖掘源代码本身 (https://github.com/Itseez/opencv/blob/master/modules/stitching/src/stitcher.cpp) 并在 OpenCV 引用手册(在线或下载 PDF 格式)中查找提供的文档也是很好的。

关于c++ - Stitcher 类 OpenCV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17724336/

相关文章:

函数参数中的c++函数定义

java - 使用 OpenCV 将两个图像拼接在一起时抛出异常

c++ - 拼接后从源图像计算坐标

c++ - 所需的最少出租车(算法)

c++ - 摆脱丑陋的 C 结构

c++ - 使用 SWIG 将 Python 数组传递给 c++ 函数

python - 为什么在更改Sobel运算符的ddepth参数时输出图像有显着差异?

python - 无法在python中打开VideoCapture

opencv - 是否可以检测到不同类型的梯形

image-processing - OpenCV - 图像拼接