CameraModel¶
giant.camera_models.camera_model
:
- class giant.camera_models.camera_model.CameraModel(field_of_view=0.0, n_rows=1, n_cols=1, use_a_priori=False)[source]¶
This is the abstract base class for all camera models in GIANT.
A camera model is a mapping from a 3D point expressed in the camera frame to a corresponding 2D point in the image. For more description of a camera model refer to the
camera_models
documentation.This class serves as a prototype for implementing a
CameraModel
in GIANT. It defines a number of abstract methods that need to be implemented for every camera model (project_onto_image()
,compute_jacobian()
,compute_pixel_jacobian()
,compute_unit_vector_jacobian()
,apply_update()
,pixels_to_unit()
,undistort_pixels()
, anddistort_pixels()
) as well as a few concrete methods that are generally valid for all camera models (overwrite()
,distortion_map()
,undistort_image()
,copy()
,to_elem()
,from_elem()
). This class also provides a few attributes (field_of_view
,n_rows
,n_cols
, anduse_a_priori
) which are required for all models.Finally, this class provides the beginning of an attribute
important_attributes
which should be updated by each sub-class to ensure some core functionality is not broken (__eq__()
,from_elem()
, andto_elem()
). Essentially, this should be a list of attributes that should (a) be checked when checking for equality between two models and (b) be added to/retrieved from elements when writing/reading a model to a file. The values in this list should be valid attributes that return values usinggetattr(self, attr)
.Note
Because this is an ABC, you cannot create an instance of CameraModel (it will raise a
TypeError
)- Parameters:
field_of_view (Real | None) – The field of view of the camera in units of degrees.
n_rows (int) – The number of rows in the active pixel array for the camera
n_cols (int) – The number of columns in the active pixel array for the camera
use_a_priori (bool) – A flag to specify whether to append the identity matrix to the Jacobian matrix returned by
compute_jacobian()
in order to include the current estimate of the camera model in the calibration process.
- n_rows¶
The number of rows in the active pixel array for the camera
- n_cols¶
The number of columns in the active pixel array for the camera
- use_a_priori¶
This boolean value is used to determine whether to append the identity matrix to the Jacobian matrix returned by
compute_jacobian()
in order to include the current estimate of the camera model in the calibration process.
- important_attributes¶
A list specifying the important attributes the must be saved/loaded for this camera model to be completely reconstructed.
- property field_of_view: float¶
A radial field of view of the camera specified in degrees.
The field of view should be set to at least the half width diagonal field of view of the camera. The field of view is used when querying star catalogues.
The diagonal field of view is defined as
+-----------+ | /| | / | | / | | V/ | | O/ | | F/ | | */ | | 2/ | | / | | / | |/ | +-----------+
If you specify this parameter to be
None
, the field of view will be computed using the camera model if possible.
- abstract property estimation_parameters: List[str]¶
A list of strings containing the parameters to estimate when performing calibration with this model.
This list is used in the methods
compute_jacobian()
andapply_update()
to determine which parameters are being estimated/updated. From thecompute_jacobian()
method, only columns of the Jacobian matrix corresponding to the parameters in this list are returned. In theapply_update()
method, the update vector elements are assumed to correspond to the order expressed in this list.Valid values for the elements of this list are dependent on each concrete camera model. Generally, they correspond to attributes of the class, with a few convenient aliases that point to a collection of attributes.
- abstract property state_vector: List[Real]¶
Returns the fully realized state vector according to
estimation_parameters
as a length l list.
Summary of Methods
This method transforms 3D points (or directions) expressed in the camera frame into the corresponding 2D image locations. |
|
This method transforms 3D directions expressed in the camera frame into the corresponding 2D image directions. |
|
This method computes the Jacobian matrix \(\partial\mathbf{x}_P/\partial\mathbf{c}\) where \(\mathbf{c}\) is a vector of camera model parameters. |
|
This method computes the Jacobian matrix \(\partial\mathbf{x}_P/\partial\mathbf{x}_C\) where \(\mathbf{x}_C\) is a vector in the camera frame that projects to \(\mathbf{x}_P\) which is the pixel location. |
|
This method computes the Jacobian matrix \(\partial\mathbf{x}_C/\partial\mathbf{x}_P\) where \(\mathbf{x}_C\) is a vector in the camera frame that projects to \(\mathbf{x}_P\) which is the pixel location. |
|
This method takes in a delta update to camera parameters (\(\Delta\mathbf{c}\)) and applies the update to the current instance in place. |
|
This method converts pixel image locations to unit vectors expressed in the camera frame. |
|
This method computes undistorted pixel locations (gnomic/pinhole locations) for given distorted pixel locations according to the current model. |
|
A method that takes gnomic pixel locations in units of pixels and applies the appropriate distortion to them. |
|
This method replaces self with the properties of |
|
This method computes the value of the distortion model across an entire image for use in creating distortion maps. |
|
This method takes in an entire image and warps it to remove the distortion specified by the current model. |
|
Convert a list of estimation parameters into state label names. |
|
Returns a deep copy of this object, breaking all references with |
|
Stores this camera model in an |
|
This class method is used to construct a new instance of cls from an |