DUtilsCV::Drawing::Plot Class Reference

Allows to plot numeric data. More...

#include <Drawing.h>

List of all members.

Classes

struct  Style
 Line style for plotting. More...

Public Member Functions

 Plot (int rows=240, int cols=320, double minx=0, double maxx=1, double miny=0, double maxy=1, int margin=0)
void create (int rows, int cols, double minx, double maxx, double miny, double maxy)
void create (int rows, int cols, double minx, double maxx, double miny, double maxy, int margin)
void create (double minx, double maxx, double miny, double maxy)
void create (double minx, double maxx, double miny, double maxy, int margin)
void setBackgroundColor (const cv::Scalar &color)
void clear ()
cv::Mat & getImage ()
const cv::Mat & getImage () const
void line (double x1, double y1, double x2, double y2, const Style &style=Style())
template<class T >
void polyline (const std::vector< T > &x, const std::vector< T > &y, const Style &style=Style())

Protected Member Functions

void setAxes (double minx, double maxx, double miny, double maxy, int margin)
int toPxX (double x) const
int toPxY (double y) const

Protected Attributes

cv::Scalar m_bg
 Background color.
int m_margin
 Area margin.
cv::Mat m_canvas
 Canvas image.
double m_cx
 Axis parameters.
double m_cy
double m_uppx
double m_uppy

Detailed Description

Allows to plot numeric data.


Constructor & Destructor Documentation

Drawing::Plot::Plot ( int  rows = 240,
int  cols = 320,
double  minx = 0,
double  maxx = 1,
double  miny = 0,
double  maxy = 1,
int  margin = 0 
)

Creates a plotting object

Parameters:
rows image height
cols image width
minx min value of x axis
maxx max value of x axis
miny min value of y axis
maxy max value of y axis
margin width of blank area close to image borders

Member Function Documentation

void DUtilsCV::Drawing::Plot::clear (  )  [inline]

Clears the image with the background color

void Drawing::Plot::create ( double  minx,
double  maxx,
double  miny,
double  maxy,
int  margin 
)

Changes the parameters of the axes and clears the image

Parameters:
minx min value of x axis
maxx max value of x axis
miny min value of y axis
maxy max value of y axis
margin width of blank area close to image borders
void Drawing::Plot::create ( double  minx,
double  maxx,
double  miny,
double  maxy 
)

Changes the parameters of the axes and clears the image

Parameters:
minx min value of x axis
maxx max value of x axis
miny min value of y axis
maxy max value of y axis
void Drawing::Plot::create ( int  rows,
int  cols,
double  minx,
double  maxx,
double  miny,
double  maxy,
int  margin 
)

Changes the parameters of the axes and clears the image

Parameters:
rows image height
cols image width
minx min value of x axis
maxx max value of x axis
miny min value of y axis
maxy max value of y axis
margin width of blank area close to image borders
void Drawing::Plot::create ( int  rows,
int  cols,
double  minx,
double  maxx,
double  miny,
double  maxy 
)

Changes the parameters of the axes and clears the image

Parameters:
rows image height
cols image width
minx min value of x axis
maxx max value of x axis
miny min value of y axis
maxy max value of y axis
const cv::Mat & DUtilsCV::Drawing::Plot::getImage (  )  const [inline]

Gets the canvas image

Returns:
a const reference to the canvas image
cv::Mat & DUtilsCV::Drawing::Plot::getImage (  )  [inline]

Gets the canvas image

Returns:
a reference to the canvas image
void Drawing::Plot::line ( double  x1,
double  y1,
double  x2,
double  y2,
const Style style = Style() 
)

Draws a line

Parameters:
x1 first point x
y1 first point y
x2 second point x
y2 second point y
style 
template<class T >
void DUtilsCV::Drawing::Plot::polyline ( const std::vector< T > &  x,
const std::vector< T > &  y,
const Style style = Style() 
) [inline]

Plots a ser of lines

Parameters:
x vector of x coordinates
y vector of y coordinates
style 
void Drawing::Plot::setAxes ( double  minx,
double  maxx,
double  miny,
double  maxy,
int  margin 
) [protected]

Sets axis parameters

Parameters:
minx min value of x axis
maxx max value of x axis
miny min value of y axis
maxy max value of y axis
margin width of blank area close to image borders
void DUtilsCV::Drawing::Plot::setBackgroundColor ( const cv::Scalar &  color  )  [inline]

Sets the background color of the plot area, but does not modify the image

Parameters:
color background color
int DUtilsCV::Drawing::Plot::toPxX ( double  x  )  const [inline, protected]

Converts a x coordinate into its pixel value

Parameters:
x axis coordinate
Returns:
u coordinate in pixels
int DUtilsCV::Drawing::Plot::toPxY ( double  y  )  const [inline, protected]

Converts a y coordinate into its pixel value

Parameters:
y axis coordinate
Returns:
v coordinate in pixels

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations
Generated on Thu Feb 7 19:22:00 2013 by  doxygen 1.6.3