From 7674f3ddbff1231021f1026df5c9259fba06fa4c Mon Sep 17 00:00:00 2001 From: Adi Shavit Date: Thu, 3 Jul 2014 22:14:58 +0300 Subject: [PATCH] Added call to clone() to avoid unexpected change to external data. - Fix both stitching_detailed.cpp sample and cv::Stitcher. --- modules/stitching/src/stitcher.cpp | 2 +- samples/cpp/stitching_detailed.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/stitching/src/stitcher.cpp b/modules/stitching/src/stitcher.cpp index ddfdb50..0d4623a 100644 --- a/modules/stitching/src/stitcher.cpp +++ b/modules/stitching/src/stitcher.cpp @@ -522,7 +522,7 @@ Stitcher::Status Stitcher::estimateCameraParams() { std::vector rmats; for (size_t i = 0; i < cameras_.size(); ++i) - rmats.push_back(cameras_[i].R); + rmats.push_back(cameras_[i].R.clone()); detail::waveCorrect(rmats, wave_correct_kind_); for (size_t i = 0; i < cameras_.size(); ++i) cameras_[i].R = rmats[i]; diff --git a/samples/cpp/stitching_detailed.cpp b/samples/cpp/stitching_detailed.cpp index df0a9ab..740047f 100644 --- a/samples/cpp/stitching_detailed.cpp +++ b/samples/cpp/stitching_detailed.cpp @@ -527,7 +527,7 @@ int main(int argc, char* argv[]) { vector rmats; for (size_t i = 0; i < cameras.size(); ++i) - rmats.push_back(cameras[i].R); + rmats.push_back(cameras[i].R.clone()); waveCorrect(rmats, wave_correct); for (size_t i = 0; i < cameras.size(); ++i) cameras[i].R = rmats[i]; -- 2.7.4