Reputation: 51
If the camera coordinates in the world frame (x1, y1, z1) are available along with the camera attitude quaternions (or pitch roll and yaw) then how do I map a pixel (x,y) onto the camera image - given the coordinates of the pixel object (x2,y2,z2) in the world frame? I am a complete newbie into computer vision. Even a link to a relevant tutorial will be much appreciated.
Upvotes: 0
Views: 1224
Reputation: 2454
Pseudocode:
view = new Matrix4();
view.rotate(camRotationQuaternion);
view.translate(camX, camY, camZ);
Pseudocode:
vertexCam = view * vertexWorld;
x
and y
values of the transformed point (in camera space)Since the point is now being "seen" from the view matrix, its z
value represents the depth from the camera, and its x
and y
values represent the pixel coordinate on the flat "image" of the camera.
Pseudocode:
pixX = vertexCam.x;
pixY = vertexCam.y;
Upvotes: 0