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

Function make_simple_test_data

examples/object_detector_advanced_ex.cpp:36–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34 typename image_array_type
35 >
36void make_simple_test_data (
37 image_array_type& images,
38 std::vector<std::vector<rectangle> >& object_locations
39)
40/*!
41 ensures
42 - #images.size() == 3
43 - #object_locations.size() == 3
44 - Creates some simple images to test the object detection routines. In particular,
45 this function creates images with white 70x70 squares in them. It also stores
46 the locations of these squares in object_locations.
47 - for all valid i:
48 - object_locations[i] == A list of all the white rectangles present in images[i].
49!*/
50{
51 images.clear();
52 object_locations.clear();
53
54 images.resize(3);
55 images[0].set_size(400,400);
56 images[1].set_size(400,400);
57 images[2].set_size(400,400);
58
59 // set all the pixel values to black
60 assign_all_pixels(images[0], 0);
61 assign_all_pixels(images[1], 0);
62 assign_all_pixels(images[2], 0);
63
64 // Now make some squares and draw them onto our black images. All the
65 // squares will be 70 pixels wide and tall.
66
67 std::vector<rectangle> temp;
68 temp.push_back(centered_rect(point(100,100), 70,70));
69 fill_rect(images[0],temp.back(),255); // Paint the square white
70 temp.push_back(centered_rect(point(200,300), 70,70));
71 fill_rect(images[0],temp.back(),255); // Paint the square white
72 object_locations.push_back(temp);
73
74 temp.clear();
75 temp.push_back(centered_rect(point(140,200), 70,70));
76 fill_rect(images[1],temp.back(),255); // Paint the square white
77 temp.push_back(centered_rect(point(303,200), 70,70));
78 fill_rect(images[1],temp.back(),255); // Paint the square white
79 object_locations.push_back(temp);
80
81 temp.clear();
82 temp.push_back(centered_rect(point(123,121), 70,70));
83 fill_rect(images[2],temp.back(),255); // Paint the square white
84 object_locations.push_back(temp);
85}
86
87// ----------------------------------------------------------------------------------------
88

Callers 1

mainFunction · 0.70

Calls 9

assign_all_pixelsFunction · 0.85
centered_rectFunction · 0.85
pointClass · 0.50
fill_rectFunction · 0.50
clearMethod · 0.45
resizeMethod · 0.45
set_sizeMethod · 0.45
push_backMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected