diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 13:19:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 13:20:02 +0000 |
commit | 58daab21cd043e1dc37024a7f99b396788372918 (patch) | |
tree | 96771e43bb69f7c1c2b0b4f7374cb74d7866d0cb /ml/dlib/dlib/image_transforms/draw_abstract.h | |
parent | Releasing debian version 1.43.2-1. (diff) | |
download | netdata-58daab21cd043e1dc37024a7f99b396788372918.tar.xz netdata-58daab21cd043e1dc37024a7f99b396788372918.zip |
Merging upstream version 1.44.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ml/dlib/dlib/image_transforms/draw_abstract.h')
-rw-r--r-- | ml/dlib/dlib/image_transforms/draw_abstract.h | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/ml/dlib/dlib/image_transforms/draw_abstract.h b/ml/dlib/dlib/image_transforms/draw_abstract.h new file mode 100644 index 000000000..6631f8d8f --- /dev/null +++ b/ml/dlib/dlib/image_transforms/draw_abstract.h @@ -0,0 +1,150 @@ +// Copyright (C) 2008 Davis E. King (davis@dlib.net) +// License: Boost Software License See LICENSE.txt for the full license. +#undef DLIB_DRAW_IMAGe_ABSTRACT +#ifdef DLIB_DRAW_IMAGe_ABSTRACT + +#include "../matrix.h" +#include "../image_processing/generic_image.h" + +namespace dlib +{ + +// ---------------------------------------------------------------------------------------- + + 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) + !*/ + +// ---------------------------------------------------------------------------------------- + + template < + typename image_type, + typename pixel_type + > + void draw_line ( + long x1, + long y1, + long x2, + long y2, + image_type& img, + const pixel_type& val + ); + /*! + requires + - image_type == an image object that implements the interface defined in + dlib/image_processing/generic_image.h + ensures + - performs draw_line(img, point(x1,y1), point(x2,y2), val) + !*/ + +// ---------------------------------------------------------------------------------------- + + 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. + !*/ + +// ---------------------------------------------------------------------------------------- + + template < + typename image_type, + typename pixel_type + > + void draw_solid_circle ( + image_type& img, + const dpoint& center_point, + double radius, + const pixel_type& pixel + ); + /*! + 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 a fully filled in circle onto image that is centered at center_point + and has the given radius. The circle will be filled by assigning the given + pixel value to each element of the circle. + !*/ + +// ---------------------------------------------------------------------------------------- + + template < + typename image_type, + typename pixel_type + > + void fill_rect ( + image_type& img, + const rectangle& rect, + const pixel_type& pixel + ); + /*! + 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 + - fills the area defined by rect in the given image with the given pixel value. + !*/ + +// ---------------------------------------------------------------------------------------- + + template < + typename image_array_type + > + matrix<typename image_traits<typename image_array_type::value_type>::pixel_type> tile_images ( + const image_array_type& images + ); + /*! + requires + - image_array_type is a dlib::array of image objects where each image object + implements the interface defined in dlib/image_processing/generic_image.h + ensures + - This function takes the given images and tiles them into a single large + square image and returns this new big tiled image. Therefore, it is a useful + method to visualize many small images at once. + !*/ + +// ---------------------------------------------------------------------------------------- + +} + +#endif // DLIB_DRAW_IMAGe_ABSTRACT + + + |