| 212 | typename image_array_type |
| 213 | > |
| 214 | void make_simple_test_data ( |
| 215 | image_array_type& images, |
| 216 | std::vector<std::vector<rectangle> >& object_locations |
| 217 | ) |
| 218 | { |
| 219 | images.clear(); |
| 220 | object_locations.clear(); |
| 221 | |
| 222 | images.resize(3); |
| 223 | images[0].set_size(400,400); |
| 224 | images[1].set_size(400,400); |
| 225 | images[2].set_size(400,400); |
| 226 | |
| 227 | // set all the pixel values to black |
| 228 | assign_all_pixels(images[0], 0); |
| 229 | assign_all_pixels(images[1], 0); |
| 230 | assign_all_pixels(images[2], 0); |
| 231 | |
| 232 | // Now make some squares and draw them onto our black images. All the |
| 233 | // squares will be 70 pixels wide and tall. |
| 234 | |
| 235 | std::vector<rectangle> temp; |
| 236 | temp.push_back(centered_rect(point(100,100), 70,70)); |
| 237 | fill_rect(images[0],temp.back(),255); // Paint the square white |
| 238 | temp.push_back(centered_rect(point(200,300), 70,70)); |
| 239 | fill_rect(images[0],temp.back(),255); // Paint the square white |
| 240 | object_locations.push_back(temp); |
| 241 | |
| 242 | temp.clear(); |
| 243 | temp.push_back(centered_rect(point(140,200), 70,70)); |
| 244 | fill_rect(images[1],temp.back(),255); // Paint the square white |
| 245 | temp.push_back(centered_rect(point(303,200), 70,70)); |
| 246 | fill_rect(images[1],temp.back(),255); // Paint the square white |
| 247 | object_locations.push_back(temp); |
| 248 | |
| 249 | temp.clear(); |
| 250 | temp.push_back(centered_rect(point(123,121), 70,70)); |
| 251 | fill_rect(images[2],temp.back(),255); // Paint the square white |
| 252 | object_locations.push_back(temp); |
| 253 | |
| 254 | // corrupt each image with random noise just to make this a little more |
| 255 | // challenging |
| 256 | dlib::rand rnd; |
| 257 | for (unsigned long i = 0; i < images.size(); ++i) |
| 258 | { |
| 259 | for (long r = 0; r < images[i].nr(); ++r) |
| 260 | { |
| 261 | for (long c = 0; c < images[i].nc(); ++c) |
| 262 | { |
| 263 | typedef typename image_array_type::type image_type; |
| 264 | typedef typename image_type::type type; |
| 265 | images[i][r][c] = (type)put_in_range(0,255,images[i][r][c] + 10*rnd.get_random_gaussian()); |
| 266 | } |
| 267 | } |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | template < |
no test coverage detected