refactor(src/api/camera_models):add independent Matrix functions to camera_models

This commit is contained in:
Messier
2019-09-03 09:58:29 +08:00
parent 0ac8d7bc16
commit 8bc2401bb3
9 changed files with 1401 additions and 4 deletions

View File

@@ -17,6 +17,7 @@
#include <vector>
#include <memory>
#include "eigen3/Eigen/Dense"
#include "Ctain/CtainBase.h"
#include <opencv2/core/core.hpp>
#include "mynteye/mynteye.h"
@@ -70,21 +71,45 @@ class Camera {
const cv::Size &boardSize,
const std::vector<std::vector<cv::Point3f> > &objectPoints,
const std::vector<std::vector<cv::Point2f> > &imagePoints) = 0;
// subEigen
virtual void estimateIntrinsics2(
const cv::Size &boardSize,
const std::vector<std::vector<cv::Point3f> > &objectPoints,
const std::vector<std::vector<cv::Point2f> > &imagePoints) = 0;
virtual void estimateExtrinsics(
const std::vector<cv::Point3f> &objectPoints,
const std::vector<cv::Point2f> &imagePoints,
cv::Mat &rvec, cv::Mat &tvec) const; // NOLINT
virtual void estimateExtrinsics2(
const std::vector<cv::Point3f> &objectPoints,
const std::vector<cv::Point2f> &imagePoints,
cv::Mat &rvec, cv::Mat &tvec) const; // NOLINT
// Lift points from the image plane to the projective space
virtual void liftProjective(
const Eigen::Vector2d &p, Eigen::Vector3d &P) const = 0; // NOLINT
// %output P
//subEigen
// Lift points from the image plane to the projective space
virtual void liftProjective(
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 Eigen::Vector3d &P, Eigen::Vector2d &p) const = 0; // NOLINT
// %output p
//subEigen
// Projects 3D points to the image plane (Pi function)
virtual void spaceToPlane(
const Ctain::Vector3d &P, Ctain::Vector2d &p) const = 0; // NOLINT
// %output p
// Projects 3D points to the image plane (Pi function)
// and calculates jacobian
// virtual void spaceToPlane(const Eigen::Vector3d& P, Eigen::Vector2d& p,
@@ -116,20 +141,36 @@ class Camera {
double reprojectionDist(
const Eigen::Vector3d &P1, const Eigen::Vector3d &P2) const;
//subEigen
double reprojectionDist(
const Ctain::Vector3d &P1, const Ctain::Vector2d &P2) const;
double reprojectionError(
const std::vector<std::vector<cv::Point3f> > &objectPoints,
const std::vector<std::vector<cv::Point2f> > &imagePoints,
const std::vector<cv::Mat> &rvecs, const std::vector<cv::Mat> &tvecs,
cv::OutputArray perViewErrors = cv::noArray()) const;
double reprojectionError(
const Eigen::Vector3d &P, const Eigen::Quaterniond &camera_q,
const Eigen::Vector3d &camera_t, const Eigen::Vector2d &observed_p) const;
//subEigen
double reprojectionError(
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<cv::Point3f> &objectPoints, const cv::Mat &rvec,
const cv::Mat &tvec, std::vector<cv::Point2f> &imagePoints) const; // NOLINT
//subEigen
void projectPoints2(
const std::vector<cv::Point3f> &objectPoints, const cv::Mat &rvec,
const cv::Mat &tvec, std::vector<cv::Point2f> &imagePoints) const; // NOLINT
protected:
cv::Mat m_mask;
};