27 #ifndef __CameraParameter_inc__
28 #define __CameraParameter_inc__
29 #include <bias_config.h>
30 #include <Base/Common/BIASpragmaStart.hh>
31 #include <Geometry/ProjectionParametersIO.hh>
35 #include <Base/Debug/Error.hh>
37 # include <Base/Common/XMLIO.hh>
40 #include <Base/Math/Vector2.hh>
41 #include <Base/Geometry/KMatrix.hh>
43 #define CAMERA_PARAMETER_CURRENT_XML_VERSION 2.0
61 #endif //BIAS_HAVE_XML2
69 void InitPerspective(
const std::string CamModel,
const int CamID,
71 const int imgWidth,
const int imgHeight,
72 const double principalX,
const double principalY,
73 const double focallength,
74 const double aspectratio,
75 const double k1,
const double k2,
76 const double k3,
const double k4,
77 const std::vector<double> &IlluCorrX,
78 const std::vector<double> &IlluCorrY);
79 void InitSpherical(
const std::string CamModel,
const int CamID,
80 const std::string LensModel,
81 const int imgWidth,
const int imgHeight,
82 const double principalX,
const double principalY,
84 const std::vector<double> &AngleCorrX,
85 const std::vector<double> &AngleCorrY,
86 const std::vector<double> &IlluCorrX,
87 const std::vector<double> &IlluCorrY);
91 int Init(
const std::string &filename);
93 int Init(
XMLIO &myXML, xmlNodePtr &cameraNode);
98 void SetZoomCamera(
const bool zoomCam);
102 bool IsZoomCamera()
const;
107 void SetZoom(
const double abszoom);
112 void SetFocalLength(
const double f);
122 double GetZoom()
const;
126 double GetFocalLength()
const;
131 void SetCellSize(
const double CellSizeX,
const double AspectRatio);
138 void SetPrincipal(
const double x,
const double y);
147 void SetDownsampling(
const double factor);
149 double GetDownsamplingFactor();
153 unsigned int GetWidth()
const;
156 unsigned int GetHeight()
const;
159 return cd_.aspectratio_;
164 cd_.width_ =w; cd_.height_ = h; }
168 double GetPrincipalX()
const;
171 double GetPrincipalY()
const;
184 return cd_. radius_/downsamplingFactor_+0.000000001;
191 if (!IsSpherical()) {
192 BIASERR(
"Can notset radius for perspective camera");
202 double& kc1,
double& kc2,
203 double& kc3,
double& kc4)
const
205 f = cd_.focallengthDef_/downsamplingFactor_+0.000000001;
213 std::vector<CPDiscreteParam>::const_iterator it;
215 vp.reserve(cd_.knownparams_vect_.size());
216 for (it=cd_.knownparams_vect_.begin();
217 it!=cd_.knownparams_vect_.end();it++) {
225 return cd_.aspectratio_;
233 return cd_.AngleCorrX_;
236 return cd_.AngleCorrY_;
239 return cd_.IlluCorrX_;
242 return cd_.IlluCorrY_;
245 #ifdef BIAS_HAVE_XML2
250 int WriteCameraData(
const std::string& Filename)
const;
264 int ReadCameraData(
const std::string& Filename);
271 #endif //BIAS_HAVE_XML2
274 void SetData_EVID31_147094();
275 void SetData_OMNITECH_ORIFL_190_3();
280 int ReadFromEXIF(
const std::string& filename);
282 void DebugOut()
const;
305 double InterpolateFocalLength_();
306 double InterpolateAbsZoom_();
318 #include <Base/Common/BIASpragmaEnd.hh>
double SetRadius(double r)
void GetZoomUndistortion(std::vector< CPDiscreteParam > &vp) const
std::vector< double > GetAngleCorrX() const
double downsamplingFactor_
double GetAspectRatio() const
Wrapper class for reading and writing XML files based on the XML library libxml2. ...
std::vector< double > GetAngleCorrY() const
void SetCameraData(const CameraData &cd)
enum BIAS::LensModel_e LensModel
std::vector< double > GetIlluCorrY() const
std::vector< double > GetIlluCorrX() const
K describes the mapping from world coordinates (wcs) to pixel coordinates (pcs).
double GetAspectratio() const
const CameraData GetCameraData() const
bool IsPerspective() const
void SetSize(unsigned int w, unsigned int h)
set size of image seperatly
void GetDefaultUndistortion(double &f, double &kc1, double &kc2, double &kc3, double &kc4) const