libcvd
Classes | Typedefs | Functions
Computer graphics

Classes and functions to support miscellaneous pixel operations. More...

Classes

class  CVD::Brezenham
 Class to implement the Bresenham line-drawing algorithm. More...
 
class  CVD::Brezenham8
 Class to implement the Bresenham line-drawing algorithm. More...
 
struct  CVD::Colourmap< Rgb< C > >
 Handy class for generating a colourscale. More...
 
struct  CVD::color< T, N >
 traits type defining colors for pixel types More...
 
struct  CVD::color< T, 1 >
 traits type defining colors for pixel types. More...
 
struct  CVD::color< T, 3 >
 traits type defining colors for pixel types. More...
 

Typedefs

typedef Brezenham CVD::Bresenham
 Alternative (and correct) spelling for this object.
 
typedef Brezenham8 CVD::Bresenham8
 Alternative (and correct) spelling for this object.
 

Functions

template<class T >
void CVD::drawLine (BasicImage< T > &im, double x1, double y1, double x2, double y2, const T &c)
 draws a line defined by start and end coordinates with given color into an image. More...
 
template<class T >
void CVD::drawLine (BasicImage< T > &im, const ImageRef &p1, const ImageRef &p2, const T &c)
 draws a line defined by two ImageRef with given color into an image. More...
 
template<class T >
void CVD::drawShape (BasicImage< T > &im, const ImageRef &offset, const std::vector< ImageRef > &points, const T &c)
 draws a polyline defined by a set of points into an image. More...
 
template<class T , class PointIterator >
void CVD::drawShape (Image< T > &im, const ImageRef &offset, PointIterator begin, PointIterator end, const T &c)
 draws a polyline defined by a set of points into an image. More...
 
template<class T >
void CVD::drawBox (BasicImage< T > &im, const ImageRef &upperleft, const ImageRef &lowerright, const T &c)
 draws a box defined by the upper left and the lower right corners into an image More...
 
template<class T >
void CVD::drawCross (BasicImage< T > &im, const ImageRef &p, double len, const T &c)
 draws a cross defined by center point and length of the arms into an image More...
 
std::vector< ImageRefCVD::getCircle (int radius)
 returns coordinate for a circle of given radius around the origin. More...
 
std::vector< ImageRefCVD::getDisc (double radius)
 returns coordinate for a disc of given radius around the origin. More...
 
template<class S , class T , class U >
void CVD::joinImages (const Image< S > &a, const Image< T > &b, Image< U > &J)
 joins two images side-by-side to create a larger image, any remaining empty region will be blacked out More...
 
template<class S , class T , class U >
void CVD::combineImages (const Image< S > &a, const Image< T > &b, Image< U > &out, const ImageRef &dst=ImageRef_zero, ImageRef size=ImageRef(), const ImageRef &from=ImageRef_zero)
 similar to copy but combines values from two source images into the output image. More...
 

Detailed Description

Classes and functions to support miscellaneous pixel operations.

Function Documentation

◆ combineImages()

template<class S , class T , class U >
void CVD::combineImages ( const Image< S > &  a,
const Image< T > &  b,
Image< U > &  out,
const ImageRef dst = ImageRef_zero,
ImageRef  size = ImageRef(),
const ImageRef from = ImageRef_zero 
)

similar to copy but combines values from two source images into the output image.

In the current implementation it simply adds the pixel values of two input images together and writes them into the output image.

Parameters
ainput image a to copy from
binput image b to copy from
outresulting combined image

◆ drawBox()

template<class T >
void CVD::drawBox ( BasicImage< T > &  im,
const ImageRef upperleft,
const ImageRef lowerright,
const T &  c 
)

draws a box defined by the upper left and the lower right corners into an image

Parameters
imimage to draw in
upperleftImageRef of upper left corner
lowerrightImageRef of lower right corner
ccolor of the box

◆ drawCross()

template<class T >
void CVD::drawCross ( BasicImage< T > &  im,
const ImageRef p,
double  len,
const T &  c 
)

draws a cross defined by center point and length of the arms into an image

Parameters
imimage to draw in
pcenter point
lenarm length
ccolor of the box

◆ drawLine() [1/2]

template<class T >
void CVD::drawLine ( BasicImage< T > &  im,
double  x1,
double  y1,
double  x2,
double  y2,
const T &  c 
)

draws a line defined by start and end coordinates with given color into an image.

Parameters
imimage to draw in
x1x coordinate of start point
y1y coordinate of start point
x2x coordinate of end point
y2y coordinate of end point
ccolor of the line

◆ drawLine() [2/2]

template<class T >
void CVD::drawLine ( BasicImage< T > &  im,
const ImageRef p1,
const ImageRef p2,
const T &  c 
)

draws a line defined by two ImageRef with given color into an image.

Parameters
imimage to draw in
p1start point
p2end point
ccolor of the line

◆ drawShape() [1/2]

template<class T >
void CVD::drawShape ( BasicImage< T > &  im,
const ImageRef offset,
const std::vector< ImageRef > &  points,
const T &  c 
)

draws a polyline defined by a set of points into an image.

A given offset is added to all points.

Parameters
imimage to draw in
offsetadded to all points
pointsvector containing points
ccolor of the line

◆ drawShape() [2/2]

template<class T , class PointIterator >
void CVD::drawShape ( Image< T > &  im,
const ImageRef offset,
PointIterator  begin,
PointIterator  end,
const T &  c 
)

draws a polyline defined by a set of points into an image.

A given offset is added to all points.

Parameters
imimage to draw in
offsetadded to all points
beginan iterator pointing to the first point in the shape.
endan iterator pointing to one past the last point in the shape.
ccolor of the line

◆ getCircle()

std::vector< ImageRef > CVD::getCircle ( int  radius)

returns coordinate for a circle of given radius around the origin.

The result can be used with drawShape to draw it into an image.

Parameters
radiusradius of the circle in pixels
Returns
vector containig ImageRef for the circle

◆ getDisc()

std::vector< ImageRef > CVD::getDisc ( double  radius)

returns coordinate for a disc of given radius around the origin.

The result can be used with drawShape to draw it into an image.

Parameters
radiusradius of the circle in pixels
Returns
vector containig ImageRef for the circle

◆ joinImages()

template<class S , class T , class U >
void CVD::joinImages ( const Image< S > &  a,
const Image< T > &  b,
Image< U > &  J 
)

joins two images side-by-side to create a larger image, any remaining empty region will be blacked out

Parameters
ainput image a to copy from
binput image b to copy from
Jresulting joint image