ViSP  2.9.0
vpDisplay.h
1 /****************************************************************************
2  *
3  * $Id: vpDisplay.h 4632 2014-02-03 17:06:40Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2014 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 #include <string>
48 
49 // image
50 #include <visp/vpImage.h>
51 
52 //color
53 #include <visp/vpColor.h>
54 #include <visp/vpMouseButton.h>
55 #include <visp/vpRGBa.h>
56 #include <visp/vpHomogeneousMatrix.h>
57 #include <visp/vpCameraParameters.h>
58 #include <visp/vpRect.h>
59 #include <visp/vpImagePoint.h>
60 
176 class VISP_EXPORT vpDisplay
177 {
178  protected :
185  unsigned int width ;
186  unsigned int height ;
187  std::string title_;
188 
196  virtual void displayArrow(const vpImagePoint &ip1, const vpImagePoint &ip2,
197  const vpColor &color=vpColor::white,
198  unsigned int w=4, unsigned int h=2,
199  unsigned int thickness=1) =0;
211  virtual void displayCharString(const vpImagePoint &ip, const char *text,
212  const vpColor &color=vpColor::green) =0;
222  virtual void displayCircle(const vpImagePoint &center, unsigned int radius,
223  const vpColor &color,
224  bool fill = false,
225  unsigned int thickness=1) =0;
233  virtual void displayCross(const vpImagePoint &ip, unsigned int size,
234  const vpColor &color,
235  unsigned int thickness=1) =0;
242  virtual void displayDotLine(const vpImagePoint &ip1,
243  const vpImagePoint &ip2,
244  const vpColor &color,
245  unsigned int thickness=1) =0;
252  virtual void displayLine(const vpImagePoint &ip1,
253  const vpImagePoint &ip2,
254  const vpColor &color,
255  unsigned int thickness=1) =0;
256 
262  virtual void displayPoint(const vpImagePoint &ip, const vpColor &color) =0;
263 
277  virtual void displayRectangle(const vpImagePoint &topLeft,
278  unsigned int width, unsigned int height,
279  const vpColor &color, bool fill = false,
280  unsigned int thickness=1)=0 ;
294  virtual void displayRectangle(const vpImagePoint &topLeft,
295  const vpImagePoint &bottomRight,
296  const vpColor &color, bool fill = false,
297  unsigned int thickness=1 )=0;
311  virtual void displayRectangle(const vpRect &rectangle,
312  const vpColor &color, bool fill = false,
313  unsigned int thickness=1)=0 ;
314 
315  public:
316  vpDisplay() ;
317  vpDisplay(const vpDisplay& d) ;
318  virtual ~vpDisplay();
319 
324  virtual void clearDisplay(const vpColor &color=vpColor::white) =0 ;
328  virtual void closeDisplay() =0;
329 
341  virtual void displayImage(const vpImage<unsigned char> &I) =0 ;
353  virtual void displayImage(const vpImage<vpRGBa> &I) =0 ;
354 
355  virtual void displayImageROI(const vpImage<unsigned char> &I,const vpImagePoint &iP, const unsigned int width, const unsigned int height) =0 ;
356  virtual void displayImageROI(const vpImage<vpRGBa> &I,const vpImagePoint &iP, const unsigned int width, const unsigned int height) =0 ;
357 
358 
363  virtual void flushDisplay() =0;
364 
369  virtual void flushDisplayROI(const vpImagePoint &iP, const unsigned int width, const unsigned int height) =0;
370 
371 
372  /* Simple interface with the mouse event */
373 
389  virtual bool getClick(bool blocking=true) =0;
390 
406  virtual bool getClick(vpImagePoint &ip,
407  bool blocking=true) =0;
426  virtual bool getClick(vpImagePoint &ip,
428  bool blocking=true) =0 ;
451  virtual bool getClickUp(vpImagePoint &ip,
453  bool blocking=true) =0;
454 
470  virtual bool getKeyboardEvent(bool blocking=true) =0;
490  virtual bool getKeyboardEvent(char *string, bool blocking=true) =0;
501  virtual bool getPointerMotionEvent (vpImagePoint &ip) =0;
502 
513  virtual bool getPointerPosition (vpImagePoint &ip) =0;
514 
519  inline unsigned int getHeight() const { return height ; }
524  inline unsigned int getWidth() const { return width ; }
525 
533  virtual void init(vpImage<unsigned char> &I,
534  int x=-1, int y=-1,
535  const char *title=NULL) =0 ;
544  virtual void init(vpImage<vpRGBa> &I,
545  int x=-1, int y=-1,
546  const char *title=NULL) =0 ;
547 
555  virtual void init(unsigned int width, unsigned int height,
556  int x=-1, int y=-1 ,
557  const char *title=NULL) =0;
558 
564  inline bool isInitialised() { return displayHasBeenInitialized; }
565 
579  virtual void setFont(const char *font) =0;
584  virtual void setTitle(const char *title) =0;
592  virtual void setWindowPosition(int winx, int winy) = 0 ;
593 
597  static void close(vpImage<unsigned char> &I) ;
598  static void display(const vpImage<unsigned char> &I) ;
599  static void displayArrow(const vpImage<unsigned char> &I,
600  const vpImagePoint &ip1, const vpImagePoint &ip2,
601  const vpColor &color=vpColor::white,
602  unsigned int w=4, unsigned int h=2,
603  unsigned int thickness=1) ;
604  static void displayArrow(const vpImage<unsigned char> &I,
605  int i1, int j1, int i2, int j2,
606  const vpColor &color=vpColor::white,
607  unsigned int w=4, unsigned int h=2,
608  unsigned int thickness=1) ;
609  static void displayCamera(const vpImage<unsigned char> &I,
610  const vpHomogeneousMatrix &cMo,
611  const vpCameraParameters &cam,
612  double size, const vpColor &color,
613  unsigned int thickness) ;
614  static void displayCharString(const vpImage<unsigned char> &I,
615  const vpImagePoint &ip, const char *string,
616  const vpColor &color) ;
617  static void displayCharString(const vpImage<unsigned char> &I,
618  int i, int j, const char *string,
619  const vpColor &color) ;
620  static void displayCircle(const vpImage<unsigned char> &I,
621  const vpImagePoint &center, unsigned int radius,
622  const vpColor &color,
623  bool fill = false,
624  unsigned int thickness=1);
625  static void displayCircle(const vpImage<unsigned char> &I,
626  int i, int j, unsigned int radius,
627  const vpColor &color,
628  bool fill = false,
629  unsigned int thickness=1);
630  static void displayCross(const vpImage<unsigned char> &I,
631  const vpImagePoint &ip, unsigned int size,
632  const vpColor &color,
633  unsigned int thickness=1) ;
634  static void displayCross(const vpImage<unsigned char> &I,
635  int i, int j, unsigned int size,
636  const vpColor &color,
637  unsigned int thickness=1) ;
638  static void displayDotLine(const vpImage<unsigned char> &I,
639  const vpImagePoint &ip1,
640  const vpImagePoint &ip2,
641  const vpColor &color,
642  unsigned int thickness=1) ;
643  static void displayDotLine(const vpImage<unsigned char> &I,
644  int i1, int j1, int i2, int j2,
645  const vpColor &color,
646  unsigned int thickness=1) ;
647  static void displayFrame(const vpImage<unsigned char> &I,
648  const vpHomogeneousMatrix &cMo,
649  const vpCameraParameters &cam,
650  double size, const vpColor &color,
651  unsigned int thickness=1) ;
652  static void displayLine(const vpImage<unsigned char> &I,
653  const vpImagePoint &ip1,
654  const vpImagePoint &ip2,
655  const vpColor &color,
656  unsigned int thickness=1) ;
657  static void displayLine(const vpImage<unsigned char> &I,
658  int i1, int j1, int i2, int j2,
659  const vpColor &color,
660  unsigned int thickness=1) ;
661  static void displayPoint(const vpImage<unsigned char> &I,
662  const vpImagePoint &ip,
663  const vpColor &color) ;
664  static void displayPoint(const vpImage<unsigned char> &I,
665  int i, int j,
666  const vpColor &color) ;
667  static void displayRectangle(const vpImage<unsigned char> &I,
668  const vpImagePoint &topLeft,
669  unsigned int width, unsigned int height,
670  const vpColor &color, bool fill = false,
671  unsigned int thickness=1);
672  static void displayRectangle(const vpImage<unsigned char> &I,
673  const vpImagePoint &topLeft,
674  const vpImagePoint &bottomRight,
675  const vpColor &color, bool fill = false,
676  unsigned int thickness=1);
677  static void displayRectangle(const vpImage<unsigned char> &I,
678  const vpRect &rectangle,
679  const vpColor &color, bool fill = false,
680  unsigned int thickness=1);
681  static void displayRectangle(const vpImage<unsigned char> &I,
682  const vpImagePoint &center,
683  float angle,
684  unsigned int width, unsigned int height,
685  const vpColor &color,
686  unsigned int thickness=1);
687  static void displayRectangle(const vpImage<unsigned char> &I,
688  int i, int j,
689  unsigned int width, unsigned int height,
690  const vpColor &color, bool fill = false,
691  unsigned int thickness=1);
692  static void displayRectangle(const vpImage<unsigned char> &I,
693  unsigned int i, unsigned int j, float angle,
694  unsigned int width, unsigned int height,
695  const vpColor &color,
696  unsigned int thickness=1);
697  static void displayROI(const vpImage<unsigned char> &I,const vpRect &roi) ;
698 
699  static void flush(const vpImage<unsigned char> &I) ;
700  static void flushROI(const vpImage<unsigned char> &I,const vpRect &roi) ;
701 
702  static bool getClick(const vpImage<unsigned char> &I, bool blocking=true) ;
703  static bool getClick(const vpImage<unsigned char> &I,
704  vpImagePoint &ip, bool blocking=true) ;
705  static bool getClick(const vpImage<unsigned char> &I,
706  vpImagePoint &ip,
708  bool blocking=true) ;
709  static bool getClickUp(const vpImage<unsigned char> &I,
710  vpImagePoint &ip,
712  bool blocking=true) ;
713  static void getImage(const vpImage<unsigned char> &Is, vpImage<vpRGBa> &Id) ;
714 
715  static bool getKeyboardEvent(const vpImage<unsigned char> &I,
716  bool blocking=true);
717  static bool getKeyboardEvent(const vpImage<unsigned char> &I,
718  char *string, bool blocking=true);
719  static bool getPointerMotionEvent (const vpImage<unsigned char> &I,
720  vpImagePoint &ip);
721  static bool getPointerPosition (const vpImage<unsigned char> &I,
722  vpImagePoint &ip);
723  static void setBackground(const vpImage<unsigned char> &I, const vpColor &color);
724  static void setFont(const vpImage<unsigned char> &I, const char *font);
725  static void setTitle(const vpImage<unsigned char> &I,
726  const char *windowtitle);
727  static void setWindowPosition(const vpImage<unsigned char> &I,
728  int winx, int winy);
729 
733  static void close(vpImage<vpRGBa> &I) ;
734 
735  static void display(const vpImage<vpRGBa> &I) ;
736  static void displayArrow(const vpImage<vpRGBa> &I,
737  const vpImagePoint &ip1, const vpImagePoint &ip2,
738  const vpColor &color=vpColor::white,
739  unsigned int w=4, unsigned int h=2,
740  unsigned int thickness=1) ;
741  static void displayArrow(const vpImage<vpRGBa> &I,
742  int i1, int j1, int i2, int j2,
743  const vpColor &color=vpColor::white,
744  unsigned int w=4, unsigned int h=2,
745  unsigned int thickness=1) ;
746  static void displayCamera(const vpImage<vpRGBa> &I,
747  const vpHomogeneousMatrix &cMo,
748  const vpCameraParameters &cam,
749  double size, const vpColor &color,
750  unsigned int thickness) ;
751  static void displayCharString(const vpImage<vpRGBa> &I,
752  const vpImagePoint &ip, const char *string,
753  const vpColor &color) ;
754  static void displayCharString(const vpImage<vpRGBa> &I,
755  int i, int j, const char *string,
756  const vpColor &color) ;
757  static void displayCircle(const vpImage<vpRGBa> &I,
758  const vpImagePoint &center, unsigned int radius,
759  const vpColor &color,
760  bool fill = false,
761  unsigned int thickness=1);
762  static void displayCircle(const vpImage<vpRGBa> &I,
763  int i, int j, unsigned int radius,
764  const vpColor &color,
765  bool fill = false,
766  unsigned int thickness=1);
767  static void displayCross(const vpImage<vpRGBa> &I,
768  const vpImagePoint &ip, unsigned int size,
769  const vpColor &color,
770  unsigned int thickness=1) ;
771  static void displayCross(const vpImage<vpRGBa> &I,
772  int i, int j, unsigned int size,
773  const vpColor &color,
774  unsigned int thickness=1) ;
775  static void displayDotLine(const vpImage<vpRGBa> &I,
776  const vpImagePoint &ip1,
777  const vpImagePoint &ip2,
778  const vpColor &color,
779  unsigned int thickness=1) ;
780  static void displayDotLine(const vpImage<vpRGBa> &I,
781  int i1, int j1, int i2, int j2,
782  const vpColor &color,
783  unsigned int thickness=1) ;
784  static void displayFrame(const vpImage<vpRGBa> &I,
785  const vpHomogeneousMatrix &cMo,
786  const vpCameraParameters &cam,
787  double size, const vpColor &color,
788  unsigned int thickness=1) ;
789  static void displayLine(const vpImage<vpRGBa> &I,
790  const vpImagePoint &ip1,
791  const vpImagePoint &ip2,
792  const vpColor &color,
793  unsigned int thickness=1) ;
794  static void displayLine(const vpImage<vpRGBa> &I,
795  int i1, int j1, int i2, int j2,
796  const vpColor &color,
797  unsigned int thickness=1) ;
798  static void displayPoint(const vpImage<vpRGBa> &I,
799  const vpImagePoint &ip,
800  const vpColor &color) ;
801  static void displayPoint(const vpImage<vpRGBa> &I,
802  int i, int j,
803  const vpColor &color) ;
804  static void displayRectangle(const vpImage<vpRGBa> &I,
805  const vpImagePoint &topLeft,
806  unsigned int width, unsigned int height,
807  const vpColor &color, bool fill = false,
808  unsigned int thickness=1);
809  static void displayRectangle(const vpImage<vpRGBa> &I,
810  const vpImagePoint &topLeft,
811  const vpImagePoint &bottomRight,
812  const vpColor &color, bool fill = false,
813  unsigned int thickness=1);
814  static void displayRectangle(const vpImage<vpRGBa> &I,
815  const vpRect &rectangle,
816  const vpColor &color, bool fill = false,
817  unsigned int thickness=1);
818  static void displayRectangle(const vpImage<vpRGBa> &I,
819  const vpImagePoint &center,
820  float angle,
821  unsigned int width, unsigned int height,
822  const vpColor &color,
823  unsigned int thickness=1);
824  static void displayRectangle(const vpImage<vpRGBa> &I,
825  int i, int j,
826  unsigned int width, unsigned int height,
827  const vpColor &color, bool fill = false,
828  unsigned int thickness=1);
829  static void displayRectangle(const vpImage<vpRGBa> &I,
830  unsigned int i, unsigned int j,
831  float angle,
832  unsigned int width, unsigned int height,
833  const vpColor &color,
834  unsigned int thickness=1);
835  static void displayROI(const vpImage<vpRGBa> &I, const vpRect &roi) ;
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  static void setBackground(const vpImage<vpRGBa> &I, const vpColor &color);
860  static void setFont(const vpImage<vpRGBa> &I, const char *font);
861  static void setTitle(const vpImage<vpRGBa> &I, const char *windowtitle);
862  static void setWindowPosition(const vpImage<vpRGBa> &I, int winx, int winy);
863 
864  private:
866  virtual void getImage(vpImage<vpRGBa> &I) = 0;
867 
868 } ;
869 
870 #endif
bool isInitialised()
Definition: vpDisplay.h:564
Class that defines generic functionnalities for display.
Definition: vpDisplay.h:176
unsigned int width
Definition: vpDisplay.h:185
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:524
Class to define colors available for display functionnalities.
Definition: vpColor.h:125
bool displayHasBeenInitialized
display has been initialized
Definition: vpDisplay.h:180
static const vpColor green
Definition: vpColor.h:170
std::string title_
Definition: vpDisplay.h:187
unsigned int height
Definition: vpDisplay.h:186
Generic class defining intrinsic camera parameters.
int windowXPosition
display position
Definition: vpDisplay.h:182
Defines a rectangle in the plane.
Definition: vpRect.h:85
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:184
static const vpColor white
Definition: vpColor.h:162
unsigned int getHeight() const
Definition: vpDisplay.h:519