utils

Utility functions

Intrinsic matrix parsing

From a calibrated camera’s intrinsic matrix, calculate the following properties:

  • Focal length (in units length)
  • Principal point (in units length)

source

get_focal_length

 get_focal_length (intrinsic, delx:float, dely:float)
Type Details
intrinsic Intrinsic matrix (3 x 3 tensor)
delx float X-direction spacing (in units length)
dely float Y-direction spacing (in units length)
Returns float Focal length (in units length)

source

get_principal_point

 get_principal_point (intrinsic, height:int, width:int, delx:float,
                      dely:float)
Type Details
intrinsic Intrinsic matrix (3 x 3 tensor)
height int Y-direction length (in units pixels)
width int X-direction length (in units pixels)
delx float X-direction spacing (in units length)
dely float Y-direction spacing (in units length)

source

parse_intrinsic_matrix

 parse_intrinsic_matrix (intrinsic, height:int, width:int, delx:float,
                         dely:float)
Type Details
intrinsic Intrinsic matrix (3 x 3 tensor)
height int Y-direction length (in units pixels)
width int X-direction length (in units pixels)
delx float X-direction spacing (in units length)
dely float Y-direction spacing (in units length)

source

make_intrinsic_matrix

 make_intrinsic_matrix (sdd:float, delx:float, dely:float, height:int,
                        width:int, x0:float=0.0, y0:float=0.0)
Type Default Details
sdd float Source-to-detector distance (in units length)
delx float X-direction spacing (in units length / pixel)
dely float Y-direction spacing (in units length / pixel)
height int Y-direction length (in units pixels)
width int X-direction length (in units pixels)
x0 float 0.0 Principal point x-coordinate (in units length)
y0 float 0.0 Principal point y-coordinate (in units length)

source

resample

 resample (img, focal_len, delx, x0=0, y0=0, new_focal_len=None,
           new_delx=None, new_x0=None, new_y0=None)

Resample an image with new intrinsic parameters.