From 94e0ac7d9f9e97d59572acc4e4b46750006785ad Mon Sep 17 00:00:00 2001 From: Aitik Gupta Date: Tue, 29 Sep 2020 01:04:01 +0530 Subject: [PATCH] need atleast 4 corresponding points to calculate homography --- modules/calib3d/src/fundam.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/calib3d/src/fundam.cpp b/modules/calib3d/src/fundam.cpp index ebfd3af992..3c1b0ce00d 100644 --- a/modules/calib3d/src/fundam.cpp +++ b/modules/calib3d/src/fundam.cpp @@ -374,6 +374,9 @@ cv::Mat cv::findHomography( InputArray _points1, InputArray _points2, return Mat(); convertPointsFromHomogeneous(p, p); } + // Need at least 4 point correspondences to calculate Homography + if( npoints < 4 ) + CV_Error(Error::StsVecLengthErr , "The input arrays should have at least 4 corresponding point sets to calculate Homography"); p.reshape(2, npoints).convertTo(m, CV_32F); }