ViSP  2.6.2
vpDisplay.h
1 /****************************************************************************
2  *
3  * $Id: vpDisplay.h 3590 2012-03-05 09:48:31Z ayol $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2012 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 
167 class VISP_EXPORT vpDisplay
168 {
169  protected :
177  char *title ;
178  char *font;
179  unsigned int width ;
180  unsigned int height ;
181 
182  vpDisplay() ;
183 
191  virtual void displayArrow(const vpImagePoint &ip1, const vpImagePoint &ip2,
192  const vpColor &color=vpColor::white,
193  unsigned int w=4, unsigned int h=2,
194  unsigned int thickness=1) =0;
206  virtual void displayCharString(const vpImagePoint &ip, const char *text,
207  const vpColor &color=vpColor::green) =0;
217  virtual void displayCircle(const vpImagePoint &center, unsigned int radius,
218  const vpColor &color,
219  bool fill = false,
220  unsigned int thickness=1) =0;
228  virtual void displayCross(const vpImagePoint &ip, unsigned int size,
229  const vpColor &color,
230  unsigned int thickness=1) =0;
237  virtual void displayDotLine(const vpImagePoint &ip1,
238  const vpImagePoint &ip2,
239  const vpColor &color,
240  unsigned int thickness=1) =0;
247  virtual void displayLine(const vpImagePoint &ip1,
248  const vpImagePoint &ip2,
249  const vpColor &color,
250  unsigned int thickness=1) =0;
251 
257  virtual void displayPoint(const vpImagePoint &ip, const vpColor &color) =0;
258 
272  virtual void displayRectangle(const vpImagePoint &topLeft,
273  unsigned int width, unsigned int height,
274  const vpColor &color, bool fill = false,
275  unsigned int thickness=1)=0 ;
289  virtual void displayRectangle(const vpImagePoint &topLeft,
290  const vpImagePoint &bottomRight,
291  const vpColor &color, bool fill = false,
292  unsigned int thickness=1 )=0;
306  virtual void displayRectangle(const vpRect &rectangle,
307  const vpColor &color, bool fill = false,
308  unsigned int thickness=1)=0 ;
309 
310  public:
314  virtual ~vpDisplay() {;} ;
315 
329  virtual void setFont(const char *font) =0;
334  virtual void setTitle(const char *title) =0;
342  virtual void setWindowPosition(int winx, int winy) = 0 ;
343 
348  virtual void clearDisplay(const vpColor &color=vpColor::white) =0 ;
352  virtual void closeDisplay() =0;
353 
361  virtual void init(vpImage<unsigned char> &I,
362  int x=-1, int y=-1,
363  const char *title=NULL) =0 ;
372  virtual void init(vpImage<vpRGBa> &I,
373  int x=-1, int y=-1,
374  const char *title=NULL) =0 ;
375 
383  virtual void init(unsigned int width, unsigned int height,
384  int x=-1, int y=-1 ,
385  const char *title=NULL) =0;
386 
398  virtual void displayImage(const vpImage<unsigned char> &I) =0 ;
410  virtual void displayImage(const vpImage<vpRGBa> &I) =0 ;
411 
412  virtual void displayImageROI(const vpImage<unsigned char> &I,const vpImagePoint &iP, const unsigned int width, const unsigned int height) =0 ;
413  virtual void displayImageROI(const vpImage<vpRGBa> &I,const vpImagePoint &iP, const unsigned int width, const unsigned int height) =0 ;
414 
415 
420  virtual void flushDisplay() =0;
421 
426  virtual void flushDisplayROI(const vpImagePoint &iP, const unsigned int width, const unsigned int height) =0;
427 
434  inline bool isInitialised() { return displayHasBeenInitialized; }
435 
436  /* Simple interface with the mouse event */
437 
453  virtual bool getClick(bool blocking=true) =0;
454 
470  virtual bool getClick(vpImagePoint &ip,
471  bool blocking=true) =0;
490  virtual bool getClick(vpImagePoint &ip,
492  bool blocking=true) =0 ;
515  virtual bool getClickUp(vpImagePoint &ip,
517  bool blocking=true) =0;
518 
534  virtual bool getKeyboardEvent(bool blocking=true) =0;
554  virtual bool getKeyboardEvent(char *string, bool blocking=true) =0;
565  virtual bool getPointerMotionEvent (vpImagePoint &ip) =0;
566 
577  virtual bool getPointerPosition (vpImagePoint &ip) =0;
578 
583  inline unsigned int getWidth() const { return width ; }
588  inline unsigned int getHeight() const { return height ; }
589 
590 
594  static void setFont(const vpImage<unsigned char> &I, const char *font);
595  static void setTitle(const vpImage<unsigned char> &I,
596  const char *windowtitle);
597  static void setWindowPosition(const vpImage<unsigned char> &I,
598  int winx, int winy);
599  static void setBackground(const vpImage<unsigned char> &I, const vpColor &color);
600  static void close(const vpImage<unsigned char> &I) ;
601  static void display(const vpImage<unsigned char> &I) ;
602  static void displayROI(const vpImage<unsigned char> &I,const vpRect &roi) ;
603  static void displayArrow(const vpImage<unsigned char> &I,
604  const vpImagePoint &ip1, const vpImagePoint &ip2,
605  const vpColor &color=vpColor::white,
606  unsigned int w=4, unsigned int h=2,
607  unsigned int thickness=1) ;
608  static void displayArrow(const vpImage<unsigned char> &I,
609  int i1, int j1, int i2, int j2,
610  const vpColor &color=vpColor::white,
611  unsigned int w=4, unsigned int h=2,
612  unsigned int thickness=1) ;
613  static void displayCharString(const vpImage<unsigned char> &I,
614  const vpImagePoint &ip, const char *string,
615  const vpColor &color) ;
616  static void displayCharString(const vpImage<unsigned char> &I,
617  int i, int j, const char *string,
618  const vpColor &color) ;
619  static void displayCircle(const vpImage<unsigned char> &I,
620  const vpImagePoint &center, unsigned int radius,
621  const vpColor &color,
622  bool fill = false,
623  unsigned int thickness=1);
624  static void displayCircle(const vpImage<unsigned char> &I,
625  int i, int j, unsigned int radius,
626  const vpColor &color,
627  bool fill = false,
628  unsigned int thickness=1);
629  static void displayCross(const vpImage<unsigned char> &I,
630  const vpImagePoint &ip, unsigned int size,
631  const vpColor &color,
632  unsigned int thickness=1) ;
633  static void displayCross(const vpImage<unsigned char> &I,
634  int i, int j, unsigned int size,
635  const vpColor &color,
636  unsigned int thickness=1) ;
637  static void displayDotLine(const vpImage<unsigned char> &I,
638  const vpImagePoint &ip1,
639  const vpImagePoint &ip2,
640  const vpColor &color,
641  unsigned int thickness=1) ;
642  static void displayDotLine(const vpImage<unsigned char> &I,
643  int i1, int j1, int i2, int j2,
644  const vpColor &color,
645  unsigned int thickness=1) ;
646  static void displayFrame(const vpImage<unsigned char> &I,
647  const vpHomogeneousMatrix &cMo,
648  const vpCameraParameters &cam,
649  double size, const vpColor &color,
650  unsigned int thickness=1) ;
651  static void displayCamera(const vpImage<unsigned char> &I,
652  const vpHomogeneousMatrix &cMo,
653  const vpCameraParameters &cam,
654  double size, const vpColor &color) ;
655  static void displayLine(const vpImage<unsigned char> &I,
656  const vpImagePoint &ip1,
657  const vpImagePoint &ip2,
658  const vpColor &color,
659  unsigned int thickness=1) ;
660  static void displayLine(const vpImage<unsigned char> &I,
661  int i1, int j1, int i2, int j2,
662  const vpColor &color,
663  unsigned int thickness=1) ;
664  static void displayPoint(const vpImage<unsigned char> &I,
665  const vpImagePoint &ip,
666  const vpColor &color) ;
667  static void displayPoint(const vpImage<unsigned char> &I,
668  int i, int j,
669  const vpColor &color) ;
670  static void displayRectangle(const vpImage<unsigned char> &I,
671  const vpImagePoint &topLeft,
672  unsigned int width, unsigned int height,
673  const vpColor &color, bool fill = false,
674  unsigned int thickness=1);
675  static void displayRectangle(const vpImage<unsigned char> &I,
676  const vpImagePoint &topLeft,
677  const vpImagePoint &bottomRight,
678  const vpColor &color, bool fill = false,
679  unsigned int thickness=1);
680  static void displayRectangle(const vpImage<unsigned char> &I,
681  const vpRect &rectangle,
682  const vpColor &color, bool fill = false,
683  unsigned int thickness=1);
684  static void displayRectangle(const vpImage<unsigned char> &I,
685  const vpImagePoint &center,
686  float angle,
687  unsigned int width, unsigned int height,
688  const vpColor &color,
689  unsigned int thickness=1);
690  static void displayRectangle(const vpImage<unsigned char> &I,
691  int i, int j,
692  unsigned int width, unsigned int height,
693  const vpColor &color, bool fill = false,
694  unsigned int thickness=1);
695  static void displayRectangle(const vpImage<unsigned char> &I,
696  unsigned int i, unsigned int j, float angle,
697  unsigned int width, unsigned int height,
698  const vpColor &color,
699  unsigned int thickness=1);
700 
701  static void flush(const vpImage<unsigned char> &I) ;
702  static void flushROI(const vpImage<unsigned char> &I,const vpRect &roi) ;
703 
704  static bool getClick(const vpImage<unsigned char> &I, bool blocking=true) ;
705  static bool getClick(const vpImage<unsigned char> &I,
706  vpImagePoint &ip, bool blocking=true) ;
707  static bool getClick(const vpImage<unsigned char> &I,
708  vpImagePoint &ip,
710  bool blocking=true) ;
711  static bool getClickUp(const vpImage<unsigned char> &I,
712  vpImagePoint &ip,
714  bool blocking=true) ;
715  static void getImage(const vpImage<unsigned char> &Is, vpImage<vpRGBa> &Id) ;
716 
717  static bool getKeyboardEvent(const vpImage<unsigned char> &I,
718  bool blocking=true);
719  static bool getKeyboardEvent(const vpImage<unsigned char> &I,
720  char *string, bool blocking=true);
721  static bool getPointerMotionEvent (const vpImage<unsigned char> &I,
722  vpImagePoint &ip);
723  static bool getPointerPosition (const vpImage<unsigned char> &I,
724  vpImagePoint &ip);
725 
729  static void setFont(const vpImage<vpRGBa> &I, const char *font);
730  static void setTitle(const vpImage<vpRGBa> &I, const char *windowtitle);
731  static void setWindowPosition(const vpImage<vpRGBa> &I, int winx, int winy);
732  static void setBackground(const vpImage<vpRGBa> &I, const vpColor &color);
733 
734  static void close(const vpImage<vpRGBa> &I) ;
735 
736  static void display(const vpImage<vpRGBa> &I) ;
737  static void displayROI(const vpImage<vpRGBa> &I, const vpRect &roi) ;
738  static void displayArrow(const vpImage<vpRGBa> &I,
739  const vpImagePoint &ip1, const vpImagePoint &ip2,
740  const vpColor &color=vpColor::white,
741  unsigned int w=4, unsigned int h=2,
742  unsigned int thickness=1) ;
743  static void displayArrow(const vpImage<vpRGBa> &I,
744  int i1, int j1, int i2, int j2,
745  const vpColor &color=vpColor::white,
746  unsigned int w=4, unsigned int h=2,
747  unsigned int thickness=1) ;
748  static void displayCharString(const vpImage<vpRGBa> &I,
749  const vpImagePoint &ip, const char *string,
750  const vpColor &color) ;
751  static void displayCharString(const vpImage<vpRGBa> &I,
752  int i, int j, const char *string,
753  const vpColor &color) ;
754  static void displayCircle(const vpImage<vpRGBa> &I,
755  const vpImagePoint &center, unsigned int radius,
756  const vpColor &color,
757  bool fill = false,
758  unsigned int thickness=1);
759  static void displayCircle(const vpImage<vpRGBa> &I,
760  int i, int j, unsigned int radius,
761  const vpColor &color,
762  bool fill = false,
763  unsigned int thickness=1);
764  static void displayCross(const vpImage<vpRGBa> &I,
765  const vpImagePoint &ip, unsigned int size,
766  const vpColor &color,
767  unsigned int thickness=1) ;
768  static void displayCross(const vpImage<vpRGBa> &I,
769  int i, int j, unsigned int size,
770  const vpColor &color,
771  unsigned int thickness=1) ;
772  static void displayDotLine(const vpImage<vpRGBa> &I,
773  const vpImagePoint &ip1,
774  const vpImagePoint &ip2,
775  const vpColor &color,
776  unsigned int thickness=1) ;
777  static void displayDotLine(const vpImage<vpRGBa> &I,
778  int i1, int j1, int i2, int j2,
779  const vpColor &color,
780  unsigned int thickness=1) ;
781  static void displayFrame(const vpImage<vpRGBa> &I,
782  const vpHomogeneousMatrix &cMo,
783  const vpCameraParameters &cam,
784  double size, const vpColor &color,
785  unsigned int thickness=1) ;
786  static void displayCamera(const vpImage<vpRGBa> &I,
787  const vpHomogeneousMatrix &cMo,
788  const vpCameraParameters &cam,
789  double size, const vpColor &color) ;
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 
837  static void flush(const vpImage<vpRGBa> &I) ;
838  static void flushROI(const vpImage<vpRGBa> &I, const vpRect &roi) ;
839  static bool getClick(const vpImage<vpRGBa> &I, bool blocking=true) ;
840  static bool getClick(const vpImage<vpRGBa> &I,
841  vpImagePoint &ip, bool blocking=true) ;
842  static bool getClick(const vpImage<vpRGBa> &I,
843  vpImagePoint &ip,
845  bool blocking=true) ;
846  static bool getClickUp(const vpImage<vpRGBa> &I,
847  vpImagePoint &ip,
849  bool blocking=true) ;
850  static void getImage(const vpImage<vpRGBa> &Is, vpImage<vpRGBa> &Id) ;
851 
852  static bool getKeyboardEvent(const vpImage<vpRGBa> &I,
853  bool blocking=true);
854  static bool getKeyboardEvent(const vpImage<vpRGBa> &I,
855  char *string, bool blocking=true);
856  static bool getPointerMotionEvent (const vpImage<vpRGBa> &I, vpImagePoint &ip);
857  static bool getPointerPosition (const vpImage<vpRGBa> &I, vpImagePoint &ip);
858 
859  private:
861  virtual void getImage(vpImage<vpRGBa> &I) = 0;
862 
863 } ;
864 
865 #endif
bool isInitialised()
Definition: vpDisplay.h:434
Class that defines generic functionnalities for display.
Definition: vpDisplay.h:167
unsigned int width
Definition: vpDisplay.h:179
virtual ~vpDisplay()
Definition: vpDisplay.h:314
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:583
Class to define colors available for display functionnalities.
Definition: vpColor.h:123
char * title
display title
Definition: vpDisplay.h:177
bool displayHasBeenInitialized
display has been initialized
Definition: vpDisplay.h:171
static const vpColor green
Definition: vpColor.h:168
unsigned int height
Definition: vpDisplay.h:180
Generic class defining intrinsic camera parameters.
int windowXPosition
display position
Definition: vpDisplay.h:173
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:175
static const vpColor white
Definition: vpColor.h:160
unsigned int getHeight() const
Definition: vpDisplay.h:588
char * font
Definition: vpDisplay.h:178