need atleast 4 corresponding points to calculate homography

This commit is contained in:
Aitik Gupta 2020-09-29 01:04:01 +05:30
parent b88ad7f2d9
commit 94e0ac7d9f

View File

@ -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);
}