须知
Stitcher 是 openCV 提供的一个图片拼接的类。 其 openCV 已经封装了很多, 我们只需要传入图片和拿到结果即可。 首先我们先对其能力进行了解和摸底及如果使用。
参考资料
https://docs.opencv.org/4.6.0/d2/d8d/classcv_1_1Stitcher.html#a37ee5bacf229e9d0fb9f97c8f5ed1acd
https://blog.csdn.net/windxgz/article/details/110792332
使用及方法说明
使用 Stitcher 就简单的拼接就是如下:
1 2 3 4
| Ptr<Stitcher> stitcher = Stitcher::create();
Stitcher::Status state = stitcher->stitch(mats, *mat);
|
我们可以通过上面使用默认的参数进行拼接,通过经验, 那么肯定是可以进行配置参数去设置如果匹配的。 其设置如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
stitcher->setRegistrationResol();
stitcher->setSeamEstimationResol()
stitcher->setCompostitingResol();
stitcher->setPanoConfidenceThresh();
stitcher->setWaveCorrection();
stitcher->setWavecorrectKind()
stitcher->setFeaturesFinder()
stitcher->setFeaturesMatcher()
stitcher->setMatchingMask()
stitcher->setBundleAdjuster()
stitcher->setCompositingResol(0.5)
stitcher->setSeamFinder(makePtr<detail::GraphCutSeamFinder>(detail::GraphCutSeamFinder::COST_COLOR))
stitcher->setBlender(makePtr<detail::MultiBandBlender>(false))
stitcher->setEstimator(makePtr<detail::HomographyBasedEstimator>())
stitcher->setWarper(makePtr<SphericalWarper>())
stitcher->setExposureCompensator(makePtr<detail::BlocksGainCompensator>());
|
结果 status 的定义如下:
1 2 3 4 5 6 7
| enum Status { OK = 0, ERR_NEED_MORE_IMGS = 1, ERR_HOMOGRAPHY_EST_FAIL = 2, ERR_CAMERA_PARAMS_ADJUST_FAIL = 3 };
|