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

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`

.

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

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?