Commit f610b16e authored by Alexey Spizhevoy's avatar Alexey Spizhevoy

fixed bug in graphcut seam estimation (opencv_stitching)

parent f391ea2a
...@@ -69,6 +69,7 @@ namespace ...@@ -69,6 +69,7 @@ namespace
inline GpuSurfFeaturesFinder(double hess_thresh, int num_octaves, int num_layers, inline GpuSurfFeaturesFinder(double hess_thresh, int num_octaves, int num_layers,
int num_octaves_descr, int num_layers_descr) int num_octaves_descr, int num_layers_descr)
{ {
surf_.keypointsRatio = 0.1f;
surf_.hessianThreshold = hess_thresh; surf_.hessianThreshold = hess_thresh;
surf_.extended = false; surf_.extended = false;
num_octaves_ = num_octaves; num_octaves_ = num_octaves;
......
...@@ -232,9 +232,15 @@ void GraphCutSeamFinder::Impl::findInPair(const Mat &img1, const Mat &img2, Poin ...@@ -232,9 +232,15 @@ void GraphCutSeamFinder::Impl::findInPair(const Mat &img1, const Mat &img2, Poin
for (int x = 0; x < roi.width; ++x) for (int x = 0; x < roi.width; ++x)
{ {
if (graph.inSourceSegment((y + gap) * (roi.width + 2 * gap) + x + gap)) if (graph.inSourceSegment((y + gap) * (roi.width + 2 * gap) + x + gap))
mask2.at<uchar>(roi.y - tl2.y + y, roi.x - tl2.x + x) = 0; {
if (mask1.at<uchar>(roi.y - tl1.y + y, roi.x - tl1.x + x))
mask2.at<uchar>(roi.y - tl2.y + y, roi.x - tl2.x + x) = 0;
}
else else
mask1.at<uchar>(roi.y - tl1.y + y, roi.x - tl1.x + x) = 0; {
if (mask2.at<uchar>(roi.y - tl2.y + y, roi.x - tl2.x + x))
mask1.at<uchar>(roi.y - tl1.y + y, roi.x - tl1.x + x) = 0;
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment