API Reference#

This section contains a detailed description of the functions, modules, and objects included in pycvcam. The reference describes how the methods work and which parameters can be used. It assumes that you have an understanding of the key concepts. The API is organized into several sections, each corresponding to a specific aspect of the package.

Transformations Classes#

The package provides a set of transformations that can be applied to process the transformation from the world_points to the image_points.

Abstract base classes#

Each tranformation model is a subclass of the abstract base class pycvcam.Transform, which defines the common interface for all transformations used in pycvcam. The typical subclasses of pycvcam.Transform are:

  • Transform: The base class for transformations, which defines the interface for applying transformations to points.

  • Intrinsic: The base class for intrinsic transformations, which defines the interface for applying intrinsic transformations to points.

  • Distortion: The base class for distortion transformations, which defines the interface for applying distortion transformations to points.

  • Extrinsic: The base class for extrinsic transformations, which defines the interface for applying extrinsic transformations to points.

Each of these classes defines :

  • parameters (property) : The parameters of the transformation that are optimisable and the jacobians are computed with respect to these parameters.

  • constants (property) : The parameters of the transformation that are not optimisable and the jacobians are not computed with respect to these parameters.

  • transform (method) : The method to apply the transformation to points, which returns a data class containing the transformed points and the jacobians of the transformation with respect to the parameters and the input points.

  • inverse_transform (method) : The method to apply the inverse transformation to points, which returns a data class containing the transformed points and the jacobians of the inverse transformation with respect to the parameters and the input points.

Data classes for transformation results#

Each transformation method returns a data class containing the transformed points and optionally the jacobians of the transformation. The typical data classes for transformation results are:

  • TransformResult: The data class for storing the results of transformations, which defines the structure for storing the transformed points and respected jacobians.

  • Rays: The data class for storing rays, which defines the structure for storing the origin and direction of rays in 3D space.

Implemented transformations#

The package provides a set of implemented transformations that can be used to process the transformation from the world_points to the image_points. These transformations are organized into three main categories:

  • Extrinsic Transformations: The implemented extrinsic transformations that can be used to transform from the world coordinate system to the camera coordinate system.

  • Distortion Transformations: The implemented distortion transformations that can be used to transform from the normalized camera coordinates to the distorted image coordinates.

  • Intrinsic Transformations: The implemented intrinsic transformations that can be used to transform from the distorted image coordinates to the pixel coordinates.

Furthermore, the package provides a set of implemented transformation assemblies that can be used to compose multiple transformations together to create complex transformations by combining simpler ones.

  • Transformations Assembly: The implemented transformation assemblies that can be used to compose multiple transformations together to create complex transformations by combining simpler ones.

Implemented Extrinsic

This section provide the implemented Extrinsic transformation models in the package from the world_points to the normalized_points.

Implemented Distortion

This section provide the implemented Distortion transformation models in the package from the normalized_points to the distorted_points.

Implemented Intrinsic

This section provide the implemented Intrinsic transformation models in the package from the distorted_points to the image_points.

Implemented Transformations Assembly

This section provide the implemented transformation assemblies that can be used to compose multiple transformations together to create complex transformations by combining simpler ones.

Write and read transformations#

To save and load transformations, the package provides the following functions:

Process basic transformations with pycvcam#

The package pycvcam provides a set of transformation processes that can be used to apply the transformations to points or images. The implemented processes are the following:

  • Distort and Undistort Images: A process to distort and undistort an image using a distortion model and an intrinsic model.

  • Distort and Undistort Points: A process to distort and undistort points using a distortion model and an intrinsic model.

  • Project Points: A process to project points from the world coordinate system to the image coordinate system using an extrinsic model, a distortion model, and an intrinsic model.

  • Compute Rays: A process to compute rays from the camera center to the world points using an extrinsic model and a distortion model.

  • Compute Optical Flow: A process to compute the optical flow between two images using the DIS method of OpenCV.

See the section Usage for more details and examples on how to use these processes.

Optimisation processes#

The package provides a set of optimisation processes that can be used to estimate the parameters of the transformations.

  • Optimize Parameters: A process to optimize the parameters of the transformation using Gaussian-Newton gradient or Trust Region Reflective optimization.

  • Optimize Input Points: A process to optimize the input points of a transformation using Gaussian-Newton gradient descent optimization.

  • Optimize Rays Intersection: A process to optimize the intersection point of multiple rays using a least squares optimization.