iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Geometry Drawing

These methods are used to draw geometric primitives onto Images

Functions

template<class T , template< typename > class PixDest, class U , template< typename > class PixOutline>
void nrt::drawLine (Image< PixDest< T > > &image, Line< int32 > const &line, PixOutline< U > const &outlineColor, uint thickness=1)
 Draw a Line in the Image. More...
 
template<class T , class U >
void nrt::drawLineAA (Image< T > &image, Line< int32 > const &line, U const &outlineColor)
 Draw an antialiased Line in the Image. More...
 
template<class T , template< typename > class SourceColorT, class U , template< typename > class OutlineColorT, class V = byte, template< typename > class FillColorT = PixRGBA>
void nrt::drawPolygon (Image< SourceColorT< T >> &image, Polygon< int32 > const &polygon, OutlineColorT< U > const &outlineColor, uint thickness=1, FillColorT< V > const &fillColor=PixRGBA< byte >(0, 0, 0, 0))
 Draw a Polygon in the image. More...
 
template<class T , class U >
void nrt::drawPolygonAA (Image< T > &image, Polygon< int32 > const &polygon, U const &outlineColor)
 Draw an antialiased Polygon in the image. More...
 
template<class T , template< typename > class PixDest, class U , template< typename > class PixFill>
void nrt::drawDisk (Image< PixDest< T > > &dst, Circle< int32 > const &circle, PixFill< U > const &fillColor)
 Draw a Disk (filled-in circle) More...
 
template<class T , class U >
void nrt::drawCircle (Image< T > &image, Circle< int32 > const &circle, U const &outlineColor, uint thickness=1)
 Draw a Circle in the image. More...
 
template<class T , class U , class V = PixRGBA<byte>>
void nrt::drawEllipse (Image< T > &image, Point2D< int32 > const &center, const float radiusx, const float radiusy, const float skew, U const &outlineColor, uint thickness=1, V const &fillColor=PixRGBA< byte >(0, 0, 0, 0))
 Draw a Ellipse in the image. More...
 
template<class T , template< typename > class SourceColorT, class U , template< typename > class OutlineColorT, class V = byte, template< typename > class FillColorT = PixRGBA>
void nrt::drawRectangle (Image< SourceColorT< T >> &image, Rectangle< int32 > const &rect, OutlineColorT< U > const &outlineColor, uint thickness=1, FillColorT< V > const &fillColor=PixRGBA< byte >(0, 0, 0, 0))
 Draw a Rectangle in the Image. More...
 
template<class T , class OutlineColorT >
void nrt::drawCross (Image< T > &image, Point2D< int32 > const &center, OutlineColorT const &outlineColor, uint32 radius, uint32 thickness=1, float angle=0)
 Draw a cross in the Image. More...
 
template<class T , class OutlineColorT >
void nrt::DrawArrow (Image< T > &image, int32 xs, int32 ys, int32 xe, int32 ye, uint32 thickness=1, OutlineColorT const &outlineColor=PixRGB< byte >(0, 0, 255), float headSizeRatio=0.35f, float headAngle=15.0f)
 Draw an arrow in the Image. More...
 
template<class T , class OutlineColorT >
void nrt::drawGrid (Image< T > &image, const int32 spacingX, const int32 spacingY, const uint32 thickX=1, const uint32 thickY=1, OutlineColorT const &outlineColor=PixRGB< byte >(0, 0, 0))
 Draw a Grid in the image. More...
 
template<class T , class OutlineColorT >
void nrt::drawGrid (Image< T > &image, const uint32 nx, const uint32 ny, const uint32 thickness=1, OutlineColorT const &outlineColor=PixRGB< byte >(0, 0, 0))
 Draw a regular Grid in the image. More...
 

Function Documentation

template<class T , template< typename > class PixDest, class U , template< typename > class PixOutline>
void nrt::drawLine ( Image< PixDest< T > > &  image,
Line< int32 > const &  line,
PixOutline< U > const &  outlineColor,
uint  thickness = 1 
)

