相关疑难解决方法(0)

Python - 从旋转角度对OpenCV进行透视变换

我正在努力depth map with OpenCV.我可以获得它,但它是从左相机原点重建的,后者有一点倾斜,如图所示,深度"移位"(深度应该接近,没有水平渐变):

在此输入图像描述

我想以零角度表达它,我尝试使用warp透视函数,如下所示,但我获得了一个空字段...

P = np.dot(cam,np.dot(Transl,np.dot(Rot,A1)))

dst = cv2.warpPerspective(depth, P, (2048, 2048))
Run Code Online (Sandbox Code Playgroud)

用:

#Projection 2D -> 3D matrix
A1 = np.zeros((4,3))
A1[0,0] = 1 
A1[0,2] = -1024
A1[1,1] = 1
A1[1,2] = -1024
A1[3,2] = 1

#Rotation matrice around the Y axis
theta = np.deg2rad(5) 
Rot = np.zeros((4,4))
Rot[0,0] = np.cos(theta)
Rot[0,2] = -np.sin(theta)
Rot[1,1] = 1
Rot[2,0] = np.sin(theta)
Rot[2,2] = np.cos(theta)
Rot[3,3] = 1

#Translation matrix on the X axis 
dist = 0
Transl …
Run Code Online (Sandbox Code Playgroud)

python opencv stereo-3d perspectivecamera

9
推荐指数
1
解决办法
1506
查看次数

标签 统计

opencv ×1

perspectivecamera ×1

python ×1

stereo-3d ×1