Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Take a look at THIS page, the calibrateCamera function. The distortion coefficients are (using default settings) all radial. So it only depends on the distance from the principal point, which is defined in the camera matrix.

To rotate, switch the f_x and f_y values, then alter the c_x and c_y values appropriately. The c_x and c_y store the location of the principal point, in pixels. So if the image is mirrored, then c_x = image.cols-c_x, flipping is rows and c_y.

That means if you rotate clockwise 90 degrees, then c_x = (old image rows)-c_y_old and c_y = c_x_old

Now, remember that you only do this if the actual pixels change. If the camera is held upside down, so the ground appears at the top of the image buffer, then you don't need to change anything. Only if you rotate the image manually or your camera automatically does it do you need to change anything.