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

Function test_null_rotate_image_with_interpolation

dlib/test/image.cpp:2322–2387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2320 }
2321
2322 void test_null_rotate_image_with_interpolation()
2323 {
2324 {
2325 matrix<unsigned char> img_s(3, 3);
2326 matrix<unsigned char> img_d;
2327
2328 img_s(0, 0) = 0;
2329 img_s(0, 1) = 100;
2330 img_s(0, 2) = 100;
2331 img_s(1, 0) = 100;
2332 img_s(1, 1) = 100;
2333 img_s(1, 2) = 100;
2334 img_s(2, 0) = 100;
2335 img_s(2, 1) = 100;
2336 img_s(2, 2) = 100;
2337
2338 rotate_image(img_s, img_d, 0, interpolate_bilinear());
2339 DLIB_TEST((img_d(0, 0) == 0));
2340 DLIB_TEST((img_d(0, 1) == 100));
2341 DLIB_TEST((img_d(1, 0) == 100));
2342 DLIB_TEST((img_d(1, 1) == 100));
2343 }
2344
2345 {
2346 matrix<rgb_pixel> img_s(3, 3);
2347 matrix<rgb_pixel> img_d(3, 3);
2348
2349 img_s(0, 0) = { 0, 0, 0 };
2350 img_s(0, 1) = { 10, 20, 30 };
2351 img_s(0, 2) = { 10, 20, 30 };
2352 img_s(1, 0) = { 10, 20, 30 };
2353 img_s(1, 1) = { 10, 20, 30 };
2354 img_s(1, 2) = { 10, 20, 30 };
2355 img_s(2, 0) = { 10, 20, 30 };
2356 img_s(2, 1) = { 10, 20, 30 };
2357 img_s(2, 2) = { 10, 20, 30 };
2358
2359 rotate_image(img_s, img_d, 0, interpolate_bilinear());
2360 DLIB_TEST((img_d(0, 0) == rgb_pixel{ 0, 0, 0 }));
2361 DLIB_TEST((img_d(0, 1) == rgb_pixel{ 10, 20, 30 }));
2362 DLIB_TEST((img_d(1, 0) == rgb_pixel{ 10, 20, 30 }));
2363 DLIB_TEST((img_d(1, 1) == rgb_pixel{ 10, 20, 30 }));
2364 }
2365
2366 {
2367 matrix<lab_pixel> img_s(3, 3);
2368 matrix<lab_pixel> img_d(3, 3);
2369
2370 img_s(0, 0) = { 0, 0, 0 };
2371 img_s(0, 1) = { 100, 20, 30 };
2372 img_s(0, 2) = { 100, 20, 30 };
2373 img_s(1, 0) = { 100, 20, 30 };
2374 img_s(1, 1) = { 100, 20, 30 };
2375 img_s(1, 2) = { 100, 20, 30 };
2376 img_s(2, 0) = { 100, 20, 30 };
2377 img_s(2, 1) = { 100, 20, 30 };
2378 img_s(2, 2) = { 100, 20, 30 };
2379

Callers 1

perform_testMethod · 0.85

Calls 2

rotate_imageFunction · 0.85

Tested by

no test coverage detected