参数pixel_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)
);
draw_rectangle
在图像上绘制矩形,然后使用save_png
保存该图像。
draw_pixel
将sp(img,dets [j])
返回的每个地标(shape.part(i)
)绘制在face_landmark_detection_ex.cpp
上。template <typename pixel_type>
void draw_pixel (
const canvas& c,
const point& p,
const pixel_type& pixel
);
/*!
requires
- pixel_traits<pixel_type> is defined
ensures
- if (c.contains(p)) then
- sets the pixel in c that represents the point p to the
given pixel color.
!*/
当所有地标都被绘制后,使用save_png
保存图像。
要这样做,请使用以下函数:
template <typename image_type, typename pixel_type >
void draw_line (
image_type& img,
const point& p1,
const point& p2,
const pixel_type& val
);
/*!
requires
- image_type == an image object that implements the interface defined in
dlib/image_processing/generic_image.h
ensures
- #img.nr() == img.nr() && #img.nc() == img.nc()
(i.e. the dimensions of the input image are not changed)
- for all valid r and c that are on the line between point p1 and p2:
- performs assign_pixel(img[r][c], val)
(i.e. it draws the line from p1 to p2 onto the image)
!*/