Monado OpenXR Runtime
xrt::auxiliary::tracking::NormalizedCoordsCache Class Reference

Provides cached, precomputed normalized image coordinates from original, distorted ones. More...

#include <tracking/t_calibration_opencv.hpp>

Public Member Functions

 NormalizedCoordsCache (cv::Size size, t_camera_distortion_model distortion_model, cv::InputArray intrinsics, cv::InputArray distortion, cv::InputArray rectification=cv::noArray(), cv::InputArray new_camera_or_projection_matrix=cv::noArray())
 Set up the precomputed cache for a given camera. More...
 
cv::Vec2f getNormalizedImageCoords (cv::Point2f origCoords) const
 Get normalized, undistorted coordinates from a point in the original (distorted, etc.) image. More...
 
cv::Vec3f getNormalizedVector (cv::Point2f origCoords) const
 Get normalized vector in the camera-space direction corresponding to the original (distorted, etc.) image coordinates. More...
 

Detailed Description

Provides cached, precomputed normalized image coordinates from original, distorted ones.

Populates internal structures using cv::undistortPoints() and performs subpixel sampling to interpolate for each query. Essentially, this class lets you perform cv::undistortPoints() while caching the initial setup work required for that function.

Constructor & Destructor Documentation

◆ NormalizedCoordsCache()

xrt::auxiliary::tracking::NormalizedCoordsCache::NormalizedCoordsCache ( cv::Size  size,
t_camera_distortion_model  distortion_model,
cv::InputArray  intrinsics,
cv::InputArray  distortion,
cv::InputArray  rectification = cv::noArray(),
cv::InputArray  new_camera_or_projection_matrix = cv::noArray() 
)

Set up the precomputed cache for a given camera.

Parameters
sizeSize of the image in pixels
distortion_modelModel used with distortion
intrinsicsCamera intrinsics matrix
distortionDistortion coefficients
rectificationRectification matrix - corresponds to parameter R to cv::undistortPoints().
new_camera_or_projection_matrixA new 3x3 camera matrix or 3x4 projection matrix - corresponds to parameter P to cv::undistortPoints().

References xrt::auxiliary::tracking::generateInputCoordsAndReserveOutputCoords(), and xrt::auxiliary::tracking::populateCacheMats().

Member Function Documentation

◆ getNormalizedImageCoords()

cv::Vec2f xrt::auxiliary::tracking::NormalizedCoordsCache::getNormalizedImageCoords ( cv::Point2f  origCoords) const

Get normalized, undistorted coordinates from a point in the original (distorted, etc.) image.

Parameters
origCoordsImage coordinates in original image
Returns
Corresponding undistorted coordinates in a "normalized" image

◆ getNormalizedVector()

cv::Vec3f xrt::auxiliary::tracking::NormalizedCoordsCache::getNormalizedVector ( cv::Point2f  origCoords) const

Get normalized vector in the camera-space direction corresponding to the original (distorted, etc.) image coordinates.

Note that the Z component will be negative by convention.


The documentation for this class was generated from the following files: