def compute_fundamental(x1, x2, method=cv2.FM_RANSAC):
"""
Computes the fundamental matrix from corresponding points x1, x2 using
the 8 point algorithm.
Options:
CV_FM_7POINT for a 7-point algorithm. N = 7
CV_FM_8POINT for an 8-point algorithm. N >= 8
CV_FM_RANSAC for the RANSAC algorithm. N >= 8
CV_FM_LMEDS for the LMedS algorithm. N >= 8"
"""
assert(x1.shape == x2.shape)
if len(x1) < 8:
raise RuntimeError('Fundamental matrix requires N >= 8 pts')
F, mask = cv2.findFundamentalMat(x1, x2, method)
return F, mask
评论列表
文章目录