The pixel_type parameter pixel_type used to specify the type of pixels that will be used to draw the rectangle. The function header declaration defines that by default the type of pixels to be used are black pixels of type rgb_pixel ( rgb_pixel(0,0,0) )
template <typename pixel_type> void draw_rectangle ( const canvas& c, rectangle rect, const pixel_type& pixel = rgb_pixel(0,0,0), const rectangle& area = rectangle(-infinity,-infinity,infinity,infinity) );
Therefore, to save the image, first use the draw_rectangle function to draw a rectangle on the image, and then save this image with save_png .
Edit for new question:
An easy way to build them is to draw each landmark ( shape.part(i) ) returned by the sp(img, dets[j]) function in face_landmark_detection_ex.cpp using the draw_pixel function.
template <typename pixel_type> void draw_pixel ( const canvas& c, const point& p, const pixel_type& pixel );
And once all the landmarks have been drawn, save the image using save_png .
However, I would recommend drawing such lines, not just landmarks 
To do this, use the function:
template <typename image_type, typename pixel_type > void draw_line ( image_type& img, const point& p1, const point& p2, const pixel_type& val );
Albert pumarola
source share