KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs | Functions
kjb::pt Namespace Reference

Classes

struct  Body_2d
 2D body information resulting from projecting the 3D body. More...
 
class  Box_likelihood
 Class that represents likelihood of a set of projected boxes given. detections. At the moment it only uses box size and optical flow; in the future, it may be use other data information. More...
 
class  Camera_prior
 Class that represents the camera prior. More...
 
class  Color_likelihood
 Class that represents color likelihood of a set of projected boxes given detections. More...
 
struct  Complete_state
 Represents the state of an actor at a frame. More...
 
struct  Head
 Simple struct representing a head. More...
 
class  Box_data
 
class  Detection_box
 Class that represents a detection bounding box from any source. More...
 
class  Direction_prior
 Class that represents the prior distribution of a trajectory. More...
 
class  Face_direction_prior
 Class that represents the prior distribution of the face direction. More...
 
struct  Face_2d
 2D face information resulting from projecting the 3D head/face. More...
 
class  Face_flow_likelihood
 Class to compute face optical flow likelihood. More...
 
class  Facemark_likelihood
 Class to compute facemark likelihood. More...
 
class  Input_directory
 Represents the input directory for the people tracking project. More...
 
class  Output_directory
 Represents the output directory for the PT tracking project. More...
 
class  Optimize_likelihood
 Approximate complete-data likelihood via HMC optimziation. More...
 
class  Optical_flow_likelihood
 Class to compute face optical flow likelihood. More...
 
class  Position_prior
 Class that represents the prior distribution of a trajectory. More...
 
class  Posterior_detail_recorder
 Records the details about the posterior. More...
 
class  Propose_person_size
 Proposal distribution/mechanism for the size of targets. More...
 
class  Sample_scenes
 Use HMC to draw samples from the scene posterior using HMC. More...
 
class  Scene
 Class that represents a full scene in the PT universe. More...
 
class  Scene_recorder
 Record a series of scenes to a directory. More...
 
class  Write_scene_iterator
 Record a series of scenes to a directory. More...
 
class  Scene_adapter
 Adapts a Scene into a VectorModel for HMC sampling. More...
 
class  Scene_gradient
 Wrapper for generic gradient function. More...
 
class  Scene_hessian
 Wrapper for generic hessian function. More...
 
class  Gradient_adapter
 Wraps Scene_gradient to work with ergo::hmc_step. More...
 
class  Pixel_move
 Functor designed to move 3D points by pixels in image plane. More...
 
class  Scene_posterior
 Posterior distribution of a scene. More...
 
class  Scene_posterior_ind
 Posterior adapter to work with independent gradient computation. More...
 
class  Target
 Class that represents a target moving through space. More...
 
struct  Propagated_2d_info
 Propagated 2D information using optical flow. More...
 
struct  Comparator_2d
 Comparator for Propagated_2d_info. More...
 
class  Feature_score
 
struct  Visibility
 Represents the information regarding visibility of an actor at a given frame and given all other actors. More...
 

Typedefs

typedef mcmcda::Association
< Target
Ascn
 
typedef Generic_trajectory_map
< Body_2d
Body_2d_trajectory_map
 
typedef Generic_trajectory
< Body_2d
Body_2d_trajectory
 
typedef
Generic_trajectory_element
< Body_2d
Body_2d_trajectory_element
 
typedef Generic_trajectory_map
< Bbox
Box_trajectory_map
 
typedef Generic_trajectory< BboxBox_trajectory
 
typedef
Generic_trajectory_element
< Bbox
Box_trajectory_element
 
typedef
Generic_trajectory_element
< Complete_state
Trajectory_element
 
typedef Generic_trajectory
< Complete_state
Trajectory
 
typedef Generic_trajectory_map
< Complete_state
Trajectory_map
 
typedef std::vector
< std::vector< Deva_facemark > > 
Facemark_data
 
typedef Generic_trajectory_map
< Face_2d
Face_2d_trajectory_map
 
typedef Generic_trajectory
< Face_2d
Face_2d_trajectory
 
typedef
Generic_trajectory_element
< Face_2d
Face_2d_trajectory_element
 
typedef std::map< const
Detection_box *, Matrix
Hist_map
 Scores based on histogram. More...
 
typedef bimap< const Target
*, multiset_of< double > > 
Depth_map
 

Functions

Body_2d project_cstate (const Complete_state &cs, const Perspective_camera &cam, double height, double width, double girth)
 Project a complete state into a body box. More...
 
Vector model_direction (const Complete_state &cs1, const Complete_state &cs2, const Perspective_camera &cam, double height, double width, double girth)
 Compute the (2D) model direction for the body. More...
 
Bbox cylinder_bounding_box (const std::vector< Vector > &pts, const Vector &bot, const Vector &top)
 Computes the cylinder of a bounding box given 2D points. More...
 
Body_2d_trajectory get_body_2d_trajectory (const Trajectory &traj, const Perspective_camera &cam)
 Convert a Trajectory to a Body_2d_trajectory. More...
 
Body_2d_trajectory_map get_body_2d_trajectory_map (const Trajectory_map &trajs, const Perspective_camera &cam)
 Convert a Trajectory_map to a body_2d_trajectory_map. More...
 
Box_trajectory get_body_box_trajectory (const Trajectory &traj, const Perspective_camera &cam)
 Convert a Trajectory to a Box_trajectory. More...
 
Box_trajectory_map get_body_box_trajectory_map (const Trajectory_map &trajs, const Perspective_camera &cam)
 Convert a Trajectory_map to a Box_trajectory_map. More...
 
