26 #ifndef __BIAS_ProjectionParametersProjective_hh__
27 #define __BIAS_ProjectionParametersProjective_hh__
28 #include "bias_config.h"
30 #include <Base/Common/BIASpragmaStart.hh>
31 #include <Geometry/ProjectionParametersBase.hh>
32 #include <Geometry/CoordinateTransform3D.hh>
33 #include <Geometry/PMatrix.hh>
55 const unsigned int height = 0)
75 BIASERR(
"cannot compare extriniscs for this parameter type")
82 BIASERR(
"cannot compare intrinsics for this parameter type")
90 bool IgnoreDistortion =
false)
const;
94 bool IgnoreDistortion)
const;
102 bool IgnoreDistortion =
false)
const {
111 bool IgnoreDistortion =
false)
const {
122 bool IgnoreDistortion=
false)
const {
125 HomgPoint3D unprojected = Pose_.LocalToGlobal(temp3D);
127 direction =
Vector3<double>(unprojected[0], unprojected[1], unprojected[2]);
134 bool IgnoreDistortion=
false)
const {
135 BIASERR(
"R matrix not available in projective case!!!")
140 bool IgnoreDistortion =
false)
const {
141 BIASERR(
"Cannot perform local unprojection in projective case!!!")
155 bool IgnoreDistortion =
false)
const {
157 BIASERR(
"No local projection possible in projective case!!!")
176 bool IgnoreDistortion =
false)
const;
182 const double& depth = 1.0,
183 bool IgnoreDistortion =
false)
const;
194 BIASERR(
"No local unprojection possible in projective case!!!")
205 bool IgnoreDistortion =
false,
206 bool Normalize =
false)
const;
211 const bool homogenized=
true)
const{
213 BIASERR(
"Not possible in projective case!!!")
224 BIASERR(
"PMatrix decomposition not possible in projective case!!!")
234 BIASERR(
"PMatrix decomposition not possible in projective case!!!")
243 BIASERR(
"PMatrix decomposition not possible in projective case!!!")
251 BIASERR(
"PMatrix decomposition not possible in projective case!!!")
259 BIASERR(
"PMatrix decomposition not possible in projective case!!!")
267 BIASERR(
"PMatrix decomposition not possible in projective case, you can only use SetP!!!")
273 BIASERR(
"PMatrix decomposition not possible in projective case!!!")
287 #ifdef BIAS_HAVE_XML2
289 virtual int XMLGetClassName(std::string& TopLevelTag,
290 double& Version)
const;
293 virtual int XMLOut(
const xmlNodePtr Node,
XMLIO& XMLObject)
const;
296 virtual int XMLIn(
const xmlNodePtr Node,
XMLIO& XMLObject);
302 BIASERR(
"dont call this for projective !");
306 BIASERR(
"dont call this for projective !")
311 BIASERR(
"dont call this for projective !")
317 BIASERR(
"dont call this for projective !")
324 BIASERR(
"dont call this for projective !")
330 BIASERR(
"dont call this for projective !")
335 const double& maxangle = 1.4)
const{
336 BIASERR(
"dont call this for projective !")
345 const double& maxangle = 1.4)
const{
346 BIASERR(
"dont call this for projective !")
359 double diff = (C1 - C2).NormL2();
375 return PMatrix(Pose_.GetMatrix3x4());
377 friend std::ostream&
operator<<(std::ostream &os,
387 os<<
"ProjectionParametersProjective:" << std::endl;
389 os <<
"width " << p.
width_ <<
" height " << p.
height_ << std::endl;
390 os << p.
Pose_ <<std::endl;
397 #include <Base/Common/BIASpragmaEnd.hh>
virtual BIAS::Vector3< double > GetC() const
Get projection center.
void SetP(const Matrix3x4< double > &P)
set 12 entries if projective P using a PMatrix
virtual BIAS::Quaternion< double > GetQ() const
Get orientation as unit quaternion.
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
void SetR(const RMatrix &R)
Set orientation from rotation matrix R.
virtual BIAS::Matrix3x4< double > GetExternals() const
Return cached 3x4 representation of external matrix [R|C].
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...
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...
void Homogenize()
homogenize class data member elements to W==1 by divison by W
void ValidatePose()
Validate currently set pose.
void SetC(const Vector3< double > &C)
Set projection center.
virtual HomgPoint2D ProjectLocal(const Vector3< double > &point, bool IgnoreDistortion=false) const
calculates the projection of a point in the camera coordinate system to a pixel in the image plane of...
Slim class bundeling pose parametrization and associated covariance matrix.
virtual const BIAS::Pose & GetPose() const
Return complete pose object.
ProjectionParametersProjective(const ProjectionParametersProjective &P)
void SetPoseParametrization(const BIAS::PoseParametrization &pp)
Set pose from pose parametrization.
virtual BIAS::KMatrix GetFakeKMatrix(double &imgsize, int resolution=0, const double &maxangle=1.4) const
Returns a fake KMatrix for the camera.
virtual void UnProjectLocal(const HomgPoint2D &pos, Vector3< double > &pointOnRay, Vector3< double > &direction, bool IgnoreDistortion=false) const
calculates the viewing ray from the camera center (in the camera coordinate system) which belongs to ...
Represents 3d pose transformations, parametrized as Euclidean translation and unit quaternion orienta...
virtual ProjectionParametersProjective * Clone() const
covariant virtual copy constructor for use in Projection
Wrapper class for reading and writing XML files based on the XML library libxml2. ...
virtual BIAS::PoseParametrization GetPoseParametrization() const
Return copy of pose parametrization 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 ...
12 parametric p for completely projective reconstruction scenarios, unknown focal lengths...
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 ...
unsigned int height_
height of image in pixels
ProjectionParametersProjective(const unsigned int width=0, const unsigned int height=0)
class BIASGeometry_EXPORT PMatrix
virtual RMatrix GetR() const
return R (R^T which is in front part of PMatrix )
virtual const bool DoExtrinsicsDiffer(const ProjectionParametersBase *p) 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 SetPose(const BIAS::Pose pose)
Set pose from pose object.
void SetQ(const BIAS::Quaternion< double > &Q)
Set orientation from unit quaternion Q.
unsigned int width_
width of image in pixels
void UnProjectToRay(const HomgPoint2D &pos, Vector3< double > &pointOnRay, Vector3< double > &direction, bool IgnoreDistortion=false) const
Calculates the view ray, which belongs to the given position on the image plane, in global coordinate...
ProjectionParametersProjective & operator=(const ProjectionParametersProjective &P)
virtual PMatrix GetP() const
return the complete pmatrix (internals+externals / projective) used for projection ...
K describes the mapping from world coordinates (wcs) to pixel coordinates (pcs).
virtual void SetQC(const BIAS::Quaternion< double > &Q, const BIAS::Vector3< double > &C)
Set pose from unit quaternion Q and projection center C.
describes a projective 3D -> 2D mapping in homogenous coordinates
virtual const bool DoIntrinsicsDiffer(const ProjectionParametersBase *p) const
double ViewDifference(const ProjectionParametersBase *ppb) const
Returns difference between two projections like |C1-C2|.
Camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
virtual ~ProjectionParametersProjective()
virtual BIAS::Vector< double > GetCQ() const
Return pose as 7 vector (first projection center C, then unit quaternion Q representing orientation)...
class BIASGeometryBase_EXPORT HomgPoint2D
virtual ProjectionParametersBase & operator=(const ProjectionParametersBase &p)
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 ...
class BIASGeometryBase_EXPORT HomgPoint3D
void Normalize()
scale P such that optical axis (first three entries of last row) has unit length
virtual BIAS::KMatrix GetFakeKMatrix(int resolution=0, const double &maxangle=1.4) const