vcsl_perspective.h
Go to the documentation of this file.
1 // This is core/vcsl/vcsl_perspective.h
2 #ifndef vcsl_perspective_h_
3 #define vcsl_perspective_h_
4 //:
5 // \file
6 // \brief Perspective projection transformation
7 // \author Francois BERTEL
8 //
9 // \verbatim
10 // Modifications
11 // 2000/08/23 Francois BERTEL Creation.
12 // 2001/04/10 Ian Scott (Manchester) Converted perceps header to doxygen
13 // 2002/01/22 Peter Vanroose - return type of execute() and inverse() changed to non-ptr
14 // 2002/01/28 Peter Vanroose - std::vector member focal_ changed to non-ptr
15 // 2004/09/17 Peter Vanroose - made focal() non-virtual - it just returns a member and should not be overloaded
16 // \endverbatim
17 
20 
21 //: Perspective projection transformation
22 // This is a perspective projection from a 3D cartesian coordinate system to a
23 // 2D cartesian coordinate system, parametrized by the focal expressed in
24 // meters. The projection is along the z axis. The center of the projection is
25 // the origin of the 3D frame. The projection plane is in the half-space z<0.
28 {
29  //***************************************************************************
30  // Constructors/Destructor
31  //***************************************************************************
32 
33  // Default constructor
34  vcsl_perspective() = default;
35 
36  public:
37  // Destructor
38  ~vcsl_perspective() override = default;
39 
40  //***************************************************************************
41  // Status report
42  //***************************************************************************
43 
44  //: Is `this' invertible at time `time'? Never !
45  // REQUIRE: valid_time(time)
46  // Pure virtual function of vcsl_spatial_transformation
47  bool is_invertible(double time) const override;
48 
49  //: Is `this' correctly set ?
50  // Virtual function of vcsl_spatial_transformation
51  bool is_valid() const override
53  ((this->duration()==0&&focal_.size()==1) ||
54  this->duration()==focal_.size()); }
55 
56  //***************************************************************************
57  // Transformation parameters
58  //***************************************************************************
59 
60  //: Set the focal in meters of a static perspective projection
61  void set_static(double new_focal);
62 
63  //: Set the focal variation along the time in meters
64  void set_focal(list_of_scalars const& new_focal) { focal_=new_focal; }
65 
66  //: Return the focal variation along the time in meters
67  list_of_scalars focal() const { return focal_; }
68 
69  //***************************************************************************
70  // Basic operations
71  //***************************************************************************
72 
73  //: Image of `v' by `this'
74  // REQUIRE: is_valid()
75  // REQUIRE: v.size()==3
76  // Pure virtual function of vcsl_spatial_transformation
78  double time) const override;
79 
80  //: Image of `v' by the inverse of `this'
81  // REQUIRE: is_valid()
82  // REQUIRE: is_invertible(time) and v.size()==2
83  // The first pre-condition is never true. You can not use this method
84  // Pure virtual function of vcsl_spatial_transformation
86  double time) const override;
87 
88  protected:
89 
90  //: Compute the parameter at time `time'
91  double focal_value(double time) const;
92 
93  //: Angle variation along the time
95 };
96 
97 #endif // vcsl_perspective_h_
unsigned int duration() const
Return the time duration.
vnl_vector< double > inverse(const vnl_vector< double > &v, double time) const override
Image of ‘v’ by the inverse of ‘this’.
Transformation between 2 spatial coordinate systems.
bool is_invertible(double time) const override
Is ‘this’ invertible at time ‘time’? Never !.
double focal_value(double time) const
Compute the parameter at time ‘time’.
Transformation between 2 spatial coordinate systems.
void set_static()
Empty the time clock and interpolators, thereby making the transf static.
bool is_valid() const override
Is ‘this’ correctly set ?.
list_of_scalars focal_
Angle variation along the time.
virtual bool is_valid() const
Is ‘this’ correctly set ?.
vnl_vector< double > execute(const vnl_vector< double > &v, double time) const override
Image of ‘v’ by ‘this’.
~vcsl_perspective() override=default
void set_focal(list_of_scalars const &new_focal)
Set the focal variation along the time in meters.
std::vector< double > list_of_scalars
Perspective projection transformation.
vcsl_perspective()=default
list_of_scalars focal() const
Return the focal variation along the time in meters.