Visual Servoing Platform  version 3.6.1 under development (2024-04-26)
vpImageDraw.h
1 /*
2  * ViSP, open source Visual Servoing Platform software.
3  * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
4  *
5  * This software is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See https://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Drawing functions.
32  */
33 
34 #ifndef _vpImageDraw_h_
35 #define _vpImageDraw_h_
36 
43 #include <visp3/core/vpCameraParameters.h>
44 #include <visp3/core/vpColor.h>
45 #include <visp3/core/vpImage.h>
46 #include <visp3/core/vpImageCircle.h>
47 #include <visp3/core/vpMath.h>
48 #include <visp3/core/vpRect.h>
49 
57 class VISP_EXPORT vpImageDraw
58 {
59 
60 public:
61  static void drawArrow(vpImage<unsigned char> &I, const vpImagePoint &ip1, const vpImagePoint &ip2,
62  unsigned char color, unsigned int w = 4, unsigned int h = 2, unsigned int thickness = 1);
63  static void drawArrow(vpImage<vpRGBa> &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color,
64  unsigned int w = 4, unsigned int h = 2, unsigned int thickness = 1);
65 
66  static void drawCircle(vpImage<unsigned char> &I, const vpImageCircle &circle,
67  unsigned char color, unsigned int thickness = 1);
68  static void drawCircle(vpImage<unsigned char> &I, const vpImagePoint &center, unsigned int radius,
69  unsigned char color, unsigned int thickness = 1);
70  static void drawCircle(vpImage<vpRGBa> &I, const vpImageCircle &circle,
71  const vpColor &color, unsigned int thickness = 1);
72  static void drawCircle(vpImage<vpRGBa> &I, const vpImagePoint &center, unsigned int radius, const vpColor &color,
73  unsigned int thickness = 1);
74 
75  static void drawCross(vpImage<unsigned char> &I, const vpImagePoint &ip, unsigned int size, unsigned char color,
76  unsigned int thickness = 1);
77  static void drawCross(vpImage<vpRGBa> &I, const vpImagePoint &ip, unsigned int size, const vpColor &color,
78  unsigned int thickness = 1);
79 
80  static void drawDottedLine(vpImage<unsigned char> &I, const vpImagePoint &ip1, const vpImagePoint &ip2,
81  unsigned char color, unsigned int thickness = 1);
82  static void drawDottedLine(vpImage<vpRGBa> &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color,
83  unsigned int thickness = 1);
84 
85  static void drawEllipse(vpImage<unsigned char> &I, const vpImagePoint &center, double coef1, double coef2,
86  double coef3, bool use_normalized_centered_moments, unsigned char color,
87  double smallalpha = 0, double highalpha = 2 * M_PI, unsigned int thickness = 1);
88  static void drawEllipse(vpImage<vpRGBa> &I, const vpImagePoint &center, double coef1, double coef2, double coef3,
89  bool use_normalized_centered_moments, const vpColor &color, double smallalpha = 0,
90  double highalpha = 2 * M_PI, unsigned int thickness = 1);
91 
92  static void drawFrame(vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
93  double size, unsigned char color, unsigned int thickness = 1,
94  const vpImagePoint &offset = vpImagePoint(0, 0));
95  static void drawFrame(vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size,
96  const vpColor &color = vpColor::none, unsigned int thickness = 1,
97  const vpImagePoint &offset = vpImagePoint(0, 0));
98 
99  static void drawLine(vpImage<unsigned char> &I, const vpImagePoint &ip1, const vpImagePoint &ip2, unsigned char color,
100  unsigned int thickness = 1);
101  static void drawLine(vpImage<vpRGBa> &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color,
102  unsigned int thickness = 1);
103 
104  static void drawPoint(vpImage<unsigned char> &I, const vpImagePoint &ip, unsigned char color,
105  unsigned int thickness = 1);
106  static void drawPoint(vpImage<vpRGBa> &I, const vpImagePoint &ip, const vpColor &color, unsigned int thickness = 1);
107 
108  static void drawPolygon(vpImage<unsigned char> &I, const std::vector<vpImagePoint> &vip, unsigned char color,
109  unsigned int thickness = 1, bool closed = true);
110  static void drawPolygon(vpImage<vpRGBa> &I, const std::vector<vpImagePoint> &vip, const vpColor &color,
111  unsigned int thickness = 1, bool closed = true);
112 
113  static void drawRectangle(vpImage<unsigned char> &I, const vpRect &rectangle, unsigned char color, bool fill = false,
114  unsigned int thickness = 1);
115  static void drawRectangle(vpImage<vpRGBa> &I, const vpRect &rectangle, const vpColor &color, bool fill = false,
116  unsigned int thickness = 1);
117 };
118 
119 #endif
Generic class defining intrinsic camera parameters.
Class to define RGB colors available for display functionalities.
Definition: vpColor.h:152
static const vpColor none
Definition: vpColor.h:223
Implementation of an homogeneous matrix and operations on such kind of matrices.
Class that defines a 2D circle in an image.
Definition: vpImageCircle.h:56
Drawing functions for image.
Definition: vpImageDraw.h:58
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:82
Defines a rectangle in the plane.
Definition: vpRect.h:76