Clear old CameraParameters in AffineBasedEstimator
authorAlexander Broemmer <alexander.broemmer@ximea.com>
Tue, 28 Mar 2017 12:31:00 +0000 (14:31 +0200)
committerAlexander Broemmer <alexander.broemmer@ximea.com>
Tue, 28 Mar 2017 13:19:25 +0000 (15:19 +0200)
AffineBasedEstimator crashed when called with an existing CameraParameters.
This happens e.g. when using Stitcher in SCANS mode.
CameraraParameters is now cleared before any calculation is executed.

modules/stitching/src/motion_estimators.cpp

index f76309f..925bb44 100644 (file)
@@ -199,7 +199,7 @@ bool AffineBasedEstimator::estimate(const std::vector<ImageFeatures> &features,
                                     const std::vector<MatchesInfo> &pairwise_matches,
                                     std::vector<CameraParams> &cameras)
 {
-    cameras.resize(features.size());
+    cameras.assign(features.size(), CameraParams());
     const int num_images = static_cast<int>(features.size());
 
     // find maximum spaning tree on pairwise matches