Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
tuw::Figure Class Reference

#include <figure.h>

Inheritance diagram for tuw::Figure:
Inheritance graph
[legend]

Public Member Functions

void appendToView (const cv::Mat &_mat, const cv::Scalar &_colMin, const cv::Scalar &_colMax, u_int8_t _truncateLayerVal=0)
 
const cv::Mat & background () const
 
cv::Mat & background ()
 
const std::string & backgroundFileName () const
 
void circle (const Point2D &p, int radius, const cv::Scalar &color, int thickness=1, int lineType=CV_AA)
 
void clear ()
 
 Figure (const std::string &title)
 draws the background image More...
 
 Figure (const Figure &)=default
 
 Figure (Figure &&)=default
 
virtual void init (int width_pixel, int height_pixel, double min_y, double max_y, double min_x, double max_x, double rotation=0, double grid_scale_x=-1, double grid_scale_y=-1, const std::string &background_image=std::string())
 
void line (const Point2D &p0, const Point2D &p1, const cv::Scalar &color, int thickness=1, int lineType=CV_AA)
 
Figureoperator= (const Figure &)=default
 
Figureoperator= (Figure &&)=default
 
void putText (cv::Mat &view, const std::string &text, const Point2D &p, int fontFace=cv::FONT_HERSHEY_PLAIN, double fontScale=0.6, cv::Scalar color=cv::Scalar(128, 0, 0), int thickness=1, int lineType=CV_AA, bool bottomLeftOrigin=false)
 
void putText (const std::string &text, const Point2D &p, int fontFace=cv::FONT_HERSHEY_PLAIN, double fontScale=0.6, cv::Scalar color=cv::Scalar(128, 0, 0), int thickness=1, int lineType=CV_AA, bool bottomLeftOrigin=false)
 
void setLabel (const std::string &label_x=std::string("x=%f"), const std::string &label_y=std::string("y=%f"))
 
void setView (const cv::Mat &view)
 
void symbol (cv::Mat &view, const Point2D &p, const cv::Scalar &color)
 
void symbol (const Point2D &p, const cv::Scalar &color)
 
void symbol (cv::Mat &view, const Pose2D &p, double radius, const cv::Scalar &color, int thickness=1, int lineType=CV_AA)
 
void symbol (const Pose2D &p, double radius, const cv::Scalar &color, int thickness=1, int lineType=CV_AA)
 
const std::string title () const
 
const cv::Mat & view () const
 
cv::Mat & view ()
 
virtual ~Figure ()=default
 
- Public Member Functions inherited from tuw::WorldScopedMaps
template<typename T >
void circle (T &map, const Point2D &p, int radius, const cv::Scalar &color, int thickness=1, int lineType=CV_AA) const
 
template<typename T >
cv::Scalar_< T > get (cv::Mat_< T > &map, const Point2D &p) const
 
int height () const
 
std::string infoHeader () const
 
void init (int width_pixel, int height_pixel, double min_y, double max_y, double min_x, double max_x, double rotation=0)
 
template<typename T >
void init (const T &metadata)
 
bool initialized ()
 
template<typename T >
void line (T &map, const Point2D &p0, const Point2D &p1, const cv::Scalar &color, int thickness=1, int lineType=CV_AA) const
 
Point2D m2w (const Point2D &src) const
 
Point2D m2w (double x, double y) const
 
Point2Dm2w (const Point2D &src, Point2D &des) const
 
double max_x () const
 
double max_y () const
 
double min_x () const
 
double min_y () const
 
const cv::Matx33d & Mm2w () const
 
const cv::Matx33d & Mw2m () const
 
WorldScopedMapsoperator= (const WorldScopedMaps &)=default
 
WorldScopedMapsoperator= (WorldScopedMaps &&)=default
 
double scale_w2m (double v) const
 
double scale_x () const
 
double scale_y () const
 
Point2D w2m (const Point2D &src) const
 
Point2D w2m (double x, double y) const
 
Point2Dw2m (const Point2D &src, Point2D &des) const
 
int width () const
 
 WorldScopedMaps ()
 
 WorldScopedMaps (const WorldScopedMaps &)=default
 
 WorldScopedMaps (WorldScopedMaps &&)=default
 
virtual ~WorldScopedMaps ()=default
 

Static Public Attributes

static const cv::Scalar black
 
static const cv::Scalar blue
 
