| 212 | // ---------------------------------------------------------------------------------------- |
| 213 | |
| 214 | void run_test1() |
| 215 | { |
| 216 | dlog << LINFO << "run_test1()"; |
| 217 | |
| 218 | print_spinner(); |
| 219 | array2d<unsigned char> img, temp_img; |
| 220 | img.set_size(600,600); |
| 221 | assign_all_pixels(img,0); |
| 222 | rectangle rect = centered_rect(10,10,5,5); |
| 223 | dlog << LTRACE << "expected: 10,10"; |
| 224 | fill_rect(img, rect, 255); |
| 225 | |
| 226 | |
| 227 | array<array2d<unsigned char> > images; |
| 228 | std::vector<std::pair<unsigned int, rectangle> > rects; |
| 229 | for (int i = 0; i < 10; ++i) |
| 230 | { |
| 231 | assign_image(temp_img, img); |
| 232 | images.push_back(temp_img); |
| 233 | rects.push_back(make_pair(i,centered_rect(0,0,5,5))); |
| 234 | } |
| 235 | |
| 236 | std::vector<std::pair<double, point> > dets, dets2, dets3; |
| 237 | |
| 238 | |
| 239 | dlog << LTRACE << "best score: "<< sum_of_rects_in_images(images,rects,point(10,10)); |
| 240 | scan_image(dets,images,rects,30000, 100); |
| 241 | scan_image_i(dets2,images,rects,30000, 100); |
| 242 | scan_image_old(dets3,images,rects,30000, 100); |
| 243 | |
| 244 | |
| 245 | |
| 246 | dlog << LTRACE << "dets.size(): "<< dets.size(); |
| 247 | dlog << LTRACE << "dets2.size(): "<< dets2.size(); |
| 248 | dlog << LTRACE << "dets3.size(): "<< dets3.size(); |
| 249 | |
| 250 | DLIB_TEST(dets.size() == dets2.size()); |
| 251 | DLIB_TEST(dets.size() == dets3.size()); |
| 252 | |
| 253 | for (unsigned long i = 0; i < dets.size(); ++i) |
| 254 | { |
| 255 | //dlog << LTRACE << "dets["<<i<<"]: " << dets[i].second << " -> " << dets[i].first; |
| 256 | //dlog << LTRACE << "dets2["<<i<<"]: " << dets2[i].second << " -> " << dets2[i].first; |
| 257 | //dlog << LTRACE << "dets3["<<i<<"]: " << dets3[i].second << " -> " << dets3[i].first; |
| 258 | |
| 259 | DLIB_TEST(sum_of_rects_in_images(images, rects, dets[i].second) == dets[i].first); |
| 260 | DLIB_TEST(sum_of_rects_in_images(images, rects, dets2[i].second) == dets2[i].first); |
| 261 | DLIB_TEST(sum_of_rects_in_images(images, rects, dets3[i].second) == dets3[i].first); |
| 262 | } |
| 263 | |
| 264 | |
| 265 | } |
| 266 | |
| 267 | // ---------------------------------------------------------------------------------------- |
| 268 |
no test coverage detected