Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Dlib how do I save image with overlay?

Tags:

c++

dlib

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");
like image 711
Tim Clemans Avatar asked Apr 21 '15 04:04

Tim Clemans


2 Answers

You can call draw_rectangle on the image before saving it.

like image 84
Davis King Avatar answered Sep 29 '22 02:09

Davis King


Try this: dlib::draw_rectangle()

Example:

dlib::draw_rectangle(rect_image, rect, dlib::rgb_pixel(255, 0, 0), 1);
like image 43
Dmitry Avatar answered Sep 29 '22 03:09

Dmitry