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

Function test_letterbox_image

dlib/test/image.cpp:2520–2541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2518 }
2519
2520 void test_letterbox_image()
2521 {
2522 print_spinner();
2523 rgb_pixel black(0, 0, 0);
2524 rgb_pixel white(255, 255, 255);
2525 matrix<rgb_pixel> img_s(40, 60);
2526 matrix<rgb_pixel> img_d(30, 30);
2527 assign_all_pixels(img_s, white);
2528 const auto tform = letterbox_image(img_s, img_d, interpolate_nearest_neighbor());
2529 DLIB_TEST(tform.get_m() == identity_matrix<double>(2) * 0.5);
2530 DLIB_TEST(tform.get_b() == dpoint(0, 5));
2531
2532 // manually generate the target image
2533 matrix<rgb_pixel> img_t(30, 30);
2534 assign_all_pixels(img_t, rgb_pixel(0, 0, 0));
2535 matrix<rgb_pixel> img_w(20, 30);
2536 assign_all_pixels(img_w, rgb_pixel(255, 255, 255));
2537 rectangle r (0, 5, 30 - 1, 25 - 1);
2538 auto si = sub_image(img_t, r);
2539 assign_image(si, img_w);
2540 DLIB_TEST(img_d == img_t);
2541 }
2542
2543 void test_draw_string()
2544 {

Callers 1

perform_testMethod · 0.85

Calls 9

print_spinnerFunction · 0.85
assign_all_pixelsFunction · 0.85
letterbox_imageFunction · 0.85
rgb_pixelClass · 0.85
sub_imageFunction · 0.85
get_bMethod · 0.80
assign_imageFunction · 0.50
get_mMethod · 0.45

Tested by

no test coverage detected