KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
psi_bbox.h
Go to the documentation of this file.
1 #ifndef KJB_PSI_BBOX_H
2 #define KJB_PSI_BBOX_H
3 
4 
8 #include <m_cpp/m_vector.h>
10 #include <g_cpp/g_util.h>
11 #include <g_cpp/g_cylinder.h>
13 
14 #ifdef KJB_HAVE_UA_CARTWHEEL
15 #include <MathLib/Capsule.h>
16 #include <Control/CapsuleState.h>
17 #endif
18 
19 #include <vector>
21 #include <psi_cpp/psi_util.h>
22 
23 namespace kjb {
24 namespace psi {
25 
26 #ifdef KJB_HAVE_UA_CARTWHEEL
27 typedef CartWheel::Math::Capsule Cw_capsule;
28 #endif
29 
30 #ifdef KJB_HAVE_UA_CARTWHEEL
31 std::vector<Bbox>
33  const CartWheel::CapsuleState& capsules,
34  const kjb::Perspective_camera& cam);
35 #endif
36 
37 std::vector<Bbox>
39  const std::vector<kjb::Cylinder>& cylinders,
40  const kjb::Perspective_camera& cam);
41 
42 
43 #ifdef KJB_HAVE_UA_CARTWHEEL
44 std::vector<kjb::Vector> capsules_to_3d_points(const std::vector<Cw_capsule*>& capsules);
45 #endif
46 
47 std::vector<kjb::Vector> cylinder_to_3d_points(const kjb::Cylinder& c, double scale_long = 1.0, double angle_short = 0.0);
48 
49 inline std::vector<kjb::Vector> box_to_3d_points(const Cuboid& box)
50 {
51  return get_corners(box);
52 }
53 
54 
56  const std::vector<kjb::Vector>& points_3d,
57  const kjb::Perspective_camera& cam);
58 
59 #ifdef KJB_HAVE_UA_CARTWHEEL
60 inline Bbox get_bounding_box(const std::vector<Cw_capsule*>& capsules, const kjb::Perspective_camera& cam)
61 {
62  std::vector<kjb::Vector> points_3d = capsules_to_3d_points(capsules);
63 
64  return get_bounding_box(points_3d, cam);
65 }
66 #endif
67 
68 inline Bbox get_bounding_box(const kjb::Cylinder& cylinder, const kjb::Perspective_camera& cam, double scale_long = 1.0, double angle_short = 0.0)
69 {
70  std::vector<kjb::Vector> points_3d = cylinder_to_3d_points(cylinder, scale_long, angle_short);
71 
72  return get_bounding_box(points_3d, cam);
73 }
74 
75 inline Bbox get_bounding_box(const Cuboid box, const kjb::Perspective_camera& cam)
76 {
77  std::vector<kjb::Vector> points_3d = box_to_3d_points(box);
78 
79  return get_bounding_box(points_3d, cam);
80 }
81 
82 
84 {
86 }
87 
88 kjb::Color_histogram compute_color_histogram_from_box(const Bbox & box, const kjb::Image & img, unsigned int num_bins);
89 
90 
91 } // namespace psi
92 } // namespace kjb
93 #endif /*KJB_PSI_BBOX_H */
94 
kjb::Color_histogram compute_color_histogram_from_box(const Bbox &box, const kjb::Image &img, unsigned int num_bins)
Definition: psi_bbox.cpp:220
Class that represents an axis-aligned 2D rectangle. It is defined in terms of its (2D) center...
Definition: gr_2D_bounding_box.h:51
std::vector< Bbox > get_bounding_boxes(const std::vector< kjb::Cylinder > &cylinders, const kjb::Perspective_camera &cam)
Definition: psi_bbox.cpp:206
Definition: psi_weighted_box.h:43
std::vector< kjb::Vector > cylinder_to_3d_points(const kjb::Cylinder &cylinder, double scale_long, double angle_short)
Definition: psi_bbox.cpp:159
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
std::vector< Vector > get_corners(const Cuboid &c)
Definition: psi_weighted_box.cpp:31
Vector projective_to_euclidean_2d(const Vector &v)
Converts coordinates in (2D) projective space to coordinates in (2D) euclidean space.
Definition: g_util.cpp:109
Bbox get_bounding_box(const std::vector< kjb::Vector > &points_3d, const kjb::Perspective_camera &cam)
Definition: psi_bbox.cpp:172
St_perspective_camera for modeling a perspective camera using the classic Forsyth and Ponce parametri...
Code for computing basic color histograms for an image.
Definition: perspective_camera.h:93
x
Definition: APPgetLargeConnectedEdges.m:100
Vector euclidean_to_projective(const Vector &v)
Converts coordinates in euclidean space to coordinates in projective space.
Definition: g_util.cpp:122
kjb::Vector project_point(const kjb::Perspective_camera &cam, const kjb::Vector &x)
Definition: psi_bbox.h:83
Definition: g_cylinder.h:32
Wrapped version of the C struct KJB_image.
Definition: i_image.h:76
const Matrix & build_camera_matrix() const
Definition: perspective_camera.h:487
std::vector< kjb::Vector > box_to_3d_points(const Cuboid &box)
Definition: psi_bbox.h:49
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionalit...
Class to compute an RGB colour histogram over an image or a rectangular portion of it...
Definition: i_color_histogram.h:40