Box_trajectory get_face_box_trajectory (const Trajectory &traj, const Perspective_camera &cam)
 Convert a Trajectory to a Box_trajectory. More...
 
Box_trajectory_map get_face_box_trajectory_map (const Trajectory_map &trajs, const Perspective_camera &cam)
 Convert a Trajectory_map to a Box_trajectory_map. More...
 
std::ostream & operator<< (std::ostream &ost, const Complete_state &cs)
 outputs the Complete_state. More...
 
double body_direction (const Vector &dir)
 Gets the body direction from a direction vector. More...
 
Vector ellipse_point (const Complete_state &cs, double height, double width, double girth, double angle)
 Compute point on ellipse given body_dir and angle. More...
 
std::vector< Vectorbody_ellipse (const Complete_state &cs, double h, double w, double g, size_t n=12)
 Computes points on ellipse given by position and dimensions. More...
 
void cylinder_points (const Complete_state &cs, double height, double width, double girth, std::vector< Vector > &fpts, std::vector< Vector > &bpts, Vector &botc, Vector &topc, Vector &bodc)
 Points on body cylinders. More...
 
std::vector< Vectorhead_points (const Complete_state &cs, double height, double width, double girth)
 Sample points on head surface. More...
 
std::vector< Vectorface_features (const Complete_state &cs, double height, double width, double girth)
 Location of face features. More...
 
Vector visible_head_point (const Complete_state &cs, const Vector &cam_center, double height, double width, double girth)
 Find a point on face which is visible from the camera. More...
 
Vector head_to_world (const Vector &vh, const Head &h, bool scale=false)
 Converts a point on the head to world coordinates. More...
 
double get_initial_direction (Trajectory &traj, size_t frame)
 Gets default body direction at frame. More...
 
void update_direction (Trajectory &traj, size_t frame, bool ow)
 Set non-initialized direction in frame to default value. More...
 
void initialize_directions (Trajectory &traj, size_t st=0, size_t et=0, bool ow=false)
 Set non-initialized directions to default values. More...
 
Deva_facemark build_deva_facemark (const Vector &lefe_eye, const Vector &right_eye, const Vector &nose, const Vector &left_mouth, const Vector &right_mouth, double yaw)
 Constructor. More...
 
Facemark_data parse_deva_facemarks (const std::vector< std::string > &fps, double img_width, double img_height)
 
void write_deva_facemarks (const Facemark_data &fm_data, const std::vector< std::string > &fps, double img_width, double img_height)
 
bool operator< (const Detection_box &b1, const Detection_box &b2)
 Compares to boxes using middle of box. Needed because we have associated containers of these. More...
 
std::ostream & operator<< (std::ostream &ost, const Detection_box &dbox)
 Write the Detection_box. More...
 
Detection_box parse_detection_box (const std::string &line)
 Read in an Detection_box from a sigle line. More...
 
std::vector< Detection_boxparse_detection_file (const std::string &filename)
 Read in a vector of Detection_box from a sigle file. More...
 
bool similar_boxes (const Bbox &model_box, const Bbox &data_box, double area_thresh_lower=0.6, double area_thresh_upper=1.2)
 Check whether the deva detection box and the model box belong to the same object based on their overlappings. More...
 
bool box_on_ground (const Detection_box &dbox, const Perspective_camera &cam)
 Checks whether the bottom of a box back-projects to the ground. More...
 
Face_2d project_cstate_face (const Complete_state &cs, const Perspective_camera &cam, double height, double width, double girth)
 Project a complete state into a face box. More...
 
Vector face_model_direction (const Complete_state &cs1, const Complete_state &cs2, const Perspective_camera &cam, double height, double width, double girth)
 Compute the (2D) model direction for the face.. More...
 
double face_distance (const Face_2d &face_model, const Deva_facemark facemark)
 Returns the distance between a face_2d model and a detection facemark. More...
 
Face_2d_trajectory get_face_2d_trajectory (const Trajectory &traj, const Perspective_camera &cam)
 Convert a Trajectory to a Face_2d_trajectory. More...
 
Face_2d_trajectory_map get_face_2d_trajectory_map (const Trajectory_map &trajs, const Perspective_camera &cam)
 Convert a Trajectory_map to a Face_2d_trajectory_map. More...
 
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. More...
 
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. More...
 
template<class InputIterator >
void estimate_gaze_direction_from_data (InputIterator first, InputIterator last, const Box_trajectory_map &btrajs, Trajectory_map &trajs, size_t frame)
 Estimate the gaze direction from face.com. More...
 
template<class OutputIterator >
Posterior_detail_recorder
< OutputIterator > 
make_pd_recorder (OutputIterator it, const Scene_posterior &post)
 Convenience function to create a Posterior_detail_recorder. More...
 
bool all_new_targets (const Scene &scene)
 Helper fcn; returns true if the scene has only new targets. More...
 
void swap (Scene &s1, Scene &s2)
 Swap two scenes. More...
 
size_t dims (const Scene &scene, bool respect_changed=true, bool infer_head=true)
 Computes the number of variables in this scene. More...
 
void update_scene_state (const Scene &scene, const Facemark_data &fmdata, bool infer_head=true, bool refine=true)
 Update the (mostly) 3D state of a scene. To be called after an association change. More...
 
void read_scene (Scene &s, const std::string &tracks_dp, const std::string &ass_fp, const std::string &cam_fp, const std::string &params_fp, bool infer_head=true)
 Read a scene. More...
 
