Camera Intrinsics
A small package that supports applying image transformations, e.g. cropping or resizing, to the camera intrinsics.
This package is under development and not well tested nor stable.
Installation
pip install camera-intrinsics
Intrinsics
Camera intrinsics are python dicts with the keys height, width, fx, fy, cx, cy, options
.
Example
import camera_intrinsics as cam
intr = cam.intrinsics(width=128, height=96, fx=128.0, fy=128.0, cx=63.5, cy=47.5)
print(intr)
>>> {'height': 96, 'width': 128, 'fx': 128.0, 'fy': 128.0, 'cx': 63.5, 'cy': 47.5, 'options': ''}
Options
The options string is the join
of the single options with a semincolon ,
. The available options are listed below.
Pixel Coordinate Convention
There are mainly two conventions for the pixel coordinates. The preferred one within this package uses (0,0)
as the coordinate for the top-left pixel and its options string is ""
. The other convention uses (.5, .5)
as the coordinate for the top-left pixel and its options string is "half_pixel_centers"
. Be careful to select the right convention when creating the intrinsics. Here is a list of toolboxes and their conventions
- No
half_pixel_centers
:
DSO (link),
MATLAb Calibration Toolbox (link),
Berkeley Automation (link) half_pixel_centers
:
COLMAP (link),
FastMVSNet (link)
Methods
Currently the following methods are supported:
intrinsics
: Make intrinsicscrop
: Crop intrinsicsresize
: Resize intrinsics