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

Function image_test

dlib/test/image.cpp:90–894  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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