OpenGlToCameraHelper

Helper class to convert matrices used by OpenGL to draw a scene into its corresponding pinhole camera.

Typically, when using OpenGL, a projective matrix defines the projective geometry (i.e. frustum) of the scene, using parameters such as field of view, near and far planes.

OpenGL typically also uses a model-view matrix, which defines the amount of translation and rotation between the camera and vertices to be drawn in the scene.

Using both a projective matrix and a model-view matrix, the corresponding pinhole camera can be estimated.

If a pinhole camera to convert to Android view coordinates (where y coordinates increase downwards), please use one of the methods provided in OrientationHelper.

Properties

Link copied to clipboard
const val MATRIX_LENGTH: Int = 16

Length of arrays used to store values of 4x4 homogeneous matrices.

Functions

Link copied to clipboard
fun computePinholeCamera(projectionMatrix: FloatArray, modelViewMatrix: FloatArray, width: Int, height: Int, result: PinholeCamera)

Computes pinhole camera from provided projection and model-view matrices.

Link copied to clipboard
fun computePinholeCameraAndReturnNew(projectionMatrix: FloatArray, modelViewMatrix: FloatArray, width: Int, height: Int): PinholeCamera

Computes pinhole camera from provided projection and model-view matrices.

Link copied to clipboard
fun computePinholeCameraIntrinsics(projectionMatrix: FloatArray, width: Int, height: Int, result: PinholeCameraIntrinsicParameters)

Computes pinhole camera intrinsic parameters from provided projection matrix and viewport size.

fun computePinholeCameraIntrinsicsAndReturnNew(projectionMatrix: FloatArray, width: Int, height: Int): PinholeCameraIntrinsicParameters

Computes pinhole camera intrinsic parameters from provided projection matrix and viewport size.

Link copied to clipboard
fun computePoseTransformation(modelViewMatrix: FloatArray, result: ProjectiveTransformation3D)

Computes transformation defining pose of a pinhole camera. Camera pose contains both camera rotation and center.

Link copied to clipboard
fun computePoseTransformationAndReturnNew(modelViewMatrix: FloatArray): ProjectiveTransformation3D

Computes transformation defining pose of a pinhole camera. Camera pose contains both camera rotation and center.