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

Function test_letterbox_image

dlib/test/image.cpp:2435–2456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2433 }
2434
2435 void test_letterbox_image()
2436 {
2437 print_spinner();
2438 rgb_pixel black(0, 0, 0);
2439 rgb_pixel white(255, 255, 255);
2440 matrix<rgb_pixel> img_s(40, 60);
2441 matrix<rgb_pixel> img_d(30, 30);
2442 assign_all_pixels(img_s, white);
2443 const auto tform = letterbox_image(img_s, img_d, interpolate_nearest_neighbor());
2444 DLIB_TEST(tform.get_m() == identity_matrix<double>(2) * 0.5);
2445 DLIB_TEST(tform.get_b() == dpoint(0, 5));
2446
2447 // manually generate the target image
2448 matrix<rgb_pixel> img_t(30, 30);
2449 assign_all_pixels(img_t, rgb_pixel(0, 0, 0));
2450 matrix<rgb_pixel> img_w(20, 30);
2451 assign_all_pixels(img_w, rgb_pixel(255, 255, 255));
2452 rectangle r (0, 5, 30 - 1, 25 - 1);
2453 auto si = sub_image(img_t, r);
2454 assign_image(si, img_w);
2455 DLIB_TEST(img_d == img_t);
2456 }
2457
2458 void test_draw_string()
2459 {

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