Go to the documentation of this file.
79 virtual void setPixel(
int x,
int y,
size_t color) =0;
104 unsigned int width = 1,
122 unsigned int width = 1 );
139 bool inferior =
true,
140 unsigned int width = 1 );
171 const std::string &str,
242 unsigned int width = 1 );
254 template <
class MATRIX2X2>
256 const MATRIX2X2 *cov2D,
259 double confIntervalStds = 2,
261 unsigned int width = 1,
262 int nEllipsePoints = 20
266 int x1=0,y1=0,x2=0,y2=0;
268 MATRIX2X2 eigVal,eigVec;
272 cov2D->eigenVectors(eigVec,eigVal);
274 eigVal = eigVal.array().sqrt().matrix();
276 M.multiply_ABt(eigVal, eigVec);
279 for (i=0,ang=0;i<nEllipsePoints;i++,ang+= (
M_2PI/(nEllipsePoints-1)))
281 double ccos = cos(ang);
282 double ssin = sin(ang);
284 x2 =
round( mean_x + confIntervalStds * (ccos * M(0,0) + ssin * M(1,0)) );
285 y2 =
round( mean_y + confIntervalStds * (ccos * M(0,1) + ssin * M(1,1)) );
288 line( x1, y1,x2, y2,color,width );
295 std::cout <<
"Covariance matrix leading to error is:" << std::endl << *cov2D << std::endl; \
303 template <
class FEATURELIST>
306 for(
size_t i=0;i<list.size(); ++i )
308 const int x =
round( list.getFeatureX(i) );
309 const int y =
round( list.getFeatureY(i) );
310 this->cross( x,y, color,
'+', cross_size );
321 template <
class FEATURELIST>
324 for(
size_t i=0;i<list.size(); ++i )
326 const int x =
round( list.getFeatureX(i) );
327 const int y =
round( list.getFeatureY(i) );
328 this->cross(x,y, color,
'+' );
329 if( showIDs ) this->textOut(x,y,
format(
"%u",
static_cast<unsigned int>(list.getFeatureID(i))),
TColor::red );
330 if (showResponse) this->textOut( x,y+10,
format(
"R:%u",
static_cast<unsigned int>(list.getFeatureResponse(i))),
TColor::red );
331 if( ! list.isPointFeature(i) ) this->drawCircle(x,y, list.getScale(i),
TColor::red );
int round(const T value)
Returns the closer integer (int) to x.
virtual void drawCircle(int x, int y, int radius, const mrpt::utils::TColor &color=mrpt::utils::TColor(255, 255, 255), unsigned int width=1)
Draws a circle of a given radius.
virtual ~CCanvas()
Dummy virtual destructor:
static TColor red
Predefined colors.
virtual size_t getWidth() const =0
Returns the width of the image in pixels.
size_t size(const MATRIXLIKE &m, int dim)
void drawFeatures(const FEATURELIST &list, const TColor &color=TColor::red, const bool showIDs=false, const bool showResponse=false)
Draws a set of marks (or scaled circles for features with scale) onto the image, given a generic cont...
virtual void line(int x0, int y0, int x1, int y1, const mrpt::utils::TColor color, unsigned int width=1, TPenStyle penStyle=psSolid)
Draws a line.
#define MRPT_END_WITH_CLEAN_UP(stuff)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A class for storing images as grayscale or RGB bitmaps.
void cross(int x0, int y0, const mrpt::utils::TColor color, char type, unsigned int size=5, unsigned int width=1)
Draw a cross.
const uint32_t * m_selectedFontBitmaps
Direct access to character bitmaps.
virtual void drawImage(int x, int y, const utils::CImage &img, float rotation, float scale)
Draws an image as a bitmap at a given position, with some custom scale and rotation changes.
virtual void textOut(int x0, int y0, const std::string &str, const mrpt::utils::TColor color)
Renders 2D text using bitmap fonts.
void drawFeaturesSimple(const FEATURELIST &list, const TColor &color=TColor::red, const int cross_size=5)
Draws a set of marks onto the image, given a generic container of entities having just "x" and "y" fi...
void ellipseGaussian(const MATRIX2X2 *cov2D, const double mean_x, const double mean_y, double confIntervalStds=2, const mrpt::utils::TColor &color=mrpt::utils::TColor(255, 255, 255), unsigned int width=1, int nEllipsePoints=20)
Draws an ellipse representing a given confidence interval of a 2D Gaussian distribution.
virtual size_t getHeight() const =0
Returns the height of the image in pixels.
virtual void selectTextFont(const std::string &fontName)
Select the current font used when drawing text.
TPenStyle
Definition of pen styles.
This virtual class defines the interface of any object accepting drawing primitives on it.
void rectangle(int x0, int y0, int x1, int y1, const mrpt::utils::TColor color, unsigned int width=1)
Draws a rectangle (an empty rectangle, without filling)
virtual void setPixel(int x, int y, size_t color)=0
Changes the value of the pixel (x,y).
virtual void drawImage(int x, int y, const utils::CImage &img)
Draws an image as a bitmap at a given position.
void triangle(int x0, int y0, int size, const mrpt::utils::TColor color, bool inferior=true, unsigned int width=1)
Draws a triangle.
virtual void filledRectangle(int x0, int y0, int x1, int y1, const mrpt::utils::TColor color)
Draws a filled rectangle.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
std::string m_selectedFont
The selected font name.
Page generated by Doxygen 1.8.20 for MRPT 1.4.0 SVN: at Thu Aug 27 02:40:23 UTC 2020 | | |