Visual Servoing Platform  version 3.1.0
vpDisplay_uchar.cpp
1 #include <visp3/core/vpDisplay.h>
2 
3 #include "vpDisplay_impl.h"
4 
5 //************************************************************************
6 // Modifications done in this file should be reported in all vpDisplay_*.cpp
7 // files that implement other types (unsigned char, vpRGB, vpRGBa)
8 //************************************************************************
9 
13 void vpDisplay::close(vpImage<unsigned char> &I) { vp_display_close(I); }
14 
24  const vpColor &color, unsigned int w, unsigned int h, unsigned int thickness)
25 {
26  vp_display_display_arrow(I, ip1, ip2, color, w, h, thickness);
27 }
28 
39 void vpDisplay::displayArrow(const vpImage<unsigned char> &I, int i1, int j1, int i2, int j2, const vpColor &color,
40  unsigned int w, unsigned int h, unsigned int thickness)
41 {
42  vp_display_display_arrow(I, i1, j1, i2, j2, color, w, h, thickness);
43 }
44 
59  const vpCameraParameters &cam, double size, const vpColor &color, unsigned int thickness)
60 {
61  vp_display_display_camera(I, cMo, cam, size, color, thickness);
62 }
63 
77 void vpDisplay::displayCharString(const vpImage<unsigned char> &I, const vpImagePoint &ip, const char *string,
78  const vpColor &color)
79 {
80  vp_display_display_char_string(I, ip, string, color);
81 }
82 
96 void vpDisplay::displayCharString(const vpImage<unsigned char> &I, int i, int j, const char *string,
97  const vpColor &color)
98 {
99  vp_display_display_char_string(I, i, j, string, color);
100 }
101 
112 void vpDisplay::displayCircle(const vpImage<unsigned char> &I, const vpImagePoint &center, unsigned int radius,
113  const vpColor &color, bool fill, unsigned int thickness)
114 {
115  vp_display_display_circle(I, center, radius, color, fill, thickness);
116 }
117 
128 void vpDisplay::displayCircle(const vpImage<unsigned char> &I, int i, int j, unsigned int radius, const vpColor &color,
129  bool fill, unsigned int thickness)
130 {
131  vp_display_display_circle(I, i, j, radius, color, fill, thickness);
132 }
133 
142 void vpDisplay::displayCross(const vpImage<unsigned char> &I, const vpImagePoint &ip, unsigned int size,
143  const vpColor &color, unsigned int thickness)
144 {
145  vp_display_display_cross(I, ip, size, color, thickness);
146 }
147 
156 void vpDisplay::displayCross(const vpImage<unsigned char> &I, int i, int j, unsigned int size, const vpColor &color,
157  unsigned int thickness)
158 {
159  vp_display_display_cross(I, i, j, size, color, thickness);
160 }
161 
170  const vpColor &color, unsigned int thickness)
171 {
172  vp_display_display_dot_line(I, ip1, ip2, color, thickness);
173 }
174 
183 void vpDisplay::displayDotLine(const vpImage<unsigned char> &I, int i1, int j1, int i2, int j2, const vpColor &color,
184  unsigned int thickness)
185 {
186  vp_display_display_dot_line(I, i1, j1, i2, j2, color, thickness);
187 }
188 
197 void vpDisplay::displayDotLine(const vpImage<unsigned char> &I, const std::vector<vpImagePoint> &ips,
198  const bool closeTheShape, const vpColor &color, unsigned int thickness)
199 {
200  if (ips.size() <= 1)
201  return;
202 
203  for (size_t i = 0; i < ips.size() - 1; i++)
204  vp_display_display_dot_line(I, ips[i], ips[i + 1], color, thickness);
205 
206  if (closeTheShape)
207  vp_display_display_dot_line(I, ips.front(), ips.back(), color, thickness);
208 }
209 
258 void vpDisplay::displayEllipse(const vpImage<unsigned char> &I, const vpImagePoint &center, const double &coef1,
259  const double &coef2, const double &coef3, bool use_centered_moments,
260  const vpColor &color, unsigned int thickness)
261 {
262  vpDisplay::displayEllipse(I, center, coef1, coef2, coef3, 0., vpMath::rad(360), use_centered_moments, color,
263  thickness);
264 }
265 
318 void vpDisplay::displayEllipse(const vpImage<unsigned char> &I, const vpImagePoint &center, const double &coef1,
319  const double &coef2, const double &coef3, const double &theta1, const double &theta2,
320  bool use_centered_moments, const vpColor &color, unsigned int thickness)
321 {
322  vp_display_display_ellipse(I, center, coef1, coef2, coef3, theta1, theta2, use_centered_moments, color, thickness);
323 }
324 
341  const vpCameraParameters &cam, double size, const vpColor &color, unsigned int thickness,
342  const vpImagePoint &offset)
343 {
344  vp_display_display_frame(I, cMo, cam, size, color, thickness, offset);
345 }
346 
355  const vpColor &color, unsigned int thickness)
356 {
357  vp_display_display_line(I, ip1, ip2, color, thickness);
358 }
359 
368 void vpDisplay::displayLine(const vpImage<unsigned char> &I, int i1, int j1, int i2, int j2, const vpColor &color,
369  unsigned int thickness)
370 {
371  vp_display_display_line(I, i1, j1, i2, j2, color, thickness);
372 }
373 
381 void vpDisplay::displayLine(const vpImage<unsigned char> &I, const std::vector<vpImagePoint> &ips,
382  const bool closeTheShape, const vpColor &color, unsigned int thickness)
383 {
384  if (ips.size() <= 1)
385  return;
386 
387  for (size_t i = 0; i < ips.size() - 1; i++)
388  vp_display_display_line(I, ips[i], ips[i + 1], color, thickness);
389 
390  if (closeTheShape)
391  vp_display_display_line(I, ips.front(), ips.back(), color, thickness);
392 }
393 
402  unsigned int thickness)
403 {
404  vp_display_display_point(I, ip, color, thickness);
405 }
406 
414 void vpDisplay::displayPoint(const vpImage<unsigned char> &I, int i, int j, const vpColor &color,
415  unsigned int thickness)
416 {
417  vp_display_display_point(I, i, j, color, thickness);
418 }
419 
427 void vpDisplay::displayPolygon(const vpImage<unsigned char> &I, const std::vector<vpImagePoint> &vip,
428  const vpColor &color, unsigned int thickness)
429 {
430  vp_display_display_polygon(I, vip, color, thickness);
431 }
432 
447 void vpDisplay::displayRectangle(const vpImage<unsigned char> &I, const vpImagePoint &topLeft, unsigned int width,
448  unsigned int height, const vpColor &color, bool fill, unsigned int thickness)
449 {
450  vp_display_display_rectangle(I, topLeft, width, height, color, fill, thickness);
451 }
452 
467 void vpDisplay::displayRectangle(const vpImage<unsigned char> &I, int i, int j, unsigned int width, unsigned int height,
468  const vpColor &color, bool fill, unsigned int thickness)
469 {
470  vp_display_display_rectangle(I, i, j, width, height, color, fill, thickness);
471 }
472 
486 void vpDisplay::displayRectangle(const vpImage<unsigned char> &I, const vpRect &rectangle, const vpColor &color,
487  bool fill, unsigned int thickness)
488 {
489  vp_display_display_rectangle(I, rectangle, color, fill, thickness);
490 }
491 
505 void vpDisplay::displayRectangle(const vpImage<unsigned char> &I, const vpImagePoint &center, float angle,
506  unsigned int width, unsigned int height, const vpColor &color, unsigned int thickness)
507 {
508  vp_display_display_rectangle(I, center, angle, width, height, color, thickness);
509 }
510 
526  const vpImagePoint &bottomRight, const vpColor &color, bool fill,
527  unsigned int thickness)
528 {
529  vp_display_display_rectangle(I, topLeft, bottomRight, color, fill, thickness);
530 }
531 
545 void vpDisplay::displayRectangle(const vpImage<unsigned char> &I, unsigned int i, unsigned int j, float angle,
546  unsigned int width, unsigned int height, const vpColor &color, unsigned int thickness)
547 {
548  vp_display_display_rectangle(I, i, j, angle, width, height, color, thickness);
549 }
550 
563 void vpDisplay::displayText(const vpImage<unsigned char> &I, const vpImagePoint &ip, const std::string &s,
564  const vpColor &color)
565 {
566  vp_display_display_text(I, ip, s, color);
567 }
568 
581 void vpDisplay::displayText(const vpImage<unsigned char> &I, int i, int j, const std::string &s, const vpColor &color)
582 {
583  vp_display_display_text(I, i, j, s, color);
584 }
585 
615 void vpDisplay::flush(const vpImage<unsigned char> &I) { vp_display_flush(I); }
616 
626 void vpDisplay::flushROI(const vpImage<unsigned char> &I, const vpRect &roi) { vp_display_flush_roi(I, roi); }
627 
639 void vpDisplay::display(const vpImage<unsigned char> &I) { vp_display_display(I); }
640 
645 void vpDisplay::displayROI(const vpImage<unsigned char> &I, const vpRect &roi) { vp_display_display_roi(I, roi); }
646 
664 bool vpDisplay::getClick(const vpImage<unsigned char> &I, bool blocking) { return vp_display_get_click(I, blocking); }
665 
684 bool vpDisplay::getClick(const vpImage<unsigned char> &I, vpImagePoint &ip, bool blocking)
685 {
686  return vp_display_get_click(I, ip, blocking);
687 }
688 
710  bool blocking)
711 {
712  return vp_display_get_click(I, ip, button, blocking);
713 }
714 
732 {
733  vpImagePoint ip;
734  return vpDisplay::getClick(I, ip, button, blocking);
735 }
736 
758  bool blocking)
759 {
760  return vp_display_get_click_up(I, ip, button, blocking);
761 }
762 
780 {
781  vpImagePoint ip;
782  return vpDisplay::getClickUp(I, ip, button, blocking);
783 }
784 
869 {
870  return vp_display_get_keyboard_event(I, blocking);
871 }
872 
959 bool vpDisplay::getKeyboardEvent(const vpImage<unsigned char> &I, std::string &key, bool blocking)
960 {
961  return vp_display_get_keyboard_event(I, key, blocking);
962 }
963 
1050 bool vpDisplay::getKeyboardEvent(const vpImage<unsigned char> &I, char *key, bool blocking)
1051 {
1052  return vp_display_get_keyboard_event(I, key, blocking);
1053 }
1054 
1065 {
1066  return vp_display_get_pointer_motion_event(I, ip);
1067 }
1068 
1079 {
1080  return vp_display_get_pointer_position(I, ip);
1081 }
1082 
1093 {
1094  vp_display_set_background(I, color);
1095 }
1096 
1110 void vpDisplay::setFont(const vpImage<unsigned char> &I, const std::string &fontname)
1111 {
1112  vp_display_set_font(I, fontname);
1113 }
1114 
1122 void vpDisplay::setTitle(const vpImage<unsigned char> &I, const std::string &windowtitle)
1123 {
1124  vp_display_set_title(I, windowtitle);
1125 }
1126 
1137 void vpDisplay::setWindowPosition(const vpImage<unsigned char> &I, int winx, int winy)
1138 {
1139  vp_display_set_window_position(I, winx, winy);
1140 }
1141 
1152 {
1153  return vp_display_get_down_scaling_factor(I);
1154 }
static void displayCamera(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size, const vpColor &color, unsigned int thickness)
static void displayEllipse(const vpImage< unsigned char > &I, const vpImagePoint &center, const double &coef1, const double &coef2, const double &coef3, bool use_centered_moments, const vpColor &color, unsigned int thickness=1)
static bool getPointerPosition(const vpImage< unsigned char > &I, vpImagePoint &ip)
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void close(vpImage< unsigned char > &I)
static bool getPointerMotionEvent(const vpImage< unsigned char > &I, vpImagePoint &ip)
Implementation of an homogeneous matrix and operations on such kind of matrices.
static void displayPolygon(const vpImage< unsigned char > &I, const std::vector< vpImagePoint > &vip, const vpColor &color, unsigned int thickness=1)
Class to define colors available for display functionnalities.
Definition: vpColor.h:120
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
static bool getClickUp(const vpImage< unsigned char > &I, vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking=true)
static void displayPoint(const vpImage< unsigned char > &I, const vpImagePoint &ip, const vpColor &color, unsigned int thickness=1)
static void flush(const vpImage< unsigned char > &I)
static void setFont(const vpImage< unsigned char > &I, const std::string &font)
static void displayArrow(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color=vpColor::white, unsigned int w=4, unsigned int h=2, unsigned int thickness=1)
static void display(const vpImage< unsigned char > &I)
Generic class defining intrinsic camera parameters.
static void displayRectangle(const vpImage< unsigned char > &I, const vpImagePoint &topLeft, unsigned int width, unsigned int height, const vpColor &color, bool fill=false, unsigned int thickness=1)
static double rad(double deg)
Definition: vpMath.h:102
static void displayCircle(const vpImage< unsigned char > &I, const vpImagePoint &center, unsigned int radius, const vpColor &color, bool fill=false, unsigned int thickness=1)
static void displayCross(const vpImage< unsigned char > &I, const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
static void setWindowPosition(const vpImage< unsigned char > &I, int winx, int winy)
static void displayFrame(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size, const vpColor &color=vpColor::none, unsigned int thickness=1, const vpImagePoint &offset=vpImagePoint(0, 0))
unsigned int getDownScalingFactor()
Definition: vpDisplay.h:229
static void setBackground(const vpImage< unsigned char > &I, const vpColor &color)
Defines a rectangle in the plane.
Definition: vpRect.h:78
static void flushROI(const vpImage< unsigned char > &I, const vpRect &roi)
static void displayROI(const vpImage< unsigned char > &I, const vpRect &roi)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:88
static void displayLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)
static bool getKeyboardEvent(const vpImage< unsigned char > &I, bool blocking=true)
static void displayCharString(const vpImage< unsigned char > &I, const vpImagePoint &ip, const char *string, const vpColor &color)
static void setTitle(const vpImage< unsigned char > &I, const std::string &windowtitle)
static void displayDotLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)