Monado OpenXR Runtime
Public Member Functions
NormalizedCoordsCache Class Reference

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

#include <tracking/t_calibration_opencv.hpp>

Public Member Functions

 NormalizedCoordsCache (cv::Size size, const cv::Matx33d &intrinsics, const cv::Matx< double, 5, 1 > &distortion)
 Set up the precomputed cache for a given camera. More...
 
 NormalizedCoordsCache (cv::Size size, const cv::Matx33d &intrinsics, const cv::Matx< double, 5, 1 > &distortion, const cv::Matx33d &rectification, const cv::Matx33d &new_camera_matrix)
 Set up the precomputed cache for a given camera (overload for rectification and new camera matrix) More...
 
 NormalizedCoordsCache (cv::Size size, const cv::Matx33d &intrinsics, const cv::Matx< double, 5, 1 > &distortion, const cv::Matx33d &rectification, const cv::Matx< double, 3, 4 > &new_projection_matrix)
 Set up the precomputed cache for a given camera. More...
 
 NormalizedCoordsCache (cv::Size size, const cv::Mat &intrinsics, const cv::Mat &distortion)
 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 access to 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() [1/4]

NormalizedCoordsCache::NormalizedCoordsCache ( cv::Size  size,
const cv::Matx33d &  intrinsics,
const cv::Matx< double, 5, 1 > &  distortion 
)

Set up the precomputed cache for a given camera.

Parameters
sizeSize of the image in pixels
intrinsicsCamera intrinsics matrix
distortionDistortion coefficients

This overload applies no rectification (R) and uses a normalized/identity new camera matrix (P).

◆ NormalizedCoordsCache() [2/4]

NormalizedCoordsCache::NormalizedCoordsCache ( cv::Size  size,
const cv::Matx33d &  intrinsics,
const cv::Matx< double, 5, 1 > &  distortion,
const cv::Matx33d &  rectification,
const cv::Matx33d &  new_camera_matrix 
)

Set up the precomputed cache for a given camera (overload for rectification and new camera matrix)

Parameters
sizeSize of the image in pixels
intrinsicsCamera intrinsics matrix
distortionDistortion coefficients
rectificationRectification matrix - corresponds to parameter R to cv::undistortPoints().
new_camera_matrixA 3x3 new camera matrix - corresponds to parameter P to cv::undistortPoints().

◆ NormalizedCoordsCache() [3/4]

NormalizedCoordsCache::NormalizedCoordsCache ( cv::Size  size,
const cv::Matx33d &  intrinsics,
const cv::Matx< double, 5, 1 > &  distortion,
const cv::Matx33d &  rectification,
const cv::Matx< double, 3, 4 > &  new_projection_matrix 
)

Set up the precomputed cache for a given camera.

(overload for rectification and new projection matrix)

Parameters
sizeSize of the image in pixels
intrinsicsCamera intrinsics matrix
distortionDistortion coefficients
rectificationRectification matrix - corresponds to parameter R to cv::undistortPoints().
new_projection_matrixA 3x4 new projection matrix - corresponds to parameter P to cv::undistortPoints().

◆ NormalizedCoordsCache() [4/4]

NormalizedCoordsCache::NormalizedCoordsCache ( cv::Size  size,
const cv::Mat &  intrinsics,
const cv::Mat &  distortion 
)

Set up the precomputed cache for a given camera.

Less-strongly-typed overload.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This overload applies no rectification (R) and uses a normalized/identity new camera matrix (P).

Member Function Documentation

◆ getNormalizedImageCoords()

cv::Vec2f 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 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: