Skip to main content

ARDK for Android/com.nianticlabs.ardk.utils/ImageMath/reprojection

reprojection

[androidJvm]
fun reprojection(aspect: Float, fovRadians: Float, zNear: Float, zFar: Float, referenceView: FloatArray, targetView: FloatArray, backProjectionDistance: Float = 0.9f): Matrix

Returns a 3×3 homography matrix (android.graphics.Matrix) that reprojects image coordinates from a reference camera view into a target camera view.

This is typically used to transform 2D image-space coordinates (normalized in 0..1) from one camera perspective to another, e.g. for aligning visual overlays between AR frames.

Return​

A 3×3 homography matrix represented as an android.graphics.Matrix.

Parameters​

androidJvm

aspectThe image aspect ratio (width / height).
fovRadiansThe vertical field of view in radians.
zNearThe near clipping plane distance.
zFarThe far clipping plane distance.
referenceViewThe reference camera's 4×4 view matrix as a FloatArray (length 16), in OpenGL-style column-major order. This can typically be acquired from ARCore using camera.getViewMatrix(viewMatrix, 0).
targetViewThe target camera's 4×4 view matrix, same format and origin as referenceView.
backProjectionDistanceNon-linear depth at which to reproject (between zNear and zFar). A value of 0.0 corresponds to the near plane, 1.0 to the far plane. Recommended value: 0.9.