MCPcopy Create free account
hub / github.com/davisking/dlib / add_grid_rects

Method add_grid_rects

dlib/image_processing/scan_image_boxes.h:170–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168 }
169
170 static void add_grid_rects (
171 std::vector<rectangle>& rects,
172 const rectangle& object_box,
173 unsigned int cells_x,
174 unsigned int cells_y
175 )
176 {
177 // make sure requires clause is not broken
178 DLIB_ASSERT(cells_x > 0 && cells_y > 0,
179 "\t void add_grid_rects()"
180 << "\n\t The number of cells along a dimension can't be zero. "
181 << "\n\t cells_x: " << cells_x
182 << "\n\t cells_y: " << cells_y
183 );
184
185 const matrix_range_exp<double>& x = linspace(object_box.left(), object_box.right(), cells_x+1);
186 const matrix_range_exp<double>& y = linspace(object_box.top(), object_box.bottom(), cells_y+1);
187
188 for (long j = 0; j+1 < y.size(); ++j)
189 {
190 for (long i = 0; i+1 < x.size(); ++i)
191 {
192 const dlib::vector<double,2> tl(x(i),y(j));
193 const dlib::vector<double,2> br(x(i+1),y(j+1));
194 rects.push_back(rectangle(tl,br));
195 }
196 }
197 }
198
199 void get_feature_extraction_regions (
200 const rectangle& rect,

Callers

nothing calls this directly

Calls 10

linspaceFunction · 0.85
xFunction · 0.85
yFunction · 0.85
rectangleClass · 0.50
leftMethod · 0.45
rightMethod · 0.45
topMethod · 0.45
bottomMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected