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

Function save_face_chips

tools/python/src/face_recognition.cpp:330–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328}
329
330void save_face_chips (
331 numpy_image<rgb_pixel> img,
332 const std::vector<full_object_detection>& faces,
333 const std::string& chip_filename,
334 size_t size = 150,
335 float padding = 0.25
336)
337{
338
339 int num_faces = faces.size();
340 std::vector<chip_details> dets;
341 for (const auto& f : faces)
342 dets.push_back(get_face_chip_details(f, size, padding));
343 dlib::array<matrix<rgb_pixel>> face_chips;
344 extract_image_chips(numpy_image<rgb_pixel>(img), dets, face_chips);
345 int i=0;
346 for (const auto& chip : face_chips)
347 {
348 i++;
349 if(num_faces > 1)
350 {
351 const std::string& file_name = chip_filename + "_" + std::to_string(i) + ".jpg";
352 save_jpeg(chip, file_name);
353 }
354 else
355 {
356 const std::string& file_name = chip_filename + ".jpg";
357 save_jpeg(chip, file_name);
358 }
359 }
360}
361
362void save_face_chip (
363 numpy_image<rgb_pixel> img,

Callers 1

save_face_chipFunction · 0.85

Calls 5

get_face_chip_detailsFunction · 0.85
extract_image_chipsFunction · 0.85
save_jpegFunction · 0.50
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected