In Dlib how do I save image with overlay?

2020-08-26 04:35发布

问题:

I'm trying to modify Dlib's face detection example to save an image with detections to a file since I'm using a server without GUI. So far I have only figured how to save the image but not the overlay. How do I save both to the same file?

//win.add_overlay(dets, rgb_pixel(255,0,0));
save_png(img, "detected.png");

回答1:

You can call draw_rectangle on the image before saving it.



回答2:

Try this: dlib::draw_rectangle()

Example:

dlib::draw_rectangle(rect_image, rect, dlib::rgb_pixel(255, 0, 0), 1);


标签: c++ dlib