43 #include <visp/vpDisplay.h>
44 #include <visp/vpDisplayException.h>
45 #include <visp/vpImageConvert.h>
47 #include <visp/vpPoint.h>
48 #include <visp/vpMeterPixelConversion.h>
49 #include <visp/vpMath.h>
61 : displayHasBeenInitialized(false), windowXPosition(0), windowYPosition(0), width(0), height(0), title_() {}
67 : displayHasBeenInitialized(false), windowXPosition(0), windowYPosition(0), width(0), height(0), title_()
100 const char *fontname )
123 const char *windowtitle )
228 double top = floor(roi.
getTop());
229 double left = floor(roi.
getLeft());
230 double roiheight = floor(roi.
getHeight());
231 double roiwidth = floor(roi.
getWidth());
232 double iheight = (double)(I.
getHeight());
233 double iwidth = (double)(I.
getWidth());
235 if (top < 0 || top > iheight || left < 0 || left > iwidth || top+roiheight > iheight || left+roiwidth > iwidth)
237 vpERROR_TRACE (
"Region of interest outside of the image" ) ;
375 const vpColor &color,
unsigned int thickness)
444 double size,
const vpColor &color,
445 unsigned int thickness )
512 double size,
const vpColor &color,
513 unsigned int thickness)
516 double halfSize = size/2.0;
524 for (
int i = 0; i < 5; i++)
525 pt[i].track ( cMo ) ;
530 for (
int i = 0; i < 4; i++)
564 double size,
const vpColor &color,
565 unsigned int thickness)
568 double halfSize = size/2.0;
576 for (
int i = 0; i < 5; i++)
577 pt[i].track ( cMo ) ;
582 for (
int i = 0; i < 4; i++)
603 unsigned int w,
unsigned int h,
604 unsigned int thickness )
633 unsigned int w,
unsigned int h,
634 unsigned int thickness )
662 int i1,
int j1,
int i2,
int j2,
664 unsigned int w,
unsigned int h,
665 unsigned int thickness)
700 int i1,
int j1,
int i2,
int j2,
702 unsigned int w,
unsigned int h,
703 unsigned int thickness)
807 int i,
int j,
const char *
string,
844 int i,
int j,
const char *
string,
879 unsigned int thickness)
909 unsigned int thickness )
938 int i,
int j,
unsigned int radius,
941 unsigned int thickness)
976 int i,
int j,
unsigned int radius,
979 unsigned int thickness)
1009 unsigned int thickness )
1036 unsigned int thickness )
1061 unsigned int size,
const vpColor &color,
1062 unsigned int thickness )
1092 unsigned int size,
const vpColor &color,
1093 unsigned int thickness )
1123 unsigned int thickness )
1150 unsigned int thickness )
1175 int i1,
int j1,
int i2,
int j2,
1177 unsigned int thickness )
1210 unsigned int thickness )
1242 unsigned int thickness )
1269 int i1,
int j1,
int i2,
int j2,
1271 unsigned int thickness )
1307 unsigned int thickness )
1340 unsigned int thickness )
1476 unsigned int width,
unsigned int height,
1477 const vpColor &color,
bool fill,
1478 unsigned int thickness)
1514 const vpColor &color,
bool fill,
1515 unsigned int thickness)
1548 const vpColor &color,
bool fill,
1549 unsigned int thickness )
1585 unsigned int width,
unsigned int height,
1587 unsigned int thickness)
1593 double i = center.
get_i();
1594 double j = center.
get_j();
1598 double cosinus = cos(angle);
1599 double sinus = sin(angle);
1600 ipa.
set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1601 ipa.
set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1602 ipb.
set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1603 ipb.
set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1604 ipc.
set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1605 ipc.
set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1606 ipd.
set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1607 ipd.
set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1639 unsigned int width,
unsigned int height,
1640 const vpColor &color,
bool fill,
1641 unsigned int thickness)
1675 const vpColor &color,
bool fill,
1676 unsigned int thickness)
1709 const vpColor &color,
bool fill,
1710 unsigned int thickness )
1746 unsigned int width,
unsigned int height,
1748 unsigned int thickness)
1754 double i = center.
get_i();
1755 double j = center.
get_j();
1759 double cosinus = cos(angle);
1760 double sinus = sin(angle);
1761 ipa.
set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1762 ipa.
set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1763 ipb.
set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1764 ipb.
set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1765 ipc.
set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1766 ipc.
set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1767 ipd.
set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1768 ipd.
set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1802 unsigned int width,
unsigned int height,
1803 const vpColor &color,
bool fill,
1804 unsigned int thickness)
1815 color, fill, thickness ) ;
1841 unsigned int i,
unsigned int j,
float angle,
1842 unsigned int width,
unsigned int height,
1843 const vpColor &color,
unsigned int thickness)
1851 float cosinus = cos(angle);
1852 float sinus = sin(angle);
1853 ipa.
set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1854 ipa.
set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1855 ipb.
set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1856 ipb.
set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1857 ipc.
set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1858 ipc.
set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1859 ipd.
set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1860 ipd.
set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1894 unsigned int width,
unsigned int height,
1895 const vpColor &color,
bool fill,
1896 unsigned int thickness)
1907 color, fill, thickness ) ;
1932 unsigned int i,
unsigned int j,
float angle,
1933 unsigned int width,
unsigned int height,
1934 const vpColor &color,
unsigned int thickness)
1942 float cosinus = cos(angle);
1943 float sinus = sin(angle);
1944 ipa.
set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1945 ipa.
set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1946 ipb.
set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1947 ipb.
set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1948 ipc.
set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1949 ipc.
set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1950 ipd.
set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1951 ipd.
set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
2190 double top = floor(roi.
getTop());
2191 double left = floor(roi.
getLeft());
2192 double roiheight = floor(roi.
getHeight());
2193 double roiwidth = floor(roi.
getWidth());
2194 double iheight = (double)(I.
getHeight());
2195 double iwidth = (double)(I.
getWidth());
2197 if (top < 0 || top >= iheight || left < 0 || left >= iwidth || top+roiheight >= iheight || left+roiwidth >= iwidth)
2199 vpERROR_TRACE (
"Region of interest outside of the image" ) ;
2201 "Region of interest outside of the image" ) ) ;
2413 return ( I.
display )->getClick(blocking) ;
2451 return ( I.
display )->getClick ( ip, blocking ) ;
2492 return ( I.
display )->getClick ( ip, button, blocking ) ;
2534 return ( I.
display )->getClickUp ( ip, button, blocking ) ;
2636 return ( I.
display )->getKeyboardEvent ( blocking ) ;
2738 char *
string,
bool blocking)
2744 return ( I.
display )->getKeyboardEvent (
string, blocking ) ;
2772 return ( I.
display )->getPointerMotionEvent ( ip ) ;
2801 return ( I.
display )->getPointerPosition ( ip ) ;
2831 return ( I.
display )->getClick(blocking) ;
2868 return ( I.
display )->getClick ( ip, blocking ) ;
2908 return ( I.
display )->getClick ( ip, button, blocking ) ;
2949 return ( I.
display )->getClickUp ( ip, button, blocking ) ;
3051 return ( I.
display )->getKeyboardEvent ( blocking ) ;
3151 char *
string,
bool blocking)
3157 return ( I.
display )->getKeyboardEvent (
string, blocking ) ;
3184 return ( I.
display )->getPointerMotionEvent ( ip ) ;
3211 return ( I.
display )->getPointerPosition ( ip ) ;
static void displayCamera(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size, const vpColor &color, unsigned int thickness)
virtual void displayCircle(const vpImagePoint ¢er, unsigned int radius, const vpColor &color, bool fill=false, unsigned int thickness=1)=0
virtual void displayImage(const vpImage< unsigned char > &I)=0
Class that defines generic functionnalities for display.
virtual void displayArrow(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color=vpColor::white, unsigned int w=4, unsigned int h=2, unsigned int thickness=1)=0
static void close(vpImage< unsigned char > &I)
unsigned int getWidth() const
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
Point coordinates conversion from normalized coordinates in meter to pixel coordinates ...
Class to define colors available for display functionnalities.
virtual void clearDisplay(const vpColor &color=vpColor::white)=0
static const vpColor none
virtual bool getClickUp(vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking=true)=0
error that can be emited by ViSP classes.
void track(const vpHomogeneousMatrix &cMo)
virtual bool getPointerMotionEvent(vpImagePoint &ip)=0
bool displayHasBeenInitialized
display has been initialized
static const vpColor green
static void flush(const vpImage< unsigned char > &I)
vpImagePoint getTopLeft() const
Class that defines what is a point.
virtual void flushDisplay()=0
void set_i(const double ii)
virtual bool getPointerPosition(vpImagePoint &ip)=0
virtual bool getKeyboardEvent(bool blocking=true)=0
void set_u(const double u)
virtual void setWindowPosition(int winx, int winy)=0
static void display(const vpImage< unsigned char > &I)
virtual void displayCross(const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)=0
void set_v(const double v)
Generic class defining intrinsic camera parameters.
virtual void displayImageROI(const vpImage< unsigned char > &I, const vpImagePoint &iP, const unsigned int width, const unsigned int height)=0
virtual void setTitle(const char *title)=0
virtual void setFont(const char *font)=0
virtual void displayRectangle(const vpImagePoint &topLeft, unsigned int width, unsigned int height, const vpColor &color, bool fill=false, unsigned int thickness=1)=0
static void displayFrame(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size, const vpColor &color, unsigned int thickness=1)
static void getImage(const vpImage< unsigned char > &Is, vpImage< vpRGBa > &Id)
virtual void displayDotLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)=0
void set_j(const double jj)
virtual void closeDisplay()=0
virtual void displayCharString(const vpImagePoint &ip, const char *text, const vpColor &color=vpColor::green)=0
int windowXPosition
display position
static void setBackground(const vpImage< unsigned char > &I, const vpColor &color)
unsigned int getHeight() const
Defines a rectangle in the plane.
static void flushROI(const vpImage< unsigned char > &I, const vpRect &roi)
static void displayROI(const vpImage< unsigned char > &I, const vpRect &roi)
virtual bool getClick(bool blocking=true)=0
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
virtual void displayLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)=0
virtual void flushDisplayROI(const vpImagePoint &iP, const unsigned int width, const unsigned int height)=0
int windowYPosition
display position
virtual void displayPoint(const vpImagePoint &ip, const vpColor &color)=0
static const vpColor blue
void setWorldCoordinates(const double ox, const double oy, const double oz)
Set the point world coordinates. We mean here the coordinates of the point in the object frame...