Commit 55698548 authored by Andrey Kamaev's avatar Andrey Kamaev

Avoid assert in lapac.cpp if findHomography fails in BestOf2NearestMatcher::match

parent 9f3ce0dd
......@@ -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]
......
......@@ -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<double>::epsilon())
if (matches_info.H.empty() || std::abs(determinant(matches_info.H)) < std::numeric_limits<double>::epsilon())
return;
// Find number of inliers
......
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