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 device related informations like intra parameters, radial and tangential distotion. This abstract class is not related to a type of camera ( fish eyes... ) More...
#include <Camera.h>
Public Member Functions | |
virtual uchar | getNbMissingParams () const |
virtual const std::vector < PointOfView * > | getRelatedViews () const |
int | getImgWidth () const |
int | getImgHeight () const |
virtual std::vector< cv::Vec4d > | convertFromImageTo3Dray (std::vector< cv::Vec3d > points)=0 |
virtual std::vector< cv::Vec2d > | pixelToNormImageCoordinates (std::vector< cv::Vec2d > points) const =0 |
virtual std::vector< cv::Vec2d > | normImageToPixelCoordinates (std::vector< cv::Vec2d > points) const =0 |
virtual cv::Mat | getIntraMatrix () const |
virtual void | updateIntrinsic (double *values, uchar nbVal, bool add_to_intra) |
virtual double | getFocal () const =0 |
virtual void | write (cv::FileStorage &fs) const =0 |
Static Public Member Functions | |
static cv::Ptr< Camera > | read (const cv::FileNode &node) |
Protected Member Functions | |
Camera (int img_w=640, int img_h=480) | |
Protected Attributes | |
int | img_width |
Width of the images taken by this camera. | |
int | img_height |
Height of the images taken by this camera. | |
std::vector< PointOfView * > | pointsOfView_ |
vector of the differents positions of the camera. | |
Friends | |
class | PointOfView |
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 device related informations like intra parameters, radial and tangential distotion. This abstract class is not related to a type of camera ( fish eyes... )
This class can be used to store device related informations like intra parameters, radial and tangential distortion. If we use the so-called pinhole camera model, a scene view is formed by projecting 3D points into the image plane using a perspective transformation. Usual notation says that a point [ u,v ] from an image is related to the point [ X,Y,Z ] using the following notation :
This leads to the following relation between local coordinates and global ones:
Additionnal radial and tangeancial distortion are modelized like this:
radial_dist_ can be used to store to tangential_dist_ can be used to store and
So this class is devoted to the conversion between 2D points from pixel image coordinates and 2D points in normalized image coordinates, or ray projection using intra parameters.
OpencvSfM::Camera::Camera | ( | int | img_w = 640 , |
int | img_h = 480 |
||
) | [protected] |
As this class is virtual, we can't create a new empty camera...
img_w | width of images the camera produce |
img_h | height of images the camera produce |
Definition at line 10 of file Camera.cpp.
virtual std::vector<cv::Vec4d> OpencvSfM::Camera::convertFromImageTo3Dray | ( | std::vector< cv::Vec3d > | points | ) | [pure virtual] |
This method can transform points from image to 3D rays ( homogeneous coordinates )
Implemented in OpencvSfM::CameraPinholeDistor, and OpencvSfM::CameraPinhole.
virtual double OpencvSfM::Camera::getFocal | ( | ) | const [pure virtual] |
This method is useful to get the focal from Intrinsic matrix:
Implemented in OpencvSfM::CameraPinhole.
int OpencvSfM::Camera::getImgHeight | ( | ) | const [inline] |
int OpencvSfM::Camera::getImgWidth | ( | ) | const [inline] |
virtual cv::Mat OpencvSfM::Camera::getIntraMatrix | ( | ) | const [inline, virtual] |
This method return the intra parameters of the camera
Reimplemented in OpencvSfM::CameraPinhole.
virtual uchar OpencvSfM::Camera::getNbMissingParams | ( | ) | const [inline, virtual] |
use this function to know which parameters are missing
Reimplemented in OpencvSfM::CameraPinholeDistor, and OpencvSfM::CameraPinhole.
virtual const std::vector<PointOfView*> OpencvSfM::Camera::getRelatedViews | ( | ) | const [inline, virtual] |
virtual std::vector<cv::Vec2d> OpencvSfM::Camera::normImageToPixelCoordinates | ( | std::vector< cv::Vec2d > | points | ) | const [pure 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. |
Implemented in OpencvSfM::CameraPinholeDistor, and OpencvSfM::CameraPinhole.
virtual std::vector<cv::Vec2d> OpencvSfM::Camera::pixelToNormImageCoordinates | ( | std::vector< cv::Vec2d > | points | ) | const [pure 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. |
Implemented in OpencvSfM::CameraPinholeDistor, and OpencvSfM::CameraPinhole.
cv::Ptr< Camera > OpencvSfM::Camera::read | ( | const cv::FileNode & | node | ) | [static] |
Create a new camera from a YAML file.
node | Previously opened YAML file node |
Reimplemented in OpencvSfM::CameraPinhole, and OpencvSfM::CameraPinholeDistor.
Definition at line 20 of file Camera.cpp.
virtual void OpencvSfM::Camera::updateIntrinsic | ( | double * | values, |
uchar | nbVal, | ||
bool | add_to_intra | ||
) | [inline, 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 in OpencvSfM::CameraPinholeDistor, and OpencvSfM::CameraPinhole.
virtual void OpencvSfM::Camera::write | ( | cv::FileStorage & | fs | ) | const [pure virtual] |
Save the camera intra parameters into a YAML file.
fs | Previously opened YAML file node |
Implemented in OpencvSfM::CameraPinhole, and OpencvSfM::CameraPinholeDistor.