| 267 | // ---------------------------------------------------------------------------------------- |
| 268 | |
| 269 | void run_test2() |
| 270 | { |
| 271 | print_spinner(); |
| 272 | dlog << LINFO << "run_test2()"; |
| 273 | array2d<unsigned char> img, temp_img; |
| 274 | img.set_size(600,600); |
| 275 | assign_all_pixels(img,0); |
| 276 | rectangle rect = centered_rect(10,11,5,6); |
| 277 | dlog << LTRACE << "expected: 10,11"; |
| 278 | fill_rect(img, rect, 255); |
| 279 | |
| 280 | |
| 281 | array<array2d<unsigned char> > images; |
| 282 | std::vector<std::pair<unsigned int, rectangle> > rects; |
| 283 | for (int i = 0; i < 10; ++i) |
| 284 | { |
| 285 | assign_image(temp_img, img); |
| 286 | images.push_back(temp_img); |
| 287 | rects.push_back(make_pair(i,centered_rect(0,0,5,5))); |
| 288 | rects.push_back(make_pair(i,centered_rect(3,2,5,6))); |
| 289 | } |
| 290 | |
| 291 | std::vector<std::pair<double, point> > dets, dets2, dets3; |
| 292 | |
| 293 | |
| 294 | scan_image(dets,images,rects,30000, 100); |
| 295 | scan_image_i(dets2,images,rects,30000, 100); |
| 296 | scan_image_old(dets3,images,rects,30000, 100); |
| 297 | |
| 298 | |
| 299 | |
| 300 | dlog << LTRACE << "dets.size(): "<< dets.size(); |
| 301 | dlog << LTRACE << "dets2.size(): "<< dets2.size(); |
| 302 | dlog << LTRACE << "dets3.size(): "<< dets3.size(); |
| 303 | |
| 304 | DLIB_TEST(dets.size() == dets2.size()); |
| 305 | DLIB_TEST(dets.size() == dets3.size()); |
| 306 | |
| 307 | for (unsigned long i = 0; i < dets.size(); ++i) |
| 308 | { |
| 309 | //dlog << LTRACE << "dets["<<i<<"]: " << dets[i].second << " -> " << dets[i].first; |
| 310 | //dlog << LTRACE << "dets2["<<i<<"]: " << dets2[i].second << " -> " << dets2[i].first; |
| 311 | //dlog << LTRACE << "dets3["<<i<<"]: " << dets3[i].second << " -> " << dets3[i].first; |
| 312 | |
| 313 | DLIB_TEST(sum_of_rects_in_images(images, rects, dets[i].second) == dets[i].first); |
| 314 | DLIB_TEST(sum_of_rects_in_images(images, rects, dets2[i].second) == dets2[i].first); |
| 315 | DLIB_TEST(sum_of_rects_in_images(images, rects, dets3[i].second) == dets3[i].first); |
| 316 | } |
| 317 | |
| 318 | |
| 319 | } |
| 320 | |
| 321 | // ---------------------------------------------------------------------------------------- |
| 322 |
no test coverage detected