26 #ifndef __BIAS_ProjectionParametersDynamicLoad_hh__
27 #define __BIAS_ProjectionParametersDynamicLoad_hh__
28 #include "bias_config.h"
30 #include <Base/Common/BIASpragmaStart.hh>
31 #include <Geometry/ProjectionParametersBase.hh>
50 const unsigned int height = 0)
60 const unsigned int height = 0)
65 className_ = className;
159 double& minPhi,
double& maxPhi,
double& centerPhi,
160 double& minTheta,
double& maxTheta);
168 return dynptr_->GetMinimalAngularSamplingStep(minAngleStep);
173 return dynptr_->DoExtrinsicsDiffer(p);
187 bool IgnoreDistortion =
false)
const{
188 return dynptr_->DoesPointProjectIntoImage(X, x, IgnoreDistortion);
199 bool IgnoreDistortion =
false)
const;
208 bool IgnoreDistortion =
false)
const {
209 return dynptr_->Project(X, IgnoreDistortion);
222 bool IgnoreDistortion =
false)
const {
224 return dynptr_->Project(X, p2d, IgnoreDistortion);
236 bool IgnoreDistortion =
false)
const;
251 bool IgnoreDistortion =
false)
const;
264 const double& depth = 1.0,
265 bool IgnoreDistortion =
false)
const;
274 bool IgnoreDistortion =
false,
bool Normalize =
false);
285 dynptr_->UnProjectToRay(pos, pointOnRay, direction, IgnoreDistortion);
291 bool IgnoreDistortion=
false)
const
293 dynptr_->UnProjectToRay(pos, pointOnRay, direction, proj, IgnoreDistortion);
302 bool IgnoreDistortion =
false)
const{
303 return dynptr_->UnProjectToPoint(pos, depth, IgnoreDistortion);
308 bool IgnoreDistortion =
false)
const{
310 return dynptr_->UnProjectToPoint(pos, depth, proj, IgnoreDistortion);
320 bool IgnoreDistortion =
false)
const{
322 return dynptr_->UnProjectToPointLocal(pos, depth, IgnoreDistortion);
353 const bool homogenized =
true)
const{
354 return dynptr_->GetUnProjectionJacobian(x, Jac, homogenized);
362 return dynptr_->GetC();
368 return dynptr_->GetQ();
375 return dynptr_->GetCQ();
380 return dynptr_->GetR();
385 return dynptr_->GetCov();
391 return dynptr_->GetPose();
397 return dynptr_->GetPoseParametrization();
402 { dynptr_->SetPoseParametrization(pp); }
407 return dynptr_->GetExternals();
411 virtual inline int GetImageSize(
unsigned int& Width,
unsigned int& Height)
const {
412 return dynptr_->GetImageSize(Width, Height);
423 return dynptr_->GetImageWidth();
434 return dynptr_->GetImageHeight();
438 return dynptr_->GetIdentifier();
442 return dynptr_->GetVideoSourceType();
447 return dynptr_->GetAspectratio();
451 virtual inline int GetPrincipal(
double& PrincipalX,
double& PrincipalY)
const {
452 return dynptr_->GetPrincipal(PrincipalX, PrincipalY);
460 dynptr_->SetAspectratio(AspectRatio);
466 dynptr_->SetPrincipal(x, y);
471 const unsigned int h) {
472 dynptr_->SetImageSize(w, h);
477 dynptr_->SetIdentifier(name);
482 dynptr_->SetVideoSourceType(name);
492 virtual void Rescale(
double ratio,
const double offset = 0.0){
493 dynptr_->Rescale(ratio, offset);
502 virtual void Rescale(
unsigned int width,
unsigned int height){
503 dynptr_->Rescale(width, height);
513 { dynptr_->SetQ(Q); }
517 { dynptr_->SetC(C); }
522 { dynptr_->SetQC(Q, C); }
526 { dynptr_->SetPose(pose); }
535 { dynptr_->SetCov(Cov); }
538 virtual inline bool CValid()
const {
return dynptr_->CValid(); }
541 virtual inline bool QValid()
const {
return dynptr_->QValid(); }
545 {
return dynptr_->PoseValid(); }
549 { dynptr_->InvalidatePose(); }
553 dynptr_->ValidatePose();
577 const double& maxangle = 1.4)
const{
578 return dynptr_->GetFakeKMatrix(imgsize, resolution, maxangle);
581 const double& maxangle = 1.4)
const{
582 return dynptr_->GetFakeKMatrix(resolution, maxangle);
592 return dynptr_->ViewDifference(pPPB);
595 #ifdef BIAS_HAVE_XML2
597 virtual int XMLGetClassName(std::string& TopLevelTag,
598 double& Version)
const;
601 virtual int XMLOut(
const xmlNodePtr Node,
XMLIO& XMLObject)
const;
604 virtual int XMLIn(
const xmlNodePtr Node,
XMLIO& XMLObject);
613 return dynptr_->Transform_(src, dst);
633 std::map<std::string, maker_t, std::less<std::string> >
factory_;
645 os <<
"ProjectionParametersDynamicLoad:" << std::endl;
646 os << *(p.
dynptr_) << std::endl;
654 #include <Base/Common/BIASpragmaEnd.hh>
virtual void SetR(const BIAS::RMatrix &R)
Set orientation from rotation matrix R.
can load exernally programmed child classes of ProjectionParametersBase
virtual bool QValid() const
Check if current orientation is valid.
virtual void SetQC(const BIAS::Quaternion< double > &Q, const BIAS::Vector3< double > &C)
Set pose from unit quaternion Q and projection center C.
virtual const unsigned int & GetImageHeight() const
Returns the image height.
virtual bool PoseValid() const
Check if current pose is valid.
virtual HomgPoint3D UnProjectToPoint(const HomgPoint2D &pos, double depth, bool IgnoreDistortion=false) const
calculates a 3D point in the global (not the rig) coordinate system, which belongs to the image posit...
virtual void SetPose(const BIAS::Pose pose)
Set pose from pose object.
virtual Vector3< double > UnProjectToPointLocal(const HomgPoint2D &pos, const double &depth, bool IgnoreDistortion=false) const
calculates a 3D point in the local camera coordinate system, which belongs to the image position pos ...
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
virtual BIAS::RMatrix GetR() const
Get orientation as rotation matrix R.
virtual BIAS::KMatrix GetFakeKMatrix(double &imgsize, int resolution=0, const double &maxangle=1.4) const
Returns a fake KMatrix for the camera.
ProjectionParametersDynamicLoad(const std::string &className, const unsigned int width=0, const unsigned int height=0)
virtual bool CValid() const
Check of current projection center is valid.
virtual void SetAspectratio(const double AspectRatio)
Set CCD aspect ratio (i.e.
virtual ProjectionParametersBase * Clone() const =0
Covariant virtual copy constructor used in BIAS::Projection.
virtual void UnProjectToRay(const HomgPoint2D &pos, Vector3< double > &pointOnRay, Vector3< double > &direction, bool IgnoreDistortion=false) const
calculates the viewing ray in the global coordinate frame from the camera center which belongs to the...
virtual BIAS::Quaternion< double > GetQ() const
Get orientation as unit quaternion.
virtual int Transform_(const Vector< double > &src, Vector< double > &dst) const
Worker function for Unscented Transform.
virtual BIAS::Vector< double > GetCQ() const
Return pose as 7 vector (first projection center C, then unit quaternion Q representing orientation)...
Slim class bundeling pose parametrization and associated covariance matrix.
virtual BIAS::Matrix3x4< double > GetExternals() const
Return cached 3x4 representation of external matrix [R|C].
virtual void SetPoseParametrization(const BIAS::PoseParametrization &pp)
Set pose from pose parametrization.
ProjectionParametersDynamicLoad & operator=(const ProjectionParametersDynamicLoad &P)
virtual ProjectionParametersBase * Clone() const
Covariant virtual copy constructor used in BIAS::Projection.
virtual int Project(const HomgPoint3D &X, HomgPoint2D &p2d, bool IgnoreDistortion=false) const
calculates the projection of a point in the world coordinate system to a pixel in the image plane of ...
virtual HomgPoint3D UnProjectToPoint(const HomgPoint2D &pos, const double depth, const ProjectionParametersBase &proj, bool IgnoreDistortion=false) const
virtual int GetImageSize(unsigned int &Width, unsigned int &Height) const
Obtain image dimensions.
Represents 3d pose transformations, parametrized as Euclidean translation and unit quaternion orienta...
void SetClassName(std::string &name)
Wrapper class for reading and writing XML files based on the XML library libxml2. ...
virtual BIAS::Matrix< POSE_TYPE > GetCov() const
Return pose covariance as 7x7 matrix with respect to C, Q.
virtual bool DoesPointProjectIntoImage(const HomgPoint3D &X, HomgPoint2D &x, bool IgnoreDistortion=false) const
Checks if 3D point projects into specified image and returns belonging 2D image point.
virtual void SetQ(const BIAS::Quaternion< double > &Q)
Set orientation from unit quaternion Q.
virtual int GetUnProjectionJacobian(const HomgPoint2D &x, Matrix2x2< double > &Jac, const bool homogenized=true) const
Get warp (local magnification/shear/...) when going from the real image to ideal image with focal len...
virtual void Rescale(unsigned int width, unsigned int height)
adapt internal parameters to new image size
virtual double GetAspectratio() const
Return aspectratio (i.e.
virtual void ValidatePose()
Validate currently set pose.
virtual void SetPrincipal(const double x, const double y)
Set principal point (in pixels relative to top left corner).
virtual void SetC(const BIAS::Vector3< double > &C)
Set projection center.
virtual std::string GetIdentifier() const
virtual void Rescale(double ratio, const double offset=0.0)
Adapt internal parameters to resampled image.
std::vector< std::string > libPaths_
virtual const bool DoExtrinsicsDiffer(const ProjectionParametersBase *p) const
virtual std::string GetVideoSourceType() const
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
std::ostream & operator<<(std::ostream &os, const Array2D< T > &arg)
virtual void SetImageSize(const unsigned int w, const unsigned int h)
Set image dimensions (in pixels).
Can be used to run along the image border.
virtual void SetVideoSourceType(const std::string &name)
Set the camera source type.
virtual HomgPoint2D Project(const HomgPoint3D &X, bool IgnoreDistortion=false) const
calculates the projection of a point in the world coordinate system to a pixel in the image plane of ...
virtual const unsigned int & GetImageWidth() const
Returns the image width.
virtual void SetCov(const Matrix< POSE_TYPE > &Cov)
Set pose covariance matrix with respect to C, Q.
virtual BIAS::KMatrix GetFakeKMatrix(int resolution=0, const double &maxangle=1.4) const
virtual int GetPrincipal(double &PrincipalX, double &PrincipalY) const
Get principal point (in pixels relative to top left corner).
virtual BIAS::Vector3< double > GetC() const
Get projection center.
virtual void SetIdentifier(std::string name)
Set the identification string.
K describes the mapping from world coordinates (wcs) to pixel coordinates (pcs).
ProjectionParametersBase * dynptr_
std::map< std::string, maker_t, std::less< std::string > > factory_
virtual const BIAS::Pose & GetPose() const
Return complete pose object.
Camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
ProjectionParametersDynamicLoad(const ProjectionParametersDynamicLoad &P)
virtual double ViewDifference(const ProjectionParametersBase *pPPB) const
Returns difference between two projections like |C1-C2|.
ProjectionParametersDynamicLoad(const unsigned int width=0, const unsigned int height=0)
virtual BIAS::PoseParametrization GetPoseParametrization() const
Return copy of pose parametrization object.
virtual void InvalidatePose()
Invalidate currently set pose.
virtual int GetMinimalAngularSamplingStep(double &minAngleStep)
Delivers the assumed minimal angular distance between two optical rays belonging to integer image coo...
virtual ProjectionParametersBase & operator=(const ProjectionParametersBase &p)
ProjectionParametersBase * GetDynPtr()
get base pointer to dynamically loaded object in order to handle it directly
virtual void UnProjectToRay(const HomgPoint2D &pos, Vector3< double > &pointOnRay, Vector3< double > &direction, const ProjectionParametersBase &proj, bool IgnoreDistortion=false) const
Calculates the view ray, which belongs to the given position on the image plane, using the given proj...