void read_scene (Scene &scene, const std::string &tracks_dp, bool infer_head=true)
 Read a scene using standard subdirectory structure; e.g., the association is read from "association.txt". More...
 
void write_scene (const Scene &s, const std::string &tracks_dp, const std::string &ass_fp, const std::string &cam_fp, const std::string &params_fp)
 Write a scene. More...
 
void write_scene (const Scene &scene, const std::string &tracks_dp)
 Write a scene using standard subdirectory structure; e.g., the association is written to "association.txt". More...
 
void set_trajectory_at_frame (const Scene &scene, const Target &target, size_t frame, const Vector3 &v, bool vis_off, bool infer_head=true)
 Function that changes a single trajectory at a single frame, and performs all the necessary updates. More...
 
void set_trajectories_at_frames (const Scene &scene, const Target &target1, const Target &target2, size_t frame1, size_t frame2, const Vector3 &v1, const Vector3 &v2, bool vis_off, bool infer_head=true)
 Function that changes a pair of trajectories at a pair of frames, and performs all the necessary updates. More...
 
void move_trajectory_at_frame (const Scene &scene, const Target &target, size_t frame, const Vector3 &dv, bool vis_off, bool infer_head=true)
 Function that moves a single trajectory at a single frame, and performs all the necessary updates. More...
 
void move_trajectories_at_frames (const Scene &scene, const Target &target1, const Target &target2, size_t frame1, size_t frame2, const Vector3 &dv1, const Vector3 &dv2, bool vis_off, bool infer_head=true)
 Function that moves a pair of trajectories at a pair of frames, and performs all the necessary updates. More...
 
void set_trajectory_dir_at_frame (const Scene &scene, const Target &target, size_t frame, double dir, bool vis_off)
 Function that changes a single direction at a single frame, and performs all the necessary updates. More...
 
void set_trajectory_dirs_at_frames (const Scene &scene, const Target &target1, const Target &target2, size_t frame1, size_t frame2, double dir1, double dir2, bool vis_off)
 Function that changes a pair of directions at a pair of frames, and performs all the necessary updates. More...
 
void move_trajectory_dir_at_frame (const Scene &scene, const Target &target, size_t frame, double dd, bool vis_off)
 Function that moves a single direction at a single frame, and performs all the necessary updates. More...
 
void move_trajectory_dirs_at_frames (const Scene &scene, const Target &target1, const Target &target2, size_t frame1, size_t frame2, double dd1, double dd2, bool vis_off)
 Function that moves a pair of directions at a pair of frames, and performs all the necessary updates. More...
 
void set_trajectory_face_dir_at_frame (const Scene &scene, const Target &target, size_t frame, const Vector2 &dir, bool vis_off)
 Function that changes a single face direction at a single frame, and performs all the necessary updates. More...
 
void set_trajectory_face_dirs_at_frames (const Scene &scene, const Target &target1, const Target &target2, size_t frame1, size_t frame2, const Vector2 &dir1, const Vector2 &dir2, bool vis_off)
 Function that changes a pair of face directions at a pair of frames, and performs all the necessary updates. More...
 
void move_trajectory_face_dir_at_frame (const Scene &scene, const Target &target, size_t frame, const Vector2 &dd, bool vis_off)
 Function that moves a single face direction at a single frame, and performs all the necessary updates. More...
 
void move_trajectory_face_dirs_at_frames (const Scene &scene, const Target &target1, const Target &target2, size_t frame1, size_t frame2, const Vector2 &dd1, const Vector2 &dd2, bool vis_off)
 Function that moves a pair of directions at a pair of frames, and performs all the necessary updates. More...
 
void update_body_model_directions (const Target &target, size_t frame, const Perspective_camera &cam)
 Helper function for the set_trajectory_* functions. More...
 
void update_face_model_directions (const Target &target, size_t frame, const Perspective_camera &cam)
 Helper function for the set_trajectory_* functions. More...
 
void update_model_directions (const Target &target, size_t frame, const Perspective_camera &cam)
 Helper function for the set_trajectory_* functions. More...
 
double get_variable_at_frame (const Scene &scene, const Target &target, size_t frame, size_t d, size_t infer_head)
 Gets the scene at the given variable. Here, d = 1 ... 5 represents the different parts of the trajectory at time 'frame'. 1 and 2 are the position x and z, 3 is the body direction, and 4 and 5 are the face direction. More...
 
void set_variable_at_frame (const Scene &scene, const Target &target, size_t frame, size_t d, double x, bool vo, bool infer_head)
 Sets the scene at the given variable. Here, d = 1 ... 5 represents the different parts of the trajectory at time 'frame'. 1 and 2 are the position x and z, 3 is the body direction, and 4 and 5 are the face direction. More...
 
void move_variable_at_frame (const Scene &scene, const Target &target, size_t frame, size_t d, double dx, bool vo, bool infer_head)
 Moves the scene at the given variable. Here, d = 1 ... 5 represents the different parts of the trajectory at time 'frame'. 1 and 2 are the position x and z, 3 is the body direction, and 4 and 5 are the face direction. More...
 
template<class G >
Gradient_adapter< G > make_gradient_adapter (const G &grad)
 Utility function that makes a gradient adapter. More...
 
std::vector< double > trajectory_gradient_step_sizes (const Scene &scene, bool infer_head=true)
 Compute the step sizes that equivalent to movement of 1 pixel in image coordinate. More...
 
void make_max (const Scene &scene, const Scene_posterior &pt, const std::vector< double > &ss, bool infer_head)
 Ensures posterior is at max (wrt a given step size). More...
 
