ViSP  2.7.0
vpDisplay.h
1 /****************************************************************************
2  *
3  * $Id: vpDisplay.h 4056 2013-01-05 13:04:42Z 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 
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 
320  virtual void clearDisplay(const vpColor &color=vpColor::white) =0 ;
324  virtual void closeDisplay() =0;
325 
337  virtual void displayImage(const vpImage<unsigned char> &I) =0 ;
349  virtual void displayImage(const vpImage<vpRGBa> &I) =0 ;
350 
351  virtual void displayImageROI(const vpImage<unsigned char> &I,const vpImagePoint &iP, const unsigned int width, const unsigned int height) =0 ;
352  virtual void displayImageROI(const vpImage<vpRGBa> &I,const vpImagePoint &iP, const unsigned int width, const unsigned int height) =0 ;
353 
354 
359  virtual void flushDisplay() =0;
360 
365  virtual void flushDisplayROI(const vpImagePoint &iP, const unsigned int width, const unsigned int height) =0;
366 
367 
368  /* Simple interface with the mouse event */
369 
385  virtual bool getClick(bool blocking=true) =0;
386 
402  virtual bool getClick(vpImagePoint &ip,
403  bool blocking=true) =0;
422  virtual bool getClick(vpImagePoint &ip,
424  bool blocking=true) =0 ;
447  virtual bool getClickUp(vpImagePoint &ip,
449  bool blocking=true) =0;
450 
466  virtual bool getKeyboardEvent(bool blocking=true) =0;
486  virtual bool getKeyboardEvent(char *string, bool blocking=true) =0;
497  virtual bool getPointerMotionEvent (vpImagePoint &ip) =0;
498 
509  virtual bool getPointerPosition (vpImagePoint &ip) =0;
510 
515  inline unsigned int getHeight() const { return height ; }
520  inline unsigned int getWidth() const { return width ; }
521 
529  virtual void init(vpImage<unsigned char> &I,
530  int x=-1, int y=-1,
531  const char *title=NULL) =0 ;
540  virtual void init(vpImage<vpRGBa> &I,
541  int x=-1, int y=-1,
542  const char *title=NULL) =0 ;
543 
551  virtual void init(unsigned int width, unsigned int height,
552  int x=-1, int y=-1 ,
553  const char *title=NULL) =0;
554 
560  inline bool isInitialised() { return displayHasBeenInitialized; }
561 
575  virtual void setFont(const char *font) =0;
580  virtual void setTitle(const char *title) =0;
588  virtual void setWindowPosition(int winx, int winy) = 0 ;
589 
593  static void close(const vpImage<unsigned char> &I) ;
594  static void display(const vpImage<unsigned char> &I) ;
595  static void displayArrow(const vpImage<unsigned char> &I,
596  const vpImagePoint &ip1, const vpImagePoint &ip2,
597  const vpColor &color=vpColor::white,
598  unsigned int w=4, unsigned int h=2,
599  unsigned int thickness=1) ;
600  static void displayArrow(const vpImage<unsigned char> &I,
601  int i1, int j1, int i2, int j2,
602  const vpColor &color=vpColor::white,
603  unsigned int w=4, unsigned int h=2,
604  unsigned int thickness=1) ;
605  static void displayCamera(const vpImage<unsigned char> &I,
606  const vpHomogeneousMatrix &cMo,
607  const vpCameraParameters &cam,
608  double size, const vpColor &color) ;
609  static void displayCharString(const vpImage<unsigned char> &I,
610  const vpImagePoint &ip, const char *string,
611  const vpColor &color) ;
612  static void displayCharString(const vpImage<unsigned char> &I,
613  int i, int j, const char *string,
614  const vpColor &color) ;
615  static void displayCircle(const vpImage<unsigned char> &I,
616  const vpImagePoint &center, unsigned int radius,
617  const vpColor &color,
618  bool fill = false,
619  unsigned int thickness=1);
620  static void displayCircle(const vpImage<unsigned char> &I,
621  int i, int j, unsigned int radius,
622  const vpColor &color,
623  bool fill = false,
624  unsigned int thickness=1);
625  static void displayCross(const vpImage<unsigned char> &I,
626  const vpImagePoint &ip, unsigned int size,
627  const vpColor &color,
628  unsigned int thickness=1) ;
629  static void displayCross(const vpImage<unsigned char> &I,
630  int i, int j, unsigned int size,
631  const vpColor &color,
632  unsigned int thickness=1) ;
633  static void displayDotLine(const vpImage<unsigned char> &I,
634  const vpImagePoint &ip1,
635  const vpImagePoint &ip2,
636  const vpColor &color,
637  unsigned int thickness=1) ;
638  static void displayDotLine(const vpImage<unsigned char> &I,
639  int i1, int j1, int i2, int j2,
640  const vpColor &color,
641  unsigned int thickness=1) ;
642  static void displayFrame(const vpImage<unsigned char> &I,
643  const vpHomogeneousMatrix &cMo,
644  const vpCameraParameters &cam,
645  double size, const vpColor &color,
646  unsigned int thickness=1) ;
647  static void displayLine(const vpImage<unsigned char> &I,
648  const vpImagePoint &ip1,
649  const vpImagePoint &ip2,
650  const vpColor &color,
651  unsigned int thickness=1) ;
652  static void displayLine(const vpImage<unsigned char> &I,
653  int i1, int j1, int i2, int j2,
654  const vpColor &color,
655  unsigned int thickness=1) ;
656  static void displayPoint(const vpImage<unsigned char> &I,
657  const vpImagePoint &ip,
658  const vpColor &color) ;
659  static void displayPoint(const vpImage<unsigned char> &I,
660  int i, int j,
661  const vpColor &color) ;
662  static void displayRectangle(const vpImage<unsigned char> &I,
663  const vpImagePoint &topLeft,
664  unsigned int width, unsigned int height,
665  const vpColor &color, bool fill = false,
666  unsigned int thickness=1);
667  static void displayRectangle(const vpImage<unsigned char> &I,
668  const vpImagePoint &topLeft,
669  const vpImagePoint &bottomRight,
670  const vpColor &color, bool fill = false,
671  unsigned int thickness=1);
672  static void displayRectangle(const vpImage<unsigned char> &I,
673  const vpRect &rectangle,
674  const vpColor &color, bool fill = false,
675  unsigned int thickness=1);
676  static void displayRectangle(const vpImage<unsigned char> &I,
677  const vpImagePoint &center,
678  float angle,
679  unsigned int width, unsigned int height,
680  const vpColor &color,
681  unsigned int thickness=1);
682  static void displayRectangle(const vpImage<unsigned char> &I,
683  int i, int j,
684  unsigned int width, unsigned int height,
685  const vpColor &color, bool fill = false,
686  unsigned int thickness=1);
687  static void displayRectangle(const vpImage<unsigned char> &I,
688  unsigned int i, unsigned int j, float angle,
689  unsigned int width, unsigned int height,
690  const vpColor &color,
691  unsigned int thickness=1);
692  static void displayROI(const vpImage<unsigned char> &I,const vpRect &roi) ;
693 
694  static void flush(const vpImage<unsigned char> &I) ;
695  static void flushROI(const vpImage<unsigned char> &I,const vpRect &roi) ;
696 
697  static bool getClick(const vpImage<unsigned char> &I, bool blocking=true) ;
698  static bool getClick(const vpImage<unsigned char> &I,
699  vpImagePoint &ip, bool blocking=true) ;
700  static bool getClick(const vpImage<unsigned char> &I,
701  vpImagePoint &ip,
703  bool blocking=true) ;
704  static bool getClickUp(const vpImage<unsigned char> &I,
705  vpImagePoint &ip,
707  bool blocking=true) ;
708  static void getImage(const vpImage<unsigned char> &Is, vpImage<vpRGBa> &Id) ;
709 
710  static bool getKeyboardEvent(const vpImage<unsigned char> &I,
711  bool blocking=true);
712  static bool getKeyboardEvent(const vpImage<unsigned char> &I,
713  char *string, bool blocking=true);
714  static bool getPointerMotionEvent (const vpImage<unsigned char> &I,
715  vpImagePoint &ip);
716  static bool getPointerPosition (const vpImage<unsigned char> &I,
717  vpImagePoint &ip);
718  static void setBackground(const vpImage<unsigned char> &I, const vpColor &color);
719  static void setFont(const vpImage<unsigned char> &I, const char *font);
720  static void setTitle(const vpImage<unsigned char> &I,
721  const char *windowtitle);
722  static void setWindowPosition(const vpImage<unsigned char> &I,
723  int winx, int winy);
724 
728  static void close(const vpImage<vpRGBa> &I) ;
729 
730  static void display(const vpImage<vpRGBa> &I) ;
731  static void displayArrow(const vpImage<vpRGBa> &I,
732  const vpImagePoint &ip1, const vpImagePoint &ip2,
733  const vpColor &color=vpColor::white,
734  unsigned int w=4, unsigned int h=2,
735  unsigned int thickness=1) ;
736  static void displayArrow(const vpImage<vpRGBa> &I,
737  int i1, int j1, int i2, int j2,
738  const vpColor &color=vpColor::white,
739  unsigned int w=4, unsigned int h=2,
740  unsigned int thickness=1) ;
741  static void displayCamera(const vpImage<vpRGBa> &I,
742  const vpHomogeneousMatrix &cMo,
743  const vpCameraParameters &cam,
744  double size, const vpColor &color) ;
745  static void displayCharString(const vpImage<vpRGBa> &I,
746  const vpImagePoint &ip, const char *string,
747  const vpColor &color) ;
748  static void displayCharString(const vpImage<vpRGBa> &I,
749  int i, int j, const char *string,
750  const vpColor &color) ;
751  static void displayCircle(const vpImage<vpRGBa> &I,
752  const vpImagePoint &center, unsigned int radius,
753  const vpColor &color,
754  bool fill = false,
755  unsigned int thickness=1);
756  static void displayCircle(const vpImage<vpRGBa> &I,
757  int i, int j, unsigned int radius,
758  const vpColor &color,
759  bool fill = false,
760  unsigned int thickness=1);
761  static void displayCross(const vpImage<vpRGBa> &I,
762  const vpImagePoint &ip, unsigned int size,
763  const vpColor &color,
764  unsigned int thickness=1) ;
765  static void displayCross(const vpImage<vpRGBa> &I,
766  int i, int j, unsigned int size,
767  const vpColor &color,
768  unsigned int thickness=1) ;
769  static void displayDotLine(const vpImage<vpRGBa> &I,
770  const vpImagePoint &ip1,
771  const vpImagePoint &ip2,
772  const vpColor &color,
773  unsigned int thickness=1) ;
774  static void displayDotLine(const vpImage<vpRGBa> &I,
775  int i1, int j1, int i2, int j2,
776  const vpColor &color,
777  unsigned int thickness=1) ;
778  static void displayFrame(const vpImage<vpRGBa> &I,
779  const vpHomogeneousMatrix &cMo,
780  const vpCameraParameters &cam,
781  double size, const vpColor &color,
782  unsigned int thickness=1) ;
783  static void displayLine(const vpImage<vpRGBa> &I,
784  const vpImagePoint &ip1,
785  const vpImagePoint &ip2,
786  const vpColor &color,
787  unsigned int thickness=1) ;
788  static void displayLine(const vpImage<vpRGBa> &I,
789  int i1, int j1, int i2, int j2,
790  const vpColor &color,
791  unsigned int thickness=1) ;
792  static void displayPoint(const vpImage<vpRGBa> &I,
793  const vpImagePoint &ip,
794  const vpColor &color) ;
795  static void displayPoint(const vpImage<vpRGBa> &I,
796  int i, int j,
797  const vpColor &color) ;
798  static void displayRectangle(const vpImage<vpRGBa> &I,
799  const vpImagePoint &topLeft,
800  unsigned int width, unsigned int height,
801  const vpColor &color, bool fill = false,
802  unsigned int thickness=1);
803  static void displayRectangle(const vpImage<vpRGBa> &I,
804  const vpImagePoint &topLeft,
805  const vpImagePoint &bottomRight,
806  const vpColor &color, bool fill = false,
807  unsigned int thickness=1);
808  static void displayRectangle(const vpImage<vpRGBa> &I,
809  const vpRect &rectangle,
810  const vpColor &color, bool fill = false,
811  unsigned int thickness=1);
812  static void displayRectangle(const vpImage<vpRGBa> &I,
813  const vpImagePoint &center,
814  float angle,
815  unsigned int width, unsigned int height,
816  const vpColor &color,
817  unsigned int thickness=1);
818  static void displayRectangle(const vpImage<vpRGBa> &I,
819  int i, int j,
820  unsigned int width, unsigned int height,
821  const vpColor &color, bool fill = false,
822  unsigned int thickness=1);
823  static void displayRectangle(const vpImage<vpRGBa> &I,
824  unsigned int i, unsigned int j,
825  float angle,
826  unsigned int width, unsigned int height,
827  const vpColor &color,
828  unsigned int thickness=1);
829  static void displayROI(const vpImage<vpRGBa> &I, const vpRect &roi) ;
830 
831  static void flush(const vpImage<vpRGBa> &I) ;
832  static void flushROI(const vpImage<vpRGBa> &I, const vpRect &roi) ;
833  static bool getClick(const vpImage<vpRGBa> &I, bool blocking=true) ;
834  static bool getClick(const vpImage<vpRGBa> &I,
835  vpImagePoint &ip, bool blocking=true) ;
836  static bool getClick(const vpImage<vpRGBa> &I,
837  vpImagePoint &ip,
839  bool blocking=true) ;
840  static bool getClickUp(const vpImage<vpRGBa> &I,
841  vpImagePoint &ip,
843  bool blocking=true) ;
844  static void getImage(const vpImage<vpRGBa> &Is, vpImage<vpRGBa> &Id) ;
845 
846  static bool getKeyboardEvent(const vpImage<vpRGBa> &I,
847  bool blocking=true);
848  static bool getKeyboardEvent(const vpImage<vpRGBa> &I,
849  char *string, bool blocking=true);
850  static bool getPointerMotionEvent (const vpImage<vpRGBa> &I, vpImagePoint &ip);
851  static bool getPointerPosition (const vpImage<vpRGBa> &I, vpImagePoint &ip);
852 
853  static void setBackground(const vpImage<vpRGBa> &I, const vpColor &color);
854  static void setFont(const vpImage<vpRGBa> &I, const char *font);
855  static void setTitle(const vpImage<vpRGBa> &I, const char *windowtitle);
856  static void setWindowPosition(const vpImage<vpRGBa> &I, int winx, int winy);
857 
858  private:
860  virtual void getImage(vpImage<vpRGBa> &I) = 0;
861 
862 } ;
863 
864 #endif
bool isInitialised()
Definition: vpDisplay.h:560
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:520
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:515
char * font
Definition: vpDisplay.h:178