1#ifndef CannyEVT_UTILITY_H
2#define CannyEVT_UTILITY_H
4#include <eigen3/Eigen/Dense>
6#include <opencv2/opencv.hpp>
9#include "TimeSurface.h"
11#include "EventCamera.h"
22 void DrawTs(TimeSurface::Ptr TsPtr, pCloud cloud, Eigen::Matrix4d Twc, EventCamera::Ptr eventCam,
25 Eigen::Matrix3d cayley2rot(
const Eigen::Vector3d &cayley);
27 Eigen::Vector3d rot2cayley(
const Eigen::Matrix3d &R);
29 template <
typename Derived>
30 static Eigen::Quaternion<typename Derived::Scalar> positify(
const Eigen::QuaternionBase<Derived> &q)
39 template <
typename Derived>
40 static Eigen::Matrix<typename Derived::Scalar, 3, 3> skewSymmetric(
const Eigen::MatrixBase<Derived> &q)
42 Eigen::Matrix<typename Derived::Scalar, 3, 3> ans;
43 ans <<
typename Derived::Scalar(0), -q(2), q(1),
44 q(2),
typename Derived::Scalar(0), -q(0),
45 -q(1), q(0),
typename Derived::Scalar(0);
49 template <
typename Derived>
50 static Eigen::Quaternion<typename Derived::Scalar> deltaQ(
const Eigen::MatrixBase<Derived> &theta)
52 typedef typename Derived::Scalar Scalar_t;
54 Eigen::Quaternion<Scalar_t> dq;
55 Eigen::Matrix<Scalar_t, 3, 1> half_theta = theta;
56 half_theta /=
static_cast<Scalar_t
>(2.0);
57 dq.w() =
static_cast<Scalar_t
>(1.0);
58 dq.x() = half_theta.x();
59 dq.y() = half_theta.y();
60 dq.z() = half_theta.z();
64 template <
typename Derived>
65 static Eigen::Matrix<typename Derived::Scalar, 4, 4> Qleft(
const Eigen::QuaternionBase<Derived> &q)
67 Eigen::Quaternion<typename Derived::Scalar> qq = positify(q);
68 Eigen::Matrix<typename Derived::Scalar, 4, 4> ans;
69 ans(0, 0) = qq.w(), ans.template block<1, 3>(0, 1) = -qq.vec().transpose();
70 ans.template block<3, 1>(1, 0) = qq.vec(), ans.template block<3, 3>(1, 1) = qq.w() * Eigen::Matrix<typename Derived::Scalar, 3, 3>::Identity() + skewSymmetric(qq.vec());
74 template <
typename Derived>
75 static Eigen::Matrix<typename Derived::Scalar, 4, 4> Qright(
const Eigen::QuaternionBase<Derived> &p)
77 Eigen::Quaternion<typename Derived::Scalar> pp = positify(p);
78 Eigen::Matrix<typename Derived::Scalar, 4, 4> ans;
79 ans(0, 0) = pp.w(), ans.template block<1, 3>(0, 1) = -pp.vec().transpose();
80 ans.template block<3, 1>(1, 0) = pp.vec(), ans.template block<3, 3>(1, 1) = pp.w() * Eigen::Matrix<typename Derived::Scalar, 3, 3>::Identity() - skewSymmetric(pp.vec());
87 void DrawPoint(
double val,
double maxRange,
double minRange,
const Eigen::Vector2d &location, cv::Mat &img);
95static const float r[] = {0,
351static const float g[] = {0,
383 0.001960784313725483,
574 0.001960784313725483,
607const float b[] = {0.5,