Carpetfizz
Carpetfizz

Reputation: 9169

Camera projection matrix principal point

I'm a little confused about the purpose of adding the offsets of the principal point, in the camera matrix. These equations are from OpenCV Docs.

enter image description here

enter image description here

enter image description here

I understand all of this except for adding c_x and c_y. I've read that we do this in order to shift the origin of the projected point so that it's relative to (0, 0), the top left of the image. However, I don't know how adding the coordinates of the center of the image (the principal point) accomplishes this. I think it's simple geometry, but I'm having a hard time understanding.

Upvotes: 3

Views: 6209

Answers (1)

Nico Schertler
Nico Schertler

Reputation: 32627

Just take a look at the diagram in your question. The x/y coordinate system has its origin somewhere around the center of the image. I.e., there can be negative coordinates. The u/v coordinate system has its origin at the top left corner, i.e., there can be no negative coordinates. For the purpose of this question, I will consider the x/y coordinate system to already be scaled with fx, fy, i.e., (x, y) = (fx * x', fy * y').

What you want to do is transform the coordinates from the x/y coordinate system to the u/v coordinate system. Let's look at a few examples:

  • The origin in x/y (0, 0) will map to (cx, cy) in u/v.
  • The top left corner (i.e., (0, 0) in u/v) has the coordinates (-cx, -cy) in x/y.

You could establish many more examples. They all have in common that (u, v) = (x, y) + (fx, fy). And this is the transform stated in the equations.

Upvotes: 4

Related Questions