我想知道triangulatePoints在 Python 2.7 和 OpenCV 3.3 中使用的立体相机的 3D 点。为此,我校准了立体相机并将矩阵存储在文件夹中。我还使用cv2.stereoRectify和使用 cv2.initUndistortRectifyMap不失真图像来纠正我的图像。然后我保存了这些图像以及投影矩阵 P1 和 P2,并在两个图像中找到相应的点。左图中的ptl = np.array([304,277])点和右图中的对应点ptr = np.array([255,277])。之后我尝试了points = cv2.triangulatePoints(P1,P2,ptl,ptr)。代码是:
import cv2
import numpy as np
import matplotlib.pyplot as plt
cameraMatrixL = np.load('mtx_left.npy')
distCoeffsL = np.load('dist_left.npy')
cameraMatrixR = np.load('mtx_right.npy')
distCoeffsR = np.load('dist_right.npy')
R = np.load('R.npy')
T = np.load('T.npy')
# following matrices I saved which i got from stereoRectify
R1 = np.load('R1.npy')
R2 = np.load('R2.npy')
P1 = np.load('P1.npy')
P2 = np.load('P2.npy') …Run Code Online (Sandbox Code Playgroud)