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

Function image_test

dlib/test/image.cpp:88–892  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86
87
88 void image_test (
89 )
90 /*!
91 ensures
92 - runs tests on pixel objects and functions for compliance with the specs
93 !*/
94 {
95
96 print_spinner();
97
98 array2d<unsigned char> img1, img2;
99
100 img1.set_size(100,100);
101
102 assign_all_pixels(img1,7);
103
104 assign_image(img2, img1);
105
106 DLIB_TEST_MSG(img1.nr() == 100 && img1.nc() == 100 &&
107 img2.nr() == 100 && img2.nc() == 100,"");
108
109
110 for (long r = 0; r < img1.nr(); ++r)
111 {
112 for (long c = 0; c < img1.nc(); ++c)
113 {
114 DLIB_TEST(img1[r][c] == 7);
115 DLIB_TEST(img2[r][c] == 7);
116 }
117 }
118
119 img2.clear();
120 DLIB_TEST(img2.size() == 0);
121 DLIB_TEST(img2.nr() == 0);
122 DLIB_TEST(img2.nc() == 0);
123 assign_image(img2, mat(img1));
124
125 DLIB_TEST_MSG(img1.nr() == 100 && img1.nc() == 100 &&
126 img2.nr() == 100 && img2.nc() == 100,"");
127
128
129 for (long r = 0; r < img1.nr(); ++r)
130 {
131 for (long c = 0; c < img1.nc(); ++c)
132 {
133 DLIB_TEST(img1[r][c] == 7);
134 DLIB_TEST(img2[r][c] == 7);
135 }
136 }
137
138
139 threshold_image(img1, img2, 4);
140
141 for (long r = 0; r < img1.nr(); ++r)
142 {
143 for (long c = 0; c < img1.nc(); ++c)
144 {
145 DLIB_TEST(img1[r][c] == 7);

Callers 1

perform_testMethod · 0.85

Calls 15

print_spinnerFunction · 0.85
assign_all_pixelsFunction · 0.85
threshold_imageFunction · 0.85
save_dngFunction · 0.85
load_dngFunction · 0.85
save_pngFunction · 0.85
load_pngFunction · 0.85
save_bmpFunction · 0.85
load_bmpFunction · 0.85
equalize_histogramFunction · 0.85
assign_border_pixelsFunction · 0.85
submFunction · 0.85

Tested by

no test coverage detected