KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pt_gaze.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: pt_gaze.h 17393 2014-08-23 20:19:14Z predoehl $ */
20 
21 #ifndef PT_GAZE_H
22 #define PT_GAZE_H
23 
27 #include <m_cpp/m_vector_d.h>
28 #include <detector_cpp/d_facecom.h>
29 #include <detector_cpp/d_bbox.h>
30 
31 #include <vector>
32 
33 namespace kjb
34 {
35 namespace pt
36 {
37 
40 (
41  const Bbox& face_box,
42  const Box_trajectory_map& body_trajs,
43  Entity_id& entity_id,
44  size_t index,
45  double overlapping_threshold = 0.4
46 );
47 
50 (
51  const Box_trajectory_map& btrajs,
52  Trajectory_map& trajs,
53  const std::vector<std::vector<Face_detection> >& face_data
54 );
55 
57 template<class InputIterator>
59 (
60  InputIterator first,
61  InputIterator last,
62  const Box_trajectory_map& btrajs,
63  Trajectory_map& trajs,
64  size_t frame
65 )
66 {
67  for(InputIterator it = first; it != last; it++)
68  {
69  Entity_id entity_id;
70  if(get_corresponding_entity(it->box(), btrajs, entity_id, frame))
71  {
72  (trajs.find(entity_id)->second).at(frame)->value.face_dir
73  = Vector2(it->yaw(), it->pitch());
74  }
75  }
76 }
77 
78 }} //namespace kjb::pt
79 
80 #endif /*PT_GAZE_H */
81 
Generic_trajectory_map< Bbox > Box_trajectory_map
Definition: pt_box_trajectory.h:44
Axis_aligned_rectangle_2d Bbox
Definition: d_bbox.h:29
Entity + index; used for file I/O.
Definition: tracking_entity.h:82
void estimate_gaze_direction_from_data(const Box_trajectory_map &btrajs, Trajectory_map &trajs, const std::vector< std::vector< Face_detection > > &face_data)
Estimate the gaze direction from face.com.
Definition: pt_gaze.cpp:73
bool get_corresponding_entity(const Bbox &face_box, const Box_trajectory_map &body_trajs, Entity_id &entity_id, size_t index, double overlapping_threshold=0.4)
Get the corresponding person based on the face box.
Definition: pt_gaze.cpp:35
Represents a set of trajectories; it is a map from entity to trajectory.
Definition: tracking_trajectory.h:53
Generic_trajectory_map< Complete_state > Trajectory_map
Definition: pt_complete_trajectory.h:43
Vector_d< 2 > Vector2
Definition: gr_opengl.h:35