CVD 0.8
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::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
typedef Brezenham8 CVD::Bresenham8

Functions

template<class T >
void CVD::drawLine (SubImage< T > &im, double x1, double y1, double x2, double y2, const T &c)
template<class T >
void CVD::drawLine (SubImage< T > &im, const ImageRef &p1, const ImageRef &p2, const T &c)
template<class T >
void CVD::drawLine (SubImage< T > &im, const TooN::Vector< 2 > &p1, const TooN::Vector< 2 > &p2, const T &c)
template<class T >
void CVD::drawShape (SubImage< T > &im, const ImageRef &offset, const std::vector< ImageRef > &points, const T &c)
template<class T , class PointIterator >
void CVD::drawShape (Image< T > &im, const ImageRef &offset, PointIterator begin, PointIterator end, const T &c)
template<class T >
void CVD::drawBox (SubImage< T > &im, const ImageRef &upperleft, const ImageRef &lowerright, const T &c)
template<class T >
void CVD::drawCross (SubImage< T > &im, const ImageRef &p, double len, const T &c)
std::vector< ImageRef > CVD::getCircle (int radius)
std::vector< ImageRef > CVD::getDisc (float radius)
std::vector< ImageRef > CVD::getSolidEllipse (float r1, float r2, float theta)
template<class S , class T , class U >
void CVD::joinImages (const Image< S > &a, const Image< T > &b, Image< U > &J)
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)

Detailed Description

Classes and functions to support miscellaneous pixel operations.


Function Documentation

template<class T >
void CVD::drawLine ( SubImage< 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

Definition at line 127 of file draw.h.

References CVD::abs(), CVD::SubImage< T >::size(), CVD::ImageRef::x, and CVD::ImageRef::y.

Referenced by CVD::drawBox(), CVD::drawCross(), CVD::drawLine(), and CVD::drawShape().

template<class T >
void CVD::drawLine ( SubImage< 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

Definition at line 149 of file draw.h.

References CVD::drawLine(), CVD::ImageRef::x, and CVD::ImageRef::y.

template<class T >
void CVD::drawLine ( SubImage< T > &  im,
const TooN::Vector< 2 > &  p1,
const TooN::Vector< 2 > &  p2,
const T &  c 
)

draws a line defined by two TooN::Vector<2> with given color into an image.

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

Definition at line 162 of file draw.h.

References CVD::drawLine().

template<class T >
void CVD::drawShape ( SubImage< 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

Definition at line 178 of file draw.h.

References CVD::drawLine().

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

Definition at line 194 of file draw.h.

References CVD::drawLine().

template<class T >
void CVD::drawBox ( SubImage< 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

Definition at line 216 of file draw.h.

References CVD::drawLine(), CVD::ImageRef::x, and CVD::ImageRef::y.

template<class T >
void CVD::drawCross ( SubImage< 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

Definition at line 231 of file draw.h.

References CVD::drawLine(), CVD::ImageRef::x, and CVD::ImageRef::y.

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
std::vector<ImageRef> CVD::getDisc ( float  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
std::vector<ImageRef> CVD::getSolidEllipse ( float  r1,
float  r2,
float  theta 
)

returns coordinates for a solid ellipse origin.

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

Parameters:
r1First radius
r2Second radius
thetaOrientation of the ellipse
Returns:
vector containig ImageRef for the ellipse
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

Definition at line 269 of file draw.h.

References CVD::copy(), CVD::Image< T >::resize(), CVD::SubImage< T >::size(), CVD::ImageRef::x, and CVD::ImageRef::y.

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

Definition at line 294 of file draw.h.

References CVD::copy(), CVD::SubImage< T >::in_image(), CVD::ImageRef::next(), CVD::SubImage< T >::size(), CVD::ImageRef::x, and CVD::ImageRef::y.