GSoC2011SfM
0.1
Google Summer of Code 2011: Structure from motion
|
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>
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< Camera > | read (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 |
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.
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.
intra_params | matrix of intra parameters ( 3*3 ) |
radial_dist | radial dist parameters ( /f$k_1/f$ to /f$k_6/f$ ) |
nbRadialParam | number of radial dist parameters ( 0, 2, 3 or 6 ) |
tangential_dist | tangential dist parameters ( /f$p_1/f$ and /f$p_2/f$ ) |
img_w | width of images the camera produce |
img_h | height of images the camera produce |
wantedEstimation | values 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.
objectPoints | The vector of vectors of the object points. See http://opencv.willowgarage.com/documentation/cpp/calib3d_camera_calibration_and_3d_reconstruction.html#cv-calibratecamera |
imagePoints | The vector of vectors of the corresponding image points. See http://opencv.willowgarage.com/documentation/cpp/calib3d_camera_calibration_and_3d_reconstruction.html#cv-calibratecamera |
imageSize | The image size in pixels; used to initialize the principal point |
aspectRatio | If it is zero or negative, both and are estimated independently. Otherwise |
radial_dist | radial dist parameters ( /f$k_1/f$ to /f$k_6/f$ ) |
nbRadialParam | number of radial dist parameters ( 0, 2, 3 or 6 ) |
tangential_dist | tangential dist parameters ( /f$p_1/f$ and /f$p_2/f$ ) |
img_w | width of images the camera produce |
img_h | height of images the camera produce |
wantedEstimation | values which need an estimation |
Definition at line 21 of file CameraPinholeDistor.cpp.
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
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
points | 2D points in normalized image homogeneous 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
points | 2D points in pixel 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.
node | Previously 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.
radial_dist | values of the new radial distortions parameters |
nbRadialParam | number of radial dist parameters ( 0, 2, 3 or 6 ) |
tangential_dist | values of the new tangential distortions parameters |
wantedEstimation | values 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
values | array 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] |
nbVal | nb values into array... |
add_to_intra | if 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.
fs | Previously opened YAML file node |
Reimplemented from OpencvSfM::CameraPinhole.
Definition at line 178 of file CameraPinholeDistor.cpp.