0

I have a frame/image that was captured using a calibrated camera. Both sets of camera parameters (intrinsic and extrinsic) are available. I was wondering, if I flip the frame in both the horizontal and vertical directions (effectively rotating it 180 degrees), what do I need to change in the original camera parameters to obtain the correct parameters for the rotated image?

Any help is appreciated. Thanks..

informer2000
  • 399
  • 6
  • 20

1 Answers1

-1

The linear parts of your camera parameters will translate into a view-projection matrix. Concatenating it with a scale(-1,-1,1) transformation will give you the view-projection for the new situation (BTW, scale(-1,-1,1) == rotate(180°=pi, 0,0,1)).

datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • Thanks @datenwolf. Could you elaborate a bit on what you mean by the linear parts of the camera parameters? Do you mean the extrinsic parameters 3x4 matrix **[R | t]**? For the intrinsic parameters, I don't think any change is necessary for the focal length. But perhaps a change to the principle point (c_x, c_y) coordinates maybe required if it was not in the centre of the image plane. My goal is obtain the new intrinsic and extrinsic parameters matrices. The corresponding OpenGL view-projection matrix is not what I'm looking for. – informer2000 Dec 22 '14 at 04:26
  • @informer2000: The linear part is everything related to the camera that does not introduce nonlinear transformations (i.e. lens distortions). Depending on your camera model both extrinsic and intrinsic parameters can be completely linear, usually extrinsic parameters always are. But if your camera model covers nonlinear lens distortion in the intrinsic model, then that part must be separated from the linear part (which is mostly just FOV). In case you're using a basic pinhole camera model, there are no nonlinear parts at all, and your camera matrix would be **P·[R|t]**. – datenwolf Dec 22 '14 at 09:01
  • @datenwold: Yes, I am using a pinhole camera model. Basically, the projection matrix **P** is the result of multiplying the intrinsic parameters matrix **K** by the extrinsic matrix **[R|t]**. So, if I understand correctly, what I need to transform is the extrinsic matrix. Can that be achieved by multiplying an augmented extrinsic matrix (by adding [0 0 0 1] as the last row to obtain a 4x4 matrix) by **I[-1 -1 1 1]^T**? – informer2000 Dec 22 '14 at 09:25
  • @informer2000: In my statement above, P is just the projection, which would be just the intrinsic parameters. P·[R|t] constitutes the viewprojection (or camera) matrix then, by expanding this to a 4×4 matrix you can turn this into a OpenGL-esque camera matrix. As a cross check, in a valid pinhole camera matrix, the WW element is 0, but the W row is nonzero in Z (so that the projected Z coordinate imposes perspective scaling). – datenwolf Dec 22 '14 at 09:31
  • I'm kind of confused here. I think we are using different terms. I do not want to use OpenGL functions for this (e.g., `glRotate()` or `glScale()`). I basically want to transform the pinhole camera model parameters directly. Can you describe this to me in terms of matrix operations? – informer2000 Dec 23 '14 at 01:47
  • @informer2000: I did. I never referred to (legacy, old and busted) OpenGL built in matrix functions. Unfortunately your question lacks a code snippet, so any practical code implementation wouldn't necessarily match your conventions. OpenCV is rather flexible in its capabilities. – datenwolf Dec 23 '14 at 08:44