GSoC2011SfM
0.1
Google Summer of Code 2011: Structure from motion
|
00001 #ifndef _GSOC_SFM_CAMERA_H 00002 #define _GSOC_SFM_CAMERA_H 1 00003 00004 #include "macro.h" //SFM_EXPORTS 00005 00006 #include "opencv2/core/core.hpp" 00007 #include <vector> 00008 00009 namespace OpencvSfM{ 00010 class PointOfView;//We will need this class, but PointOfView need our class too... 00011 00012 00048 class SFM_EXPORTS Camera 00049 { 00050 friend class PointOfView;//PointOfView is a good friend of Camera as it's intimately related! 00051 protected: 00052 00053 int img_width; 00054 int img_height; 00055 00056 std::vector<PointOfView*> pointsOfView_; 00057 00062 Camera( int img_w=640, int img_h=480 ); 00063 public: 00064 virtual ~Camera( void ); 00069 virtual uchar getNbMissingParams( ) const{return 0;}; 00074 virtual const std::vector<PointOfView*> getRelatedViews( ) const { 00075 return pointsOfView_; 00076 }; 00080 int getImgWidth() const { return img_width;}; 00084 int getImgHeight() const { return img_height;}; 00088 virtual std::vector<cv::Vec4d> convertFromImageTo3Dray( std::vector<cv::Vec3d> points ) =0;//we don't know how this transformation can be done, so pure virtual 00089 00095 virtual std::vector<cv::Vec2d> pixelToNormImageCoordinates( 00096 std::vector<cv::Vec2d> points ) const=0; 00102 virtual std::vector<cv::Vec2d> normImageToPixelCoordinates( 00103 std::vector<cv::Vec2d> points ) const=0; 00108 virtual cv::Mat getIntraMatrix( ) const 00109 {return cv::Mat::eye( 3,3,CV_64FC1 );}; 00110 00122 virtual void updateIntrinsic( double* values, uchar nbVal, bool add_to_intra ) {}; 00123 00128 virtual double getFocal( ) const=0; 00129 00134 static cv::Ptr<Camera> read( const cv::FileNode& node ); 00135 00140 virtual void write( cv::FileStorage& fs ) const = 0; 00141 00142 }; 00143 00144 } 00145 00146 #endif