GSoC2011SfM  0.1
Google Summer of Code 2011: Structure from motion
Public Member Functions | Static Public Member Functions | Protected Attributes
OpencvSfM::CameraPinholeDistor Class Reference

This class represent the physical device which take the pictures. It is not related to a 3D position which is the role of the PointOfView class. The role of the class is to store intra parameters and radial distortion. More...

#include <CameraPinholeDistor.h>

Inheritance diagram for OpencvSfM::CameraPinholeDistor:
OpencvSfM::CameraPinhole OpencvSfM::Camera

List of all members.

Public Member Functions

 CameraPinholeDistor (cv::Mat intra_params=cv::Mat::eye(3, 3, CV_64F), cv::Vec6d radial_dist=cv::Vec6d(0.0, 0.0, 0.0, 0.0, 0.0, 0.0), unsigned char nbRadialParam=6, cv::Vec2d tangential_dist=cv::Vec2d(0.0, 0.0), int img_w=640, int img_h=480, unsigned char wantedEstimation=FOCAL_PARAM|SKEW_PARAM|PRINCIPAL_POINT_PARAM|RADIAL_PARAM|TANGEANT_PARAM)
 CameraPinholeDistor (const std::vector< std::vector< cv::Point3f > > &objectPoints, const std::vector< std::vector< cv::Point2f > > &imagePoints, cv::Size imageSize, double aspectRatio=1., cv::Vec6d radial_dist=cv::Vec6d(0.0, 0.0, 0.0, 0.0, 0.0, 0.0), unsigned char nbRadialParam=6, cv::Vec2d tangential_dist=cv::Vec2d(0.0, 0.0), int img_w=640, int img_h=480, unsigned char wantedEstimation=FOCAL_PARAM|SKEW_PARAM|PRINCIPAL_POINT_PARAM|RADIAL_PARAM|TANGEANT_PARAM)
virtual uchar getNbMissingParams () const
virtual void updateIntrinsic (double *values, uchar nbVal, bool add_to_intra)
void updateDistortionParameters (const cv::Vec6d &radial_dist, unsigned char nbRadialParam, const cv::Vec2d &tangential_dist, unsigned char wantedEstimation=RADIAL_PARAM|TANGEANT_PARAM)
virtual std::vector< cv::Vec4d > convertFromImageTo3Dray (std::vector< cv::Vec3d > points)
virtual std::vector< cv::Vec2d > pixelToNormImageCoordinates (std::vector< cv::Vec2d > points) const
virtual std::vector< cv::Vec2d > normImageToPixelCoordinates (std::vector< cv::Vec2d > points) const
virtual void write (cv::FileStorage &fs) const

Static Public Member Functions

static cv::Ptr< Cameraread (const cv::FileNode &node)

Protected Attributes

cv::Vec< double, 6 > radial_dist_
 used to store radial dist parameters ( /f$k_1/f$ to /f$k_6/f$ )
unsigned char nb_radial_params_
 number of radial dist parameters ( 0, 2, 3 or 6 )
cv::Vec< double, 2 > tangential_dist_
 used to store tangential dist parameters ( /f$p_1/f$ and /f$p_2/f$ )
unsigned char nb_tangent_params_
 N umbers of tangeancial distorition parameters (0, 1 or 2)
cv::Mat distortionVector
 vector of distortion coefficients ( k_1, k_2, p_1, p_2[ , k_3[ , k_4, k_5, k_6 ]] ) of 4, 5 or 8 elements

Detailed Description

This class represent the physical device which take the pictures. It is not related to a 3D position which is the role of the PointOfView class. The role of the class is to store intra parameters and radial distortion.

So this class is devoted to the conversion between 3D points ( using camera coordinate ) and 2D points ( using image coordinate ) using the methods convertFromImageTo3Dray or convertFrom3DToImage

Definition at line 24 of file CameraPinholeDistor.h.


Constructor & Destructor Documentation

OpencvSfM::CameraPinholeDistor::CameraPinholeDistor ( cv::Mat  intra_params = cv::Mat::eye( 3, 3, CV_64F ),
cv::Vec6d  radial_dist = cv::Vec6d( 0.0,0.0,0.0,0.0,0.0,0.0 ),
unsigned char  nbRadialParam = 6,
cv::Vec2d  tangential_dist = cv::Vec2d( 0.0,0.0 ),
int  img_w = 640,
int  img_h = 480,
unsigned char  wantedEstimation = FOCAL_PARAM|SKEW_PARAM|PRINCIPAL_POINT_PARAM|RADIAL_PARAM|TANGEANT_PARAM 
)

Constructor with ( or not ) intra parameters.

Parameters:
intra_paramsmatrix of intra parameters ( 3*3 )
radial_distradial dist parameters ( /f$k_1/f$ to /f$k_6/f$ )
nbRadialParamnumber of radial dist parameters ( 0, 2, 3 or 6 )
tangential_disttangential dist parameters ( /f$p_1/f$ and /f$p_2/f$ )
img_wwidth of images the camera produce
img_hheight of images the camera produce
wantedEstimationvalues which need an estimation

Definition at line 12 of file CameraPinholeDistor.cpp.

Referenced by read().

