我必须从一组图像中重建3d对象。假设我已经对所有图像进行了相机校准(例如示例10张图像,它们全部以不同角度显示对象)。我创建了一个视差图数组(例如,第一个视差图为1和2,第二个视差图为2和3,依此类推),之后我必须创建一个所有视差图的点云,我该怎么做?下面是显示我仅用于处理2张图像的代码。
stereo = cv2.StereoSGBM_create(minDisparity= min_disp,
numDisparities = num_disp,
blockSize = 5,
uniquenessRatio = 5,
speckleWindowSize = 5,
speckleRange = 5,
disp12MaxDiff = 1,
P1 = 8*3*win_size**2,#8*3*win_size**2,
P2 =32*3*win_size**2) #32*3*win_size**2)
#Compute disparity map
print ("\nComputing the disparity map...")
disparity_map = stereo.compute(img_1_downsampled, img_2_downsampled)
Q = np.float32([[1,0,0,-w/2.0],
[0,-1,0,h/2.0],
[0,0,0,-focal_length],
[0,0,1,0]])
points_3D = cv2.reprojectImageTo3D(disparity_map, Q)