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

Function test_frame

dlib/test/ffmpeg.cpp:82–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80
81 template <class pixel>
82 void test_frame()
83 {
84 const matrix<pixel> img1 = get_random_image<pixel>();
85 const matrix<pixel> img2 = get_random_image<pixel>();
86
87 // Create a frame
88 frame f1(img1.nr(), img1.nc(), pix_traits<pixel>::fmt, system_clock::time_point{});
89 convert(img1, f1);
90
91 // Check frame is correct
92 check_image(f1, img1);
93
94 // Copy
95 frame f2(f1);
96
97 // Check it's a deepcopy, i.e. pointers are different but values are the same
98 check_image(f2, img1);
99
100 // Check pointers are different
101 DLIB_TEST(f1.get_frame().data[0] != f2.get_frame().data[0]);
102
103 // Set f2 and check this doesn't affect f1
104 f2 = frame(img2.nr(), img2.nc(), pix_traits<pixel>::fmt, system_clock::time_point{});
105 convert(img2, f2);
106
107 check_image(f2, img2);
108 check_image(f1, img1);
109 DLIB_TEST(f1.get_frame().data[0] != f2.get_frame().data[0]);
110
111 // Move
112 f2 = std::move(f1);
113 check_image(f2, img1);
114 DLIB_TEST(f1.is_empty());
115
116 print_spinner();
117 }
118
119 template <typename pixel_type>
120 static double psnr(const matrix<pixel_type>& img1, const matrix<pixel_type>& img2)

Callers

nothing calls this directly

Calls 8

check_imageFunction · 0.85
frameClass · 0.85
moveFunction · 0.85
print_spinnerFunction · 0.85
convertFunction · 0.50
nrMethod · 0.45
ncMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected