Visual Servoing Platform  version 3.6.1 under development (2024-11-15)
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 
40 #ifndef _vpImageDraw_h_
41 #define _vpImageDraw_h_
42 
43 #include <visp3/core/vpConfig.h>
44 #include <visp3/core/vpCameraParameters.h>
45 #include <visp3/core/vpColor.h>
46 #include <visp3/core/vpImage.h>
47 #include <visp3/core/vpImageCircle.h>
48 #include <visp3/core/vpMath.h>
49 #include <visp3/core/vpRect.h>
50 
51 BEGIN_VISP_NAMESPACE
59 class VISP_EXPORT vpImageDraw
60 {
61 
62 public:
63  static void drawArrow(vpImage<unsigned char> &I, const vpImagePoint &ip1, const vpImagePoint &ip2,
64  unsigned char color, unsigned int w = 4, unsigned int h = 2, unsigned int thickness = 1);
65  static void drawArrow(vpImage<vpRGBa> &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color,
66  unsigned int w = 4, unsigned int h = 2, unsigned int thickness = 1);
67 
68  static void drawCircle(vpImage<unsigned char> &I, const vpImageCircle &circle,
69  unsigned char color, unsigned int thickness = 1);
70  static void drawCircle(vpImage<unsigned char> &I, const vpImagePoint &center, unsigned int radius,
71  unsigned char color, unsigned int thickness = 1);
72  static void drawCircle(vpImage<vpRGBa> &I, const vpImageCircle &circle,
73  const vpColor &color, unsigned int thickness = 1);
74  static void drawCircle(vpImage<vpRGBa> &I, const vpImagePoint &center, unsigned int radius, const vpColor &color,
75  unsigned int thickness = 1);
76 
77  static void drawCross(vpImage<unsigned char> &I, const vpImagePoint &ip, unsigned int size, unsigned char color,
78  unsigned int thickness = 1);
79  static void drawCross(vpImage<vpRGBa> &I, const vpImagePoint &ip, unsigned int size, const vpColor &color,
80  unsigned int thickness = 1);
81 
82  static void drawDottedLine(vpImage<unsigned char> &I, const vpImagePoint &ip1, const vpImagePoint &ip2,
83  unsigned char color, unsigned int thickness = 1);
84  static void drawDottedLine(vpImage<vpRGBa> &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color,
85  unsigned int thickness = 1);
86 
87  static void drawEllipse(vpImage<unsigned char> &I, const vpImagePoint &center, double coef1, double coef2,
88  double coef3, bool use_normalized_centered_moments, unsigned char color,
89  double smallalpha = 0, double highalpha = 2 * M_PI, unsigned int thickness = 1);
90  static void drawEllipse(vpImage<vpRGBa> &I, const vpImagePoint &center, double coef1, double coef2, double coef3,
91  bool use_normalized_centered_moments, const vpColor &color, double smallalpha = 0,
92  double highalpha = 2 * M_PI, unsigned int thickness = 1);
93 
94  static void drawFrame(vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
95  double size, unsigned char color, unsigned int thickness = 1,
96  const vpImagePoint &offset = vpImagePoint(0, 0));
97  static void drawFrame(vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size,
98  const vpColor &color = vpColor::none, unsigned int thickness = 1,
99  const vpImagePoint &offset = vpImagePoint(0, 0));
100 
101  static void drawLine(vpImage<unsigned char> &I, const vpImagePoint &ip1, const vpImagePoint &ip2, unsigned char color,
102  unsigned int thickness = 1);
103  static void drawLine(vpImage<vpRGBa> &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color,
104  unsigned int thickness = 1);
105 
106  static void drawPoint(vpImage<unsigned char> &I, const vpImagePoint &ip, unsigned char color,
107  unsigned int thickness = 1);
108  static void drawPoint(vpImage<vpRGBa> &I, const vpImagePoint &ip, const vpColor &color, unsigned int thickness = 1);
109 
110  static void drawPolygon(vpImage<unsigned char> &I, const std::vector<vpImagePoint> &vip, unsigned char color,
111  unsigned int thickness = 1, bool closed = true);
112  static void drawPolygon(vpImage<vpRGBa> &I, const std::vector<vpImagePoint> &vip, const vpColor &color,
113  unsigned int thickness = 1, bool closed = true);
114 
115  static void drawRectangle(vpImage<unsigned char> &I, const vpRect &rectangle, unsigned char color, bool fill = false,
116  unsigned int thickness = 1);
117  static void drawRectangle(vpImage<vpRGBa> &I, const vpRect &rectangle, const vpColor &color, bool fill = false,
118  unsigned int thickness = 1);
119 };
120 END_VISP_NAMESPACE
121 #endif
Generic class defining intrinsic camera parameters.
Class to define RGB colors available for display functionalities.
Definition: vpColor.h:157
static const vpColor none
Definition: vpColor.h:229
Implementation of an homogeneous matrix and operations on such kind of matrices.
Class that defines a 2D circle in an image.
Definition: vpImageCircle.h:57
Drawing functions for image.
Definition: vpImageDraw.h:60
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:79