Draw a Line in the Image.

Parameters
imageThe image onto which to draw a Line
lineThe line to draw
outlineColorThe color of the Line
thicknessThe thickness of the Line
Examples:
tests/test-Geometry.C, and tests/test-UKF.C.

Referenced by main().

template<class T , class U >
void nrt::drawLineAA ( Image< T > &  image,
Line< int32 > const &  line,
U const &  outlineColor 
)

Draw an antialiased Line in the Image.

Parameters
imageThe image onto which to draw a Line
lineThe line to draw
outlineColorThe color of the Line
template<class T , template< typename > class SourceColorT, class U , template< typename > class OutlineColorT, class V = byte, template< typename > class FillColorT = PixRGBA>
void nrt::drawPolygon ( Image< SourceColorT< T >> &  image,
Polygon< int32 > const &  polygon,
OutlineColorT< U > const &  outlineColor,
uint  thickness = 1,
FillColorT< V > const &  fillColor = PixRGBA< byte >(0, 0, 0, 0) 
)

Draw a Polygon in the image.

Parameters
imageThe image onto which to draw a Polygon
polygonThe Polygon to draw
outlineColorThe color of the Polygon's outline
thicknessThe thickness of the Polygon's outline
fillColorThe color of the Polygon's fill
Warning
Only specify a fill color if you know that your Polygon is convex.
Examples:
tests/test-Geometry.C, and tests/test-UKF.C.
template<class T , class U >
void nrt::drawPolygonAA ( Image< T > &  image,
Polygon< int32 > const &  polygon,
U const &  outlineColor 
)

Draw an antialiased Polygon in the image.

Parameters
imageThe image onto which to draw a Polygon
polygonThe Polygon to draw
outlineColorThe color of the Polygon's outline
Examples:
tests/test-Geometry.C.
template<class T , template< typename > class PixDest, class U , template< typename > class PixFill>
void nrt::drawDisk ( Image< PixDest< T > > &  dst,
Circle< int32 > const &  circle,
PixFill< U > const &  fillColor 
)

Draw a Disk (filled-in circle)

Parameters
dstThe image onto which to draw a disk
circleThe circle which defines the disk to draw
fillColorThe color of the disk
Todo:
Merge this into drawCircle, a-la drawRectangle
Examples:
tests/test-Geometry.C.
template<class T , class U >
void nrt::drawCircle ( Image< T > &  image,
Circle< int32 > const &  circle,
U const &  outlineColor,
uint  thickness = 1 
)

Draw a Circle in the image.

Parameters
imageThe image onto which to draw a Circle
circleThe circle to draw
outlineColorThe color of the Circle's outline
thicknessThe thickness of the Circle's outline
Examples:
tests/test-Geometry.C, and tests/test-UKF.C.

Referenced by main().

template<class T , class U , class V = PixRGBA<byte>>
void nrt::drawEllipse ( Image< T > &  image,
Point2D< int32 > const &  center,
const float  radiusx,
const float  radiusy,
const float  skew,
U const &  outlineColor,
uint  thickness = 1,
V const &  fillColor = PixRGBA< byte >(0, 0, 0, 0) 
)

Draw a Ellipse in the image.

Parameters
imageThe image onto which to draw a ellipse
centerThe center of the ellipse
radiusxThe radius of the ellipse in the x dimension
radiusyThe radius of the ellipse in the y dimension
skewHow much the ellipse is skewed. This is a cheap approximation to rotation.
outlineColorThe color of the ellipse's outline
thicknessThe thickness of the ellipse's outline
fillColorthe color to use to fill the ellipse (use PixRGBA if you need transparency)
template<class T , template< typename > class SourceColorT, class U , template< typename > class OutlineColorT, class V = byte, template< typename > class FillColorT = PixRGBA>
void nrt::drawRectangle ( Image< SourceColorT< T >> &  image,
Rectangle< int32 > const &  rect,
OutlineColorT< U > const &  outlineColor,
uint  thickness = 1,
FillColorT< V > const &  fillColor = PixRGBA< byte >(0, 0, 0, 0) 
)

