Skip to content

Commit 94e0ac7

Browse files
committed
need atleast 4 corresponding points to calculate homography
1 parent b88ad7f commit 94e0ac7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/calib3d/src/fundam.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,9 @@ cv::Mat cv::findHomography( InputArray _points1, InputArray _points2,
374374
return Mat();
375375
convertPointsFromHomogeneous(p, p);
376376
}
377+
// Need at least 4 point correspondences to calculate Homography
378+
if( npoints < 4 )
379+
CV_Error(Error::StsVecLengthErr , "The input arrays should have at least 4 corresponding point sets to calculate Homography");
377380
p.reshape(2, npoints).convertTo(m, CV_32F);
378381
}
379382

0 commit comments

Comments
 (0)