标签:info 区域 mic nts poi pytho rem line from
继上篇,为了改善标定板的深度信息:
remove_idx1 = np.where(Z <= 0) remove_idx2 = np.where(Z > 500)#将Z轴坐标限定在0-500,以减少非标定板区域的坐标影响
采用线性回归并显示坐标信息
from sklearn.linear_model import LinearRegression import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D #删除掉无效及多余点后,得到points_3d X = points_3d[:, 0] Y = points_3d[:, 1] Z = points_3d[:, 2] XY = points_3d[:, :2] #利用线性回归计算新的Z轴坐标 reg = LinearRegression() reg.fit(XY, Z) Z_predict = reg.predict(XY) fig=plt.figure() ax = plt.axes(projection=‘3d‘) ax.scatter3D(X, Y, Z, c=‘gray‘, s=1)#显示原始点信息 ax.scatter3D(X, Y, Z_predict, c=‘red‘)#显示修正点信息 ax.set_xlabel(r‘$x_1$‘,fontsize = 20, color = ‘blue‘) ax.set_ylabel(r‘$x_2$‘,fontsize = 20, color = ‘blue‘) ax.set_zlabel(r‘$x_3$‘,fontsize = 20, color = ‘blue‘)
采用线性回归方法降低双目测距到平面的误差(python+sklearn)
标签:info 区域 mic nts poi pytho rem line from
原文地址:https://www.cnblogs.com/er-gou-zi/p/11965708.html