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

Function make_simple_test_data

dlib/test/object_detector.cpp:214–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212 typename image_array_type
213 >
214 void make_simple_test_data (
215 image_array_type& images,
216 std::vector<std::vector<rectangle> >& object_locations
217 )
218 {
219 images.clear();
220 object_locations.clear();
221
222 images.resize(3);
223 images[0].set_size(400,400);
224 images[1].set_size(400,400);
225 images[2].set_size(400,400);
226
227 // set all the pixel values to black
228 assign_all_pixels(images[0], 0);
229 assign_all_pixels(images[1], 0);
230 assign_all_pixels(images[2], 0);
231
232 // Now make some squares and draw them onto our black images. All the
233 // squares will be 70 pixels wide and tall.
234
235 std::vector<rectangle> temp;
236 temp.push_back(centered_rect(point(100,100), 70,70));
237 fill_rect(images[0],temp.back(),255); // Paint the square white
238 temp.push_back(centered_rect(point(200,300), 70,70));
239 fill_rect(images[0],temp.back(),255); // Paint the square white
240 object_locations.push_back(temp);
241
242 temp.clear();
243 temp.push_back(centered_rect(point(140,200), 70,70));
244 fill_rect(images[1],temp.back(),255); // Paint the square white
245 temp.push_back(centered_rect(point(303,200), 70,70));
246 fill_rect(images[1],temp.back(),255); // Paint the square white
247 object_locations.push_back(temp);
248
249 temp.clear();
250 temp.push_back(centered_rect(point(123,121), 70,70));
251 fill_rect(images[2],temp.back(),255); // Paint the square white
252 object_locations.push_back(temp);
253
254 // corrupt each image with random noise just to make this a little more
255 // challenging
256 dlib::rand rnd;
257 for (unsigned long i = 0; i < images.size(); ++i)
258 {
259 for (long r = 0; r < images[i].nr(); ++r)
260 {
261 for (long c = 0; c < images[i].nc(); ++c)
262 {
263 typedef typename image_array_type::type image_type;
264 typedef typename image_type::type type;
265 images[i][r][c] = (type)put_in_range(0,255,images[i][r][c] + 10*rnd.get_random_gaussian());
266 }
267 }
268 }
269 }
270
271 template <

Callers 12

test_fhog_pyramidFunction · 0.70
test_1Function · 0.70
test_1_boxesFunction · 0.70
test_1mFunction · 0.70
test_1_fine_hogFunction · 0.70
test_1_polyFunction · 0.70
test_1m_polyFunction · 0.70
test_1_poly_nnFunction · 0.70
test_1_poly_nn_boxesFunction · 0.70
test_2Function · 0.70
test_3Function · 0.70
test_3_boxesFunction · 0.70

Calls 15

assign_all_pixelsFunction · 0.85
centered_rectFunction · 0.85
put_in_rangeFunction · 0.85
get_random_gaussianMethod · 0.80
pointClass · 0.50
fill_rectFunction · 0.50
shrink_rectFunction · 0.50
clearMethod · 0.45
resizeMethod · 0.45
set_sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected