From 55698548ddf405bdbc2a9ca9a4a7a48cd373f806 Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Tue, 12 Mar 2013 22:36:00 +0400 Subject: [PATCH] Avoid assert in lapac.cpp if findHomography fails in BestOf2NearestMatcher::match --- modules/core/src/lapack.cpp | 1 + modules/stitching/src/matchers.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/core/src/lapack.cpp b/modules/core/src/lapack.cpp index 62206fa..bf376c8 100644 --- a/modules/core/src/lapack.cpp +++ b/modules/core/src/lapack.cpp @@ -878,6 +878,7 @@ double cv::determinant( InputArray _mat ) size_t step = mat.step; const uchar* m = mat.data; + CV_Assert( !mat.empty() ); CV_Assert( mat.rows == mat.cols && (type == CV_32F || type == CV_64F)); #define Mf(y, x) ((float*)(m + y*step))[x] diff --git a/modules/stitching/src/matchers.cpp b/modules/stitching/src/matchers.cpp index 9584d48..c5f3a59 100644 --- a/modules/stitching/src/matchers.cpp +++ b/modules/stitching/src/matchers.cpp @@ -573,7 +573,7 @@ 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 (std::abs(determinant(matches_info.H)) < std::numeric_limits::epsilon()) + if (matches_info.H.empty() || std::abs(determinant(matches_info.H)) < std::numeric_limits::epsilon()) return; // Find number of inliers -- 2.7.4