bool pixel_visible (int x, int y, const Visibility &vis)
 Helper function that determines if a pixel is visible. More...
 
bool empty_target (const Target &target)
 Helper function; needed because, occasionally, C++ is stupid. More...
 
void fix_target (Target &target, double imw, double imh)
 Helper function that fixes a track when it leaves the view. More...
 
template<class TargetIterator >
void sample (const Position_prior &pos_prior, const Direction_prior &dir_prior, const Face_direction_prior &fdir_prior, const Normal_distribution &height_prior, const Normal_distribution &width_prior, const Normal_distribution &girth_prior, TargetIterator first, TargetIterator last)
 Sample a scene from the prior (and a given sequence of tracks). More...
 
Perspective_camera sample (const Camera_prior &cam_prior)
 Sample from camera prior. More...
 
Detection_box sample (const Box_likelihood &box_lh, const Bbox &mbox, const std::string &type)
 Sample a single data box from a model box. More...
 
template<class TargetIterator >
void sample (const Box_likelihood &box_lh, Box_data &box_data, TargetIterator first, TargetIterator last, const std::vector< size_t > fa_count)
 Sample detection data from likelihood. More...
 
template<class FmvIterator >
void sample (const Facemark_likelihood &fm_lh, const Scene &scene, FmvIterator fm_out)
 Sample facemark data from likelihood. More...
 
template<class FlowIterator >
void sample (const Optical_flow_likelihood &of_lh, const Scene &scene, FlowIterator xflow_out, FlowIterator yflow_out)
 Sample optical flow data from likelihood. More...
 
template<class FmvIterator , class FlowOutIterator >
void sample (const mcmcda::Prior< Target > &w_prior, const Camera_prior &cam_prior, const Scene_posterior &posterior, size_t T, Scene &scene, Box_data &box_data, FmvIterator fm_out, FlowOutIterator xflow_out, FlowOutIterator yflow_out, size_t max_tracks=0)
 Sample from full generative model. More...
 
void write_posterior_details (const Scene_posterior &post, const Scene &scene, double mlh, std::ostream &ost)
 Write the details of the posterior in a table format. More...
 
Vector get_cs_position (const Complete_state &cs)
 Helper function – gets the position from CS as a kjb::Vector. More...
 
Vector get_cs_face_dir (const Complete_state &cs)
 Helper function – gets the face_dir from CS as a kjb::Vector. More...
 
void sync_state (const Target &tg)
 Sync targets trajectory with endpoints. More...
 
void standardize (Vector &v, double cam_width, double cam_height)
 Changes Vector to standard (camera) coordinate system. More...
 
void standardize (Bbox &box, double cam_width, double cam_height)
 Changes box coordinates to standard (camera) coordinate system. More...
 
void standardize (Deva_facemark &face, double cam_width, double cam_height)
 Changes box coordinates to standard (camera) coordinate system. More...
 
void unstandardize (Vector &v, double cam_width, double cam_height)
 Changes vector to unstandard (image) coordinate system. More...
 
void unstandardize (Bbox &box, double cam_width, double cam_height)
 Changes box coordinates to unstandard (image) coordinate system. More...
 
void unstandardize (Deva_facemark &face, double cam_width, double cam_height)
 Changes Deva_facemark coordinates to unstandard (image) coordinate system. More...
 
Ascn make_gt_association (const Box_data &data, const Box_trajectory_map &gt_btrajs, double width, double height, boost::optional< const Perspective_camera & > cam_p=boost::none, boost::optional< const Facemark_data & > fm_data_p=boost::none)
 Create data from GT box trajectories and compute association based upon it. More...
 
Box_data make_gt_data (const Box_trajectory_map &gt_btrajs, double width, double height)
 Create data from GT box trajectories and compute association based upon it. More...
 
std::map< int, std::vector
< Propagated_2d_info > > 
propagate_boxes_by_flow (const Target &target, const std::vector< Integral_flow > &x_flows, const std::vector< Integral_flow > &y_flows, const std::vector< Integral_flow > &back_x_flows, const std::vector< Integral_flow > &back_y_flows, size_t duration)
 Propagate the detection boxes based on optical flow to neighboring frames. More...
 
double chi_squared_dist_to_prob (double chi_square_dist)
 Given the chi-square distance between the histograms of two detection boxes. More...
 
Vector average_box_flow (const Integral_flow &fx, const Integral_flow &fy, const Bbox &box, const Visibility &vis)
 Compute the average flow in a box, ignoring occluded parts. More...
 
void prune_by_height (std::vector< Deva_detection > &deva_boxes, double image_width, double image_height, const Perspective_camera &camera, double average_height)
 Prune the deva boxes based on the average entity height. More...
 
Vector project_point (const Perspective_camera &cam, const Vector &x)
 Projects a 3D point into a 2D point using camera. More...
 
void update_facemarks (const Ascn &ascn, const Facemark_data &fms)
 Update facemark detections for face trajectories. More...
 
void clear_facemarks (const Ascn &ascn)
 Update facemark detections for face trajectories. More...
 
Visibility get_box_visibility (const Bbox &box, double depth, size_t frame, const Depth_map &depth_map, double img_width, double img_height, bool infer_head)
 Computes visible of a box given other boxes. More...
 
void update_visibilities (const Scene &scene, bool infer_head=true)
 Update all the visibilities in a scene. More...
 
void update_visibilities (const Scene &scene, size_t frame, bool infer_head=true)
 Update visibility for a single frame (and leave others intact). More...
 

Typedef Documentation

