How to rotate a camera to point to an object on the screen

asked 2017-08-20 16:00:03 -0500

davidparks21 gravatar image

updated 2017-08-20 16:01:07 -0500

I have a camera which points in a direct, I have a unit vector C which describes the orientation of the camera in world coordinates.

There is a point of interest in the image taken by the camera. Given the field of view of the camera and image size, I can compute two vectors in pixel space:

A, the principal point (center point of the image), and

B the point of interest in pixel space.

I want to rotate the camera C (in world coordinates) such that it now points at the object represented on screen by B

It's unclear to me how to transition between the on-screen pixel-space orientation of vectors A and B and the world space vector C.

edit retag flag offensive close merge delete


You need to calculate transformation matrix to be able to convert pixel to world and vice versa.

Ziri gravatar imageZiri ( 2017-08-21 04:18:49 -0500 )edit

Is that a 4D transformation matrix? It's been a while since I studied that and I don't remember the details extremely well. And once I have the transformation matrix, do I move the world space vectors to pixel space, perform the rotation, then apply the transpose of the transformation matrix again?

davidparks21 gravatar imagedavidparks21 ( 2017-08-22 11:05:12 -0500 )edit