diff --git a/modules/stitching/main.cpp b/modules/stitching/main.cpp index ea4b331725..d465229619 100644 --- a/modules/stitching/main.cpp +++ b/modules/stitching/main.cpp @@ -549,6 +549,7 @@ int main(int argc, char* argv[]) sz.width = cvRound(full_img_sizes[i].width * compose_scale); sz.height = cvRound(full_img_sizes[i].height * compose_scale); } + Rect roi = warper->warpRoi(sz, static_cast(cameras[i].focal), cameras[i].R); corners[i] = roi.tl(); sizes[i] = roi.size(); diff --git a/modules/stitching/matchers.cpp b/modules/stitching/matchers.cpp index b0438869af..6365c2b3d1 100644 --- a/modules/stitching/matchers.cpp +++ b/modules/stitching/matchers.cpp @@ -465,6 +465,8 @@ void BestOf2NearestMatcher::match(const ImageFeatures &features1, const ImageFea // Find pair-wise motion matches_info.H = findHomography(src_points, dst_points, matches_info.inliers_mask, CV_RANSAC); + if (abs(determinant(matches_info.H)) < numeric_limits::epsilon()) + return; // Find number of inliers matches_info.num_inliers = 0;