EasyMVS
simple 3D reconstruction framework
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
PinholeCamera Class Reference

this is the base class of all pinhole cameras, which is the common camera type. this class implement the common pinhole camera module, which include classic 3x3 camera intrinsic matrix, and distortion module the detailed information of this camera module can be found in OpenCV document "Camera Calibration and 3D Reconstruction" part More...

#include <CameraObject.h>

Inheritance diagram for PinholeCamera:
Inheritance graph
[legend]
Collaboration diagram for PinholeCamera:
Collaboration graph
[legend]

Public Types

using Ptr = std::shared_ptr< PinholeCamera >
 the shared pointer of PinholeCamera class
 
- Public Types inherited from CameraObject
using Ptr = std::shared_ptr< CameraObject >
 shared pointer
 
- Public Types inherited from DataFlowObject
using Ptr = std::shared_ptr< DataFlowObject >
 the shared pointer type of DataFlowObject
 

Public Member Functions

 PinholeCamera (const cv::Mat1d &CameraMatrix=cv::Mat1d(), const cv::Mat1d &DistCoeff=cv::Mat1d())
 Construct a new Pinhole Camera object. More...
 
virtual ~PinholeCamera ()
 Destroy the Pinhole Camera object.
 
virtual bool undistort (const cv::Mat &src, cv::Mat &dst) override
 Transforms an image to compensate for lens distortion. this is a pure virtual function, the real undistort algorithm should be implemented. More...
 
std::tuple< cv::Mat1d, cv::Mat1d > getCameraParameters ()
 Get the Camera Parameters. More...
 
bool updateCameraMatrix (const cv::Mat1d &CameraMatrix)
 set the new camera intrinsic matrix More...
 
bool updateDistCoeff (const cv::Mat1d &DistCoeff)
 
virtual std::string type_name () override
 get the typename. More...
 
virtual bool save (JsonNode &fs) override
 save data and settings to file More...
 
virtual bool load (JsonNode &fs) override
 load data and settings from file More...
 
- Public Member Functions inherited from CameraObject
 CameraObject ()
 Construct a new Camera Object object. More...
 
 CameraObject (std::string CameraName)
 Construct a new Camera Object object. More...
 
virtual ~CameraObject ()
 Destroy the Camera Object object.
 
std::string getCameraName ()
 Get the Camera Name. More...
 
virtual bool undistort (const cv::Mat &src, cv::Mat &dst)=0
 Transforms an image to compensate for lens distortion. this is a pure virtual function, the real undistort algorithm should be implemented. More...
 
virtual bool open ()
 open the camera with the preloaded parameter More...
 
bool save (JsonNode &fs) override
 save data and settings to file More...
 
bool load (JsonNode &fs) override
 load data and settings from file More...
 
virtual std::string type_name () override
 get the typename. More...
 
- Public Member Functions inherited from DataFlowObject
 DataFlowObject ()
 Construct a new Data Flow Object object.
 
virtual ~DataFlowObject ()
 Destroy the Data Flow Object object.
 
- Public Member Functions inherited from MVSObject
 MVSObject ()
 Construct a new MVSObject object.
 
virtual ~MVSObject ()
 Destroy the MVSObject object.
 
virtual bool save (JsonNode &fs)=0
 save data and settings to file More...
 
virtual bool load (JsonNode &fs)=0
 load data and settings from file More...
 
virtual std::string type_name ()
 get the typename. More...
 

Static Public Member Functions

static Ptr Create (const cv::Mat1d &CameraMatrix=cv::Mat1d(), const cv::Mat1d &DistCoeff=cv::Mat1d())
 Creates PinholeCamera object. More...
 
- Static Public Member Functions inherited from DataFlowObject
static void cvMat2Sophus (const cv::Mat1d &Mat, Sophus::SE3d &Pose)
 create shared pointer of DataFlowObject, do NOT use this method directly, use the Create() method in derived class. More...
 
static void Sophus2cvMat (const Sophus::SE3d &pose, cv::Mat1d &Mat)
 
static cv::Mat1d Rt2T (const cv::Mat1d &R, const cv::Mat1d &t)
 
static std::tuple< cv::Mat1d, cv::Mat1d > T2Rt (const cv::Mat1d &T)
 

