| 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, |