121 unsigned int width = 1);
135 bool inferior =
true,
unsigned int width = 1);
207 unsigned int size = 5,
unsigned int width = 1);
234 int x,
int y,
int radius,
236 unsigned int width = 1);
252 template <
class MATRIX2X2>
254 const MATRIX2X2* cov2D,
const double mean_x,
const double mean_y,
255 double confIntervalStds = 2,
257 unsigned int width = 1,
int nEllipsePoints = 20)
260 int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
262 MATRIX2X2 eigVal, eigVec;
266 cov2D->eigenVectors(eigVec, eigVal);
268 eigVal = eigVal.array().sqrt().matrix();
270 M.multiply_ABt(eigVal, eigVec);
273 for (i = 0, ang = 0; i < nEllipsePoints;
274 i++, ang += (
M_2PI / (nEllipsePoints - 1)))
276 double ccos = cos(ang);
277 double ssin = sin(ang);
280 mean_x + confIntervalStds * (ccos * M(0, 0) + ssin * M(1, 0)));
282 mean_y + confIntervalStds * (ccos * M(0, 1) + ssin * M(1, 1)));
291 std::cout <<
"Covariance matrix leading to error is:" << std::endl
292 << *cov2D << std::endl;);
302 template <
class FEATURELIST>
305 const int cross_size = 5)
307 for (
size_t i = 0; i < list.size(); ++i)
309 const int x =
round(list.getFeatureX(i));
310 const int y =
round(list.getFeatureY(i));
323 template <
class FEATURELIST>
326 const bool showIDs =
false,
const bool showResponse =
false)
328 for (
size_t i = 0; i < list.size(); ++i)
330 const int x =
round(list.getFeatureX(i));
331 const int y =
round(list.getFeatureY(i));
337 "%u", static_cast<unsigned int>(list.getFeatureID(i))),
342 "R:%u", static_cast<unsigned int>(
343 list.getFeatureResponse(i))),
345 if (!list.isPointFeature(i))
virtual void textOut(int x0, int y0, const std::string &str, const mrpt::utils::TColor color)
Renders 2D text using bitmap fonts.
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...
std::string m_selectedFont
The selected font name.
#define MRPT_END_WITH_CLEAN_UP(stuff)
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.
A class for storing images as grayscale or RGB bitmaps.
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.
GLenum GLenum GLenum GLenum GLenum scale
virtual size_t getHeight() const =0
Returns the height of the image in pixels.
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)
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 setPixel(int x, int y, size_t color)=0
Changes the value of the pixel (x,y).
const uint32_t * m_selectedFontBitmaps
Direct access to character 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.
virtual void selectTextFont(const std::string &fontName)
Select the current font used when drawing text.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
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...
virtual ~CCanvas()
Dummy virtual destructor:
GLsizei const GLchar ** string
virtual void filledRectangle(int x0, int y0, int x1, int y1, const mrpt::utils::TColor color)
Draws a filled rectangle.
virtual size_t getWidth() const =0
Returns the width of the image in pixels.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
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.
static constexpr TColor red()
Predefined colors.
int round(const T value)
Returns the closer integer (int) to x.
This virtual class defines the interface of any object accepting drawing primitives on it...
TPenStyle
Definition of pen styles.
unsigned __int32 uint32_t
GLuint GLuint GLsizei GLenum type
virtual void drawImage(int x, int y, const utils::CImage &img)
Draws an image as a bitmap at a given position.