20 #ifndef KJB_CPP_EDGE_MANHATTAN_HOG_H
21 #define KJB_CPP_EDGE_MANHATTAN_HOG_H
53 hog_responses_horizontal =
new float[manhattan_hog_size];
54 memcpy(hog_responses_horizontal, src.hog_responses_horizontal, manhattan_hog_size*
sizeof(
float));
55 hog_responses_vertical_1 =
new float[manhattan_hog_size];
56 memcpy(hog_responses_vertical_1, src.hog_responses_vertical_1, manhattan_hog_size*
sizeof(
float));
57 hog_responses_vertical_2 =
new float[manhattan_hog_size];
58 memcpy(hog_responses_vertical_2, src.hog_responses_vertical_2, manhattan_hog_size*
sizeof(
float));
59 num_hog_cols = src.num_hog_cols;
60 num_hog_rows = src.num_hog_rows;
61 hog_maxs = src.hog_maxs;
62 bin_size = src.bin_size;
67 delete[] hog_responses_horizontal;
68 delete[] hog_responses_vertical_1;
69 delete[] hog_responses_vertical_2;
74 delete[] hog_responses_horizontal;
75 delete[] hog_responses_vertical_1;
76 delete[] hog_responses_vertical_2;
77 hog_responses_horizontal = NULL;
78 hog_responses_vertical_1 = NULL;
79 hog_responses_vertical_2 = NULL;
80 hog_responses_horizontal =
new float[manhattan_hog_size];
81 memcpy(hog_responses_horizontal, src.hog_responses_horizontal, manhattan_hog_size*
sizeof(
float));
82 hog_responses_vertical_1 =
new float[manhattan_hog_size];
83 memcpy(hog_responses_vertical_1, src.hog_responses_vertical_1, manhattan_hog_size*
sizeof(
float));
84 hog_responses_vertical_2 =
new float[manhattan_hog_size];
85 memcpy(hog_responses_vertical_2, src.hog_responses_vertical_2, manhattan_hog_size*
sizeof(
float));
86 num_hog_cols = src.num_hog_cols;
87 num_hog_rows = src.num_hog_rows;
88 hog_maxs = src.hog_maxs;
89 bin_size = src.bin_size;
94 void read(std::istream& in);
97 void write(std::ostream& out)
const;
101 return (hog_size_2D/32)*27;
106 std::vector<kjb::Vector> & manhattan_dir_3d_vertical,
107 std::vector<kjb::Vector> & manhattan_dir_3d_vertical1,
108 std::vector<kjb::Vector> & manhattan_dir_3d_vertical2,
114 const std::vector<kjb::Vector> & manhattan_dir_3d_vertical,
115 const std::vector<kjb::Vector> & manhattan_dir_3d_vertical1,
116 const std::vector<kjb::Vector> & manhattan_dir_3d_vertical2,
121 std::vector<kjb::Vector> & projected_manhattan_dir_horizontal,
122 std::vector<kjb::Vector> & projected_manhattan_dir_vertical1,
123 std::vector<kjb::Vector> & projected_manhattan_dir_vertical2
128 const std::vector<kjb::Vector> & projected_directions,
129 const float * weights_2D,
131 double angle_increment,
137 std::vector<Line_segment> & line_segments,
138 const std::vector<kjb::Vector> & projected_directions,
152 void get_hog_pixels(std::vector<std::pair<int, int> > & hog_pixels)
const;
158 return 1.5 + bin_size + (bin_size*hog_x_index);
163 return 1.5 + bin_size + (bin_size*hog_y_index);
168 return hog_responses_horizontal;
173 return hog_responses_vertical_1;
178 return hog_responses_vertical_2;
197 int manhattan_hog_size;
200 float * hog_responses_horizontal;
201 float * hog_responses_vertical_1;
202 float * hog_responses_vertical_2;
206 void find_2D_hog_directions(std::vector<kjb::Vector> & directions_2D,
int num_angle_bins)
const;
208 double find_2D_weight_by_interpolation
210 const Vector & idirection,
211 double angle_increment,
213 const float * weights
int get_num_hog_cols() const
Definition: st_manhattan_hog.h:191
Abstract class to write this object to an output stream.
Definition: l_writeable.h:41
Image draw_image_with_vertical_segments(const Hog_responses &hog_responses, const Image &image, const Perspective_camera &camera, const Parametric_parapiped ¶piped) const
Definition: st_manhattan_hog.cpp:354
Abstract class to read this object from an input stream.
Definition: l_readable.h:39
const float * get_vertical1() const
Definition: st_manhattan_hog.h:171
int get_hog_cell_x_center(int hog_x_index) const
Definition: st_manhattan_hog.h:156
void write(std::ostream &out) const
Writes this Line segment to an output stream.
Definition: st_manhattan_hog.cpp:139
void compute_HOG_features(const Image &img, int bin_size)
Definition: st_manhattan_hog.h:35
void read(std::istream &in)
Reads this Line segment from an input stream.
Definition: st_manhattan_hog.cpp:107
void get_projected_manhattan_directions(const std::vector< kjb::Vector > &manhattan_dir_3d_vertical, const std::vector< kjb::Vector > &manhattan_dir_3d_vertical1, const std::vector< kjb::Vector > &manhattan_dir_3d_vertical2, const kjb::Vector ¢er_in_pp_coordinates, const kjb::Parametric_parapiped &pp, const kjb::Perspective_camera &camera, int img_height, std::vector< kjb::Vector > &projected_manhattan_dir_horizontal, std::vector< kjb::Vector > &projected_manhattan_dir_vertical1, std::vector< kjb::Vector > &projected_manhattan_dir_vertical2) const
Definition: st_manhattan_hog.cpp:247
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
void interpolate_projected_directions(const std::vector< kjb::Vector > &projected_directions, const float *weights_2D, float *weights_3D, double angle_increment, int inum_bins)
Definition: st_manhattan_hog.cpp:309
size_t length(const C &cner)
Counts the total number of elements in a 2D STL-style container.
Definition: l_util.h:17
St_perspective_camera for modeling a perspective camera using the classic Forsyth and Ponce parametri...
int compute_manhattan_hog_size(int hog_size_2D)
Definition: st_manhattan_hog.h:99
int get_num_hog_rows() const
Definition: st_manhattan_hog.h:186
Definition: perspective_camera.h:93
int get_hog_cell_y_center(int hog_y_index) const
Definition: st_manhattan_hog.h:161
void get_3D_manhattan_directions(std::vector< kjb::Vector > &manhattan_dir_3d_vertical, std::vector< kjb::Vector > &manhattan_dir_3d_vertical1, std::vector< kjb::Vector > &manhattan_dir_3d_vertical2, int num_directions) const
Definition: st_manhattan_hog.cpp:198
Manhattan_hog(const Hog_responses &hog_responses, const Image &image, const Perspective_camera &camera, const Parametric_parapiped ¶piped)
Definition: st_manhattan_hog.cpp:23
void get_line_segments_for_drawing(std::vector< Line_segment > &line_segments, const std::vector< kjb::Vector > &projected_directions, double center_x, double center_y, double length) const
Definition: st_manhattan_hog.cpp:325
void get_hog_offsets(std::vector< int > &hog_offsets) const
Definition: st_manhattan_hog.cpp:501
virtual void read(std::istream &in)=0
Reads this Readable from an input stream.
const Vector & get_hog_maxs() const
Definition: st_manhattan_hog.h:181
Wrapped version of the C struct KJB_image.
Definition: i_image.h:76
Manhattan_hog(const std::string &file_name)
Definition: st_manhattan_hog.h:46
~Manhattan_hog()
Definition: st_manhattan_hog.h:65
Manhattan_hog & operator=(const Manhattan_hog &src)
Definition: st_manhattan_hog.h:72
Manhattan_hog(const Manhattan_hog &src)
Definition: st_manhattan_hog.h:51
const float * get_horizontal() const
Definition: st_manhattan_hog.h:166
void get_hog_pixels(std::vector< std::pair< int, int > > &hog_pixels) const
Definition: st_manhattan_hog.cpp:489
const float * get_vertical2() const
Definition: st_manhattan_hog.h:176
Definition: st_parapiped.h:99