15#error "This header is C++-only."
20#include <opencv2/opencv.hpp>
23namespace xrt::auxiliary::tracking {
47 const cv::Size image_size_pixels_cv;
48 cv::Mat_<double> intrinsics_mat;
49 cv::Mat_<double> distortion_mat;
57 distortion_mat(t_num_opencv_params_from_distortion_model(base.
distortion_model),
59 &calib.distortion_parameters_as_array[0]),
63 U_LOG_W(
"Reinterpreting T_DISTORTION_WMR model as T_DISTORTION_OPENCV_RADTAN_8!");
72 return intrinsics_mat.size() == cv::Size(3, 3) &&
73 (
double *)intrinsics_mat.data == &(base.
intrinsics[0][0]) &&
75 distortion_mat.size() ==
76 cv::Size(1, t_num_opencv_params_from_distortion_model(base.
distortion_model)) &&
77 (
double *)distortion_mat.data == &(base.distortion_parameters_as_array[0]);
92 cv::Mat_<double> camera_translation_mat;
93 cv::Mat_<double> camera_rotation_mat;
94 cv::Mat_<double> camera_essential_mat;
95 cv::Mat_<double> camera_fundamental_mat;
102 t_stereo_camera_calibration_alloc(&data_ptr, distortion_model);
115 t_stereo_camera_calibration_reference(&temp, stereo);
117 assert(isDataStorageValid());
128 t_stereo_camera_calibration_reference(&
tmp, NULL);
133 t_stereo_camera_calibration_reference(&base, NULL);
137 isDataStorageValid()
const noexcept
139 return camera_translation_mat.size() == cv::Size(1, 3) &&
142 camera_rotation_mat.size() == cv::Size(3, 3) &&
145 camera_essential_mat.size() == cv::Size(3, 3) &&
148 camera_fundamental_mat.size() == cv::Size(3, 3) &&
179 cv::InputArray rectify_transform_optional = cv::noArray(),
180 cv::Mat new_camera_matrix_optional = cv::Mat());
191 cv::Mat rotation_mat = {};
192 cv::Mat projection_mat = {};
236 NormalizedCoordsCache(cv::Size size,
const cv::Matx33d &intrinsics,
const cv::Matx<double, 5, 1> &distortion);
250 const cv::Matx33d &intrinsics,
251 const cv::Matx<double, 5, 1> &distortion,
252 const cv::Matx33d &rectification,
253 const cv::Matx33d &new_camera_matrix);
268 const cv::Matx33d &intrinsics,
269 const cv::Matx<double, 5, 1> &distortion,
270 const cv::Matx33d &rectification,
271 const cv::Matx<double, 3, 4> &new_projection_matrix);
306 cv::Mat_<float> cacheX_;
307 cv::Mat_<float> cacheY_;
Provides cached, precomputed normalized image coordinates from original, distorted ones.
Definition: t_calibration_opencv.hpp:224
cv::Vec3f getNormalizedVector(cv::Point2f origCoords) const
Get normalized vector in the camera-space direction corresponding to the original (distorted,...
Definition: t_calibration.cpp:1490
NormalizedCoordsCache(cv::Size size, const cv::Matx33d &intrinsics, const cv::Matx< double, 5, 1 > &distortion)
Set up the precomputed cache for a given camera.
Definition: t_calibration.cpp:1414
cv::Vec2f getNormalizedImageCoords(cv::Point2f origCoords) const
Get normalized, undistorted coordinates from a point in the original (distorted, etc....
Definition: t_calibration.cpp:1469
#define U_LOG_W(...)
Log a message at U_LOGGING_WARN level, conditional on the global log level.
Definition: u_logging.h:298
static size_t t_num_params_from_distortion_model(const enum t_camera_distortion_model model)
Returns the number of parameters needed for this t_camera_distortion_model to be held by an OpenCV Ma...
Definition: t_tracking.h:161
t_camera_distortion_model
The distortion model this camera calibration falls under.
Definition: t_tracking.h:63
@ T_DISTORTION_OPENCV_RADTAN_8
OpenCV's radial-tangential distortion model.
Definition: t_tracking.h:82
@ T_DISTORTION_FISHEYE_KB4
Juho Kannalla and Sami Sebastian Brandt's fisheye distortion model.
Definition: t_tracking.h:116
@ T_DISTORTION_WMR
Windows Mixed Reality headsets' camera model.
Definition: t_tracking.h:131
Essential calibration data for a single camera, or single lens/sensor of a stereo camera.
Definition: t_tracking.h:223
double intrinsics[3][3]
Camera intrinsics matrix.
Definition: t_tracking.h:228
struct xrt_size image_size_pixels
Source image size.
Definition: t_tracking.h:225
enum t_camera_distortion_model distortion_model
Distortion model that this camera uses.
Definition: t_tracking.h:241
Stereo camera calibration data to be given to trackers.
Definition: t_tracking.h:248
double camera_essential[3][3]
Essential matrix.
Definition: t_tracking.h:261
double camera_translation[3]
Translation from first to second in the stereo pair.
Definition: t_tracking.h:256
struct t_camera_calibration view[2]
Calibration of individual views/sensor.
Definition: t_tracking.h:253
double camera_rotation[3][3]
Rotation matrix from first to second in the stereo pair.
Definition: t_tracking.h:258
double camera_fundamental[3][3]
Fundamental matrix.
Definition: t_tracking.h:263
Definition: comp_scratch.c:122
Essential calibration data wrapped for C++.
Definition: t_calibration_opencv.hpp:44
bool isDataStorageValid() const noexcept
Try to verify nothing was reallocated.
Definition: t_calibration_opencv.hpp:70
An x,y pair of matrices for the remap() function.
Definition: t_calibration_opencv.hpp:162
Essential stereo calibration data wrapped for C++.
Definition: t_calibration_opencv.hpp:89
Rectification maps as well as transforms for a stereo camera.
Definition: t_calibration_opencv.hpp:201
StereoRectificationMaps(t_stereo_camera_calibration *data)
Constructor - produces rectification data for a stereo camera based on calibration data.
Definition: t_file.cpp:112
cv::Mat disparity_to_depth_mat
Disparity and position to camera world coordinates.
Definition: t_calibration_opencv.hpp:205
Rectification, rotation, projection data for a single view in a stereo pair.
Definition: t_calibration_opencv.hpp:189
Image size.
Definition: xrt_defines.h:409
RemapPair calibration_get_undistort_map(t_camera_calibration &calib, cv::InputArray rectify_transform_optional=cv::noArray(), cv::Mat new_camera_matrix_optional=cv::Mat())
Prepare undistortion/normalization remap structures for a rectilinear or fisheye image.
Definition: t_file.cpp:71