static const cv::Scalar blue_bright
 
static const cv::Scalar blue_dark
 
static const cv::Scalar cyan
 
static const cv::Scalar gray
 
static const cv::Scalar gray_bright
 
static const cv::Scalar green
 color to use with the drawing functions More...
 
static const cv::Scalar green_bright
 
static const cv::Scalar green_dark
 
static const cv::Scalar magenta
 
static const cv::Scalar niceBlue
 
static const cv::Scalar niceDirtyPink
 
static const cv::Scalar niceGreen
 
static const cv::Scalar niceGreenBlue
 
static const cv::Scalar niceGreenWashed
 
static const cv::Scalar niceGrey
 
static const cv::Scalar niceGreyDark
 
static const cv::Scalar niceGreyLight
 
static const cv::Scalar niceGreyPurple
 
static const cv::Scalar niceLime
 
static const cv::Scalar niceMagenta
 
static const cv::Scalar niceMustard
 
static const cv::Scalar niceRed
 
static const cv::Scalar niceRedDark
 
static const cv::Scalar orange
 
static const cv::Scalar red
 
static const cv::Scalar white
 
static const cv::Scalar yellow
 

Private Member Functions

void drawBackground ()
 dimension of the drawn grid, if -1 no grid will be drawn More...
 

Private Attributes

cv::Mat background_
 canvas More...
 
std::string background_filename_
 background data, grid or image More...
 
double grid_scale_x_
 if empty no file will be used More...
 
double grid_scale_y_
 
std::string label_format_x_
 window name More...
 
std::string label_format_y_
 label format string More...
 
std::string title_
 
cv::Mat view_
 label format string More...
 

Detailed Description

class to visualize information using OpenCV matrices

Definition at line 17 of file figure.h.

Constructor & Destructor Documentation

Figure::Figure ( const std::string &  title)

draws the background image

constructor

Parameters
titletitle of the displayed windows

Definition at line 42 of file figure.cpp.

virtual tuw::Figure::~Figure ( )
virtualdefault
tuw::Figure::Figure ( const Figure )
default
tuw::Figure::Figure ( Figure &&  )
default

Member Function Documentation

void Figure::appendToView ( const cv::Mat &  _mat,
const cv::Scalar &  _colMin,
const cv::Scalar &  _colMax,
u_int8_t  _truncateLayerVal = 0 
)

Appends the contents of a single channel CV_8U map into the foreground image as a (BGR) colour gradient on foreground pixels that were previously white (255,255,255).

Parameters
_matMap (CV_8U) to be appended to the foreground image
_colMinMinimum (BGR) colour vector value of the appended map (a value of 0 in the input map will be appended with the colour _colMin)
_colMaxMaximum (BGR) colour vector value of the appended map (a value of 255 in the input map will be appended with the colour _colMax)
_truncateLayerValValue to be truncated from the source map. For example, a value of 10 will not append any pixels with value greater than 245 ( = 255-10 )

Definition at line 180 of file figure.cpp.

const cv::Mat & Figure::background ( ) const
Returns
the matrix related to the background canvas

Definition at line 61 of file figure.cpp.

cv::Mat & Figure::background ( )
Returns
the matrix related to the background canvas

Definition at line 64 of file figure.cpp.

const std::string & Figure::backgroundFileName ( ) const
Returns
Name of the background file

Definition at line 52 of file figure.cpp.

void Figure::circle ( const Point2D p,
int  radius,
const cv::Scalar &  color,
int  thickness = 1,
int  lineType = CV_AA 
)

draws a circle given in the visualization space (meter, ....) into the foreground image

Parameters
plocation
radiusradius
colorcolor –>
See also
opencv
Parameters
thicknessline thickness –>
See also
opencv
Parameters
lineTypeline type –>
See also
opencv

Definition at line 160 of file figure.cpp.

void Figure::clear ( )

overwrites the foreground with the background

Definition at line 138 of file figure.cpp.

void Figure::drawBackground ( )
private

dimension of the drawn grid, if -1 no grid will be drawn

Definition at line 87 of file figure.cpp.

void Figure::init ( int  width_pixel,
int  height_pixel,
double  min_y,
double  max_y,
double  min_x,
double  max_x,
double  rotation = 0,
double  grid_scale_x = -1,
double  grid_scale_y = -1,
const std::string &  background_image = std::string() 
)
virtual

used to initialize the figure