Protected Attributes

cv::Mat1d CameraMatrix
 Camera Intrinsic Matrix.
 
cv::Mat1d DistCoeff
 Camera Distortion Parameters.
 
- Protected Attributes inherited from CameraObject
std::string CameraName
 
cv::Size2i ImageSize
 

Additional Inherited Members

- Protected Member Functions inherited from MVSObject
bool isDirExist (std::string path)
 check if the directory is exist. More...
 
bool mkdir (std::string path)
 create directory in given path. More...
 

Detailed Description

this is the base class of all pinhole cameras, which is the common camera type. this class implement the common pinhole camera module, which include classic 3x3 camera intrinsic matrix, and distortion module the detailed information of this camera module can be found in OpenCV document "Camera Calibration and 3D Reconstruction" part

Constructor & Destructor Documentation

◆ PinholeCamera()

PinholeCamera::PinholeCamera ( const cv::Mat1d &  CameraMatrix = cv::Mat1d(),
const cv::Mat1d &  DistCoeff = cv::Mat1d() 
)

Construct a new Pinhole Camera object.

Parameters
CameraNamethe unique name of Camera
CameraMatrixthe 3x3 camera intrinsic matrix
DistCoeffthe camera distortion parameters

Member Function Documentation

◆ Create()

PinholeCamera::Ptr PinholeCamera::Create ( const cv::Mat1d &  CameraMatrix = cv::Mat1d(),
const cv::Mat1d &  DistCoeff = cv::Mat1d() 
)
static

Creates PinholeCamera object.

Parameters
CameraNamethe unique name of Camera
CameraMatrixthe 3x3 camera intrinsic matrix
DistCoeffthe camera distortion parameters
Returns
Ptr the shared pointer of PinholeCamera class

◆ getCameraParameters()

std::tuple< cv::Mat1d, cv::Mat1d > PinholeCamera::getCameraParameters ( )

Get the Camera Parameters.

Returns
std::tuple<cv::Mat1d, cv::Mat1d> Camera intrinsic matrix and distortion parameters

◆ load()

bool PinholeCamera::load ( JsonNode &  fs)
overridevirtual

load data and settings from file

this method will load data such as keypoints, descriptors, translation matrices in DataFlowObject and its sub-classes from the given JsonNode instance. or will load parameters and settings in WorkFlowObject and its sub-classes to the given JsonNode instance, and automatically initialize the WorkFlow with these parameters

Parameters
fsthe json handler
Returns
true load successfully
false load failed or initialization falied.

Reimplemented from CameraObject.

Reimplemented in PinholeImageReader.

◆ save()

bool PinholeCamera::save ( JsonNode &  fs)
overridevirtual

save data and settings to file

this method will save data such as keypoints, descriptors, translation matrices in DataFlowObject and its sub-classes to the given JsonNode instance, or will save parameters and settings in WorkFlowObject and its sub-classes to the given JsonNode instance.

Parameters
fsthe json handler
Returns
true save successfully
false save failed

Reimplemented from CameraObject.

Reimplemented in PinholeImageReader.

◆ type_name()

std::string PinholeCamera::type_name ( )
overridevirtual

get the typename.

Returns

Reimplemented from CameraObject.

Reimplemented in PinholeImageReader.

◆ undistort()

bool PinholeCamera::undistort ( const cv::Mat &  src,
cv::Mat &  dst 
)
overridevirtual

Transforms an image to compensate for lens distortion. this is a pure virtual function, the real undistort algorithm should be implemented.

Parameters
srcInput (distorted) image.
dstOutput (corrected) image that has the same size and type as src.
Returns
true successfully undistort
false undistort failed

Implements CameraObject.

◆ updateCameraMatrix()

bool PinholeCamera::updateCameraMatrix ( const cv::Mat1d &  CameraMatrix)

set the new camera intrinsic matrix

Parameters
CameraMatrixnew camera intrinsic matrix
Returns
true update
false update failed

◆ updateDistCoeff()

bool PinholeCamera::updateDistCoeff ( const cv::Mat1d &  DistCoeff)
Parameters
DistCoeffset the new camera distortion parameters
Returns
true
false

The documentation for this class was generated from the following files: