From 72de43877c1172f7bbabfb51ff16bd4d1f437359 Mon Sep 17 00:00:00 2001 From: Messier Date: Thu, 5 Sep 2019 15:09:22 +0800 Subject: [PATCH] refactor(*): change namespace Ctain to mynteye::ctain --- src/mynteye/api/camera_models/CtainBase.h | 12 ++-- src/mynteye/api/camera_models/Matrix.h | 14 +++-- src/mynteye/api/camera_models/MatrixSolver.h | 21 ++++++- src/mynteye/api/camera_models/Quaternion.h | 11 +++- src/mynteye/api/camera_models/SquareMatrix.h | 11 +++- src/mynteye/api/camera_models/camera.cc | 24 +++---- src/mynteye/api/camera_models/camera.h | 10 +-- .../api/camera_models/equidistant_camera.cc | 62 +++++++++---------- .../api/camera_models/equidistant_camera.h | 16 ++--- .../api/processor/rectify_processor.cc | 20 +++--- src/mynteye/api/processor/rectify_processor.h | 2 +- 11 files changed, 120 insertions(+), 83 deletions(-) diff --git a/src/mynteye/api/camera_models/CtainBase.h b/src/mynteye/api/camera_models/CtainBase.h index 2fd040d..aceb896 100644 --- a/src/mynteye/api/camera_models/CtainBase.h +++ b/src/mynteye/api/camera_models/CtainBase.h @@ -16,11 +16,14 @@ #include "SquareMatrix.h" #include "MatrixSolver.h" #include "Quaternion.h" -#ifndef MATRIX_CTAIN_H -#define MATRIX_CTAIN_H +#ifndef SRC_MYNTEYE_API_CAMERA_MODELS_CTAINBASE_H_ +#define SRC_MYNTEYE_API_CAMERA_MODELS_CTAINBASE_H_ +#include "mynteye/mynteye.h" -namespace Ctain { +MYNTEYE_BEGIN_NAMESPACE + +namespace ctain { typedef SMatrix Matrixd; typedef Matrix MatrixXd; typedef Matrix Matrix23d; @@ -43,4 +46,5 @@ namespace Ctain { typedef Quaternion Quaterniond; } -#endif // Ctain_CtainBASE_H +MYNTEYE_END_NAMESPACE +#endif // SRC_MYNTEYE_API_CAMERA_MODELS_CTAINBASE_H_ diff --git a/src/mynteye/api/camera_models/Matrix.h b/src/mynteye/api/camera_models/Matrix.h index 28bca00..9a85cc7 100644 --- a/src/mynteye/api/camera_models/Matrix.h +++ b/src/mynteye/api/camera_models/Matrix.h @@ -19,7 +19,11 @@ #include #include -namespace Ctain { +#include "mynteye/mynteye.h" + +MYNTEYE_BEGIN_NAMESPACE + +namespace ctain { template class Matrix { public: @@ -280,7 +284,6 @@ class Matrix { inline _Scalar cData(int i, int j) const { return data[id(i, j)]; } - }; // class Matrix template @@ -346,8 +349,7 @@ Matrix<_Scalar> Matrix<_Scalar>::operator -(const Matrix<_Scalar> &m) const { } template -Matrix<_Scalar> Matrix<_Scalar>::transpose() const -{ +Matrix<_Scalar> Matrix<_Scalar>::transpose() const { Matrix<_Scalar> res(_Cols, _Rows); for (int i = 0; i < _Rows; i++) { for (int j = 0; j < _Cols; j++) { @@ -417,5 +419,7 @@ double Matrix<_Scalar>::norm() const { return sum; } -} // namespace Ctain +} // namespace ctain + +MYNTEYE_END_NAMESPACE #endif // SRC_MYNTEYE_API_CAMERA_MODELS_MATRIX_H_ diff --git a/src/mynteye/api/camera_models/MatrixSolver.h b/src/mynteye/api/camera_models/MatrixSolver.h index 9254fc4..bfb1936 100644 --- a/src/mynteye/api/camera_models/MatrixSolver.h +++ b/src/mynteye/api/camera_models/MatrixSolver.h @@ -1,17 +1,31 @@ +// Copyright 2018 Slightech Co., Ltd. All rights reserved. // -// Created by 顾涵彬 on 2019-08-30. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at // +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. #ifndef SRC_MYNTEYE_API_CAMERA_MODELS_MATRIXSOLVER_H_ #define SRC_MYNTEYE_API_CAMERA_MODELS_MATRIXSOLVER_H_ #include #include +#include "mynteye/mynteye.h" + +MYNTEYE_BEGIN_NAMESPACE + static bool Matrix_EigenValue(double *K1, int n, int LoopNumber, double Error1, double *Ret); static void Matrix_Hessenberg(double *A1, int n, double *ret); -namespace Ctain { +namespace ctain { class EigenSolver { public: explicit EigenSolver(SMatrix s) { @@ -35,7 +49,7 @@ class EigenSolver { Matrix t; }; -} // namespace Ctain +} // namespace ctain static void Matrix_Hessenberg(double *A1, int n, double *ret) { int MaxNumber; @@ -239,4 +253,5 @@ static bool Matrix_EigenValue(double *K1, int n, return true; } +MYNTEYE_END_NAMESPACE #endif // SRC_MYNTEYE_API_CAMERA_MODELS_MATRIXSOLVER_H_ diff --git a/src/mynteye/api/camera_models/Quaternion.h b/src/mynteye/api/camera_models/Quaternion.h index 4c7dcfa..edf3e26 100644 --- a/src/mynteye/api/camera_models/Quaternion.h +++ b/src/mynteye/api/camera_models/Quaternion.h @@ -17,7 +17,12 @@ #include "SquareMatrix.h" #include -namespace Ctain { + +#include "mynteye/mynteye.h" + +MYNTEYE_BEGIN_NAMESPACE + +namespace ctain { template class Quaternion { public: @@ -62,5 +67,7 @@ class Quaternion { T _z; T _w; }; -} // namespace Ctain +} // namespace ctain + +MYNTEYE_END_NAMESPACE #endif // SRC_MYNTEYE_API_CAMERA_MODELS_QUATERNION_H_ diff --git a/src/mynteye/api/camera_models/SquareMatrix.h b/src/mynteye/api/camera_models/SquareMatrix.h index d7b0d2b..2880741 100644 --- a/src/mynteye/api/camera_models/SquareMatrix.h +++ b/src/mynteye/api/camera_models/SquareMatrix.h @@ -15,7 +15,12 @@ #ifndef SRC_MYNTEYE_API_CAMERA_MODELS_SQUAREMATRIX_H_ #define SRC_MYNTEYE_API_CAMERA_MODELS_SQUAREMATRIX_H_ #include "Matrix.h" -namespace Ctain { + +#include "mynteye/mynteye.h" + +MYNTEYE_BEGIN_NAMESPACE + +namespace ctain { #define Matrix_ Matrix<_Scalar> template class SMatrix: public Matrix_{ @@ -92,5 +97,7 @@ _Scalar SMatrix<_Scalar>::M(int m, int n) { } #undef Matrix_ -} // namespace Ctain +} // namespace ctain + +MYNTEYE_END_NAMESPACE #endif // SRC_MYNTEYE_API_CAMERA_MODELS_SQUAREMATRIX_H_ diff --git a/src/mynteye/api/camera_models/camera.cc b/src/mynteye/api/camera_models/camera.cc index b8ac430..659d636 100644 --- a/src/mynteye/api/camera_models/camera.cc +++ b/src/mynteye/api/camera_models/camera.cc @@ -105,7 +105,7 @@ void Camera::estimateExtrinsics( std::vector Ms(imagePoints.size()); for (size_t i = 0; i < Ms.size(); ++i) { // Eigen::Vector3d P; - Ctain::Vectord P(3, 1), p(2, 1); + ctain::Vectord P(3, 1), p(2, 1); p<< imagePoints.at(i).x << imagePoints.at(i).y; // liftProjective( @@ -122,8 +122,8 @@ void Camera::estimateExtrinsics( } double Camera::reprojectionDist( - const Ctain::Vector3d &P1, const Ctain::Vector3d &P2) const { - Ctain::Vector2d p1(2, 1), p2(2, 1); + const ctain::Vector3d &P1, const ctain::Vector3d &P2) const { + ctain::Vector2d p1(2, 1), p2(2, 1); spaceToPlane(P1, p1); spaceToPlane(P2, p2); @@ -171,13 +171,13 @@ double Camera::reprojectionError( } double Camera::reprojectionError( - const Ctain::Vector3d &P, const Ctain::Quaterniond &camera_q, - const Ctain::Vector3d &camera_t, - const Ctain::Vector2d &observed_p) const { - Ctain::Vector3d P_cam; + const ctain::Vector3d &P, const ctain::Quaterniond &camera_q, + const ctain::Vector3d &camera_t, + const ctain::Vector2d &observed_p) const { + ctain::Vector3d P_cam; P_cam = camera_q.toRotationMatrix() * P + camera_t; - Ctain::Vector2d p(2, 1), res(2, 1); + ctain::Vector2d p(2, 1), res(2, 1); spaceToPlane(P_cam, p); res = p - observed_p; return res.norm(); @@ -193,24 +193,24 @@ void Camera::projectPoints( cv::Mat R0; cv::Rodrigues(rvec, R0); - Ctain::MatrixXd R(3, 3); + ctain::MatrixXd R(3, 3); R << R0.at(0, 0) << R0.at(0, 1) << R0.at(0, 2) << R0.at(1, 0) << R0.at(1, 1) << R0.at(1, 2) << R0.at(2, 0) << R0.at(2, 1) << R0.at(2, 2); - Ctain::Vectord t(3, 1); + ctain::Vectord t(3, 1); t << tvec.at(0) << tvec.at(1) << tvec.at(2); for (size_t i = 0; i < objectPoints.size(); ++i) { const cv::Point3f &objectPoint = objectPoints.at(i); // Rotate and translate - Ctain::Vectord P(3, 1); + ctain::Vectord P(3, 1); P << objectPoint.x << objectPoint.y << objectPoint.z; P = R * P + t; - Ctain::Vector2d p(2, 1); + ctain::Vector2d p(2, 1); spaceToPlane(P, p); imagePoints.push_back(cv::Point2f(p(0), p(1))); diff --git a/src/mynteye/api/camera_models/camera.h b/src/mynteye/api/camera_models/camera.h index 57868f3..87e57c2 100644 --- a/src/mynteye/api/camera_models/camera.h +++ b/src/mynteye/api/camera_models/camera.h @@ -76,12 +76,12 @@ class Camera { // Lift points from the image plane to the projective space virtual void liftProjective( - const Ctain::Vector2d &p, Ctain::Vector3d &P) const = 0; // NOLINT + const ctain::Vector2d &p, ctain::Vector3d &P) const = 0; // NOLINT // %output P // Projects 3D points to the image plane (Pi function) virtual void spaceToPlane( - const Ctain::Vector3d &P, Ctain::Vector2d &p) const = 0; // NOLINT + const ctain::Vector3d &P, ctain::Vector2d &p) const = 0; // NOLINT // %output p // Projects 3D points to the image plane (Pi function) @@ -113,7 +113,7 @@ class Camera { * \return euclidean distance in the plane */ double reprojectionDist( - const Ctain::Vector3d &P1, const Ctain::Vector3d &P2) const; + const ctain::Vector3d &P1, const ctain::Vector3d &P2) const; double reprojectionError( const std::vector > &objectPoints, @@ -122,8 +122,8 @@ class Camera { cv::OutputArray perViewErrors = cv::noArray()) const; double reprojectionError( - const Ctain::Vector3d &P, const Ctain::Quaterniond &camera_q, - const Ctain::Vector3d &camera_t, const Ctain::Vector2d &observed_p) const; + const ctain::Vector3d &P, const ctain::Quaterniond &camera_q, + const ctain::Vector3d &camera_t, const ctain::Vector2d &observed_p) const; void projectPoints( const std::vector &objectPoints, const cv::Mat &rvec, diff --git a/src/mynteye/api/camera_models/equidistant_camera.cc b/src/mynteye/api/camera_models/equidistant_camera.cc index a336769..906c3ee 100644 --- a/src/mynteye/api/camera_models/equidistant_camera.cc +++ b/src/mynteye/api/camera_models/equidistant_camera.cc @@ -280,8 +280,8 @@ void EquidistantCamera::estimateIntrinsics( double f0 = 0.0; for (size_t i = 0; i < imagePoints.size(); ++i) { // std::vector center(boardSize.height); - std::vector center( - boardSize.height, Ctain::Vector2d(2, 1)); + std::vector center( + boardSize.height, ctain::Vector2d(2, 1)); int arrayLength = boardSize.height; double *radius = new double[arrayLength]; memset(radius, 0, arrayLength * sizeof(double)); @@ -354,9 +354,9 @@ void EquidistantCamera::estimateIntrinsics( */ void EquidistantCamera::liftProjective( - const Ctain::Vector2d &p, Ctain::Vector3d &P) const { + const ctain::Vector2d &p, ctain::Vector3d &P) const { // Lift points to normalised plane - Ctain::Vector2d p_u(2, 1); + ctain::Vector2d p_u(2, 1); p_u << m_inv_K11 * p(0) + m_inv_K13 << m_inv_K22 * p(1) + m_inv_K23; // Obtain a projective ray @@ -376,7 +376,7 @@ void EquidistantCamera::liftProjective( */ void EquidistantCamera::spaceToPlane( - const Ctain::Vector3d &P, Ctain::Vector2d &p) const { + const ctain::Vector3d &P, ctain::Vector2d &p) const { // double theta = acos(0.5); // double theta = 0.5; // double phi = 0.5; @@ -390,9 +390,9 @@ void EquidistantCamera::spaceToPlane( // double phi = ApproxAtan2(P(1), P(0)); double tmp[2] = {cos(phi), sin(phi)}; - Ctain::Vector2d p_u = r(mParameters.k2(), mParameters.k3(), mParameters.k4(), + ctain::Vector2d p_u = r(mParameters.k2(), mParameters.k3(), mParameters.k4(), mParameters.k5(), theta) * - Ctain::Vector2d(tmp, 2, 1); + ctain::Vector2d(tmp, 2, 1); // Apply generalised projection matrix p << mParameters.mu() * p_u(0) + mParameters.u0() @@ -406,14 +406,14 @@ void EquidistantCamera::spaceToPlane( * \param p return value, contains the image point coordinates */ void EquidistantCamera::spaceToPlane( - const Ctain::Vector3d &P, Ctain::Vector2d &p, - Ctain::Matrix23d &J) const { + const ctain::Vector3d &P, ctain::Vector2d &p, + ctain::Matrix23d &J) const { double theta = acos(P(2) / 3.0); double phi = atan2(P(1), P(0)); double tmp[2] = {cos(phi), sin(phi)}; - Ctain::Vector2d p_u = r(mParameters.k2(), mParameters.k3(), mParameters.k4(), + ctain::Vector2d p_u = r(mParameters.k2(), mParameters.k3(), mParameters.k4(), mParameters.k5(), theta) * - Ctain::Vector2d(tmp, 2, 1); + ctain::Vector2d(tmp, 2, 1); // Apply generalised projection matrix p << mParameters.mu() * p_u(0) + mParameters.u0() @@ -432,14 +432,14 @@ void EquidistantCamera::initUndistortMap( double my_u = m_inv_K22 / fScale * v + m_inv_K23 / fScale; double theta, phi; - Ctain::Vector2d tmp(2, 1); + ctain::Vector2d tmp(2, 1); tmp << mx_u << my_u; backprojectSymmetric(tmp, theta, phi); - Ctain::Vector3d P(3, 1); + ctain::Vector3d P(3, 1); P << sin(theta) * cos(phi) << sin(theta) * sin(phi) << cos(theta); - Ctain::Vector2d p(2, 1); + ctain::Vector2d p(2, 1); spaceToPlane(P, p); mapX.at(v, u) = p(0); @@ -462,7 +462,7 @@ cv::Mat EquidistantCamera::initUndistortRectifyMap( cv::Mat mapX = cv::Mat::zeros(imageSize.height, imageSize.width, CV_32F); cv::Mat mapY = cv::Mat::zeros(imageSize.height, imageSize.width, CV_32F); - Ctain::Matrix3f K_rect(3); + ctain::Matrix3f K_rect(3); if (cx == -1.0f && cy == -1.0f) { K_rect << fx << 0 << imageSize.width / 2 << @@ -476,8 +476,8 @@ cv::Mat EquidistantCamera::initUndistortRectifyMap( K_rect(1, 1) = mParameters.mv(); } - Ctain::Matrix3f K_rect_inv = K_rect.inverse(); - Ctain::Matrix3f R(3), R_inv(3); + ctain::Matrix3f K_rect_inv = K_rect.inverse(); + ctain::Matrix3f R(3), R_inv(3); for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { @@ -488,11 +488,11 @@ cv::Mat EquidistantCamera::initUndistortRectifyMap( for (int v = 0; v < imageSize.height; ++v) { for (int u = 0; u < imageSize.width; ++u) { - Ctain::Vector3f xo(3, 1); + ctain::Vector3f xo(3, 1); xo << u << v << 1; - Ctain::Vector3f uo = R_inv * K_rect_inv * xo; - Ctain::Vector2d p(2, 1); + ctain::Vector3f uo = R_inv * K_rect_inv * xo; + ctain::Vector2d p(2, 1); spaceToPlane(uo.cast(), p); mapX.at(v, u) = p(0); @@ -579,16 +579,16 @@ void EquidistantCamera::fitOddPoly( pows.push_back(i); } - Ctain::MatrixXd X(x.size(), pows.size()); - Ctain::MatrixXd Y(y.size(), 1); + ctain::MatrixXd X(x.size(), pows.size()); + ctain::MatrixXd Y(y.size(), 1); for (size_t i = 0; i < x.size(); ++i) { for (size_t j = 0; j < pows.size(); ++j) { X(i, j) = pow(x.at(i), pows.at(j)); } Y(i, 0) = y.at(i); } - Ctain::SMatrix Tmp(X.transpose() * X); - Ctain::MatrixXd A = Tmp.inverse() * X.transpose() * Y; + ctain::SMatrix Tmp(X.transpose() * X); + ctain::MatrixXd A = Tmp.inverse() * X.transpose() * Y; coeffs.resize(A.rows()); for (int i = 0; i < A.rows(); ++i) { @@ -597,7 +597,7 @@ void EquidistantCamera::fitOddPoly( } void EquidistantCamera::backprojectSymmetric( - const Ctain::Vector2d &p_u, double &theta, double &phi) const { + const ctain::Vector2d &p_u, double &theta, double &phi) const { double tol = 1e-10; double p_u_norm = p_u.norm(); @@ -621,7 +621,7 @@ void EquidistantCamera::backprojectSymmetric( npow -= 2; } - Ctain::MatrixXd coeffs(npow + 1, 1); + ctain::MatrixXd coeffs(npow + 1, 1); coeffs.setZero(); coeffs(0) = -p_u_norm; coeffs(1) = 1.0; @@ -644,17 +644,17 @@ void EquidistantCamera::backprojectSymmetric( } else { // Get eigenvalues of companion matrix corresponding to polynomial. // Eigenvalues correspond to roots of polynomial. - Ctain::Matrixd A(npow); + ctain::Matrixd A(npow); A.setZero(); A.block(1, 0, npow - 1, npow - 1).setIdentity(); A.col(npow - 1) = -coeffs.block(0, 0, npow, 1) / coeffs(npow); std::cout << std::endl <<"A:" << A; - Ctain::EigenSolver es(A); - Ctain::Matrix eigval(9, 2); + ctain::EigenSolver es(A); + ctain::Matrix eigval(9, 2); eigval = es.eigenvalues(); - // Ctain::EigenSolver es(A); - // Ctain::MatrixXcd eigval(npow, 2); + // ctain::EigenSolver es(A); + // ctain::MatrixXcd eigval(npow, 2); // eigval = es.eigenvalues(); std::cout << std::endl <<"eigval:" << eigval; std::vector thetas; diff --git a/src/mynteye/api/camera_models/equidistant_camera.h b/src/mynteye/api/camera_models/equidistant_camera.h index 46924be..1a10179 100644 --- a/src/mynteye/api/camera_models/equidistant_camera.h +++ b/src/mynteye/api/camera_models/equidistant_camera.h @@ -116,26 +116,26 @@ class EquidistantCamera : public Camera { const std::vector > &imagePoints); // Lift points from the image plane to the projective space - void liftProjective(const Ctain::Vector2d &p, Ctain::Vector3d &P) const; // NOLINT + void liftProjective(const ctain::Vector2d &p, ctain::Vector3d &P) const; // NOLINT // %output P // Projects 3D points to the image plane (Pi function) - void spaceToPlane(const Ctain::Vector3d &P, Ctain::Vector2d &p) const; // NOLINT + void spaceToPlane(const ctain::Vector3d &P, ctain::Vector2d &p) const; // NOLINT // %output p // Projects 3D points to the image plane (Pi function) // and calculates jacobian void spaceToPlane( - const Ctain::Vector3d &P,Ctain::Vector2d &p, // NOLINT - Ctain::Matrix23d &J) const; // NOLINT + const ctain::Vector3d &P,ctain::Vector2d &p, // NOLINT + ctain::Matrix23d &J) const; // NOLINT // %output p // %output J template static void spaceToPlane( const T *const params, const T *const q, const T *const t, - const Ctain::Matrix &P, Ctain::Matrix &p); // NOLINT + const ctain::Matrix &P, ctain::Matrix &p); // NOLINT void initUndistortMap( cv::Mat &map1, cv::Mat &map2, double fScale = 1.0) const; // NOLINT @@ -164,7 +164,7 @@ class EquidistantCamera : public Camera { std::vector &coeffs) const; // NOLINT void backprojectSymmetric( - const Ctain::Vector2d &p_u, double &theta, double &phi) const; // NOLINT + const ctain::Vector2d &p_u, double &theta, double &phi) const; // NOLINT Parameters mParameters; @@ -193,7 +193,7 @@ T EquidistantCamera::r(T k2, T k3, T k4, T k5, T theta) { template void spaceToPlane( const T *const params, const T *const q, const T *const t, - const Ctain::Matrix &P, Ctain::Matrix &p) { // NOLINT + const ctain::Matrix &P, ctain::Matrix &p) { // NOLINT T P_w[3]; P_w[0] = T(P(0)); P_w[1] = T(P(1)); @@ -224,7 +224,7 @@ void spaceToPlane( T theta = acos(P_c[2] / len); T phi = atan2(P_c[1], P_c[0]); - Ctain::Matrix p_u(2, 1), tmp(2, 1); + ctain::Matrix p_u(2, 1), tmp(2, 1); tmp(0) = cos(phi); tmp(1) = sin(phi); p_u = r(k2, k3, k4, k5, theta) * tmp; diff --git a/src/mynteye/api/processor/rectify_processor.cc b/src/mynteye/api/processor/rectify_processor.cc index 63817d4..db5da3a 100644 --- a/src/mynteye/api/processor/rectify_processor.cc +++ b/src/mynteye/api/processor/rectify_processor.cc @@ -126,8 +126,8 @@ void RectifyProcessor::stereoRectify(models::CameraPtr leftOdo, CvMat pts_3 = cvMat(1, 4, CV_32FC3, _pts_3); // Eigen::Vector2d a; // Eigen::Vector3d b; - Ctain::Vector2d a(2, 1); - Ctain::Vector3d b(3, 1); + ctain::Vector2d a(2, 1); + ctain::Vector3d b(3, 1); for (i = 0; i < 4; i++) { int j = (i < 2) ? 0 : 1; a(0) = static_cast((i % 2)*(nx)); @@ -233,8 +233,8 @@ void RectifyProcessor::stereoRectify(models::CameraPtr leftOdo, // Eigen::Matrix4d RectifyProcessor::loadT(const mynteye::Extrinsics& in) { // subEigen -Ctain::Matrix4d RectifyProcessor::loadT(const mynteye::Extrinsics &in) { - Ctain::Matrix3d R(3); +ctain::Matrix4d RectifyProcessor::loadT(const mynteye::Extrinsics &in) { + ctain::Matrix3d R(3); R<< in.rotation[0][0] << in.rotation[0][1] << in.rotation[0][2] << in.rotation[1][0] << in.rotation[1][1] << in.rotation[1][2] << @@ -244,12 +244,12 @@ Ctain::Matrix4d RectifyProcessor::loadT(const mynteye::Extrinsics &in) { double t_y = in.translation[1]; double t_z = in.translation[2]; - Ctain::Quaterniond q(R); + ctain::Quaterniond q(R); q.normalize(); - Ctain::Matrix4d T(4); + ctain::Matrix4d T(4); T(3, 3) = 1; T.topLeftCorner<3, 3>() = q.toRotationMatrix(); - Ctain::Vector3d t(3, 1); + ctain::Vector3d t(3, 1); t << t_x << t_y << t_z; T.topRightCorner<3, 1>() = t; @@ -293,10 +293,10 @@ std::shared_ptr RectifyProcessor::stereoRectify( // Eigen::Matrix4d T = loadT(ex_right_to_left); // Eigen::Matrix3d R = T.topLeftCorner<3, 3>(); // Eigen::Vector3d t = T.topRightCorner<3, 1>(); - Ctain::Matrix4d T = loadT(ex_right_to_left); - Ctain::Matrix3d R; + ctain::Matrix4d T = loadT(ex_right_to_left); + ctain::Matrix3d R; R = T.topLeftCorner<3, 3>(); - Ctain::Vector3d t = T.topRightCorner<3, 1>(); + ctain::Vector3d t = T.topRightCorner<3, 1>(); // cv::Mat cv_R, cv_t; // cv::eigen2cv(R, cv_R); cv::Mat cv_R(3, 3, CV_64FC1); diff --git a/src/mynteye/api/processor/rectify_processor.h b/src/mynteye/api/processor/rectify_processor.h index c6150fa..bc4b037 100644 --- a/src/mynteye/api/processor/rectify_processor.h +++ b/src/mynteye/api/processor/rectify_processor.h @@ -92,7 +92,7 @@ class RectifyProcessor : public Processor { // Eigen::Matrix4d loadT(const mynteye::Extrinsics& in); // subEigen - Ctain::Matrix4d loadT(const mynteye::Extrinsics &in); + ctain::Matrix4d loadT(const mynteye::Extrinsics &in); void loadCameraMatrix(cv::Mat& K, cv::Mat& D, // NOLINT cv::Size& image_size, // NOLINT