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

Method load

dlib/image_keypoint/poly_image.h:137–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135 typename image_type
136 >
137 inline void load (
138 const image_type& img
139 )
140 {
141 COMPILE_TIME_ASSERT( pixel_traits<typename image_traits<image_type>::pixel_type>::has_alpha == false );
142
143 poly_coef.resize(get_num_dimensions());
144 des.set_size(get_num_dimensions());
145
146
147 if (normalize)
148 {
149 array2d<float> coef0;
150 rectangle rect = filter_image(img, coef0, filters[0]);
151 num_rows = rect.height();
152 num_cols = rect.width();
153
154 for (unsigned long i = 1; i < filters.size(); ++i)
155 {
156 filter_image(img, poly_coef[i-1], filters[i]);
157
158 // intensity normalize everything
159 for (long r = 0; r < coef0.nr(); ++r)
160 {
161 for (long c = 0; c < coef0.nc(); ++c)
162 {
163 if (coef0[r][c] >= 1)
164 poly_coef[i-1][r][c] /= coef0[r][c];
165 else
166 poly_coef[i-1][r][c] = 0;
167 }
168 }
169 }
170
171 if (rotation_invariance)
172 rotate_polys(rect);
173 }
174 else
175 {
176 rectangle rect;
177 for (unsigned long i = 0; i < filters.size(); ++i)
178 {
179 rect = filter_image(img, poly_coef[i], filters[i]);
180 }
181 num_rows = rect.height();
182 num_cols = rect.width();
183
184 if (rotation_invariance)
185 rotate_polys(rect);
186 }
187 }
188
189 void unload()
190 {

Callers

nothing calls this directly

Calls 7

resizeMethod · 0.45
set_sizeMethod · 0.45
heightMethod · 0.45
widthMethod · 0.45
sizeMethod · 0.45
nrMethod · 0.45
ncMethod · 0.45

Tested by

no test coverage detected