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

Method load

examples/object_detector_advanced_ex.cpp:113–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111 typename image_type
112 >
113 inline void load (
114 const image_type& img
115 )
116 {
117 feat_image.set_size(img.nr(), img.nc());
118 assign_all_pixels(feat_image,0);
119 for (long r = 1; r+1 < img.nr(); ++r)
120 {
121 for (long c = 1; c+1 < img.nc(); ++c)
122 {
123 unsigned char f = 0;
124 if (img[r][c]) f |= 0x1;
125 if (img[r][c+1]) f |= 0x2;
126 if (img[r][c-1]) f |= 0x4;
127 if (img[r+1][c]) f |= 0x8;
128 if (img[r-1][c]) f |= 0x10;
129
130 // Store the code value for the pattern of pixel values in the 4-connected
131 // neighborhood around this row and column.
132 feat_image[r][c] = f;
133 }
134 }
135 }
136
137 inline size_t size () const { return feat_image.size(); }
138 inline long nr () const { return feat_image.nr(); }

Callers 4

mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls 4

assign_all_pixelsFunction · 0.85
set_sizeMethod · 0.45
nrMethod · 0.45
ncMethod · 0.45

Tested by 1