template class sophus::CameraModelT¶
Overview¶
Camera model class template for pinhole-like camera projections. More…
#include <camera_model.h> template <class TScalar, class TDistortion, class TProj = ProjectionZ1> class CameraModelT { public: // typedefs using Distortion = TDistortion ; using Proj = TProj ; using PointCamera = Eigen::Matrix<TScalar, 3, 1> ; using PixelImage = Eigen::Matrix<TScalar, 2, 1> ; using ProjInCameraLifted = Eigen::Matrix<TScalar, 2, 1> ; using Params = Eigen::Matrix<TScalar, kNumParams, 1> ; using DistorationParams = Eigen::Matrix<TScalar, kNumDistortionParams, 1> ; // fields static constexpr int kNumDistortionParams = Distortion::kNumDistortionParams; static constexpr int kNumParams = Distortion::kNumParams; static constexpr const std::string_view kProjectionModel = Distortion::kProjectionModel; // construction CameraModelT(ImageSize const& image_size, Params const& params); CameraModelT(); // methods PixelImage focalLength() const; void setFocalLength(PixelImage const& focal_length); PixelImage principalPoint() const; void setPrincipalPoint(PixelImage const& principal_point); DistorationParams distortionParams() const; Eigen::Matrix<TScalar, kNumParams, 1>& params(); Eigen::Matrix<TScalar, kNumParams, 1> const& params() const; CameraModelT subsampleDown() const; CameraModelT subsampleUp() const; CameraModelT binDown() const; CameraModelT binUp() const; CameraModelT scale(ImageSize const& image_size) const; CameraModelT roi(Eigen::Vector2i const& top_left, ImageSize roi_size) const; PixelImage distort(ProjInCameraLifted const& point2_in_camera_lifted) const; Eigen::Matrix<TScalar, 2, 2> dxDistort(PixelImage const& pixel_in_image) const; ProjInCameraLifted undistort(PixelImage const& pixel_in_image) const; MutImage<Eigen::Vector2f> undistortTable() const; PixelImage camProj(PointCamera const& point_in_camera) const; Eigen::Matrix<TScalar, 2, 3> dxCamProjX(PointCamera const& point_in_camera) const; PointCamera camUnproj(PixelImage const& pixel_in_image, double depth_z) const; TScalar* data(); ImageSize const& imageSize() const; bool contains(Eigen::Vector2i const& obs, int border = 0) const; bool contains(PixelImage const& obs, TScalar border = TScalar(0)) const; static CameraModelT fromData(TScalar const*const ptr); };
Detailed Documentation¶
Camera model class template for pinhole-like camera projections.
Construction¶
CameraModelT(ImageSize const& image_size, Params const& params)
Constructs camera model from image size and set up parameters.
Methods¶
PixelImage focalLength() const
Focal length.
void setFocalLength(PixelImage const& focal_length)
Focal length.
void setPrincipalPoint(PixelImage const& principal_point)
Focal length.
DistorationParams distortionParams() const
Returns distortion parameters by value.
Eigen::Matrix<TScalar, kNumParams, 1>& params()
Parameters mutator.
Eigen::Matrix<TScalar, kNumParams, 1> const& params() const
Parameters accessor.
CameraModelT subsampleDown() const
Subsamples pixel down, factor of 0.5.
See for details: https://docs.google.com/document/d/1xmhCMWklP2UoQMGaMqFnsoPWoeMvBfXN7S8-ie9k0UA/edit#heading=h.97r8rr8owwpc
If the original width [height] is odd, the new width [height] will be: (width+1)/2 [height+1)/2].
CameraModelT subsampleUp() const
Subsamples pixel up, factor of 2.0.
See for details: https://docs.google.com/document/d/1xmhCMWklP2UoQMGaMqFnsoPWoeMvBfXN7S8-ie9k0UA/edit#heading=h.97r8rr8owwpc
CameraModelT binDown() const
Bins pixel down, factor of 0.5.
See for details: https://docs.google.com/document/d/1xmhCMWklP2UoQMGaMqFnsoPWoeMvBfXN7S8-ie9k0UA/edit#heading=h.elfm6123mecj
If the original width [height] is odd, the new width [height] will be: (width+1)/2 [height+1)/2].
CameraModelT binUp() const
Bins pixel up, factor of 2.0.
See for details: https://docs.google.com/document/d/1xmhCMWklP2UoQMGaMqFnsoPWoeMvBfXN7S8-ie9k0UA/edit#heading=h.elfm6123mecj
CameraModelT roi(Eigen::Vector2i const& top_left, ImageSize roi_size) const
Region of interest given top_left
and ` roi_size
.
PixelImage distort(ProjInCameraLifted const& point2_in_camera_lifted) const
Maps a 2-point in the z=1 plane of the camera to a pixel in the image.
ProjInCameraLifted undistort(PixelImage const& pixel_in_image) const
Maps a pixel in the image to a 2-point in the z=1 plane of the camera.
PixelImage camProj(PointCamera const& point_in_camera) const
Projects 3-point in camera frame to a pixel in the image.
PointCamera camUnproj(PixelImage const& pixel_in_image, double depth_z) const
Unprojects pixel in the image to point in camera frame.
The point is projected onto the xy-plane at z = depth_z
.
TScalar* data()
Raw data access. To be used in ceres optimization only.
ImageSize const& imageSize() const
Accessor of image size.
bool contains(Eigen::Vector2i const& obs, int border = 0) const
Returns true if obs is within image.
Note: Postiive border makes the image frame smaller.
bool contains(PixelImage const& obs, TScalar border = TScalar(0)) const
Returns true if obs is within image.
Note: Postiive border makes the image frame smaller.
static CameraModelT fromData(TScalar const*const ptr)
Returns camera model from raw data pointer. To be used within ceres optimization only.