OpencvSfM::CameraPinholeDistor::CameraPinholeDistor ( const std::vector< std::vector< cv::Point3f > > &  objectPoints,
const std::vector< std::vector< cv::Point2f > > &  imagePoints,
cv::Size  imageSize,
double  aspectRatio = 1.,
cv::Vec6d  radial_dist = cv::Vec6d( 0.0,0.0,0.0,0.0,0.0,0.0 ),
unsigned char  nbRadialParam = 6,
cv::Vec2d  tangential_dist = cv::Vec2d( 0.0,0.0 ),
int  img_w = 640,
int  img_h = 480,
unsigned char  wantedEstimation = FOCAL_PARAM|SKEW_PARAM|PRINCIPAL_POINT_PARAM|RADIAL_PARAM|TANGEANT_PARAM 
)

Constructor where initial camera matrix is computed from the 3D-2D point correspondences. Currently, the function only supports planar calibration patterns, i.e. patterns where each object point has z-coordinate =0.

Parameters:
objectPointsThe vector of vectors of the object points. See http://opencv.willowgarage.com/documentation/cpp/calib3d_camera_calibration_and_3d_reconstruction.html#cv-calibratecamera
imagePointsThe vector of vectors of the corresponding image points. See http://opencv.willowgarage.com/documentation/cpp/calib3d_camera_calibration_and_3d_reconstruction.html#cv-calibratecamera
imageSizeThe image size in pixels; used to initialize the principal point
aspectRatioIf it is zero or negative, both $f_x$ and $f_y$ are estimated independently. Otherwise $f_x=f_y * aspectRatio$
radial_distradial dist parameters ( /f$k_1/f$ to /f$k_6/f$ )
nbRadialParamnumber of radial dist parameters ( 0, 2, 3 or 6 )
tangential_disttangential dist parameters ( /f$p_1/f$ and /f$p_2/f$ )
img_wwidth of images the camera produce
img_hheight of images the camera produce
wantedEstimationvalues which need an estimation

Definition at line 21 of file CameraPinholeDistor.cpp.


Member Function Documentation

std::vector< cv::Vec4d > OpencvSfM::CameraPinholeDistor::convertFromImageTo3Dray ( std::vector< cv::Vec3d >  points) [virtual]

This method can transform points from image to 3D rays

Reimplemented from OpencvSfM::CameraPinhole.

Definition at line 87 of file CameraPinholeDistor.cpp.

uchar OpencvSfM::CameraPinholeDistor::getNbMissingParams ( ) const [virtual]

use this function to know which parameters are missing

Returns:
numbers of parameters needed for this camera

Reimplemented from OpencvSfM::CameraPinhole.

Definition at line 38 of file CameraPinholeDistor.cpp.

vector< Vec2d > OpencvSfM::CameraPinholeDistor::normImageToPixelCoordinates ( std::vector< cv::Vec2d >  points) const [virtual]

This method can convert 2D points from normalized image coordinates to 2D points in pixel image coordinates

Parameters:
points2D points in normalized image homogeneous coordinates.
Returns:
2D points in pixel image coordinates.

Reimplemented from OpencvSfM::CameraPinhole.

Definition at line 103 of file CameraPinholeDistor.cpp.

vector< Vec2d > OpencvSfM::CameraPinholeDistor::pixelToNormImageCoordinates ( std::vector< cv::Vec2d >  points) const [virtual]

This method can convert 2D points from pixel image coordinates to 2D points in normalized image coordinates

Parameters:
points2D points in pixel image homogeneous coordinates.
Returns:
2D points in normalized image homogeneous coordinates.

Reimplemented from OpencvSfM::CameraPinhole.

Definition at line 94 of file CameraPinholeDistor.cpp.

cv::Ptr< Camera > OpencvSfM::CameraPinholeDistor::read ( const cv::FileNode &  node) [static]

Create a new camera from a YAML file.

Parameters:
nodePreviously opened YAML file node

Reimplemented from OpencvSfM::CameraPinhole.

Definition at line 145 of file CameraPinholeDistor.cpp.

Referenced by OpencvSfM::PointOfView::read().

void OpencvSfM::CameraPinholeDistor::updateDistortionParameters ( const cv::Vec6d &  radial_dist,
unsigned char  nbRadialParam,
const cv::Vec2d &  tangential_dist,
unsigned char  wantedEstimation = RADIAL_PARAM|TANGEANT_PARAM 
)

this method can be used to update the intra parameters.

Parameters:
radial_distvalues of the new radial distortions parameters
nbRadialParamnumber of radial dist parameters ( 0, 2, 3 or 6 )
tangential_distvalues of the new tangential distortions parameters
wantedEstimationvalues which need an estimation

Definition at line 54 of file CameraPinholeDistor.cpp.

Referenced by CameraPinholeDistor().

void OpencvSfM::CameraPinholeDistor::updateIntrinsic ( double *  values,
uchar  nbVal,
bool  add_to_intra 
) [virtual]

This method modify the intra parameters of the camera

Parameters:
valuesarray of intra parameters (order corresponds to SBA) K( 0,0 ) -> values[0] K( 2,0 ) -> values[1], K( 2,1 ) -> values[2], K( 1,1 )/K( 0,0 ) -> values[3] K( 1,0 ) -> values[4]
nbValnb values into array...
add_to_intraif true, the vector is the delta to apply to each intra values

Reimplemented from OpencvSfM::CameraPinhole.

Definition at line 48 of file CameraPinholeDistor.cpp.

void OpencvSfM::CameraPinholeDistor::write ( cv::FileStorage &  fs) const [virtual]

Save the camera intra parameters into a YAML file.

Parameters:
fsPreviously opened YAML file node

Reimplemented from OpencvSfM::CameraPinhole.

Definition at line 178 of file CameraPinholeDistor.cpp.


The documentation for this class was generated from the following files:
 All Classes Functions Variables