Parameters
width_pixelpixel size of the canvas
height_pixelpixel size of the canvas
min_yminimal y of the visualized space
max_ymaximal y of the visualized space
min_xminimal x of the visualized space
max_xmaximal x of the visualized space
rotationrotation of the visualized space
grid_scale_xdimension of the drawn grid, if -1 no grid will be drawn
grid_scale_ydimension of the drawn grid, if -1 no grid will be drawn
background_imagefile name of an image for the background, it can be empty as well

Reimplemented in tuw::LayeredFigure.

Definition at line 79 of file figure.cpp.

void Figure::line ( const Point2D p0,
const Point2D p1,
const cv::Scalar &  color,
int  thickness = 1,
int  lineType = CV_AA 
)

draws a line given in the visualization space (meter, ....) into the foreground image

Parameters
p0start point
p1end point
colorcolor –>
See also
opencv
Parameters
thicknessline thickness –>
See also
opencv
Parameters
lineTypeline type –>
See also
opencv

Definition at line 143 of file figure.cpp.

Figure& tuw::Figure::operator= ( const Figure )
default
Figure& tuw::Figure::operator= ( Figure &&  )
default
void Figure::putText ( cv::Mat &  view,
const std::string &  text,
const Point2D p,
int  fontFace = cv::FONT_HERSHEY_PLAIN,
double  fontScale = 0.6,
cv::Scalar  color = cv::Scalar ( 128,0,0 ),
int  thickness = 1,
int  lineType = CV_AA,
bool  bottomLeftOrigin = false 
)

draws a text (pose) given in the visualization space (meter, ....) into the image

Parameters
viewimage
texttext
plocation
fontFacefontFace –>
See also
opencv
Parameters
fontScalefontScale –>
See also
opencv
Parameters
colorcolor –>
See also
opencv
Parameters
thicknessline thickness –>
See also
opencv
Parameters
lineTypeline type –>
See also
opencv

Definition at line 176 of file figure.cpp.

void Figure::putText ( const std::string &  text,
const Point2D p,
int  fontFace = cv::FONT_HERSHEY_PLAIN,
double  fontScale = 0.6,
cv::Scalar  color = cv::Scalar ( 128,0,0 ),
int  thickness = 1,
int  lineType = CV_AA,
bool  bottomLeftOrigin = false 
)

draws a text (pose) given in the visualization space (meter, ....) into the foreground image

Parameters
texttext
plocation
fontFacefontFace –>
See also
opencv
Parameters
fontScalefontScale –>
See also
opencv
Parameters
colorcolor –>
See also
opencv
Parameters
thicknessline thickness –>
See also
opencv
Parameters
lineTypeline type –>
See also
opencv

Definition at line 173 of file figure.cpp.

void Figure::setLabel ( const std::string &  label_x = std::string("x=%f"),
const std::string &  label_y = std::string("y=%f") 
)

can be used to define the x and y label format

Parameters
label_xformat of the x label, default "x=%f"
label_yformat of the y label, default "y=%f"

Definition at line 49 of file figure.cpp.

void Figure::setView ( const cv::Mat &  view)

can be used to clone an image into the foreground independent to the image format (gray, color, ...)

Parameters
viewsource image

Definition at line 67 of file figure.cpp.

void Figure::symbol ( cv::Mat &  view,
const Point2D p,
const cv::Scalar &  color 
)

draws a symbol (dot) given in the visualization space (meter, ....) into a pixel map

Parameters
viewimage
plocation
colorcolor –>
See also
opencv

Definition at line 150 of file figure.cpp.

void Figure::symbol ( const Point2D p,
const cv::Scalar &  color 
)

draws a symbol (dot) given in the visualization space (meter, ....) into the foreground image

Parameters
plocation
colorcolor –>
See also
opencv

Definition at line 147 of file figure.cpp.

void Figure::symbol ( cv::Mat &  view,
const Pose2D p,
double  radius,
const cv::Scalar &  color,
int  thickness = 1,
int  lineType = CV_AA 
)

draws a symbol (pose) given in the visualization space (meter, ....) into the image

Parameters
viewimage
plocation
radiusradius
colorcolor –>
See also
opencv
Parameters
thicknessline thickness –>
See also
opencv
Parameters
lineTypeline type –>
See also
opencv

Definition at line 168 of file figure.cpp.

