Go to the documentation of this file.00001
00024 #ifndef __BUNDLE_CAMERA__
00025 #define __BUNDLE_CAMERA__
00026
00027 #include <vector>
00028 #include <opencv/cv.h>
00029 #include <string>
00030 #include <fstream>
00031
00032 namespace DVision {
00033 namespace Bundle {
00034
00035 class CameraFile
00036 {
00037 public:
00038
00042 class Camera
00043 {
00044 public:
00045 float f, k1, k2;
00046 cv::Mat R;
00047 cv::Mat t;
00048
00049 public:
00053 Camera(){}
00054
00059 Camera(const std::string &filename)
00060 {
00061 load(filename);
00062 }
00063
00069 void save(const std::string &filename,
00070 const std::string &comment = "") const;
00071
00076 void load(const std::string &filename);
00077
00078 protected:
00079 friend class CameraFile;
00080
00086 void save(std::fstream &f) const;
00087
00093 void load(std::fstream &f);
00094
00095 };
00096
00097 public:
00103 static void readFile(const std::string &filename,
00104 std::vector<Camera> &cameras);
00105
00111 static void saveFile(const std::string &filename,
00112 const std::vector<Camera> &cameras);
00113
00114 protected:
00115
00122 static void readFromStream(std::fstream &f, int N,
00123 std::vector<Camera> &cameras);
00124
00130 static void saveToStream(std::fstream &f,
00131 const std::vector<Camera> &cameras);
00132
00133 };
00134
00135 }
00136 }
00137
00138 #endif
00139