OpenCV 优化

def optimize_data(pts3d, weights=None):
  from scipy.optimize import least_squares
  def residual_func(exp_pts3d):
    return np.mean([ np.linalg.norm(exp_pts3d-s)  for s in pts3d ])

  x0 = np.mean(pts3d, axis=0)
  res_lsq = least_squares(residual_func, x0, loss='cauchy', f_scale=0.1)


  return res_lsq.x, min(res_lsq.fun), pts3d

你可能感兴趣的:(opencv,人工智能,计算机视觉)