Monado OpenXR Runtime
hg_image_distorter.cpp File Reference

Utility to do batch stereographic projections of images. More...

#include <cmath>
#include <opencv2/core.hpp>
#include <stdio.h>
#include <string>
#include "math/m_vec3.h"
#include "math/m_vec2.h"
#include "util/u_time.h"
#include "xrt/xrt_defines.h"
#include "math/m_space.h"
#include <filesystem>
#include <fstream>
#include "os/os_time.h"
#include "util/u_logging.h"
#include "tracking/t_tracking.h"
#include "tracking/t_calibration_opencv.hpp"
#include <iostream>
#include <opencv2/opencv.hpp>
#include "math/m_eigen_interop.hpp"
#include "hg_sync.hpp"
#include "hg_stereographic_unprojection.hpp"
Include dependency graph for hg_image_distorter.cpp:

Data Structures

struct  xrt::tracking::hand::mercury::ArrayStack
 
struct  xrt::tracking::hand::mercury::projection_state
 

Macros

#define ARRAY_STACK_SIZE   20
 

Typedefs

template<typename T >
using xrt::tracking::hand::mercury::OutputSizedArray = Eigen::Array< T, wsize, wsize, Eigen::RowMajor >
 
using xrt::tracking::hand::mercury::OutputSizedFloatArray = OutputSizedArray< float >
 

Functions

static void xrt::tracking::hand::mercury::project_kb4 (projection_state &mi, const OutputSizedFloatArray &x, const OutputSizedFloatArray &y, const OutputSizedFloatArray &z, OutputSizedFloatArray &out_x, OutputSizedFloatArray &out_y)
 
template<typename T >
xrt::tracking::hand::mercury::map_ranges (T value, T from_low, T from_high, T to_low, T to_high)
 
void xrt::tracking::hand::mercury::naive_remap (OutputSizedArray< int16_t > &image_x, OutputSizedArray< int16_t > &image_y, cv::Mat &input, Eigen::Map< OutputSizedArray< uint8_t >> &output)
 
void xrt::tracking::hand::mercury::StereographicDistort (projection_state &mi)
 
bool xrt::tracking::hand::mercury::slow (projection_state &mi, float x, float y, cv::Point2i &out)
 
void xrt::tracking::hand::mercury::draw_and_clear (cv::Mat img, std::vector< cv::Point > &line_vec, bool good, cv::Scalar color)
 
void xrt::tracking::hand::mercury::add_or_draw_line (projection_state &mi, int x, int y, std::vector< cv::Point > &line_vec, cv::Scalar color, bool &good_most_recent, bool &started, cv::Mat &img)
 
void xrt::tracking::hand::mercury::draw_boundary (projection_state &mi, cv::Scalar color, cv::Mat img)
 
void xrt::tracking::hand::mercury::project_21_points_unscaled (Eigen::Array< float, 3, 21 > &joints_local, Eigen::Quaternionf rot_quat, hand21_2d &out_joints)
 
template<typename V2 >
void xrt::tracking::hand::mercury::project_point_scaled (projection_state &mi, Eigen::Vector3f direction, V2 &out_img_pt)
 
void xrt::tracking::hand::mercury::project_21_points_scaled (projection_state &mi, Eigen::Array< float, 3, 21 > &joints_local, hand21_2d &out_joints_in_img)
 
Eigen::Quaternionf xrt::tracking::hand::mercury::direction (Eigen::Vector3f dir, float twist)
 
void xrt::tracking::hand::mercury::add_rel_depth (const Eigen::Array< float, 3, 21 > &joints, hand21_2d &out_joints_in_img)
 
static float xrt::tracking::hand::mercury::palm_length (hand21_2d &joints)
 
void xrt::tracking::hand::mercury::make_projection_instructions (t_camera_model_params &dist, bool flip_after, float expand_val, float twist, Eigen::Array< float, 3, 21 > &joints, projection_instructions &out_instructions, hand21_2d &out_hand)
 
void xrt::tracking::hand::mercury::make_projection_instructions_angular (xrt_vec3 direction_3d, bool flip_after, float angular_radius, float expand_val, float twist, projection_instructions &out_instructions)
 
void xrt::tracking::hand::mercury::stereographic_project_image (const t_camera_model_params &dist, const projection_instructions &instructions, cv::Mat &input_image, cv::Mat *debug_image, const cv::Scalar boundary_color, cv::Mat &out)
 

Variables

constexpr int xrt::tracking::hand::mercury::wsize = 128
 

Detailed Description

Utility to do batch stereographic projections of images.

Author
Moses Turner moses.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m

Function Documentation

◆ make_projection_instructions()

void xrt::tracking::hand::mercury::make_projection_instructions ( t_camera_model_params dist,
bool  flip_after,
float  expand_val,
float  twist,
Eigen::Array< float, 3, 21 > &  joints,
projection_instructions out_instructions,
hand21_2d &  out_hand 
)
Todo:
optimize
Todo:
this is probably wrong, should probably be negated

References xrt::tracking::hand::mercury::make_projection_instructions().

Referenced by xrt::tracking::hand::mercury::make_projection_instructions().

◆ StereographicDistort()

void xrt::tracking::hand::mercury::StereographicDistort ( projection_state mi)