Class Figure

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class Figure : public tuw::WorldScopedMaps

class to visualize information using OpenCV matrices

Subclassed by tuw::LayeredFigure

Public Functions

Figure(const std::string &title)

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

constructor

Parameters:

title – title of the displayed windows

virtual ~Figure() = default
Figure(const Figure&) = default
Figure &operator=(const Figure&) = default
Figure(Figure&&) = default
Figure &operator=(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())

used to initialize the figure

Parameters:
  • width_pixel – pixel size of the canvas

  • height_pixel – pixel size of the canvas

  • min_y – minimal y of the visualized space

  • max_y – maximal y of the visualized space

  • min_x – minimal x of the visualized space

  • max_x – maximal x of the visualized space

  • rotation – rotation of the visualized space

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

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

  • background_image – file name of an image for the background, it can be empty as well

virtual void init(int width_pixel, int height_pixel, cv::Matx33d Mw2m, double grid_scale_y, double grid_scale_x, const std::string &background_image)
const std::string title() const
Returns:

title of the window

void 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_x – format of the x label, default “x=%f”

  • label_y – format of the y label, default “y=%f”

const std::string &backgroundFileName() const
Returns:

Name of the background file

const cv::Mat &view() const
Returns:

the matrix related to the foreground canvas

cv::Mat &view()
Returns:

the matrix related to the foreground canvas

const cv::Mat &background() const
Returns:

the matrix related to the background canvas

cv::Mat &background()
Returns:

the matrix related to the background canvas

const cv::Mat &background_image() const
Returns:

the matrix related to the background image

cv::Mat &background_image()
Returns:

the matrix related to the background image

void setView(const cv::Mat &view)

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

Parameters:

view – source image

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

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

See also

opencv

See also

opencv

See also

opencv

Parameters:
  • p0 – start point

  • p1 – end point

  • color – color –>

  • thickness – line thickness –>

  • lineType – line type –>

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

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

See also

opencv

See also

opencv

See also

opencv

Parameters:
  • p – location

  • radius – radius

  • color – color –>

  • thickness – line thickness –>

  • lineType – line type –>

void 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

See also

opencv

Parameters:
  • view – image

  • p – location

  • color – color –>

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

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

See also

opencv

Parameters:
  • p – location

  • color – color –>

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

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

See also

opencv

See also

opencv

See also

opencv

Parameters:
  • view – image

  • p – location

  • radius – radius

  • color – color –>

  • thickness – line thickness –>

  • lineType – line type –>

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

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

See also

opencv

See also

opencv

See also

opencv

Parameters:
  • p – location

  • radius – radius

  • color – color –>

  • thickness – line thickness –>

  • lineType – line type –>

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::LINE_AA, bool bottomLeftOrigin = false)

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

See also

opencv

See also

opencv

See also

opencv

See also

opencv

See also

opencv

Parameters:
  • view – image

  • text – text

  • p – location

  • fontFace – fontFace –>

  • fontScale – fontScale –>

  • color – color –>

  • thickness – line thickness –>

  • lineType – line type –>

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::LINE_AA, bool bottomLeftOrigin = false)

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

See also

opencv

See also

opencv

See also

opencv

See also

opencv

See also

opencv

Parameters:
  • text – text

  • p – location

  • fontFace – fontFace –>

  • fontScale – fontScale –>

  • color – color –>

  • thickness – line thickness –>

  • lineType – line type –>

void drawBackground()

draws the background cavas it is normly called in init but if the background images changes it has to called again

void clear()

overwrites the foreground with the background

void 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:
  • _mat – Map (CV_8U) to be appended to the foreground image

  • _colMin – Minimum (BGR) colour vector value of the appended map (a value of 0 in the input map will be appended with the colour _colMin)

  • _colMax – Maximum (BGR) colour vector value of the appended map (a value of 255 in the input map will be appended with the colour _colMax)

  • _truncateLayerVal – Value 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 )

template<typename T>
inline void line(T &map, const Point2D &p0, const Point2D &p1, const cv::Scalar &color, int thickness = 1, int lineType = cv::LINE_AA) const

draws a line given in the visualization space (meter, ….) into a pixel map

See also

opencv

See also

opencv

See also

opencv

Parameters:
  • map – opencv matrix

  • p0 – start point

  • p1 – end point

  • color – color –>

  • thickness – line thickness –>

  • lineType – line type –>

template<typename T>
inline void circle(T &map, const Point2D &p, int radius, const cv::Scalar &color, int thickness = 1, int lineType = cv::LINE_AA) const

draws a circle given in the visualization space (meter, ….) into a pixel map

See also

opencv

See also

opencv

See also

opencv

Parameters:
  • map – opencv matrix

  • p – location

  • radius – radius

  • color – color –>

  • thickness – line thickness –>

  • lineType – line type –>

Public Static Attributes

static const cv::Scalar green

color to use with the drawing functions

static const cv::Scalar green_bright
static const cv::Scalar green_dark
static const cv::Scalar red
static const cv::Scalar blue
static const cv::Scalar blue_bright
static const cv::Scalar blue_dark
static const cv::Scalar orange
static const cv::Scalar yellow
static const cv::Scalar cyan
static const cv::Scalar magenta
static const cv::Scalar gray_bright
static const cv::Scalar gray
static const cv::Scalar black
static const cv::Scalar white
static const cv::Scalar niceBlue
static const cv::Scalar niceMustard
static const cv::Scalar niceMagenta
static const cv::Scalar niceGreenBlue
static const cv::Scalar niceRed
static const cv::Scalar niceRedDark
static const cv::Scalar niceGreen
static const cv::Scalar niceGrey
static const cv::Scalar niceGreyLight
static const cv::Scalar niceGreyPurple
static const cv::Scalar niceGreenWashed
static const cv::Scalar niceGreyDark
static const cv::Scalar niceLime
static const cv::Scalar niceDirtyPink