parameters: (p1, p2, matches, config)
return_statement: return F, matches[inliers]
docstring: Filter matches by estimating the Fundamental matrix via RANSAC.
docstring_summary: Filter matches by estimating the Fundamental matrix via RANSAC.
docstring_tokens: Filter matches by estimating the Fundamental matrix via RANSAC .
function: def robust_match_fundamental(p1, p2, matches, config):
      """Filter matches by estimating the Fundamental matrix via RANSAC."""
      if len(matches) < 8:
          return None, np.array([])
  
      p1 = p1[matches[:, 0]][:, :2].copy()
      p2 = p2[matches[:, 1]][:, :2].copy()
  
      FM_RANSAC = cv2.FM_RANSAC if context.OPENCV3 else cv2.cv.CV_FM_RANSAC
      threshold = config['robust_matching_threshold']
      F, mask = cv2.findFundamentalMat(p1, p2, FM_RANSAC, threshold, 0.9999)
      inliers = mask.ravel().nonzero()
  
      if F is None or F[2, 2] == 0.0:
          return F, []
  
      return F, matches[inliers]
function_tokens: def robust_match_fundamental ( p1 , p2 , matches , config ) : if len ( matches ) < 8 : return None , np . array ( [ ] ) p1 = p1 [ matches [ : , 0 ] ] [ : , : 2 ] . copy ( ) p2 = p2 [ matches [ : , 1 ] ] [ : , : 2 ] . copy ( ) FM_RANSAC = cv2 . FM_RANSAC if context . OPENCV3 else cv2 . cv . CV_FM_RANSAC threshold = config [ 'robust_matching_threshold' ] F , mask = cv2 . findFundamentalMat ( p1 , p2 , FM_RANSAC , threshold , 0.9999 ) inliers = mask . ravel ( ) . nonzero ( ) if F is None or F [ 2 , 2 ] == 0.0 : return F , [ ] return F , matches [ inliers ]