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