MCPcopy Create free account
hub / github.com/OAID/Tengine / copy_one_patch

Function copy_one_patch

examples/mtcnn/mtcnn_utils.cpp:217–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215 padding(img_h, img_w, rects);
216}
217void copy_one_patch(image img, face_box& input_box, float* data_to, int width, int height)
218{
219 double w = std::abs(input_box.px0 - input_box.px1);
220 double h = std::abs(input_box.py0 - input_box.py1);
221 image chop_im = make_image(( int )w, ( int )h, img.c);
222
223 for(int c = 0; c < img.c; c++)
224 {
225 for(int i = 0; i < ( int )h; i++)
226 {
227 for(int j = 0; j < ( int )w; j++)
228 {
229 chop_im.data[c * ( int )h * ( int )w + i * ( int )w + j] =
230 img.data[c * img.h * img.w + (i + ( int )input_box.py0) * img.w + j + ( int )input_box.px0];
231 }
232 }
233 }
234
235 int pad_top = std::abs(input_box.py0 - input_box.y0);
236 int pad_left = std::abs(input_box.px0 - input_box.x0);
237 int pad_bottom = std::abs(input_box.py1 - input_box.y1);
238 int pad_right = std::abs(input_box.px1 - input_box.x1);
239
240 image copyMakerImage = copyMaker(chop_im, pad_top, pad_bottom, pad_left, pad_right, 0);
241
242 image resImg = resize_image(copyMakerImage, width, height);
243
244 for(int i = 0; i < 3 * width * height; i++)
245 {
246 *data_to = resImg.data[i];
247 data_to++;
248 }
249}

Callers 4

run_RNetMethod · 0.85
run_ONetMethod · 0.85
run_RNetMethod · 0.85
run_ONetMethod · 0.85

Calls 3

make_imageFunction · 0.85
copyMakerFunction · 0.85
resize_imageFunction · 0.85

Tested by

no test coverage detected