typedef bimap<const Target*, multiset_of<double> > kjb::pt::Depth_map
typedef std::vector<std::vector<Deva_facemark> > kjb::pt::Facemark_data
typedef std::map<const Detection_box*, Matrix> kjb::pt::Hist_map

Scores based on histogram.

Function Documentation

bool kjb::pt::all_new_targets ( const Scene scene)

Helper fcn; returns true if the scene has only new targets.

Vector kjb::pt::average_box_flow ( const Integral_flow fx,
const Integral_flow fy,
const Bbox box,
const Visibility vis 
)

Compute the average flow in a box, ignoring occluded parts.

Returns
A kjb::Vector representing the average flow.
double kjb::pt::body_direction ( const Vector &  dir)
inline

Gets the body direction from a direction vector.

std::vector< Vector > kjb::pt::body_ellipse ( const Complete_state cs,
double  h,
double  w,
double  g,
size_t  n = 12 
)

Computes points on ellipse given by position and dimensions.

bool kjb::pt::box_on_ground ( const Detection_box &  dbox,
const Perspective_camera &  cam 
)
inline

Checks whether the bottom of a box back-projects to the ground.

Deva_facemark kjb::pt::build_deva_facemark ( const Vector lefe_eye,
const Vector right_eye,
const Vector nose,
const Vector left_mouth,
const Vector right_mouth,
double  yaw 
)

Constructor.

Reads boxes for single time from single file.Return a Deva_facemark from face mark

double kjb::pt::chi_squared_dist_to_prob ( double  chi_square_dist)
inline

Given the chi-square distance between the histograms of two detection boxes.

Returns
the probability of the two detection boxes belong to the same person
void kjb::pt::clear_facemarks ( const Ascn ascn)

Update facemark detections for face trajectories.

Returns
The number of noisy detections Clear facemark detections for face trajectories.
Bbox kjb::pt::cylinder_bounding_box ( const std::vector< Vector > &  pts,
const Vector bot,
const Vector top 
)

Computes the cylinder of a bounding box given 2D points.

void kjb::pt::cylinder_points ( const Complete_state cs,
double  height,
double  width,
double  girth,
std::vector< Vector > &  fpts,
std::vector< Vector > &  bpts,
Vector botc,
Vector topc,
Vector bodc 
)

Points on body cylinders.

size_t kjb::pt::dims ( const Scene scene,
bool  respect_changed = true,
bool  infer_head = true 
)

Computes the number of variables in this scene.

Vector kjb::pt::ellipse_point ( const Complete_state &  cs,
double  height,
double  width,
double  girth,
double  angle 
)
inline

Compute point on ellipse given body_dir and angle.

bool kjb::pt::empty_target ( const Target &  target)
inline

Helper function; needed because, occasionally, C++ is stupid.

void kjb::pt::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.

/\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\

template<class InputIterator >
void kjb::pt::estimate_gaze_direction_from_data ( InputIterator  first,
InputIterator  last,
const Box_trajectory_map &  btrajs,
Trajectory_map &  trajs,
size_t  frame 
)

Estimate the gaze direction from face.com.

double kjb::pt::face_distance ( const Face_2d face_model,
const Deva_facemark  facemark 
)

Returns the distance between a face_2d model and a detection facemark.

std::vector< Vector > kjb::pt::face_features ( const Complete_state cs,
double  height,
double  width,
double  girth 
)

Location of face features.

Vector kjb::pt::face_model_direction ( const Complete_state cs1,
const Complete_state cs2,
const Perspective_camera cam,
double  height,
double  width,
double  girth 
)

Compute the (2D) model direction for the face..

void kjb::pt::fix_target ( Target &  target,
double  imw,
double  imh 
)
inline

Helper function that fixes a track when it leaves the view.

Body_2d_trajectory kjb::pt::get_body_2d_trajectory ( const Trajectory traj,
const Perspective_camera cam 
)

Convert a Trajectory to a Body_2d_trajectory.

Body_2d_trajectory_map kjb::pt::get_body_2d_trajectory_map ( const Trajectory_map trajs,
const Perspective_camera cam 
)

Convert a Trajectory_map to a body_2d_trajectory_map.

Box_trajectory kjb::pt::get_body_box_trajectory ( const Trajectory traj,
const Perspective_camera cam 
)

Convert a Trajectory to a Box_trajectory.

Box_trajectory_map kjb::pt::get_body_box_trajectory_map ( const Trajectory_map trajs,
const Perspective_camera cam 
)

Convert a Trajectory_map to a Box_trajectory_map.

Visibility kjb::pt::get_box_visibility ( const Bbox box,
double  depth,
size_t  frame,
const Depth_map depth_map,
double  img_width,
double  img_height,
bool  infer_head 
)

Computes visible of a box given other boxes.

bool kjb::pt::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.

Vector kjb::pt::get_cs_face_dir ( const Complete_state &  cs)
inline

Helper function – gets the face_dir from CS as a kjb::Vector.

Vector kjb::pt::get_cs_position ( const Complete_state &  cs)
inline

Helper function – gets the position from CS as a kjb::Vector.

Face_2d_trajectory kjb::pt::get_face_2d_trajectory ( const Trajectory traj,
const Perspective_camera cam 
)

Convert a Trajectory to a Face_2d_trajectory.

Face_2d_trajectory_map kjb::pt::get_face_2d_trajectory_map ( const Trajectory_map trajs,
const Perspective_camera cam 
)

Convert a Trajectory_map to a Face_2d_trajectory_map.

Box_trajectory kjb::pt::get_face_box_trajectory ( const Trajectory traj,
const Perspective_camera cam 
)

