Projection matrix

Hello I have one question.

I am using drone and I have his location (x,y,z and rotation) so use this function to calculate projection matrix.

def projection_matrix(x, y, z, theta, K):

R_x = np.array([[1, 0, 0],
                [0, np.cos(theta[0]), -np.sin(theta[0])],
                [0, np.sin(theta[0]), np.cos(theta[0])]

R_y = np.array([[np.cos(theta[1]), 0, np.sin(theta[1])],
                [0, 1, 0],
                [-np.sin(theta[1]), 0, np.cos(theta[1])]

R_z = np.array([[np.cos(theta[2]), -np.sin(theta[2]), 0],
                [np.sin(theta[2]), np.cos(theta[2]), 0],
                [0, 0, 1]

R =,, R_x))
t = np.array([x, y, z])

C =,t)
R_C = np.matrix.transpose(R)

Rt = np.zeros((3, 4))
Rt[:3, :3] = R_C
Rt[:3, 3] = C

P =, Rt)

return P

P1 = projection_matrix(x=x, y=z, z=y, theta=[0, -theta, 0], K=K)
P0 = projection_matrix(x=0, y=0, z=0, theta=[0, 0, 0], K=K)

I used transpose matrix beacuse I was told that camera pose is difrent then world coordinate system. And I used this equations to transform them:

I don’t know if I am doing this correct beacuse I get off results when I triangulate 2D points with this 2 projection matrix


as for pose matrices, you should browse this forum. many people have written a lot about this.

this tag contains those discussions: