mirror of
https://github.com/opencv/opencv.git
synced 2025-07-24 22:16:27 +08:00
Fix assertion in cv2.sampsonDistance
This commit is contained in:
parent
8e65075c1e
commit
a9cb451199
@ -84,5 +84,13 @@ class calibration_test(NewOpenCVTests):
|
||||
self.assertTrue(imagePoints is not None)
|
||||
self.assertTrue(jacobian is not None)
|
||||
|
||||
def test_sampsonDistance_valid2D(self):
|
||||
pt1 = (np.random.rand(3, 10) * 256).astype(np.float64)
|
||||
pt2 = (np.random.rand(3, 10) * 256).astype(np.float64)
|
||||
F = (np.random.rand(3, 3) * 256).astype(np.float64)
|
||||
dist = cv.sampsonDistance(pt1, pt2, F)
|
||||
self.assertTrue(isinstance(dist, (float, np.floating)))
|
||||
self.assertGreaterEqual(dist, 0.0)
|
||||
|
||||
if __name__ == '__main__':
|
||||
NewOpenCVTests.bootstrap()
|
||||
|
@ -1224,7 +1224,7 @@ double cv::sampsonDistance(InputArray _pt1, InputArray _pt2, InputArray _F)
|
||||
{
|
||||
CV_INSTRUMENT_REGION();
|
||||
|
||||
CV_Assert(_pt1.type() == CV_64F && _pt2.type() == CV_64F && _F.type() == CV_64F);
|
||||
CV_Assert(_pt1.depth() == CV_64F && _pt2.depth() == CV_64F && _F.depth() == CV_64F);
|
||||
CV_DbgAssert(_pt1.rows() == 3 && _F.size() == Size(3, 3) && _pt1.rows() == _pt2.rows());
|
||||
|
||||
Mat pt1(_pt1.getMat());
|
||||
|
Loading…
Reference in New Issue
Block a user