From f610b16eafd44d6d517c6fb303100464617f6c2b Mon Sep 17 00:00:00 2001 From: Alexey Spizhevoy Date: Mon, 23 May 2011 07:35:46 +0000 Subject: [PATCH] fixed bug in graphcut seam estimation (opencv_stitching) --- modules/stitching/matchers.cpp | 1 + modules/stitching/seam_finders.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/stitching/matchers.cpp b/modules/stitching/matchers.cpp index 25e253d..483518a 100644 --- a/modules/stitching/matchers.cpp +++ b/modules/stitching/matchers.cpp @@ -69,6 +69,7 @@ namespace inline GpuSurfFeaturesFinder(double hess_thresh, int num_octaves, int num_layers, int num_octaves_descr, int num_layers_descr) { + surf_.keypointsRatio = 0.1f; surf_.hessianThreshold = hess_thresh; surf_.extended = false; num_octaves_ = num_octaves; diff --git a/modules/stitching/seam_finders.cpp b/modules/stitching/seam_finders.cpp index 410bc95..9188710 100644 --- a/modules/stitching/seam_finders.cpp +++ b/modules/stitching/seam_finders.cpp @@ -232,9 +232,15 @@ void GraphCutSeamFinder::Impl::findInPair(const Mat &img1, const Mat &img2, Poin for (int x = 0; x < roi.width; ++x) { if (graph.inSourceSegment((y + gap) * (roi.width + 2 * gap) + x + gap)) - mask2.at(roi.y - tl2.y + y, roi.x - tl2.x + x) = 0; + { + if (mask1.at(roi.y - tl1.y + y, roi.x - tl1.x + x)) + mask2.at(roi.y - tl2.y + y, roi.x - tl2.x + x) = 0; + } else - mask1.at(roi.y - tl1.y + y, roi.x - tl1.x + x) = 0; + { + if (mask2.at(roi.y - tl2.y + y, roi.x - tl2.x + x)) + mask1.at(roi.y - tl1.y + y, roi.x - tl1.x + x) = 0; + } } } } -- 2.7.4