Convert a Trajectory to a Box_trajectory.

Box_trajectory_map kjb::pt::get_face_box_trajectory_map ( const Trajectory_map trajs,
const Perspective_camera cam 
)

Convert a Trajectory_map to a Box_trajectory_map.

double kjb::pt::get_initial_direction ( Trajectory traj,
size_t  frame 
)

Gets default body direction at frame.

double kjb::pt::get_variable_at_frame ( const Scene &  scene,
const Target &  target,
size_t  frame,
size_t  d,
size_t  infer_head 
)
inline

Gets the scene at the given variable. Here, d = 1 ... 5 represents the different parts of the trajectory at time 'frame'. 1 and 2 are the position x and z, 3 is the body direction, and 4 and 5 are the face direction.

std::vector< Vector > kjb::pt::head_points ( const Complete_state cs,
double  height,
double  width,
double  girth 
)

Sample points on head surface.

Vector kjb::pt::head_to_world ( const Vector &  vh,
const Head &  h,
bool  scale = false 
)
inline

Converts a point on the head to world coordinates.

void kjb::pt::initialize_directions ( Trajectory traj,
size_t  st = 0,
size_t  et = 0,
bool  ow = false 
)

Set non-initialized directions to default values.

template<class G >
Gradient_adapter<G> kjb::pt::make_gradient_adapter ( const G &  grad)
inline

Utility function that makes a gradient adapter.

Ascn kjb::pt::make_gt_association ( const Box_data data,
const Box_trajectory_map gt_btrajs,
double  width,
double  height,
boost::optional< const Perspective_camera & >  cam_p = boost::none,
boost::optional< const Facemark_data & >  fm_data_p = boost::none 
)

Create data from GT box trajectories and compute association based upon it.

Box_data kjb::pt::make_gt_data ( const Box_trajectory_map gt_btrajs,
double  width,
double  height 
)

Create data from GT box trajectories and compute association based upon it.

void kjb::pt::make_max ( const Scene scene,
const Scene_posterior pt,
const std::vector< double > &  ss,
bool  infer_head 
)

Ensures posterior is at max (wrt a given step size).

template<class OutputIterator >
Posterior_detail_recorder<OutputIterator> kjb::pt::make_pd_recorder ( OutputIterator  it,
const Scene_posterior &  post 
)
inline

Convenience function to create a Posterior_detail_recorder.

Vector kjb::pt::model_direction ( const Complete_state cs1,
const Complete_state cs2,
const Perspective_camera cam,
double  height,
double  width,
double  girth 
)

Compute the (2D) model direction for the body.

void kjb::pt::move_trajectories_at_frames ( const Scene &  scene,
const Target &  target1,
const Target &  target2,
size_t  frame1,
size_t  frame2,
const Vector3 &  dv1,
const Vector3 &  dv2,
bool  vis_off,
bool  infer_head = true 
)
inline

Function that moves a pair of trajectories at a pair of frames, and performs all the necessary updates.

void kjb::pt::move_trajectory_at_frame ( const Scene &  scene,
const Target &  target,
size_t  frame,
const Vector3 &  dv,
bool  vis_off,
bool  infer_head = true 
)
inline

Function that moves a single trajectory at a single frame, and performs all the necessary updates.

void kjb::pt::move_trajectory_dir_at_frame ( const Scene &  scene,
const Target &  target,
size_t  frame,
double  dd,
bool  vis_off 
)
inline

Function that moves a single direction at a single frame, and performs all the necessary updates.

void kjb::pt::move_trajectory_dirs_at_frames ( const Scene &  scene,
const Target &  target1,
const Target &  target2,
size_t  frame1,
size_t  frame2,
double  dd1,
double  dd2,
bool  vis_off 
)
inline

Function that moves a pair of directions at a pair of frames, and performs all the necessary updates.

void kjb::pt::move_trajectory_face_dir_at_frame ( const Scene &  scene,
const Target &  target,
size_t  frame,
const Vector2 &  dd,
bool  vis_off 
)
inline

Function that moves a single face direction at a single frame, and performs all the necessary updates.

void kjb::pt::move_trajectory_face_dirs_at_frames ( const Scene &  scene,
const Target &  target1,
const Target &  target2,
size_t  frame1,
size_t  frame2,
const Vector2 &  dd1,
const Vector2 &  dd2,
bool  vis_off 
)
inline

Function that moves a pair of directions at a pair of frames, and performs all the necessary updates.

void kjb::pt::move_variable_at_frame ( const Scene &  scene,
const Target &  target,
size_t  frame,
size_t  d,
double  dx,
bool  vo,
bool  infer_head 
)
inline

Moves the scene at the given variable. Here, d = 1 ... 5 represents the different parts of the trajectory at time 'frame'. 1 and 2 are the position x and z, 3 is the body direction, and 4 and 5 are the face direction.

bool kjb::pt::operator< ( const Detection_box &  b1,
const Detection_box &  b2 
)
inline

Compares to boxes using middle of box. Needed because we have associated containers of these.

std::ostream& kjb::pt::operator<< ( std::ostream &  ost,
const Complete_state &  cs 
)
inline

outputs the Complete_state.

std::ostream& kjb::pt::operator<< ( std::ostream &  ost,
const Detection_box &  dbox 
)
inline

Write the Detection_box.

Detection_box kjb::pt::parse_detection_box ( const std::string &  line)
inline

Read in an Detection_box from a sigle line.

std::vector< Detection_box > kjb::pt::parse_detection_file ( const std::string &  filename)

Read in a vector of Detection_box from a sigle file.

