Camera calibration: scale focal length as resolution change

According to OpenCV documentation:

“If, for example, a camera has been calibrated on images of 320 x 240 resolution, absolutely the same distortion coefficients can be used for 640 x 480 images from the same camera while , , , and need to be scaled appropriately.”

I am using a RealSense depth camera and I list its focal lengths for different resolutions. However, I found the focal length does not scale accordingly. The focal length fx (along x direction) is 608 for width 640 and the fx is 913 for width 1280. The fx does not double as the resolution changes from 640 to 1280

Thank you!


if you know exactly how the pictures are formed, yes you can recalculate the camera matrix easily.

what are the vertical resolutions of those modes? I’m guessing those modes aren’t equivalent because they have different aspect ratios.

the original full resolution picture from a camera sensor is cropped and binned. only sometimes is the entire sensor area used and resampled. resampling is undesirable because it’s costly and it is more likely to introduce moire patterns. simple cropping and binning is cheap and predictable, often done by the sensor itself.

can you find a datasheet for your camera that details the cropping and binning for each mode?

What crackwitz said - except I don’t see any Y resolutions, so it’s not clear to me that your aspect ratio changed.

Also I notice that your fx scale is very close to 1.5 (913/608), but your X scale is 2.0 (1280/640). It seems like your camera isn’t doing a straightforward scaling (2x2 binning), but something else - like a crop and 3:2 scale or something? Can you take a picture of a a ruler or a piece of graph paper (or similar gauge) in both resolutions and confirm that the image is getting cropped?

It might be easiest for you to calibrate your camera twice, once for each mode you want to use.