Visual Servoing Platform  version 3.4.0
vpImageDraw Class Reference

#include <vpImageDraw.h>

Static Public Member Functions

static void drawArrow (vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, unsigned char color, unsigned int w=4, unsigned int h=2, unsigned int thickness=1)
 
static void drawArrow (vpImage< vpRGBa > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int w=4, unsigned int h=2, unsigned int thickness=1)
 
static void drawCircle (vpImage< unsigned char > &I, const vpImagePoint &center, unsigned int radius, unsigned char color, unsigned int thickness=1)
 
static void drawCircle (vpImage< vpRGBa > &I, const vpImagePoint &center, unsigned int radius, const vpColor &color, unsigned int thickness=1)
 
static void drawCross (vpImage< unsigned char > &I, const vpImagePoint &ip, unsigned int size, unsigned char color, unsigned int thickness=1)
 
static void drawCross (vpImage< vpRGBa > &I, const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
 
static void drawDottedLine (vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, unsigned char color, unsigned int thickness=1)
 
static void drawDottedLine (vpImage< vpRGBa > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)
 
static void drawEllipse (vpImage< unsigned char > &I, const vpImagePoint &center, double coef1, double coef2, double coef3, bool use_normalized_centered_moments, unsigned char color, double smallalpha=0, double highalpha=2 *M_PI, unsigned int thickness=1)
 
static void drawEllipse (vpImage< vpRGBa > &I, const vpImagePoint &center, double coef1, double coef2, double coef3, bool use_normalized_centered_moments, const vpColor &color, double smallalpha=0, double highalpha=2 *M_PI, unsigned int thickness=1)
 
static void drawFrame (vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size, unsigned char color, unsigned int thickness=1, const vpImagePoint &offset=vpImagePoint(0, 0))
 
static void drawFrame (vpImage< vpRGBa > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size, const vpColor &color=vpColor::none, unsigned int thickness=1, const vpImagePoint &offset=vpImagePoint(0, 0))
 
static void drawLine (vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, unsigned char color, unsigned int thickness=1)
 
static void drawLine (vpImage< vpRGBa > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)
 
static void drawPoint (vpImage< unsigned char > &I, const vpImagePoint &ip, unsigned char color, unsigned int thickness=1)
 
static void drawPoint (vpImage< vpRGBa > &I, const vpImagePoint &ip, const vpColor &color, unsigned int thickness=1)
 
static void drawPolygon (vpImage< unsigned char > &I, const std::vector< vpImagePoint > &vip, unsigned char color, unsigned int thickness=1, bool closed=true)
 
static void drawPolygon (vpImage< vpRGBa > &I, const std::vector< vpImagePoint > &vip, const vpColor &color, unsigned int thickness=1, bool closed=true)
 
static void drawRectangle (vpImage< unsigned char > &I, const vpRect &rectangle, unsigned char color, bool fill=false, unsigned int thickness=1)
 
static void drawRectangle (vpImage< vpRGBa > &I, const vpRect &rectangle, const vpColor &color, bool fill=false, unsigned int thickness=1)
 

Detailed Description

Drawing functions for image.

Definition at line 58 of file vpImageDraw.h.

Member Function Documentation

void vpImageDraw::drawArrow ( vpImage< unsigned char > &  I,
const vpImagePoint ip1,
const vpImagePoint ip2,
unsigned char  color,
unsigned int  w = 4,
unsigned int  h = 2,
unsigned int  thickness = 1 
)
static

Draw an arrow from image point ip1 to image point ip2.

Parameters
[in,out]I: Image where to draw the arrow.
[in]ip1,ip2: Initial and final image points.
[in]color: Arrow color.
[in]w,h: Width and height of the arrow.
[in]thickness: Thickness of the lines used to display the arrow.
Examples:
testImageDraw.cpp.

Definition at line 237 of file vpImageDraw.cpp.

References vpImagePoint::distance(), drawLine(), vpImagePoint::get_i(), vpImagePoint::get_j(), vpImagePoint::set_i(), vpImagePoint::set_j(), and vpMath::sqr().

Referenced by drawFrame().

void vpImageDraw::drawArrow ( vpImage< vpRGBa > &  I,
const vpImagePoint ip1,
const vpImagePoint ip2,
const vpColor color,
unsigned int  w = 4,
unsigned int  h = 2,
unsigned int  thickness = 1 
)
static

Draw an arrow from image point ip1 to image point ip2.

Parameters
[in,out]I: Image where to draw the arrow.
[in]ip1,ip2: Initial and final image points.
[in]color: Arrow color.
[in]w,h: Width and height of the arrow.
[in]thickness: Thickness of the lines used to display the arrow.

Definition at line 282 of file vpImageDraw.cpp.

References vpImagePoint::distance(), drawLine(), vpImagePoint::get_i(), vpImagePoint::get_j(), vpImagePoint::set_i(), vpImagePoint::set_j(), and vpMath::sqr().

void vpImageDraw::drawCircle ( vpImage< unsigned char > &  I,
const vpImagePoint center,
unsigned int  radius,
unsigned char  color,
unsigned int  thickness = 1 
)
static

Draw a circle in an image.

Parameters
[in,out]I: Image where to draw the circle.
[in]center: Circle center position.
[in]radius: Circle radius.
[in]color: Circle color.
[in]thickness: Thickness of the circle.
Examples:
testImageDraw.cpp.

Definition at line 327 of file vpImageDraw.cpp.

void vpImageDraw::drawCircle ( vpImage< vpRGBa > &  I,
const vpImagePoint center,
unsigned int  radius,
const vpColor color,
unsigned int  thickness = 1 
)
static

Draw a circle in an image.

Parameters
[in,out]I: Image where to draw the circle.
[in]center: Circle center position.
[in]radius: Circle radius.
[in]color: Circle color.
[in]thickness: Thickness of the circle.

Definition at line 341 of file vpImageDraw.cpp.

References vpRGBa::B, vpRGBa::G, and vpRGBa::R.

void vpImageDraw::drawCross ( vpImage< unsigned char > &  I,
const vpImagePoint ip,
unsigned int  size,
unsigned char  color,
unsigned int  thickness = 1 
)
static

Draw a cross in an image at position given by ip location.

Parameters
[in,out]I: Image where to draw the cross.
[in]ip: Cross location.
[in]size: Size (width and height) of the cross.
[in]color: Cross color.
[in]thickness: Thickness of the lines used to display the cross.
Examples:
testGenericTracker.cpp, and testImageDraw.cpp.

Definition at line 355 of file vpImageDraw.cpp.

References drawLine(), vpImagePoint::get_i(), vpImagePoint::get_j(), vpImagePoint::set_i(), and vpImagePoint::set_j().

void vpImageDraw::drawCross ( vpImage< vpRGBa > &  I,
const vpImagePoint ip,
unsigned int  size,
const vpColor color,
unsigned int  thickness = 1 
)
static

Draw a cross in an image at position given by ip location.

Parameters
[in,out]I: Image where to draw the cross.
[in]ip: Cross location.
[in]size: Size (width and height) of the cross.
[in]color: Cross color.
[in]thickness: Thickness of the lines used to display the cross.

Definition at line 379 of file vpImageDraw.cpp.

References drawLine(), vpImagePoint::get_i(), vpImagePoint::get_j(), vpImagePoint::set_i(), and vpImagePoint::set_j().

void vpImageDraw::drawDottedLine ( vpImage< unsigned char > &  I,
const vpImagePoint ip1,
const vpImagePoint ip2,
unsigned char  color,
unsigned int  thickness = 1 
)
static

Draw a dashed line in an image between two image points.

Parameters
[in,out]I: Image where to draw the dashed line.
[in]ip1,ip2: Initial and final image points.
[in]color: Line color.
[in]thickness: Dashed line thickness.
Examples:
testImageDraw.cpp.

Definition at line 402 of file vpImageDraw.cpp.

References drawLine(), vpImagePoint::get_i(), vpImagePoint::get_j(), and vpMath::sqr().

void vpImageDraw::drawDottedLine ( vpImage< vpRGBa > &  I,
const vpImagePoint ip1,
const vpImagePoint ip2,
const vpColor color,
unsigned int  thickness = 1 
)
static

Draw a dashed line in an image between two image points.

Parameters
[in,out]I: Image where to draw the dashed line.
[in]ip1,ip2: Initial and final image points.
[in]color: Line color.
[in]thickness: Dashed line thickness.

Definition at line 445 of file vpImageDraw.cpp.

References drawLine(), vpImagePoint::get_i(), vpImagePoint::get_j(), and vpMath::sqr().

void vpImageDraw::drawEllipse ( vpImage< unsigned char > &  I,
const vpImagePoint center,
double  coef1,
double  coef2,
double  coef3,
bool  use_normalized_centered_moments,
unsigned char  color,
double  smallalpha = 0,
double  highalpha = 2 * M_PI,
unsigned int  thickness = 1 
)
static

Draw an ellipse in an image from its parameters expressed in pixels.

Parameters
[in,out]I: Image where to draw the ellipse.
[in]center: Center $(u_c, v_c)$ of the ellipse.
coef1,coef2,coef3: Depending on the parameter use_normalized_centered_moments these parameters are:
  • second order centered moments of the ellipse normalized by its area (i.e., such that $n_{ij} = \mu_{ij}/a$ where $\mu_{ij}$ are the centered moments and a the area) expressed in pixels.
  • the major and minor axis lenght in pixels and the excentricity of the ellipse in radians: $a, b, e$.
smallalpha: Smallest $ alpha $ angle in rad (0 for a complete ellipse).
highalpha: Highest $ alpha $ angle in rad (2 $ \Pi $ for a complete ellipse).
use_normalized_centered_moments: When false, the parameters coef1, coef2, coef3 are the parameters $a, b, e$. When true, the parameters coef1, coef2, coef3 are rather the normalized centered moments $n_{20}, n_{11}, n_{02}$ expressed in pixels. In that case, we compute the parameters a, b and e from the centered moments.
[in]color: Ellipse color.
[in]thickness: Ellipse thickness.

The following example shows how to use for example this function to draw the result of a tracking.

vpMeEllipse ellipse;
...
vpDisplay::display(I);
ellipse.track(I);
ellipse.get_nij()[0], ellipse.get_nij()[1], ellipse.get_nij()[2],
true,
ellipse.getSmallestAngle(), ellipse.getHighestAngle(),

Definition at line 516 of file vpImageDraw.cpp.

References drawLine(), vpImagePoint::get_u(), vpImagePoint::get_v(), and vpImagePoint::set_uv().

void vpImageDraw::drawEllipse ( vpImage< vpRGBa > &  I,
const vpImagePoint center,
double  coef1,
double  coef2,
double  coef3,
bool  use_normalized_centered_moments,
const vpColor color,
double  smallalpha = 0,
double  highalpha = 2 * M_PI,
unsigned int  thickness = 1 
)
static

Draw an ellipse in an image from its parameters expressed in pixels.

Parameters
[in,out]I: Image where to draw the ellipse.
[in]center: Center $(u_c, v_c)$ of the ellipse.
coef1,coef2,coef3: Depending on the parameter use_normalized_centered_moments these parameters are:
  • second order centered moments of the ellipse normalized by its area (i.e., such that $n_{ij} = \mu_{ij}/a$ where $\mu_{ij}$ are the centered moments and a the area) expressed in pixels.
  • the major and minor axis lenght in pixels and the excentricity of the ellipse in radians: $a, b, e$.
smallalpha: Smallest $ alpha $ angle in rad (0 for a complete ellipse).
highalpha: Highest $ alpha $ angle in rad (2 $ \Pi $ for a complete ellipse).
use_normalized_centered_moments: When false, the parameters coef1, coef2, coef3 are the parameters $a, b, e$. When true, the parameters coef1, coef2, coef3 are rather the normalized centered moments $n_{20}, n_{11}, n_{02}$ expressed in pixels. In that case, we compute the parameters a, b and e from the centered moments.
[in]color: Ellipse color.
[in]thickness: Ellipse thickness.

The following example shows how to use for example this function to draw the result of a tracking.

vpMeEllipse ellipse;
...
vpDisplay::display(I);
ellipse.track(I);
ellipse.get_nij()[0], ellipse.get_nij()[1], ellipse.get_nij()[2],
true,
ellipse.getSmallestAngle(), ellipse.getHighestAngle(),

Definition at line 630 of file vpImageDraw.cpp.

References drawLine(), vpImagePoint::get_u(), vpImagePoint::get_v(), and vpImagePoint::set_uv().

void vpImageDraw::drawFrame ( vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cMo,
const vpCameraParameters cam,
double  size,
unsigned char  color,
unsigned int  thickness = 1,
const vpImagePoint offset = vpImagePoint(0, 0) 
)
static

Draw the projection in an image of an object frame represented by 3 arrows in the image. Red, green and blue arrows correspond to frame X, Y and Z axis respectively.

Parameters
[in,out]I: Image where to draw the ellipse.
[in]cMo: Homogeneous matrix that gives the transformation between the camera frame and the object frame to project in the image.
[in]cam: Camera intrinsic parameters.
[in]size: Size of the object frame.
[in]color: Color used to display the frame in the image.
[in]thickness: the thickness of the line.
[in]offset: Offset in pixels applied to the frame origin location in the image.
Examples:
testImageDraw.cpp.

Definition at line 723 of file vpImageDraw.cpp.

References vpMeterPixelConversion::convertPoint(), drawArrow(), vpTracker::p, and vpForwardProjection::track().

void vpImageDraw::drawFrame ( vpImage< vpRGBa > &  I,
const vpHomogeneousMatrix cMo,
const vpCameraParameters cam,
double  size,
const vpColor color = vpColor::none,
unsigned int  thickness = 1,
const vpImagePoint offset = vpImagePoint(0, 0) 
)
static

Draw the projection in an image of an object frame represented by 3 arrows in the image. Red, green and blue arrows correspond to frame X, Y and Z axis respectively.

Parameters
[in,out]I: Image where to draw the ellipse.
[in]cMo: Homogeneous matrix that gives the transformation between the camera frame and the object frame to project in the image.
[in]cam: Camera intrinsic parameters.
[in]size: Size of the object frame.
[in]color: Color used to display the frame in the image.
[in]thickness: the thickness of the line.
[in]offset: Offset in pixels applied to the frame origin location in the image.

Definition at line 765 of file vpImageDraw.cpp.

References vpColor::blue, vpMeterPixelConversion::convertPoint(), drawArrow(), vpColor::green, vpColor::none, vpTracker::p, vpColor::red, and vpForwardProjection::track().

void vpImageDraw::drawLine ( vpImage< unsigned char > &  I,
const vpImagePoint ip1,
const vpImagePoint ip2,
unsigned char  color,
unsigned int  thickness = 1 
)
static

Draw a line in an image between two image points.

Parameters
[in,out]I: Image where to draw the line.
[in]ip1,ip2: Initial and final image points.
[in]color: Line color.
[in]thickness: Dashed line thickness.
Examples:
testGenericTracker.cpp, and testImageDraw.cpp.

Definition at line 812 of file vpImageDraw.cpp.

References vpImagePoint::get_u(), and vpImagePoint::get_v().

Referenced by drawArrow(), drawCross(), drawDottedLine(), and drawEllipse().

void vpImageDraw::drawLine ( vpImage< vpRGBa > &  I,
const vpImagePoint ip1,
const vpImagePoint ip2,
const vpColor color,
unsigned int  thickness = 1 
)
static

Draw a line in an image between two image points.

Parameters
[in,out]I: Image where to draw the line.
[in]ip1,ip2: Initial and final image points.
[in]color: Line color.
[in]thickness: Dashed line thickness.

Definition at line 827 of file vpImageDraw.cpp.

References vpRGBa::B, vpRGBa::G, vpImagePoint::get_u(), vpImagePoint::get_v(), and vpRGBa::R.

void vpImageDraw::drawPoint ( vpImage< unsigned char > &  I,
const vpImagePoint ip,
unsigned char  color,
unsigned int  thickness = 1 
)
static

Draw in an image a point at the image point ip location.

Parameters
[in,out]I: Image where to draw the point.
[in]ip: Point location.
[in]color: Point color.
[in]thickness: Thickness of the point
Examples:
testImageDraw.cpp.

Definition at line 841 of file vpImageDraw.cpp.

References drawRectangle().

void vpImageDraw::drawPoint ( vpImage< vpRGBa > &  I,
const vpImagePoint ip,
const vpColor color,
unsigned int  thickness = 1 
)
static

Draw in an image a point at the image point ip location.

Parameters
[in,out]I: Image where to draw the point.
[in]ip: Point location.
[in]color: Point color.
[in]thickness: Thickness of the point

Definition at line 853 of file vpImageDraw.cpp.

References drawRectangle().

void vpImageDraw::drawPolygon ( vpImage< unsigned char > &  I,
const std::vector< vpImagePoint > &  vip,
unsigned char  color,
unsigned int  thickness = 1,
bool  closed = true 
)
static

Draw in an image a polygon defined by a vector of image points.

Parameters
[in,out]I: Image where to draw the polygon.
[in]vip: Vector of image point that define the vertexes of the polygon.
[in]color: Polygon color.
[in]thickness: Polygon thickness.
[in]closed: When true display a closed polygon with a segment between first and last image point.
Examples:
testImageDraw.cpp.

Definition at line 866 of file vpImageDraw.cpp.

void vpImageDraw::drawPolygon ( vpImage< vpRGBa > &  I,
const std::vector< vpImagePoint > &  vip,
const vpColor color,
unsigned int  thickness = 1,
bool  closed = true 
)
static

Draw in an image a polygon defined by a vector of image points.

Parameters
[in,out]I: Image where to draw the polygon.
[in]vip: Vector of image point that define the vertexes of the polygon.
[in]color: Polygon color.
[in]thickness: Polygon thickness.
[in]closed: When true display a closed polygon with a segment between first and last image point.

Definition at line 880 of file vpImageDraw.cpp.

References vpRGBa::B, vpRGBa::G, and vpRGBa::R.

void vpImageDraw::drawRectangle ( vpImage< unsigned char > &  I,
const vpRect rectangle,
unsigned char  color,
bool  fill = false,
unsigned int  thickness = 1 
)
static

Draw in an image a rectangle with topLeft as the top-left corner and width and height the rectangle size.

Parameters
[in,out]I: Image where to draw the rectangle.
[in]rectangle: Rectangle characteristics.
[in]color: Rectangle color.
[in]fill: When set to true fill the rectangle.
[in]thickness: Thickness of the four lines used to display the rectangle. This parameter is only useful when fill is set to false.
Examples:
testImageDraw.cpp.

Definition at line 898 of file vpImageDraw.cpp.

Referenced by drawPoint().

void vpImageDraw::drawRectangle ( vpImage< vpRGBa > &  I,
const vpRect rectangle,
const vpColor color,
bool  fill = false,
unsigned int  thickness = 1 
)
static

Draw in an image a rectangle with topLeft as the top-left corner and width and height the rectangle size.

Parameters
[in,out]I: Image where to draw the rectangle.
[in]rectangle: Rectangle characteristics.
[in]color: Rectangle color.
[in]fill: When set to true fill the rectangle.
[in]thickness: Thickness of the four lines used to display the rectangle. This parameter is only useful when fill is set to false.

Definition at line 919 of file vpImageDraw.cpp.

References vpRGBa::B, vpRGBa::G, and vpRGBa::R.