1 | initial version |
You can get an approximated camera matrix if you know the FOV angle of the camera and the image dimensions. Then you can calculate the focal length from the following formula:
image_size/2
f=---------------
tan(FOV/2)
where image_size is the horizontal, vertical or diagonal image_size in pixels that corresponds to the FOV (horizontal, vertical or diagonal). Note that if not stated otherwise, the FOV angle given in the camera specification most often refers to the diagonal FOV angle. Unfortunately, for cheap cameras (webcams) you might not be able to find any specifications or they will not include the FOV angle. In such a case you can determine the focal length of your camera by taking a picture of an object of known length from a known distance. Then, based on the pinhole camera model:
object_length_in_mm object_length_in_pixels
---------------------- = --------------------------
object_distance_in_mm focal_length
you can easily calculate f.
As for the principal point you simply assume the center of the image and no skew and no lens distortions.