Fawkes API  Fawkes Development Version
position_to_pixel.h
1 /***************************************************************************
2  * globfromrel.cpp - Implementation of the global ball position model
3  *
4  * Created: Do Apr 03 16:45:22 2014
5  * Copyright 2014 Tobias Neumann
6  *
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version. A runtime exception applies to
13  * this software (see LICENSE.GPL_WRE file mentioned below for details).
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
21  */
22 
23 #ifndef __FIREVISION_PIXELFROMPOSITION_H_
24 #define __FIREVISION_PIXELFROMPOSITION_H_
25 
26 #include <tf/transformer.h>
27 #include <utils/math/types.h>
28 
29 #include <string>
30 
31 namespace firevision {
32 
34 {
35 public:
36  PositionToPixel( fawkes::tf::Transformer* tf, std::string cam_frame,
37  float cam_aperture_x, float cam_aperture_y,
38  unsigned int cam_width_x, unsigned int cam_height_y, float cam_angle_y = 0 );
39 
40  fawkes::upoint_t get_pixel_position(fawkes::cart_coord_3d_t& position, std::string& frame, const fawkes::Time& time);
41  fawkes::point_t get_pixel_position_unchecked(fawkes::cart_coord_3d_t& position, std::string& frame, const fawkes::Time& time);
42 
43 private:
44  std::string cam_frame_;
45  fawkes::tf::Transformer* tf_listener;
46 
47  float cam_aperture_horizontal_;
48  float cam_aperture_vertical_;
49  float cam_angle_y_;
50  unsigned int cam_resolution_x_;
51  unsigned int cam_resolution_y_;
52 
53  float cam_pixel_per_angle_horizontal_;
54  float cam_pixel_per_angle_vertical_;
55 
56  float cam_angle_max_horizontal_;
57  float cam_angle_min_horizontal_;
58  float cam_angle_max_vertical_;
59  float cam_angle_min_vertical_;
60 };
61 }
62 #endif /* __FIREVISION_PIXELFROMPOSITION_H_ */
fawkes::point_t get_pixel_position_unchecked(fawkes::cart_coord_3d_t &position, std::string &frame, const fawkes::Time &time)
A class for handling time.
Definition: time.h:91
Compute a pixel position in the camera image from a cartesian world coordinate.
Point with cartesian coordinates as unsigned integers.
Definition: types.h:34
Cartesian coordinates (3D).
Definition: types.h:78
Point with cartesian coordinates as signed integers.
Definition: types.h:40
fawkes::upoint_t get_pixel_position(fawkes::cart_coord_3d_t &position, std::string &frame, const fawkes::Time &time)
Coordinate transforms between any two frames in a system.
Definition: transformer.h:68
PositionToPixel(fawkes::tf::Transformer *tf, std::string cam_frame, float cam_aperture_x, float cam_aperture_y, unsigned int cam_width_x, unsigned int cam_height_y, float cam_angle_y=0)
Construct a PositionToPixel model with the required camera geometry.