Facemark_data kjb::pt::parse_deva_facemarks ( const std::vector< std::string > &  fps,
double  img_width,
double  img_height 
)
bool kjb::pt::pixel_visible ( int  x,
int  y,
const Visibility &  vis 
)
inline

Helper function that determines if a pixel is visible.

Body_2d kjb::pt::project_cstate ( const Complete_state cs,
const Perspective_camera cam,
double  height,
double  width,
double  girth 
)

Project a complete state into a body box.

Face_2d kjb::pt::project_cstate_face ( const Complete_state cs,
const Perspective_camera cam,
double  height,
double  width,
double  girth 
)

Project a complete state into a face box.

Vector kjb::pt::project_point ( const Perspective_camera &  cam,
const Vector &  x 
)
inline

Projects a 3D point into a 2D point using camera.

std::map< int, std::vector< Propagated_2d_info > > kjb::pt::propagate_boxes_by_flow ( const Target target,
const std::vector< Integral_flow > &  x_flows,
const std::vector< Integral_flow > &  y_flows,
const std::vector< Integral_flow > &  back_x_flows,
const std::vector< Integral_flow > &  back_y_flows,
size_t  duration 
)

Propagate the detection boxes based on optical flow to neighboring frames.

void kjb::pt::prune_by_height ( std::vector< Deva_detection > &  deva_boxes,
double  image_width,
double  image_height,
const Perspective_camera camera,
double  average_height 
)

Prune the deva boxes based on the average entity height.

void kjb::pt::read_scene ( Scene s,
const std::string &  tracks_dp,
const std::string &  ass_fp,
const std::string &  cam_fp,
const std::string &  params_fp,
bool  infer_head = true 
)

Read a scene.

Parameters
sTarget scene variable.
tracks_dpDirectory where trajectory files will be read.
ass_fpPath where association file will be written; it is usually in the directory tracks_dp.
cam_fpPath where camera file will be read; it is usually in the directory tracks_dp.
params_fpPath where parameters file will be read; it is
void kjb::pt::read_scene ( Scene &  scene,
const std::string &  tracks_dp,
bool  infer_head = true 
)
inline

Read a scene using standard subdirectory structure; e.g., the association is read from "association.txt".

Parameters
sceneTarget scene variable.
tracks_dpDirectory where trajectory files will be read.
template<class TargetIterator >
void kjb::pt::sample ( const Position_prior &  pos_prior,
const Direction_prior &  dir_prior,
const Face_direction_prior &  fdir_prior,
const Normal_distribution &  height_prior,
const Normal_distribution &  width_prior,
const Normal_distribution &  girth_prior,
TargetIterator  first,
TargetIterator  last 
)

Sample a scene from the prior (and a given sequence of tracks).

This function samples the 3D configuration of a set of tracks by filling in their trajectories. That is, it samples from p(z | w).

Perspective_camera kjb::pt::sample ( const Camera_prior &  cam_prior)
inline

Sample from camera prior.

Detection_box kjb::pt::sample ( const Box_likelihood &  box_lh,
const Bbox &  mbox,
const std::string &  type 
)
inline

Sample a single data box from a model box.

This function samples a detection box from the box likelihood and a given model box. That is, it samples from p(b | h).

template<class TargetIterator >
void kjb::pt::sample ( const Box_likelihood &  box_lh,
Box_data &  box_data,
TargetIterator  first,
TargetIterator  last,
const std::vector< size_t >  fa_count 
)

Sample detection data from likelihood.

This function samples box data from the box likelihood (and a given set of tracks and 3D scene). That is, it samples from p(B | z, w).

template<class FmvIterator >
void kjb::pt::sample ( const Facemark_likelihood &  fm_lh,
const Scene &  scene,
FmvIterator  fm_out 
)

Sample facemark data from likelihood.

template<class FlowIterator >
void kjb::pt::sample ( const Optical_flow_likelihood &  of_lh,
const Scene &  scene,
FlowIterator  xflow_out,
FlowIterator  yflow_out 
)

Sample optical flow data from likelihood.

This function samples OF data from the OF likelihood and a given scene That is, it samples from p(I | z, w).

template<class FmvIterator , class FlowOutIterator >
void kjb::pt::sample ( const mcmcda::Prior< Target > &  w_prior,
const Camera_prior &  cam_prior,
const Scene_posterior &  posterior,
size_t  T,
Scene &  scene,
Box_data &  box_data,
FmvIterator  fm_out,
FlowOutIterator  xflow_out,
FlowOutIterator  yflow_out,
size_t  max_tracks = 0 
)

Sample from full generative model.

This function samples from the joint p(B, I, x, w) using ancestral sampling.

void kjb::pt::set_trajectories_at_frames ( const Scene scene,
const Target target1,
const Target target2,
size_t  frame1,
size_t  frame2,
const Vector3 v1,
const Vector3 v2,
bool  vis_off,
bool  infer_head = true 
)

Function that changes a pair of trajectories at a pair of frames, and performs all the necessary updates.

void kjb::pt::set_trajectory_at_frame ( const Scene scene,
const Target target,
size_t  frame,
const Vector3 v,
bool  vis_off,
bool  infer_head = true 
)

Function that changes a single trajectory at a single frame, and performs all the necessary updates.

void kjb::pt::set_trajectory_dir_at_frame ( const Scene scene,
const Target target,
size_t  frame,
double  dir,
bool  vis_off 
)

Function that changes a single direction at a single frame, and performs all the necessary updates.

