KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
d_facecom.h
Go to the documentation of this file.
1 /* =========================================================================== *
2  |
3  | Copyright (c) 1994-2011 by Kobus Barnard (author)
4  |
5  | Personal and educational use of this code is granted, provided that this
6  | header is kept intact, and that the authorship is not misrepresented, that
7  | its use is acknowledged in publications, and relevant papers are cited.
8  |
9  | For other use contact the author (kobus AT cs DOT arizona DOT edu).
10  |
11  | Please note that the code in this file has not necessarily been adequately
12  | tested. Naturally, there is no guarantee of performance, support, or fitness
13  | for any particular task. Nonetheless, I am interested in hearing about
14  | problems that you encounter.
15  |
16  | Author: Jinyan Guan
17  * =========================================================================== */
18 
19 /* $Id: d_facecom.h 18724 2015-03-28 21:22:30Z jguan1 $ */
20 
21 #ifndef D_FACECOM_H
22 #define D_FACECOM_H
23 
24 #include <detector_cpp/d_bbox.h>
25 
26 #include <iosfwd>
27 #include <vector>
28 #include <string>
29 
30 namespace kjb {
31 
32 class Perspective_camera;
39 {
40 public:
43  (
44  const Bbox& box,
45  double pitch = 0.0,
46  double yaw = 0.0,
47  double roll = 0.0
48  ) :
49  box_(box),
50  pitch_(pitch),
51  yaw_(yaw),
52  roll_(roll)
53  {}
54 
56  const Bbox& box() const { return box_; }
57 
59  Bbox& box() { return box_; }
60 
62  double pitch() const { return pitch_; }
63 
65  double yaw() const { return yaw_; }
66 
68  double roll() const { return roll_; }
69 
71  double& pitch() { return pitch_; }
72 
74  double& yaw() { return yaw_; }
75 
77  double& roll() { return roll_; }
78 
79 private:
80  Bbox box_;
81  double pitch_;
82  double yaw_;
83  double roll_;
84 };
85 
92 Vector gaze_direction
93 (
94  const Face_detection& face,
95  const Perspective_camera& camera
96 );
97 
98 
105 Vector face_location_3d
106 (
107  const Face_detection& face,
108  const Perspective_camera& camera,
109  const Bbox& body_box
110 );
111 
112 
119 std::ostream& operator<<(std::ostream& ost, const Face_detection& face);
120 
125 bool operator<(const Face_detection& f1, const Face_detection& f2);
126 
127 
131 Face_detection parse_face_line(const std::string& line);
132 
133 
135 std::vector<Face_detection> read_face_file(std::istream& is);
136 
141 std::vector<std::vector<Face_detection> > read_face_files
142 (
143  const std::vector<std::string>& face_fps
144 );
145 
146 } // namespace kjb
147 
148 #endif /*D_FACECOM_H */
149 
std::vector< std::vector< Face_detection > > read_face_files(const std::vector< std::string > &face_fps)
Parse the output of the faces from multiple files into a vector of vector of Face_detection.
Definition: d_facecom.cpp:65
Bbox & box()
DOCUMENT LATER!
Definition: d_facecom.h:59
Class that represents an axis-aligned 2D rectangle. It is defined in terms of its (2D) center...
Definition: gr_2D_bounding_box.h:51
double & yaw()
DOCUMENT LATER!
Definition: d_facecom.h:74
double & roll()
DOCUMENT LATER!
Definition: d_facecom.h:77
bool operator<(const Face_detection &f1, const Face_detection &f2)
Compares to boxes using middle of box. Needed because we have associated containers of these...
Definition: d_facecom.cpp:147
Axis_aligned_rectangle_2d Bbox
Definition: d_bbox.h:29
double yaw() const
DOCUMENT LATER!
Definition: d_facecom.h:65
Definition: d_facecom.h:38
Face_detection(const Bbox &box, double pitch=0.0, double yaw=0.0, double roll=0.0)
DOCUMENT LATER!
Definition: d_facecom.h:43
double & pitch()
DOCUMENT LATER!
Definition: d_facecom.h:71
double roll() const
DOCUMENT LATER!
Definition: d_facecom.h:68
Face_detection parse_face_line(const std::string &line)
Parse a line of a file (in face.com format) into a Face_Detection.
Definition: d_facecom.cpp:163
const Bbox & box() const
DOCUMENT LATER!
Definition: d_facecom.h:56
std::ofstream & operator<<(std::ofstream &out, const Quaternion &q)
Definition: turntable_camera.cpp:77
std::vector< Face_detection > read_face_file(std::istream &is)
Read set of faces from file (in face.com format).
Definition: d_facecom.cpp:44
Vector gaze_direction(const Face_detection &face, const Perspective_camera &camera)
Computes the direction of the gaze.
Definition: d_facecom.cpp:86
double pitch() const
DOCUMENT LATER!
Definition: d_facecom.h:62
Vector face_location_3d(const Face_detection &face, const Perspective_camera &camera, const Bbox &body_box)
Computes the 3D location of a face.
Definition: d_facecom.cpp:106