14 return H[0]*(H[5]*H[10]-H[9]*H[6]) - H[4]*(H[1]*H[10]-H[2]*H[9]) + H[8]*(H[1]*H[6]-H[5]*H[2]);
17 int main(
int argc,
char * argv[])
try 20 window app(1280, 720,
"RealSense Tracking and Depth Example");
32 std::vector<rs2_vector> trajectory;
35 std::map<std::string, rs2::colorizer> colorizers;
39 std::vector<std::string> serials;
45 for (
auto&& serial : serials)
51 pipelines.emplace_back(pipe);
58 float H_t265_d400[16] = {1, 0, 0, 0,
63 std::ifstream ifs(fn);
65 std::cerr <<
"Couldn't open " << fn << std::endl;
69 for (
int i = 0;
i < 3;
i++) {
70 for (
int j = 0;
j < 4;
j++) {
71 ifs >> H_t265_d400[
i+4*
j];
75 float det =
detR(H_t265_d400);
76 if (fabs(1-det) > 1
e-6) {
77 std::cerr <<
"Invalid homogeneous transformation matrix input (det != 1)" << std::endl;
83 for (
auto &&
pipe : pipelines)
116 auto pose_data =
pose.get_pose_data();
117 std::cout <<
"\r" <<
"Device Position: " << std::setprecision(3) << std::fixed << pose_data.translation.x <<
" " << pose_data.translation.y <<
" " << pose_data.translation.z <<
" (meters)";
120 if (trajectory.size() == 0)
121 trajectory.push_back(pose_data.translation);
125 if (sqrt(pow((curr.
x - prev.
x), 2) + pow((curr.
y - prev.
y), 2) + pow((curr.
z - prev.
z), 2)) > 0.002)
126 trajectory.push_back(pose_data.translation);
132 if (points && pose_frame) {
145 catch (
const std::exception & e)
device_list query_devices() const
GLint GLint GLsizei GLsizei GLsizei depth
void map_to(frame mapped)
GLsizei const GLchar *const * string
void enable_device(const std::string &serial)
int main(int argc, char *argv[])
rs2_pose get_pose_data() const
::realsense_legacy_msgs::pose_< std::allocator< void > > pose
const std::string & get_failed_args() const
void register_glfw_callbacks(window &app, glfw_state &app_state)
void upload(const rs2::video_frame &frame)
points calculate(frame depth) const
3D vector in Euclidean coordinate space
const std::string & get_failed_function() const
void draw_pointcloud_wrt_world(float width, float height, glfw_state &app_state, rs2::points &points, rs2_pose &pose, float H_t265_d400[16], std::vector< rs2_vector > &trajectory)
GLdouble GLdouble GLint GLint const GLdouble * points