DLib:要在 draw_rectangle() 中使用的输入参数

DLib: what input arguments to be used in draw_rectangle()

Dlib 中的 draw_rectangle 函数使用的这些输入参数是什么:

  1. image_type& img
  2. const rectangle& rect
  3. const pixel_type& val
  4. unsigned int thickness

有人可以告诉我这些参数是什么吗?我应该使用什么值来绘制输入图像上找到的地标的叠加层以保存它。

template <
    typename image_type,
    typename pixel_type
    >
void draw_rectangle (
    image_type& img,
    const rectangle& rect,
    const pixel_type& val,
    unsigned int thickness = 1
);
/*!
    requires
        - image_type == an image object that implements the interface defined in
          dlib/image_processing/generic_image.h 
        - pixel_traits<pixel_type> is defined
    ensures
        - Draws the given rectangle onto the image img.  It does this by calling
          draw_line() four times to draw the four sides of the rectangle.  
        - The rectangle is drawn with the color given by val.
        - The drawn rectangle will have edges that are thickness pixels wide.
!*/

这是他们网页上的内容。这似乎是不言自明的。你需要一个 image 来绘制,你需要 rectangle 你想绘制, pixel_type 表示 colorthickness 是线条的粗细,默认为一个像素。

您可以找到有关此库 图像 的更多信息 here and you can read about the different pixel_types right on their front page here

根据你的问题,我想说你可能想先学习更多的 C++,尤其是模板,因为这个库大量使用它们。有很多功能,你不能来这里对每一个功能都问这个问题。