118 unsigned int width = 1);
132 bool inferior =
true,
unsigned int width = 1);
203 unsigned int size = 5,
unsigned int width = 1);
231 int x,
int y,
int radius,
233 unsigned int width = 1);
249 template <
class MATRIX2X2>
251 const MATRIX2X2* cov2D,
const double mean_x,
const double mean_y,
252 double confIntervalStds = 2,
254 unsigned int width = 1,
int nEllipsePoints = 20)
257 int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
259 MATRIX2X2 eigVal, eigVec;
263 cov2D->eigenVectors(eigVec, eigVal);
265 eigVal = eigVal.array().sqrt().matrix();
267 M.multiply_ABt(eigVal, eigVec);
270 for (i = 0, ang = 0; i < nEllipsePoints;
271 i++, ang += (
M_2PI / (nEllipsePoints - 1)))
273 double ccos = cos(ang);
274 double ssin = sin(ang);
277 mean_x + confIntervalStds * (ccos * M(0, 0) + ssin * M(1, 0)));
279 mean_y + confIntervalStds * (ccos * M(0, 1) + ssin * M(1, 1)));
288 std::cout <<
"Covariance matrix leading to error is:" << std::endl
289 << *cov2D << std::endl;);
299 template <
class FEATURELIST>
302 const int cross_size = 5)
304 for (
size_t i = 0; i < list.size(); ++i)
306 const int x =
round(list.getFeatureX(i));
307 const int y =
round(list.getFeatureY(i));
320 template <
class FEATURELIST>
323 const bool showIDs =
false,
const bool showResponse =
false)
325 for (
size_t i = 0; i < list.size(); ++i)
327 const int x =
round(list.getFeatureX(i));
328 const int y =
round(list.getFeatureY(i));
334 "%u", static_cast<unsigned int>(list.getFeatureID(i))),
339 "R:%u", static_cast<unsigned int>(
340 list.getFeatureResponse(i))),
342 if (!list.isPointFeature(i))
virtual void drawCircle(int x, int y, int radius, const mrpt::img::TColor &color=mrpt::img::TColor(255, 255, 255), unsigned int width=1)
Draws a circle of a given radius.
This virtual class defines the interface of any object accepting drawing primitives on it...
void cross(int x0, int y0, const mrpt::img::TColor color, char type, unsigned int size=5, unsigned int width=1)
Draw a cross.
TPenStyle
Definition of pen styles.
virtual void line(int x0, int y0, int x1, int y1, const mrpt::img::TColor color, unsigned int width=1, TPenStyle penStyle=psSolid)
Draws a line.
virtual ~CCanvas()
Dummy virtual destructor:
GLenum GLenum GLenum GLenum GLenum scale
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 void setPixel(int x, int y, size_t color)=0
Changes the value of the pixel (x,y).
#define MRPT_END_WITH_CLEAN_UP(stuff)
void triangle(int x0, int y0, int size, const mrpt::img::TColor color, bool inferior=true, unsigned int width=1)
Draws a triangle.
std::string m_selectedFont
The selected font name.
virtual void selectTextFont(const std::string &fontName)
Select the current font used when drawing text.
virtual void filledRectangle(int x0, int y0, int x1, int y1, const mrpt::img::TColor color)
Draws a filled rectangle.
void rectangle(int x0, int y0, int x1, int y1, const mrpt::img::TColor color, unsigned int width=1)
Draws a rectangle (an empty rectangle, without filling)
GLsizei const GLchar ** string
virtual size_t getWidth() const =0
Returns the width of the image in pixels.
static constexpr TColor red()
Predefined colors.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
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 textOut(int x0, int y0, const std::string &str, const mrpt::img::TColor color)
Renders 2D text using bitmap fonts.
virtual size_t getHeight() const =0
Returns the height of the image in pixels.
void ellipseGaussian(const MATRIX2X2 *cov2D, const double mean_x, const double mean_y, double confIntervalStds=2, const mrpt::img::TColor &color=mrpt::img::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 void drawImage(int x, int y, const mrpt::img::CImage &img)
Draws an image as a bitmap at a given position.
unsigned __int32 uint32_t
GLuint GLuint GLsizei GLenum type
const uint32_t * m_selectedFontBitmaps
Direct access to character bitmaps.
A class for storing images as grayscale or RGB bitmaps.
int round(const T value)
Returns the closer integer (int) to x.