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>
66 title =
new char[1024];
97 const char *fontname )
120 const char *windowtitle )
225 double top = floor(roi.
getTop());
226 double left = floor(roi.
getLeft());
227 double roiheight = floor(roi.
getHeight());
228 double roiwidth = floor(roi.
getWidth());
229 double iheight = (double)(I.
getHeight());
230 double iwidth = (double)(I.
getWidth());
232 if (top < 0 || top > iheight || left < 0 || left > iwidth || top+roiheight > iheight || left+roiwidth > iwidth)
234 vpERROR_TRACE (
"Region of interest outside of the image" ) ;
372 const vpColor &color,
unsigned int thickness)
441 double size,
const vpColor &color,
442 unsigned int thickness )
509 double size,
const vpColor &color,
510 unsigned int thickness)
513 double halfSize = size/2.0;
521 for (
int i = 0; i < 5; i++)
522 pt[i].track ( cMo ) ;
527 for (
int i = 0; i < 4; i++)
561 double size,
const vpColor &color,
562 unsigned int thickness)
565 double halfSize = size/2.0;
573 for (
int i = 0; i < 5; i++)
574 pt[i].track ( cMo ) ;
579 for (
int i = 0; i < 4; i++)
600 unsigned int w,
unsigned int h,
601 unsigned int thickness )
630 unsigned int w,
unsigned int h,
631 unsigned int thickness )
659 int i1,
int j1,
int i2,
int j2,
661 unsigned int w,
unsigned int h,
662 unsigned int thickness)
697 int i1,
int j1,
int i2,
int j2,
699 unsigned int w,
unsigned int h,
700 unsigned int thickness)
804 int i,
int j,
const char *
string,
841 int i,
int j,
const char *
string,
876 unsigned int thickness)
906 unsigned int thickness )
935 int i,
int j,
unsigned int radius,
938 unsigned int thickness)
973 int i,
int j,
unsigned int radius,
976 unsigned int thickness)
1006 unsigned int thickness )
1033 unsigned int thickness )
1058 unsigned int size,
const vpColor &color,
1059 unsigned int thickness )
1089 unsigned int size,
const vpColor &color,
1090 unsigned int thickness )
1120 unsigned int thickness )
1147 unsigned int thickness )
1172 int i1,
int j1,
int i2,
int j2,
1174 unsigned int thickness )
1207 unsigned int thickness )
1239 unsigned int thickness )
1266 int i1,
int j1,
int i2,
int j2,
1268 unsigned int thickness )
1304 unsigned int thickness )
1337 unsigned int thickness )
1473 unsigned int width,
unsigned int height,
1474 const vpColor &color,
bool fill,
1475 unsigned int thickness)
1511 const vpColor &color,
bool fill,
1512 unsigned int thickness)
1545 const vpColor &color,
bool fill,
1546 unsigned int thickness )
1582 unsigned int width,
unsigned int height,
1584 unsigned int thickness)
1590 double i = center.
get_i();
1591 double j = center.
get_j();
1595 double cosinus = cos(angle);
1596 double sinus = sin(angle);
1597 ipa.
set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1598 ipa.
set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1599 ipb.
set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1600 ipb.
set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1601 ipc.
set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1602 ipc.
set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1603 ipd.
set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1604 ipd.
set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1636 unsigned int width,
unsigned int height,
1637 const vpColor &color,
bool fill,
1638 unsigned int thickness)
1672 const vpColor &color,
bool fill,
1673 unsigned int thickness)
1706 const vpColor &color,
bool fill,
1707 unsigned int thickness )
1743 unsigned int width,
unsigned int height,
1745 unsigned int thickness)
1751 double i = center.
get_i();
1752 double j = center.
get_j();
1756 double cosinus = cos(angle);
1757 double sinus = sin(angle);
1758 ipa.
set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1759 ipa.
set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1760 ipb.
set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1761 ipb.
set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1762 ipc.
set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1763 ipc.
set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1764 ipd.
set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1765 ipd.
set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1799 unsigned int width,
unsigned int height,
1800 const vpColor &color,
bool fill,
1801 unsigned int thickness)
1812 color, fill, thickness ) ;
1838 unsigned int i,
unsigned int j,
float angle,
1839 unsigned int width,
unsigned int height,
1840 const vpColor &color,
unsigned int thickness)
1848 float cosinus = cos(angle);
1849 float sinus = sin(angle);
1850 ipa.
set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1851 ipa.
set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1852 ipb.
set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1853 ipb.
set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1854 ipc.
set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1855 ipc.
set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1856 ipd.
set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1857 ipd.
set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1891 unsigned int width,
unsigned int height,
1892 const vpColor &color,
bool fill,
1893 unsigned int thickness)
1904 color, fill, thickness ) ;
1929 unsigned int i,
unsigned int j,
float angle,
1930 unsigned int width,
unsigned int height,
1931 const vpColor &color,
unsigned int thickness)
1939 float cosinus = cos(angle);
1940 float sinus = sin(angle);
1941 ipa.
set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1942 ipa.
set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1943 ipb.
set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1944 ipb.
set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1945 ipc.
set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1946 ipc.
set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1947 ipd.
set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1948 ipd.
set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
2187 double top = floor(roi.
getTop());
2188 double left = floor(roi.
getLeft());
2189 double roiheight = floor(roi.
getHeight());
2190 double roiwidth = floor(roi.
getWidth());
2191 double iheight = (double)(I.
getHeight());
2192 double iwidth = (double)(I.
getWidth());
2194 if (top < 0 || top >= iheight || left < 0 || left >= iwidth || top+roiheight >= iheight || left+roiwidth >= iwidth)
2196 vpERROR_TRACE (
"Region of interest outside of the image" ) ;
2198 "Region of interest outside of the image" ) ) ;
2410 return ( I.
display )->getClick(blocking) ;
2448 return ( I.
display )->getClick ( ip, blocking ) ;
2489 return ( I.
display )->getClick ( ip, button, blocking ) ;
2531 return ( I.
display )->getClickUp ( ip, button, blocking ) ;
2633 return ( I.
display )->getKeyboardEvent ( blocking ) ;
2735 char *
string,
bool blocking)
2741 return ( I.
display )->getKeyboardEvent (
string, blocking ) ;
2769 return ( I.
display )->getPointerMotionEvent ( ip ) ;
2798 return ( I.
display )->getPointerPosition ( ip ) ;
2828 return ( I.
display )->getClick(blocking) ;
2865 return ( I.
display )->getClick ( ip, blocking ) ;
2905 return ( I.
display )->getClick ( ip, button, blocking ) ;
2946 return ( I.
display )->getClickUp ( ip, button, blocking ) ;
3048 return ( I.
display )->getKeyboardEvent ( blocking ) ;
3148 char *
string,
bool blocking)
3154 return ( I.
display )->getKeyboardEvent (
string, blocking ) ;
3181 return ( I.
display )->getPointerMotionEvent ( ip ) ;
3208 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)
void set_j(const double j)
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
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
void set_i(const double i)
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
char * title
display title
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
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
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...