Draw a Rectangle in the Image.

To omit either the outline or the fill, you can specify a color type with an alpha channel set to 0 (for example, the default fill is a PixRGBA<byte>(0,0,0,0), and thus will be drawn as only an outline).

Parameters
imageThe image onto which to draw a Rectangle
rectThe rectangle to draw
outlineColorThe outline color of the Rectangle
thicknessThe thickness of the outline
fillColorThe filled color of the inside of the Rectangle
Image<PixRGB<byte>> myImage(Dims<int32>(640,480), nrt::ImageInitPolicy::Zeros);
Rectangle<int32> myRect(Point2D<int32>(320,240), Dims<int32>(50,50));
// Draw a rectangle with a red 1px outline and no fill
drawRectangle(myImage, myRect, PixRGB<byte>(255,0,0));
// Draw a rectangle with a red 1px outline and a blue fill
drawRectangle(myImage, myRect-Point2D<int>(50,0), PixRGB<byte>(255,0,0), 1, PixRGB<byte>(0,0,255));
// Draw a rectangle with a red 4px outline with 50% opacity and a blue fill with 25% opacity
drawRectangle(myImage, myRect+Point2D<int>(50,0), PixRGBA<byte>(255,0,0,128), 4, PixRGBA<byte>(0,0,255,64));
Examples:
tests/test-Geometry.C.
template<class T , class OutlineColorT >
void nrt::drawCross ( Image< T > &  image,
Point2D< int32 > const &  center,
OutlineColorT const &  outlineColor,
uint32  radius,
uint32  thickness = 1,
float  angle = 0 
)

Draw a cross in the Image.

Parameters
imageThe image onto which to draw a cross
centerThe center of the cross
outlineColorThe color of the cross
radiusThe radius of the cross (the distance from the tip of one line to the center point)
thicknessThe line3 thickness
angleThe rotation angle (in radians)
Examples:
tests/test-Geometry.C, and tests/test-UKF.C.
template<class T , class OutlineColorT >
void nrt::DrawArrow ( Image< T > &  image,
int32  xs,
int32  ys,
int32  xe,
int32  ye,
uint32  thickness = 1,
OutlineColorT const &  outlineColor = PixRGB< byte >(0, 0, 255),
float  headSizeRatio = 0.35f,
float  headAngle = 15.0f 
)

Draw an arrow in the Image.

Parameters
imageThe image onto which to draw a cross
xsstart column location on the image
ysstart row location on the image
xeend column location on the image
yeend row location on the image
thicknessthe line3 thickness
outlineColorthe color of the cross
headSizeRatiothe ratio of the head size to the length of the arrow
headAnglethe angle between the arrow lines and the main body
template<class T , class OutlineColorT >
void nrt::drawGrid ( Image< T > &  image,
const int32  spacingX,
const int32  spacingY,
const uint32  thickX = 1,
const uint32  thickY = 1,
OutlineColorT const &  outlineColor = PixRGB< byte >(0, 0, 0) 
)

Draw a Grid in the image.

Parameters
[in,out]imageThe image onto which to draw a Line
[in]spacingXthe x spacing
[in]spacingYthe y spacing
[in]thickXthe thickness of the grid in X direction
[in]thickYthe thickness of the grid in Y direction
[in]outlineColorthe color of the grid
Examples:
tests/test-Geometry.C.
template<class T , class OutlineColorT >
void nrt::drawGrid ( Image< T > &  image,
const uint32  nx,
const uint32  ny,
const uint32  thickness = 1,
OutlineColorT const &  outlineColor = PixRGB< byte >(0, 0, 0) 
)

Draw a regular Grid in the image.

Draws an nx * ny grid that exactly partitions the image

Parameters
[in,out]imageThe image onto which to draw a Line
[in]nxNumber of lines in x direction
[in]nyNumber of lines in y direction
[in]thicknessthickness of grid
[in]outlineColorthe color of the grid