void kjb::pt::set_trajectory_dirs_at_frames ( const Scene scene,
const Target target1,
const Target target2,
size_t  frame1,
size_t  frame2,
double  dir1,
double  dir2,
bool  vis_off 
)

Function that changes a pair of directions at a pair of frames, and performs all the necessary updates.

void kjb::pt::set_trajectory_face_dir_at_frame ( const Scene scene,
const Target target,
size_t  frame,
const Vector2 dir,
bool  vis_off 
)

Function that changes a single face direction at a single frame, and performs all the necessary updates.

void kjb::pt::set_trajectory_face_dirs_at_frames ( const Scene scene,
const Target target1,
const Target target2,
size_t  frame1,
size_t  frame2,
const Vector2 dir1,
const Vector2 dir2,
bool  vis_off 
)

Function that changes a pair of face directions at a pair of frames, and performs all the necessary updates.

void kjb::pt::set_variable_at_frame ( const Scene &  scene,
const Target &  target,
size_t  frame,
size_t  d,
double  x,
bool  vo,
bool  infer_head 
)
inline

Sets the scene at the given variable. Here, d = 1 ... 5 represents the different parts of the trajectory at time 'frame'. 1 and 2 are the position x and z, 3 is the body direction, and 4 and 5 are the face direction.

bool kjb::pt::similar_boxes ( const Bbox model_box,
const Bbox data_box,
double  area_thresh_lower = 0.6,
double  area_thresh_upper = 1.2 
)

Check whether the deva detection box and the model box belong to the same object based on their overlappings.

void kjb::pt::standardize ( Vector &  v,
double  cam_width,
double  cam_height 
)
inline

Changes Vector to standard (camera) coordinate system.

void kjb::pt::standardize ( Bbox &  box,
double  cam_width,
double  cam_height 
)
inline

Changes box coordinates to standard (camera) coordinate system.

void kjb::pt::standardize ( Deva_facemark face,
double  cam_width,
double  cam_height 
)

Changes box coordinates to standard (camera) coordinate system.

Changes box coordinates to unstandard (image) coordinate system.

void kjb::pt::swap ( Scene &  s1,
Scene &  s2 
)
inline

Swap two scenes.

void kjb::pt::sync_state ( const Target tg)

Sync targets trajectory with endpoints.

std::vector< double > kjb::pt::trajectory_gradient_step_sizes ( const Scene scene,
bool  infer_head = true 
)

Compute the step sizes that equivalent to movement of 1 pixel in image coordinate.

void kjb::pt::unstandardize ( Vector &  v,
double  cam_width,
double  cam_height 
)
inline

Changes vector to unstandard (image) coordinate system.

void kjb::pt::unstandardize ( Bbox &  box,
double  cam_width,
double  cam_height 
)
inline

Changes box coordinates to unstandard (image) coordinate system.

void kjb::pt::unstandardize ( Deva_facemark face,
double  cam_width,
double  cam_height 
)

Changes Deva_facemark coordinates to unstandard (image) coordinate system.

void kjb::pt::update_body_model_directions ( const Target target,
size_t  frame,
const Perspective_camera cam 
)

Helper function for the set_trajectory_* functions.

void kjb::pt::update_direction ( Trajectory traj,
size_t  frame,
bool  ow 
)

Set non-initialized direction in frame to default value.

void kjb::pt::update_face_model_directions ( const Target target,
size_t  frame,
const Perspective_camera cam 
)

Helper function for the set_trajectory_* functions.

void kjb::pt::update_facemarks ( const Ascn ascn,
const Facemark_data fms 
)

Update facemark detections for face trajectories.

Returns
The number of noisy detections
void kjb::pt::update_model_directions ( const Target &  target,
size_t  frame,
const Perspective_camera &  cam 
)
inline

Helper function for the set_trajectory_* functions.

void kjb::pt::update_scene_state ( const Scene scene,
const Facemark_data fmdata,
bool  infer_head = true,
bool  refine = true 
)

Update the (mostly) 3D state of a scene. To be called after an association change.

void kjb::pt::update_visibilities ( const Scene scene,
bool  infer_head = true 
)

Update all the visibilities in a scene.

void kjb::pt::update_visibilities ( const Scene scene,
size_t  frame,
bool  infer_head = true 
)

Update visibility for a single frame (and leave others intact).

Vector kjb::pt::visible_head_point ( const Complete_state cs,
const Vector cam_center,
double  height,
double  width,
double  girth 
)

Find a point on face which is visible from the camera.

void kjb::pt::write_deva_facemarks ( const Facemark_data fm_data,
const std::vector< std::string > &  fps,
double  img_width,
double  img_height 
)
void kjb::pt::write_posterior_details ( const Scene_posterior post,
const Scene scene,
double  mlh,
std::ostream &  ost 
)

Write the details of the posterior in a table format.

void kjb::pt::write_scene ( const Scene s,
const std::string &  tracks_dp,
const std::string &  ass_fp,
const std::string &  cam_fp,
const std::string &  params_fp 
)

Write a scene.

Parameters
sScene to be written.
tracks_dpDirectory where trajectory files will be written.
ass_fpPath where association file will be written; it is usually in the directory tracks_dp.
cam_fpPath where camera file will be written; it is usually in the directory tracks_dp.
params_fpPath where parameters file will be written; it is usually in the directory tracks_dp.
void kjb::pt::write_scene ( const Scene &  scene,
const std::string &  tracks_dp 
)
inline

Write a scene using standard subdirectory structure; e.g., the association is written to "association.txt".

Parameters
sceneScene to be written.
tracks_dpDirectory where trajectory files will be written.