Python 为什么OpenCV 2x中的estimateAffine3D结果如此不同。与3x/4x相比?

Python 为什么OpenCV 2x中的estimateAffine3D结果如此不同。与3x/4x相比?,python,opencv,opencv3.0,Python,Opencv,Opencv3.0,我使用以下简单脚本估计变换: import numpy as np import cv2 ​ np.set_printoptions(suppress=True, linewidth=150, precision=3) ​ src_pts = np.array([ [404003.4538534981, 6439036.085327965, 30.070000000298023], [404031.8414760324, 6439025.267706301, 30.0399999

我使用以下简单脚本估计变换:

import numpy as np
import cv2
​
np.set_printoptions(suppress=True, linewidth=150, precision=3)
​
src_pts = np.array([
    [404003.4538534981, 6439036.085327965, 30.070000000298023],
    [404031.8414760324, 6439025.267706301, 30.03999999910593],
    [404021.6794758776, 6439102.775758727, 29.739999999292195],
    [404021.3647202959, 6439136.031732696, 29.50999999884516]
])
dst_pts = np.array([
    [65560.854, 238055.105, 30.07],
    [65590.083, 238044.21, 30.04],
    [65587.214, 238120.096, 29.74],
    [65587.074, 238160.277, 29.51]
])
​
​
def print_xy_error(src, dst, transform, label):
    predicted = np.dot(np.hstack((src, np.ones((src.shape[0], 1)))), transform.transpose())
    error = dst - predicted
    avg_xy_error = np.mean(np.sqrt(np.sum(error[:, 0:2] ** 2., 1)))
    print('OpenCV v{} solver {} found transform with error {:.5f}:'.format(cv2.__version__, label, avg_xy_error))
    print(transform)
​
_, transform3d, _ = cv2.estimateAffine3D(src_pts, dst_pts)
print_xy_error(src_pts, dst_pts, transform3d, 'estimateAffine3D')
但是OpenCV 2x和3x/4x的结果非常不同

在2.x中运行此脚本:

OpenCV v2.4.13.2 solver estimateAffine3D found transform with error 0.00000:
[[       1.164        0.254       35.727 -2040695.972]
 [      -0.237        0.62       -84.713 -3656548.676]
 [       0.          -0.           1.           0.   ]]
在3.x中运行此脚本:

OpenCV v3.4.0 solver estimateAffine3D found transform with error 0.09992:
[[       1.16         0.25        34.905 -2013737.96 ]
 [      -0.25         0.61       -86.809 -3588616.483]
 [      -0.          -0.           1.           0.   ]]

有人能帮我理解为什么吗?

RANSAC是一种随机算法。在同一版本上不同的运行之间有相似的差异吗?没有,当我更改random seedRANSAC是一个随机算法时。在同一版本上不同的运行之间有相似的差异吗?没有,当我更改随机种子时没有