23 #include "projective_cam.h"
25 #include <geometry/hom_point.h>
26 #include <geometry/vector.h>
27 #include <core/exceptions/software.h>
32 using namespace fawkes;
36 namespace firevision {
49 AboveHorizonException::AboveHorizonException(
const char *msg,
const center_in_roi_t img_pt)
throw()
50 :
fawkes::Exception(
"AboveHorizonException: %s (%0.1f, %0.1f)", msg, img_pt.x, img_pt.y)
59 AboveHorizonException::get_img_pt()
const
82 __gpa_inv_data =
new float[9];
97 float roll,
float pitch,
float yaw,
98 float height,
float x,
float y):
103 __gpa_inv_data =
new float[9];
114 __p = (pc.__p != NULL ?
new Matrix(*pc.__p) : NULL);
115 __gpa_inv_data =
new float[9];
118 for (
unsigned int i = 0; i < 9; ++i) {
119 __gpa_inv_data[i] = pc.__gpa_inv_data[i];
122 __gpa_inv =
new Matrix(3, 3, __gpa_inv_data,
false);
124 else __gpa_inv = NULL;
133 delete[] __gpa_inv_data;
160 t.
trans(-x, y, height);
183 __gpa_inv =
new Matrix(3, 3, __gpa_inv_data,
false);
203 Vector wld_v = *__gpa_inv * img_v;
227 Vector img_v = *__p * wld_v;
279 __p->
print_info(name ? name :
"Projective Camera", col_sep, row_sep);
280 __cal.
print_info(
"Calibration Matrix", col_sep, row_sep);
float z() const
Convenience getter to obtain the third element.
virtual ProjectiveCam & set_location(const fawkes::HomTransform &loc)
Sets a new location for the camera.
Cartesian coordinates (2D).
Calibration get_cal() const
Calibration getter.
The point that should be calculated lies above the horizon.
float x() const
Convenience getter to obtain the first element.
ProjectiveCam(const ProjectiveCam &pc)
Copy Constructor.
fawkes::Matrix get_p() const
P matrix getter.
virtual ~ProjectiveCam()
Destructor.
A Calibration matrix for a finite camera.
void print_info(const char *name=0, const char *col_sep=0, const char *row_sep=0) const
Print matrix to standard out.
virtual void print_info(const char *name=0, const char *col_sep=0, const char *row_sep=0) const
Prints the matrix P.
void overlay(unsigned int row, unsigned int col, const Matrix &m)
Overlays another matrix over this matrix.
virtual center_in_roi_t get_GPA_image_coord(const fawkes::cart_coord_2d_t &wld_p) const
Returns an image point of a world point under the ground plane assumption.
Abstract class for projective cameras.
Base class for exceptions in Fawkes.
virtual fawkes::cart_coord_2d_t get_GPA_world_coord(const center_in_roi_t &img_p) const
Returns a point in the world under the ground plane assumption.
Matrix & invert()
Inverts the matrix.
Matrix get_submatrix(unsigned int row, unsigned int col, unsigned int num_rows, unsigned int num_cols) const
Returns a submatrix of the matrix.
fawkes::Matrix get_GPA_p() const
Returns the modified P matrix.
void set(unsigned int d, float v)
Set a certain element.
float y() const
Convenience getter to obtain the second element.