Monado OpenXR Runtime
|
Provides cached, precomputed 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... | |
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.
xrt::auxiliary::tracking::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.
size | Size of the image in pixels |
intrinsics | Camera intrinsics matrix |
distortion | Distortion coefficients |
This overload applies no rectification (R
) and uses a normalized/identity new camera matrix (P
).
References xrt::auxiliary::tracking::generateInputCoordsAndReserveOutputCoords(), and xrt::auxiliary::tracking::populateCacheMats().
xrt::auxiliary::tracking::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)
size | Size of the image in pixels |
intrinsics | Camera intrinsics matrix |
distortion | Distortion coefficients |
rectification | Rectification matrix - corresponds to parameter R to cv::undistortPoints(). |
new_camera_matrix | A 3x3 new camera matrix - corresponds to parameter P to cv::undistortPoints(). |
References xrt::auxiliary::tracking::generateInputCoordsAndReserveOutputCoords(), and xrt::auxiliary::tracking::populateCacheMats().
xrt::auxiliary::tracking::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)
size | Size of the image in pixels |
intrinsics | Camera intrinsics matrix |
distortion | Distortion coefficients |
rectification | Rectification matrix - corresponds to parameter R to cv::undistortPoints(). |
new_projection_matrix | A 3x4 new projection matrix - corresponds to parameter P to cv::undistortPoints(). |
References xrt::auxiliary::tracking::generateInputCoordsAndReserveOutputCoords(), and xrt::auxiliary::tracking::populateCacheMats().
xrt::auxiliary::tracking::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
).
References xrt::auxiliary::tracking::generateInputCoordsAndReserveOutputCoords(), and xrt::auxiliary::tracking::populateCacheMats().
cv::Vec2f xrt::auxiliary::tracking::NormalizedCoordsCache::getNormalizedImageCoords | ( | cv::Point2f | origCoords | ) | const |
Get normalized, undistorted coordinates from a point in the original (distorted, etc.) image.
origCoords | Image coordinates in original image |
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.