Program Listing for File distortion-radtan.h

Return to documentation for file (aslam_cv2/aslam_cv_cameras/include/aslam/cameras/distortion-radtan.h)

#ifndef ASLAM_RADTAN_DISTORTION_H_
#define ASLAM_RADTAN_DISTORTION_H_

#include <Eigen/Core>
#include <glog/logging.h>

#include <aslam/common/crtp-clone.h>
#include <aslam/cameras/distortion.h>
#include <aslam/common/macros.h>

namespace aslam {

class RadTanDistortion : public aslam::Cloneable<Distortion, RadTanDistortion> {
 public:
  enum { kNumOfParams = 4 };

  enum { CLASS_SERIALIZATION_VERSION = 1 };
  ASLAM_POINTER_TYPEDEFS(RadTanDistortion);


  explicit RadTanDistortion(const Eigen::VectorXd& distortionParams);

  friend std::ostream& operator<<(std::ostream& out, const RadTanDistortion& distortion);

 public:
  RadTanDistortion(const RadTanDistortion&) = default;
  void operator=(const RadTanDistortion&) = delete;


 public:
  virtual void distortUsingExternalCoefficients(const Eigen::VectorXd* dist_coeffs,
                                                Eigen::Vector2d* point,
                                                Eigen::Matrix2d* out_jacobian) const;

  virtual void distortParameterJacobian(const Eigen::VectorXd* dist_coeffs,
                                        const Eigen::Vector2d& point,
                                        Eigen::Matrix<double, 2, Eigen::Dynamic>* out_jacobian) const;



  virtual void undistortUsingExternalCoefficients(const Eigen::VectorXd& dist_coeffs,
                                                  Eigen::Vector2d* point) const;



  static RadTanDistortion::UniquePtr createTestDistortion() {
    Eigen::VectorXd params(4); params << -0.28,  0.08, -0.00026, -0.00024;
    return RadTanDistortion::UniquePtr(new RadTanDistortion(params));
  }

  static RadTanDistortion::UniquePtr createZeroTestDistortion() {
    Eigen::VectorXd params(4); params << 0.0, 0.0, 0.0, 0.0;
    return RadTanDistortion::UniquePtr(new RadTanDistortion(params));
  }



  static bool areParametersValid(const Eigen::VectorXd& parameters);

  virtual bool distortionParametersValid(const Eigen::VectorXd& dist_coeffs) const;

  inline static constexpr size_t parameterCount() {
      return kNumOfParams;
  }

  virtual int getParameterSize() const {
    return kNumOfParams;
  }

  virtual void printParameters(std::ostream& out, const std::string& text) const;


};
} // namespace aslam

#endif /* ASLAM_RADTAN_DISTORTION_H_ */