![]()  | 
  
  
  
    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 only intra parameters ( without radial distortion ) More...
#include <CameraPinhole.h>
  
 Public Member Functions | |
| CameraPinhole (cv::Mat intra_params=cv::Mat::eye(3, 3, CV_64F), int img_w=640, int img_h=480, unsigned char wantedEstimation=FOCAL_PARAM|SKEW_PARAM|PRINCIPAL_POINT_PARAM) | |
| CameraPinhole (const std::vector< std::vector< cv::Point3f > > &objectPoints, const std::vector< std::vector< cv::Point2f > > &imagePoints, cv::Size imageSize, double aspectRatio=1., int img_w=640, int img_h=480, unsigned char wantedEstimation=FOCAL_PARAM|SKEW_PARAM|PRINCIPAL_POINT_PARAM) | |
| virtual uchar | getNbMissingParams () const | 
| virtual void | updateIntrinsic (double *values, uchar nbVal, bool add_to_intra) | 
| void | updateIntrinsicMatrix (cv::Mat newParams, unsigned char intraValues=FOCAL_PARAM|SKEW_PARAM|PRINCIPAL_POINT_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 cv::Mat | getIntraMatrix () const | 
| virtual double | getFocal () const | 
| virtual void | write (cv::FileStorage &fs) const | 
Static Public Member Functions | |
| static cv::Ptr< Camera > | read (const cv::FileNode &node) | 
Protected Attributes | |
| cv::Mat | intra_params_ | 
| store intra parameters( 3*3 matrix ). This matrix contains focal informations, principal point coordinates and skew of axis  | |
| cv::Mat | inv_intra_params_ | 
| This is the inverse transformation of intra_params_. Used to speed up calculus...  | |
| unsigned char | estimation_needed_ | 
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 only intra parameters ( without 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 CameraPinhole.h.
| OpencvSfM::CameraPinhole::CameraPinhole | ( | cv::Mat | intra_params = cv::Mat::eye( 3, 3, CV_64F ),  | 
        
| int | img_w = 640,  | 
        ||
| int | img_h = 480,  | 
        ||
| unsigned char | wantedEstimation = FOCAL_PARAM|SKEW_PARAM|PRINCIPAL_POINT_PARAM  | 
        ||
| ) | 
Constructor with ( or not ) intra parameters.
| intra_params | matrix of intra parameters ( 3*3 ) | 
| 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 CameraPinhole.cpp.
Referenced by read().
| OpencvSfM::CameraPinhole::CameraPinhole | ( | const std::vector< std::vector< cv::Point3f > > & | objectPoints, | 
| const std::vector< std::vector< cv::Point2f > > & | imagePoints, | ||
| cv::Size | imageSize, | ||
| double | aspectRatio = 1.,  | 
        ||
| int | img_w = 640,  | 
        ||
| int | img_h = 480,  | 
        ||
| unsigned char | wantedEstimation = FOCAL_PARAM|SKEW_PARAM|PRINCIPAL_POINT_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    | 
| 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 24 of file CameraPinhole.cpp.
| vector< Vec4d > OpencvSfM::CameraPinhole::convertFromImageTo3Dray | ( | std::vector< cv::Vec3d > | points | ) |  [virtual] | 
        
This method can transform points from image to 3D rays
Implements OpencvSfM::Camera.
Reimplemented in OpencvSfM::CameraPinholeDistor.
Definition at line 112 of file CameraPinhole.cpp.
| double OpencvSfM::CameraPinhole::getFocal | ( | ) |  const [virtual] | 
        
This method retrive the focal from Intrinsic matrix. It's not using pixel reference but using camera reference!
Implements OpencvSfM::Camera.
Definition at line 167 of file CameraPinhole.cpp.
| virtual cv::Mat OpencvSfM::CameraPinhole::getIntraMatrix | ( | ) |  const [inline, virtual] | 
        
This method return the intra parameters of the camera
Reimplemented from OpencvSfM::Camera.
Definition at line 108 of file CameraPinhole.h.
Referenced by OpencvSfM::CameraPinholeDistor::read().
| uchar OpencvSfM::CameraPinhole::getNbMissingParams | ( | ) |  const [virtual] | 
        
use this function to know which parameters are missing
Reimplemented from OpencvSfM::Camera.
Reimplemented in OpencvSfM::CameraPinholeDistor.
Definition at line 42 of file CameraPinhole.cpp.
| vector< Vec2d > OpencvSfM::CameraPinhole::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. | 
Implements OpencvSfM::Camera.
Reimplemented in OpencvSfM::CameraPinholeDistor.
Definition at line 148 of file CameraPinhole.cpp.
| vector< Vec2d > OpencvSfM::CameraPinhole::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. | 
Implements OpencvSfM::Camera.
Reimplemented in OpencvSfM::CameraPinholeDistor.
Definition at line 118 of file CameraPinhole.cpp.
| cv::Ptr< Camera > OpencvSfM::CameraPinhole::read | ( | const cv::FileNode & | node | ) |  [static] | 
        
Create a new camera from a YAML file.
| node | Previously opened YAML file node | 
Reimplemented from OpencvSfM::Camera.
Reimplemented in OpencvSfM::CameraPinholeDistor.
Definition at line 199 of file CameraPinhole.cpp.
Referenced by OpencvSfM::PointOfView::read().
| void OpencvSfM::CameraPinhole::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::Camera.
Reimplemented in OpencvSfM::CameraPinholeDistor.
Definition at line 54 of file CameraPinhole.cpp.
| void OpencvSfM::CameraPinhole::updateIntrinsicMatrix | ( | cv::Mat | newParams, | 
| unsigned char | intraValues = FOCAL_PARAM|SKEW_PARAM|PRINCIPAL_POINT_PARAM  | 
        ||
| ) | 
this method can be used to update the intra parameters.
| newParams | matrix of new parameters ( 3*3 ) | 
| intraValues | values which are useful in matrix | 
Definition at line 81 of file CameraPinhole.cpp.
| void OpencvSfM::CameraPinhole::write | ( | cv::FileStorage & | fs | ) |  const [virtual] | 
        
Save the camera intra parameters into a YAML file.
| fs | Previously opened YAML file node | 
Implements OpencvSfM::Camera.
Reimplemented in OpencvSfM::CameraPinholeDistor.
Definition at line 219 of file CameraPinhole.cpp.
unsigned char OpencvSfM::CameraPinhole::estimation_needed_ [protected] | 
        
This attribut is used to know what we should estimate... Example: if equal to 0, nothing should be estimated... If equal to 3, focal and skew should be estimated ( FOCAL_PARAM + SKEW_PARAM )
Definition at line 34 of file CameraPinhole.h.
Referenced by CameraPinhole(), getNbMissingParams(), OpencvSfM::CameraPinholeDistor::getNbMissingParams(), OpencvSfM::CameraPinholeDistor::updateDistortionParameters(), and write().
 1.7.5.1