void Figure::symbol ( const Pose2D p,
double  radius,
const cv::Scalar &  color,
int  thickness = 1,
int  lineType = CV_AA 
)

draws a symbol (pose) given in the visualization space (meter, ....) into the foreground image

Parameters
plocation
radiusradius
colorcolor –>
See also
opencv
Parameters
thicknessline thickness –>
See also
opencv
Parameters
lineTypeline type –>
See also
opencv

Definition at line 164 of file figure.cpp.

const std::string Figure::title ( ) const
Returns
title of the window

Definition at line 156 of file figure.cpp.

const cv::Mat & Figure::view ( ) const
Returns
the matrix related to the foreground canvas

Definition at line 55 of file figure.cpp.

cv::Mat & Figure::view ( )
Returns
the matrix related to the foreground canvas

Definition at line 58 of file figure.cpp.

Member Data Documentation

cv::Mat tuw::Figure::background_
private

canvas

Definition at line 22 of file figure.h.

std::string tuw::Figure::background_filename_
private

background data, grid or image

Definition at line 23 of file figure.h.

const cv::Scalar Figure::black
static

Definition at line 200 of file figure.h.

const cv::Scalar Figure::blue
static

Definition at line 191 of file figure.h.

const cv::Scalar Figure::blue_bright
static

Definition at line 192 of file figure.h.

const cv::Scalar Figure::blue_dark
static

Definition at line 193 of file figure.h.

const cv::Scalar Figure::cyan
static

Definition at line 196 of file figure.h.

const cv::Scalar Figure::gray
static

Definition at line 199 of file figure.h.

const cv::Scalar Figure::gray_bright
static

Definition at line 198 of file figure.h.

const cv::Scalar Figure::green
static

color to use with the drawing functions

Definition at line 187 of file figure.h.

const cv::Scalar Figure::green_bright
static

Definition at line 188 of file figure.h.

const cv::Scalar Figure::green_dark
static

Definition at line 189 of file figure.h.

double tuw::Figure::grid_scale_x_
private

if empty no file will be used

Definition at line 24 of file figure.h.

double tuw::Figure::grid_scale_y_
private

Definition at line 24 of file figure.h.

std::string tuw::Figure::label_format_x_
private

window name

Definition at line 19 of file figure.h.

std::string tuw::Figure::label_format_y_
private

label format string

Definition at line 20 of file figure.h.

const cv::Scalar Figure::magenta
static

Definition at line 197 of file figure.h.

const cv::Scalar Figure::niceBlue
static

Definition at line 203 of file figure.h.

const cv::Scalar Figure::niceDirtyPink
static

Definition at line 216 of file figure.h.

const cv::Scalar Figure::niceGreen
static

Definition at line 209 of file figure.h.

const cv::Scalar Figure::niceGreenBlue
static

Definition at line 206 of file figure.h.

const cv::Scalar Figure::niceGreenWashed
static

Definition at line 213 of file figure.h.

const cv::Scalar Figure::niceGrey
static

Definition at line 210 of file figure.h.

const cv::Scalar Figure::niceGreyDark
static

Definition at line 214 of file figure.h.

const cv::Scalar Figure::niceGreyLight
static

Definition at line 211 of file figure.h.

const cv::Scalar Figure::niceGreyPurple
static

Definition at line 212 of file figure.h.

const cv::Scalar Figure::niceLime
static

Definition at line 215 of file figure.h.

const cv::Scalar Figure::niceMagenta
static

Definition at line 205 of file figure.h.

const cv::Scalar Figure::niceMustard
static

Definition at line 204 of file figure.h.

const cv::Scalar Figure::niceRed
static

Definition at line 207 of file figure.h.

const cv::Scalar Figure::niceRedDark
static

Definition at line 208 of file figure.h.

const cv::Scalar Figure::orange
static

Definition at line 194 of file figure.h.

const cv::Scalar Figure::red
static

Definition at line 190 of file figure.h.

std::string tuw::Figure::title_
private

Definition at line 18 of file figure.h.

cv::Mat tuw::Figure::view_
private

label format string

Definition at line 21 of file figure.h.

const cv::Scalar Figure::white
static

Definition at line 201 of file figure.h.

const cv::Scalar Figure::yellow
static

Definition at line 195 of file figure.h.


The documentation for this class was generated from the following files:


tuw_geometry
Author(s): Markus Bader
autogenerated on Mon Jun 10 2019 15:33:09