ViSP  2.8.0
vpDisplay.h
1 /****************************************************************************
2  *
3  * $Id: vpDisplay.h 4323 2013-07-18 09:24:01Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Image display.
36  *
37  * Authors:
38  * Eric Marchand
39  * Fabien Spindler
40  *
41  *****************************************************************************/
42 
43 
44 #ifndef vpDisplay_h
45 #define vpDisplay_h
46 
47 // image
48 #include <visp/vpImage.h>
49 
50 //color
51 #include <visp/vpColor.h>
52 #include <visp/vpMouseButton.h>
53 #include <visp/vpRGBa.h>
54 #include <visp/vpHomogeneousMatrix.h>
55 #include <visp/vpCameraParameters.h>
56 #include <visp/vpRect.h>
57 #include <visp/vpImagePoint.h>
58 
175 class VISP_EXPORT vpDisplay
176 {
177  protected :
185  char *title ;
186  char *font;
187  unsigned int width ;
188  unsigned int height ;
189 
190  vpDisplay() ;
191 
199  virtual void displayArrow(const vpImagePoint &ip1, const vpImagePoint &ip2,
200  const vpColor &color=vpColor::white,
201  unsigned int w=4, unsigned int h=2,
202  unsigned int thickness=1) =0;
214  virtual void displayCharString(const vpImagePoint &ip, const char *text,
215  const vpColor &color=vpColor::green) =0;
225  virtual void displayCircle(const vpImagePoint &center, unsigned int radius,
226  const vpColor &color,
227  bool fill = false,
228  unsigned int thickness=1) =0;
236  virtual void displayCross(const vpImagePoint &ip, unsigned int size,
237  const vpColor &color,
238  unsigned int thickness=1) =0;
245  virtual void displayDotLine(const vpImagePoint &ip1,
246  const vpImagePoint &ip2,
247  const vpColor &color,
248  unsigned int thickness=1) =0;
255  virtual void displayLine(const vpImagePoint &ip1,
256  const vpImagePoint &ip2,
257  const vpColor &color,
258  unsigned int thickness=1) =0;
259 
265  virtual void displayPoint(const vpImagePoint &ip, const vpColor &color) =0;
266 
280  virtual void displayRectangle(const vpImagePoint &topLeft,
281  unsigned int width, unsigned int height,
282  const vpColor &color, bool fill = false,
283  unsigned int thickness=1)=0 ;
297  virtual void displayRectangle(const vpImagePoint &topLeft,
298  const vpImagePoint &bottomRight,
299  const vpColor &color, bool fill = false,
300  unsigned int thickness=1 )=0;
314  virtual void displayRectangle(const vpRect &rectangle,
315  const vpColor &color, bool fill = false,
316  unsigned int thickness=1)=0 ;
317 
318  public:
319  virtual ~vpDisplay();
320 
325  virtual void clearDisplay(const vpColor &color=vpColor::white) =0 ;
329  virtual void closeDisplay() =0;
330 
342  virtual void displayImage(const vpImage<unsigned char> &I) =0 ;
354  virtual void displayImage(const vpImage<vpRGBa> &I) =0 ;
355 
356  virtual void displayImageROI(const vpImage<unsigned char> &I,const vpImagePoint &iP, const unsigned int width, const unsigned int height) =0 ;
357  virtual void displayImageROI(const vpImage<vpRGBa> &I,const vpImagePoint &iP, const unsigned int width, const unsigned int height) =0 ;
358 
359 
364  virtual void flushDisplay() =0;
365 
370  virtual void flushDisplayROI(const vpImagePoint &iP, const unsigned int width, const unsigned int height) =0;
371 
372 
373  /* Simple interface with the mouse event */
374 
390  virtual bool getClick(bool blocking=true) =0;
391 
407  virtual bool getClick(vpImagePoint &ip,
408  bool blocking=true) =0;
427  virtual bool getClick(vpImagePoint &ip,
429  bool blocking=true) =0 ;
452  virtual bool getClickUp(vpImagePoint &ip,
454  bool blocking=true) =0;
455 
471  virtual bool getKeyboardEvent(bool blocking=true) =0;
491  virtual bool getKeyboardEvent(char *string, bool blocking=true) =0;
502  virtual bool getPointerMotionEvent (vpImagePoint &ip) =0;
503 
514  virtual bool getPointerPosition (vpImagePoint &ip) =0;
515 
520  inline unsigned int getHeight() const { return height ; }
525  inline unsigned int getWidth() const { return width ; }
526 
534  virtual void init(vpImage<unsigned char> &I,
535  int x=-1, int y=-1,
536  const char *title=NULL) =0 ;
545  virtual void init(vpImage<vpRGBa> &I,
546  int x=-1, int y=-1,
547  const char *title=NULL) =0 ;
548 
556  virtual void init(unsigned int width, unsigned int height,
557  int x=-1, int y=-1 ,
558  const char *title=NULL) =0;
559 
565  inline bool isInitialised() { return displayHasBeenInitialized; }
566 
580  virtual void setFont(const char *font) =0;
585  virtual void setTitle(const char *title) =0;
593  virtual void setWindowPosition(int winx, int winy) = 0 ;
594 
598  static void close(vpImage<unsigned char> &I) ;
599  static void display(const vpImage<unsigned char> &I) ;
600  static void displayArrow(const vpImage<unsigned char> &I,
601  const vpImagePoint &ip1, const vpImagePoint &ip2,
602  const vpColor &color=vpColor::white,
603  unsigned int w=4, unsigned int h=2,
604  unsigned int thickness=1) ;
605  static void displayArrow(const vpImage<unsigned char> &I,
606  int i1, int j1, int i2, int j2,
607  const vpColor &color=vpColor::white,
608  unsigned int w=4, unsigned int h=2,
609  unsigned int thickness=1) ;
610  static void displayCamera(const vpImage<unsigned char> &I,
611  const vpHomogeneousMatrix &cMo,
612  const vpCameraParameters &cam,
613  double size, const vpColor &color,
614  unsigned int thickness) ;
615  static void displayCharString(const vpImage<unsigned char> &I,
616  const vpImagePoint &ip, const char *string,
617  const vpColor &color) ;
618  static void displayCharString(const vpImage<unsigned char> &I,
619  int i, int j, const char *string,
620  const vpColor &color) ;
621  static void displayCircle(const vpImage<unsigned char> &I,
622  const vpImagePoint &center, unsigned int radius,
623  const vpColor &color,
624  bool fill = false,
625  unsigned int thickness=1);
626  static void displayCircle(const vpImage<unsigned char> &I,
627  int i, int j, unsigned int radius,
628  const vpColor &color,
629  bool fill = false,
630  unsigned int thickness=1);
631  static void displayCross(const vpImage<unsigned char> &I,
632  const vpImagePoint &ip, unsigned int size,
633  const vpColor &color,
634  unsigned int thickness=1) ;
635  static void displayCross(const vpImage<unsigned char> &I,
636  int i, int j, unsigned int size,
637  const vpColor &color,
638  unsigned int thickness=1) ;
639  static void displayDotLine(const vpImage<unsigned char> &I,
640  const vpImagePoint &ip1,
641  const vpImagePoint &ip2,
642  const vpColor &color,
643  unsigned int thickness=1) ;
644  static void displayDotLine(const vpImage<unsigned char> &I,
645  int i1, int j1, int i2, int j2,
646  const vpColor &color,
647  unsigned int thickness=1) ;
648  static void displayFrame(const vpImage<unsigned char> &I,
649  const vpHomogeneousMatrix &cMo,
650  const vpCameraParameters &cam,
651  double size, const vpColor &color,
652  unsigned int thickness=1) ;
653  static void displayLine(const vpImage<unsigned char> &I,
654  const vpImagePoint &ip1,
655  const vpImagePoint &ip2,
656  const vpColor &color,
657  unsigned int thickness=1) ;
658  static void displayLine(const vpImage<unsigned char> &I,
659  int i1, int j1, int i2, int j2,
660  const vpColor &color,
661  unsigned int thickness=1) ;
662  static void displayPoint(const vpImage<unsigned char> &I,
663  const vpImagePoint &ip,
664  const vpColor &color) ;
665  static void displayPoint(const vpImage<unsigned char> &I,
666  int i, int j,
667  const vpColor &color) ;
668  static void displayRectangle(const vpImage<unsigned char> &I,
669  const vpImagePoint &topLeft,
670  unsigned int width, unsigned int height,
671  const vpColor &color, bool fill = false,
672  unsigned int thickness=1);
673  static void displayRectangle(const vpImage<unsigned char> &I,
674  const vpImagePoint &topLeft,
675  const vpImagePoint &bottomRight,
676  const vpColor &color, bool fill = false,
677  unsigned int thickness=1);
678  static void displayRectangle(const vpImage<unsigned char> &I,
679  const vpRect &rectangle,
680  const vpColor &color, bool fill = false,
681  unsigned int thickness=1);
682  static void displayRectangle(const vpImage<unsigned char> &I,
683  const vpImagePoint &center,
684  float angle,
685  unsigned int width, unsigned int height,
686  const vpColor &color,
687  unsigned int thickness=1);
688  static void displayRectangle(const vpImage<unsigned char> &I,
689  int i, int j,
690  unsigned int width, unsigned int height,
691  const vpColor &color, bool fill = false,
692  unsigned int thickness=1);
693  static void displayRectangle(const vpImage<unsigned char> &I,
694  unsigned int i, unsigned int j, float angle,
695  unsigned int width, unsigned int height,
696  const vpColor &color,
697  unsigned int thickness=1);
698  static void displayROI(const vpImage<unsigned char> &I,const vpRect &roi) ;
699 
700  static void flush(const vpImage<unsigned char> &I) ;
701  static void flushROI(const vpImage<unsigned char> &I,const vpRect &roi) ;
702 
703  static bool getClick(const vpImage<unsigned char> &I, bool blocking=true) ;
704  static bool getClick(const vpImage<unsigned char> &I,
705  vpImagePoint &ip, bool blocking=true) ;
706  static bool getClick(const vpImage<unsigned char> &I,
707  vpImagePoint &ip,
709  bool blocking=true) ;
710  static bool getClickUp(const vpImage<unsigned char> &I,
711  vpImagePoint &ip,
713  bool blocking=true) ;
714  static void getImage(const vpImage<unsigned char> &Is, vpImage<vpRGBa> &Id) ;
715 
716  static bool getKeyboardEvent(const vpImage<unsigned char> &I,
717  bool blocking=true);
718  static bool getKeyboardEvent(const vpImage<unsigned char> &I,
719  char *string, bool blocking=true);
720  static bool getPointerMotionEvent (const vpImage<unsigned char> &I,
721  vpImagePoint &ip);
722  static bool getPointerPosition (const vpImage<unsigned char> &I,
723  vpImagePoint &ip);
724  static void setBackground(const vpImage<unsigned char> &I, const vpColor &color);
725  static void setFont(const vpImage<unsigned char> &I, const char *font);
726  static void setTitle(const vpImage<unsigned char> &I,
727  const char *windowtitle);
728  static void setWindowPosition(const vpImage<unsigned char> &I,
729  int winx, int winy);
730 
734  static void close(vpImage<vpRGBa> &I) ;
735 
736  static void display(const vpImage<vpRGBa> &I) ;
737  static void displayArrow(const vpImage<vpRGBa> &I,
738  const vpImagePoint &ip1, const vpImagePoint &ip2,
739  const vpColor &color=vpColor::white,
740  unsigned int w=4, unsigned int h=2,
741  unsigned int thickness=1) ;
742  static void displayArrow(const vpImage<vpRGBa> &I,
743  int i1, int j1, int i2, int j2,
744  const vpColor &color=vpColor::white,
745  unsigned int w=4, unsigned int h=2,
746  unsigned int thickness=1) ;
747  static void displayCamera(const vpImage<vpRGBa> &I,
748  const vpHomogeneousMatrix &cMo,
749  const vpCameraParameters &cam,
750  double size, const vpColor &color,
751  unsigned int thickness) ;
752  static void displayCharString(const vpImage<vpRGBa> &I,
753  const vpImagePoint &ip, const char *string,
754  const vpColor &color) ;
755  static void displayCharString(const vpImage<vpRGBa> &I,
756  int i, int j, const char *string,
757  const vpColor &color) ;
758  static void displayCircle(const vpImage<vpRGBa> &I,
759  const vpImagePoint &center, unsigned int radius,
760  const vpColor &color,
761  bool fill = false,
762  unsigned int thickness=1);
763  static void displayCircle(const vpImage<vpRGBa> &I,
764  int i, int j, unsigned int radius,
765  const vpColor &color,
766  bool fill = false,
767  unsigned int thickness=1);
768  static void displayCross(const vpImage<vpRGBa> &I,
769  const vpImagePoint &ip, unsigned int size,
770  const vpColor &color,
771  unsigned int thickness=1) ;
772  static void displayCross(const vpImage<vpRGBa> &I,
773  int i, int j, unsigned int size,
774  const vpColor &color,
775  unsigned int thickness=1) ;
776  static void displayDotLine(const vpImage<vpRGBa> &I,
777  const vpImagePoint &ip1,
778  const vpImagePoint &ip2,
779  const vpColor &color,
780  unsigned int thickness=1) ;
781  static void displayDotLine(const vpImage<vpRGBa> &I,
782  int i1, int j1, int i2, int j2,
783  const vpColor &color,
784  unsigned int thickness=1) ;
785  static void displayFrame(const vpImage<vpRGBa> &I,
786  const vpHomogeneousMatrix &cMo,
787  const vpCameraParameters &cam,
788  double size, const vpColor &color,
789  unsigned int thickness=1) ;
790  static void displayLine(const vpImage<vpRGBa> &I,
791  const vpImagePoint &ip1,
792  const vpImagePoint &ip2,
793  const vpColor &color,
794  unsigned int thickness=1) ;
795  static void displayLine(const vpImage<vpRGBa> &I,
796  int i1, int j1, int i2, int j2,
797  const vpColor &color,
798  unsigned int thickness=1) ;
799  static void displayPoint(const vpImage<vpRGBa> &I,
800  const vpImagePoint &ip,
801  const vpColor &color) ;
802  static void displayPoint(const vpImage<vpRGBa> &I,
803  int i, int j,
804  const vpColor &color) ;
805  static void displayRectangle(const vpImage<vpRGBa> &I,
806  const vpImagePoint &topLeft,
807  unsigned int width, unsigned int height,
808  const vpColor &color, bool fill = false,
809  unsigned int thickness=1);
810  static void displayRectangle(const vpImage<vpRGBa> &I,
811  const vpImagePoint &topLeft,
812  const vpImagePoint &bottomRight,
813  const vpColor &color, bool fill = false,
814  unsigned int thickness=1);
815  static void displayRectangle(const vpImage<vpRGBa> &I,
816  const vpRect &rectangle,
817  const vpColor &color, bool fill = false,
818  unsigned int thickness=1);
819  static void displayRectangle(const vpImage<vpRGBa> &I,
820  const vpImagePoint &center,
821  float angle,
822  unsigned int width, unsigned int height,
823  const vpColor &color,
824  unsigned int thickness=1);
825  static void displayRectangle(const vpImage<vpRGBa> &I,
826  int i, int j,
827  unsigned int width, unsigned int height,
828  const vpColor &color, bool fill = false,
829  unsigned int thickness=1);
830  static void displayRectangle(const vpImage<vpRGBa> &I,
831  unsigned int i, unsigned int j,
832  float angle,
833  unsigned int width, unsigned int height,
834  const vpColor &color,
835  unsigned int thickness=1);
836  static void displayROI(const vpImage<vpRGBa> &I, const vpRect &roi) ;
837 
838  static void flush(const vpImage<vpRGBa> &I) ;
839  static void flushROI(const vpImage<vpRGBa> &I, const vpRect &roi) ;
840  static bool getClick(const vpImage<vpRGBa> &I, bool blocking=true) ;
841  static bool getClick(const vpImage<vpRGBa> &I,
842  vpImagePoint &ip, bool blocking=true) ;
843  static bool getClick(const vpImage<vpRGBa> &I,
844  vpImagePoint &ip,
846  bool blocking=true) ;
847  static bool getClickUp(const vpImage<vpRGBa> &I,
848  vpImagePoint &ip,
850  bool blocking=true) ;
851  static void getImage(const vpImage<vpRGBa> &Is, vpImage<vpRGBa> &Id) ;
852 
853  static bool getKeyboardEvent(const vpImage<vpRGBa> &I,
854  bool blocking=true);
855  static bool getKeyboardEvent(const vpImage<vpRGBa> &I,
856  char *string, bool blocking=true);
857  static bool getPointerMotionEvent (const vpImage<vpRGBa> &I, vpImagePoint &ip);
858  static bool getPointerPosition (const vpImage<vpRGBa> &I, vpImagePoint &ip);
859 
860  static void setBackground(const vpImage<vpRGBa> &I, const vpColor &color);
861  static void setFont(const vpImage<vpRGBa> &I, const char *font);
862  static void setTitle(const vpImage<vpRGBa> &I, const char *windowtitle);
863  static void setWindowPosition(const vpImage<vpRGBa> &I, int winx, int winy);
864 
865  private:
867  virtual void getImage(vpImage<vpRGBa> &I) = 0;
868 
869 } ;
870 
871 #endif
bool isInitialised()
Definition: vpDisplay.h:565
Class that defines generic functionnalities for display.
Definition: vpDisplay.h:175
unsigned int width
Definition: vpDisplay.h:187
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
unsigned int getWidth() const
Definition: vpDisplay.h:525
Class to define colors available for display functionnalities.
Definition: vpColor.h:125
char * title
display title
Definition: vpDisplay.h:185
bool displayHasBeenInitialized
display has been initialized
Definition: vpDisplay.h:179
static const vpColor green
Definition: vpColor.h:170
unsigned int height
Definition: vpDisplay.h:188
Generic class defining intrinsic camera parameters.
int windowXPosition
display position
Definition: vpDisplay.h:181
Defines a rectangle in the plane.
Definition: vpRect.h:82
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:92
int windowYPosition
display position
Definition: vpDisplay.h:183
static const vpColor white
Definition: vpColor.h:162
unsigned int getHeight() const
Definition: vpDisplay.h:520
char * font
Definition: vpDisplay.h:186