BrownModel.get_projections

giant.camera_models.brown_model:

BrownModel.get_projections(points_in_camera_frame, image=0, temperature=0)[source]

This method computes and returns the pinhole, and pixel locations for a set of 3D points expressed in the camera frame.

In general the user will not use this method and the higher level project_onto_image() will be used instead. In cases where it is desirable to use this method, the camera points should be input as a shape (2,) or shape (2, n) array of points expressed in the camera frame (units don’t matter) This method will then return the gnomic locations in units of distance as a shape (2,) or (2, n) numpy array and the pixel locations of the points as a shape (2,) or (2, n) numpy array with units of pixels as a length 2 tuple.

The optional image flag specifies which image you are projecting the points onto. This is only important if you have the estimate_multiple_misalignments flag set to true, and have a different alignment set for each image. In general, the optional input image should be ignored except during calibration.

The optional temperature input specifies the temperature to perform the projection at. This is only import when your focal length is dependent on temperature and you have entered or calibrated for the temperature dependency coefficients.

You can specify the directions to be input as either a shape (3,) or shape (3, n) array:

>>> from giant.camera_models import BrownModel
>>> model = BrownModel(fx=3000, fy=4000, px=500, py=500, a1=1e-5, a2=1e-6,
>>>                      misalignment=[[1e-12, -2e-14, 3e-10], [2e-15, 1e-13, 3e-10]],
>>>                      estimation_parameters=['multiple misalignments'])
>>> model.get_projections([1, 2, 12000])
(array([ 0.00083333,  0.00166667]), array([ 500.25      ,  500.66666667]))
>>> model.get_projections([[1, 2, 3, 4], [2, 5, 6, 7], [12000, 13000, 9000, 5000]], image=1)
(array([[ 0.00083333,  0.00153846,  0.00333333,  0.008     ],
        [ 0.00166667,  0.00384615,  0.00666667,  0.014     ]]),
 array([[ 500.25      ,  500.46153846,  501.        ,  502.4       ],
        [ 500.66666667,  501.53846154,  502.66666667,  505.6       ]]))
>>> model.get_projections([[1, 2, 3, 4], [2, 5, 6, 7], [12000, 13000, 9000, 5000]], temperature=-1)
(array([[-0.00166667, -0.00307694, -0.0066667 , -0.01600007],
        [-0.00333335, -0.00769234, -0.01333339, -0.02800013]]),
 array([[ 499.49999775,  499.07691892,  497.999991  ,  495.1999784 ],
        [ 498.66666066,  496.92306307,  494.66664266,  488.79994959]]))
Parameters:
  • points_in_camera_frame (Sequence | ndarray) – a shape (3,) or shape (3, n) array of points to project

  • image (int) – The index of the image being projected onto (only applicable with multiple misalignments)

  • temperature (Real) – The temperature to project the points at

Returns:

A tuple of the pinhole, distorted pinhole, and pixel locations for a set of 3D points expressed in the camera frame

Return type:

Tuple[ndarray, ndarray, ndarray]