21 #ifndef KJB_CPP_CAMERA_BACKPROJECT
22 #define KJB_CPP_CAMERA_BACKPROJECT
27 #include <l/l_sys_io.h>
28 #include <l/l_sys_lib.h>
70 screen_point.
resize(3, 1.0);
89 else if(t == std::numeric_limits<double>::infinity())
124 Vector(0.0, ground_height, 0.0),
137 if(result.
size() == 0)
return result;
139 if(result[2] > y_behind_camera_)
163 assert(t != std::numeric_limits<double>::infinity());
168 double y_behind_camera_;
185 Vector bottom_3d = ground_back_projector(bottom_2d(0), bottom_2d(1));
186 if(bottom_3d.
empty())
191 Vector height_normal(0.0, 0.0, -1.0);
192 Back_projector height_back_projector(camera, bottom_3d, height_normal);
194 Vector top_3d = height_back_projector(top_2d(0), top_2d(1));
Vector & resize(int new_length, Value_type pad=Value_type(0))
Resize vector, retaining previous values.
Definition: m_vector.cpp:242
Vector camera_center_
Definition: camera_backproject.h:104
Definition for the Matrix class, a thin wrapper on the KJB Matrix struct and its related functionalit...
size_type size() const
Alias to get_length(). Required to comply with stl Container concept.
Definition: m_vector.h:510
bool empty() const
Returns true iff size is zero. Required to comply with stl Container concept.
Definition: m_vector.h:526
Definition: camera_backproject.h:113
Vector ground_plane_
Definition: camera_backproject.h:102
#define KJB(x)
Definition: l_util.h:9
Vector3 backproject(const Vector3 &homo_screen_coord, const Matrix_d< 3, 4 > &camera_matrix)
Same as backproject(), but using Vector3.
Definition: g_camera.cpp:57
Definition: camera_backproject.h:42
#define ASSERT(condition, message)
Definition: Assert.h:45
Matrix M
Definition: camera_backproject.h:105
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
Declarations for Line class.
Ground_back_projector(const Perspective_camera &cam, double ground_height)
Definition: camera_backproject.h:118
Vector operator()(double u, double v) const
Definition: camera_backproject.h:134
St_perspective_camera for modeling a perspective camera using the classic Forsyth and Ponce parametri...
Vector operator()(double u, double v) const
Definition: camera_backproject.h:62
Definition: perspective_camera.h:93
const kjb::Vector & get_camera_centre() const
returns the camera centre
Definition: perspective_camera.h:194
Matrix & resize(int new_rows, int new_cols, Value_type pad=Value_type(0))
Resize this matrix, retaining previous values. Space is reused if possible. Otherwise requires a new ...
Definition: m_matrix.cpp:457
Matrix transpose() const
Transpose this matrix.
Definition: m_matrix.cpp:395
const Matrix & get_modelview_matrix() const
Definition: perspective_camera.h:340
Vector ground_normal_
Definition: camera_backproject.h:103
double intersect_line_with_plane(const kjb::Vector &line_point, const kjb::Vector &line_direction, const kjb::Vector &plane_point, const kjb::Vector &plane_normal)
Definition: g_line.h:222
This class implements matrices, in the linear-algebra sense, with real-valued elements.
Definition: m_matrix.h:94
const Matrix & build_camera_matrix() const
Definition: perspective_camera.h:487
double get_3d_height(const Vector &bottom_2d, const Vector &top_2d, const Perspective_camera &camera)
Back project the 2d points to find the height in 3D. Assume that the bottom is on the ground...
Definition: camera_backproject.h:177
Back_projector(const Perspective_camera &cam, const Vector &plane, const Vector &plane_normal)
Definition: camera_backproject.h:46
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionalit...