ViSP  2.9.0
vpDisplay.cpp
1 /****************************************************************************
2  *
3  * $Id: vpDisplay.cpp 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 #include <visp/vpDisplay.h>
44 #include <visp/vpDisplayException.h>
45 #include <visp/vpImageConvert.h>
46 
47 #include <visp/vpPoint.h>
48 #include <visp/vpMeterPixelConversion.h>
49 #include <visp/vpMath.h>
50 
51 
61  : displayHasBeenInitialized(false), windowXPosition(0), windowYPosition(0), width(0), height(0), title_() {}
62 
67  : displayHasBeenInitialized(false), windowXPosition(0), windowYPosition(0), width(0), height(0), title_()
68 {
72 
73  width = d.width;
74  height = d.height;
75 }
76 
81 {
83 }
84 
98 void
100  const char *fontname )
101 {
102 
103  try
104  {
105  if ( I.display != NULL )
106  {
107  ( I.display )->setFont ( fontname ) ;
108  }
109  }
110  catch ( ... )
111  {
112  vpERROR_TRACE ( "Error caught" ) ;
113  throw ;
114  }
115 }
121 void
123  const char *windowtitle )
124 {
125 
126  try
127  {
128  if ( I.display != NULL )
129  {
130  ( I.display )->setTitle ( windowtitle ) ;
131  }
132  }
133  catch ( ... )
134  {
135  vpERROR_TRACE ( "Error caught" ) ;
136  throw ;
137  }
138 }
139 
149 void
151  int winx, int winy )
152 {
153 
154  try
155  {
156  if ( I.display != NULL )
157  {
158  ( I.display )->setWindowPosition ( winx, winy ) ;
159  }
160  }
161  catch ( ... )
162  {
163  vpERROR_TRACE ( "Error caught" ) ;
164  throw ;
165  }
166 }
167 
177 void
179 {
180  try
181  {
182  if ( I.display != NULL )
183  {
184  ( I.display )->clearDisplay ( color ) ;
185  }
186  }
187  catch ( ... )
188  {
189  vpERROR_TRACE ( "Error caught" ) ;
190  throw ;
191  }
192 }
193 
205 void
207 {
208 
209  try
210  {
211  if ( I.display != NULL )
212  {
213  ( I.display )->displayImage ( I ) ;
214  }
215  }
216  catch ( ... )
217  {
218  vpERROR_TRACE ( "Error caught" ) ;
219  throw ;
220  }
221 }
222 
223 
224 void
226 {
227  vpImagePoint topLeft;
228  double top = floor(roi.getTop());
229  double left = floor(roi.getLeft());
230  double roiheight = floor(roi.getHeight());
231  double roiwidth = floor(roi.getWidth());
232  double iheight = (double)(I.getHeight());
233  double iwidth = (double)(I.getWidth());
234 
235  if (top < 0 || top > iheight || left < 0 || left > iwidth || top+roiheight > iheight || left+roiwidth > iwidth)
236  {
237  vpERROR_TRACE ( "Region of interest outside of the image" ) ;
238  throw ( vpException ( vpException::dimensionError,"Region of interest outside of the image" ) ) ;
239  }
240 
241  try
242  {
243  if ( I.display != NULL )
244  {
245  ( I.display )->displayImageROI ( I , vpImagePoint(top,left), (unsigned int)roiwidth,(unsigned int)roiheight ) ;
246  }
247  }
248  catch ( ... )
249  {
250  vpERROR_TRACE ( "Error caught" ) ;
251  throw ;
252  }
253 }
254 
255 
256 
323 void
325  vpImage<vpRGBa> &Idest )
326 {
327 
328  try
329  {
330  if ( Isrc.display != NULL )
331  {
332  ( Isrc.display )->getImage ( Idest ) ;
333  }
334  else
335  {
336  vpImageConvert::convert(Isrc, Idest);
337 // vpERROR_TRACE ( "Display not initialized" ) ;
338 // throw ( vpDisplayException ( vpDisplayException::notInitializedError,
339 // "Display not initialized" ) ) ;
340  }
341  }
342  catch ( ... )
343  {
344  vpERROR_TRACE ( "Error caught" ) ;
345  throw ;
346  }
347 }
348 
349 
370 void
372  const vpHomogeneousMatrix &cMo,
373  const vpCameraParameters &cam,
374  double size,
375  const vpColor &color, unsigned int thickness)
376 {
377  // used by display
378  vpPoint o; o.setWorldCoordinates ( 0.0,0.0,0.0 ) ;
379  vpPoint x; x.setWorldCoordinates ( size,0.0,0.0 ) ;
380  vpPoint y; y.setWorldCoordinates ( 0.0,size,0.0 ) ;
381  vpPoint z; z.setWorldCoordinates ( 0.0,0.0,size ) ;
382 
383  o.track ( cMo ) ;
384  x.track ( cMo ) ;
385  y.track ( cMo ) ;
386  z.track ( cMo ) ;
387 
388  vpImagePoint ipo, ip1;
389 
390  if ( color == vpColor::none )
391  {
392  vpMeterPixelConversion::convertPoint ( cam, o.p[0], o.p[1], ipo) ;
393 
394  vpMeterPixelConversion::convertPoint ( cam, x.p[0], x.p[1], ip1) ;
395  vpDisplay::displayArrow ( I, ipo, ip1, vpColor::red, 4*thickness, 2*thickness, thickness) ;
396 
397  vpMeterPixelConversion::convertPoint ( cam, y.p[0], y.p[1], ip1) ;
398  vpDisplay::displayArrow ( I, ipo, ip1, vpColor::green, 4*thickness, 2*thickness, thickness) ;
399 
400  vpMeterPixelConversion::convertPoint ( cam, z.p[0], z.p[1], ip1) ;
401  vpDisplay::displayArrow ( I,ipo, ip1, vpColor::blue, 4*thickness, 2*thickness, thickness) ;
402  }
403  else
404  {
405  vpMeterPixelConversion::convertPoint ( cam, o.p[0], o.p[1], ipo) ;
406 
407  vpMeterPixelConversion::convertPoint ( cam, x.p[0], x.p[1], ip1) ;
408  vpDisplay::displayArrow ( I, ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
409 
410  vpMeterPixelConversion::convertPoint ( cam, y.p[0], y.p[1], ip1) ;
411  vpDisplay::displayArrow ( I, ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
412 
413  vpMeterPixelConversion::convertPoint ( cam, z.p[0], z.p[1], ip1) ;
414  vpDisplay::displayArrow ( I,ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
415 
416  }
417 }
418 
419 
440 void
442  const vpHomogeneousMatrix &cMo,
443  const vpCameraParameters &cam,
444  double size, const vpColor &color,
445  unsigned int thickness )
446 {
447  // used by display
448  vpPoint o; o.setWorldCoordinates ( 0.0,0.0,0.0 ) ;
449  vpPoint x; x.setWorldCoordinates ( size,0.0,0.0 ) ;
450  vpPoint y; y.setWorldCoordinates ( 0.0,size,0.0 ) ;
451  vpPoint z; z.setWorldCoordinates ( 0.0,0.0,size ) ;
452 
453  o.track ( cMo ) ;
454  x.track ( cMo ) ;
455  y.track ( cMo ) ;
456  z.track ( cMo ) ;
457 
458  vpImagePoint ipo, ip1;
459  if ( color == vpColor::none )
460  {
461  vpMeterPixelConversion::convertPoint ( cam, o.p[0], o.p[1], ipo) ;
462 
463  vpMeterPixelConversion::convertPoint ( cam, x.p[0], x.p[1], ip1) ;
464  vpDisplay::displayArrow ( I, ipo, ip1, vpColor::red, 4, 2, thickness) ;
465 
466  vpMeterPixelConversion::convertPoint ( cam, y.p[0], y.p[1], ip1) ;
467  vpDisplay::displayArrow ( I, ipo, ip1, vpColor::green, 4, 2, thickness) ;
468 
469  vpMeterPixelConversion::convertPoint ( cam, z.p[0], z.p[1], ip1) ;
470  vpDisplay::displayArrow ( I,ipo, ip1, vpColor::blue, 4, 2, thickness) ;
471  }
472  else
473  {
474  vpMeterPixelConversion::convertPoint ( cam, o.p[0], o.p[1], ipo) ;
475 
476  vpMeterPixelConversion::convertPoint ( cam, x.p[0], x.p[1], ip1) ;
477  vpDisplay::displayArrow ( I, ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
478 
479  vpMeterPixelConversion::convertPoint ( cam, y.p[0], y.p[1], ip1) ;
480  vpDisplay::displayArrow ( I, ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
481 
482  vpMeterPixelConversion::convertPoint ( cam, z.p[0], z.p[1], ip1) ;
483  vpDisplay::displayArrow ( I,ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
484 
485  }
486 }
487 
508 void
510  const vpHomogeneousMatrix &cMo,
511  const vpCameraParameters &cam,
512  double size, const vpColor &color,
513  unsigned int thickness)
514 {
515  // used by display
516  double halfSize = size/2.0;
517  vpPoint pt[5];
518  pt[0].setWorldCoordinates ( -halfSize,-halfSize,0.0 );
519  pt[1].setWorldCoordinates ( halfSize,-halfSize,0.0 );
520  pt[2].setWorldCoordinates ( halfSize,halfSize,0.0 );
521  pt[3].setWorldCoordinates ( -halfSize,halfSize,0.0 );
522  pt[4].setWorldCoordinates ( 0.0,0.0,-size );
523 
524  for (int i = 0; i < 5; i++)
525  pt[i].track ( cMo ) ;
526 
527  vpImagePoint ip, ip_1, ip0;
528  vpMeterPixelConversion::convertPoint ( cam, pt[4].p[0], pt[4].p[1], ip0);
529 
530  for (int i = 0; i < 4; i++)
531  {
532  vpMeterPixelConversion::convertPoint ( cam, pt[i].p[0], pt[i].p[1], ip_1);
533  vpMeterPixelConversion::convertPoint ( cam, pt[(i+1)%4].p[0], pt[(i+1)%4].p[1], ip);
534  vpDisplay::displayLine ( I, ip_1, ip, color, thickness);
535  vpDisplay::displayLine ( I, ip0, ip_1, color, thickness);
536  }
537 }
538 
539 
560 void
562  const vpHomogeneousMatrix &cMo,
563  const vpCameraParameters &cam,
564  double size, const vpColor &color,
565  unsigned int thickness)
566 {
567  // used by display
568  double halfSize = size/2.0;
569  vpPoint pt[5];
570  pt[0].setWorldCoordinates ( -halfSize,-halfSize,0.0 );
571  pt[1].setWorldCoordinates ( halfSize,-halfSize,0.0 );
572  pt[2].setWorldCoordinates ( halfSize,halfSize,0.0 );
573  pt[3].setWorldCoordinates ( -halfSize,halfSize,0.0 );
574  pt[4].setWorldCoordinates ( 0.0,0.0,-size );
575 
576  for (int i = 0; i < 5; i++)
577  pt[i].track ( cMo ) ;
578 
579  vpImagePoint ip, ip_1, ip0;
580  vpMeterPixelConversion::convertPoint ( cam, pt[4].p[0], pt[4].p[1], ip0);
581 
582  for (int i = 0; i < 4; i++)
583  {
584  vpMeterPixelConversion::convertPoint ( cam, pt[i].p[0], pt[i].p[1], ip_1);
585  vpMeterPixelConversion::convertPoint ( cam, pt[(i+1)%4].p[0], pt[(i+1)%4].p[1], ip);
586  vpDisplay::displayLine ( I, ip_1, ip, color, thickness);
587  vpDisplay::displayLine ( I, ip0, ip_1, color, thickness);
588  }
589 }
590 
599 void
601  const vpImagePoint &ip1, const vpImagePoint &ip2,
602  const vpColor &color,
603  unsigned int w,unsigned int h,
604  unsigned int thickness )
605 {
606  try
607  {
608  if ( I.display != NULL )
609  {
610  ( I.display )->displayArrow ( ip1, ip2, color, w, h, thickness ) ;
611  }
612  }
613  catch ( ... )
614  {
615  vpERROR_TRACE ( "Error caught" ) ;
616  throw ;
617  }
618 }
619 
629 void
631  const vpImagePoint &ip1, const vpImagePoint &ip2,
632  const vpColor &color,
633  unsigned int w,unsigned int h,
634  unsigned int thickness )
635 {
636  try
637  {
638  if ( I.display != NULL )
639  {
640  ( I.display )->displayArrow ( ip1, ip2, color, w, h, thickness ) ;
641  }
642  }
643  catch ( ... )
644  {
645  vpERROR_TRACE ( "Error caught" ) ;
646  throw ;
647  }
648 }
649 
660 void
662  int i1, int j1, int i2, int j2,
663  const vpColor &color,
664  unsigned int w, unsigned int h,
665  unsigned int thickness)
666 {
667  try
668  {
669  if ( I.display != NULL )
670  {
671  vpImagePoint ip1, ip2;
672  ip1.set_i(i1);
673  ip1.set_j(j1);
674  ip2.set_i(i2);
675  ip2.set_j(j2);
676  ( I.display )->displayArrow ( ip1, ip2, color, w, h, thickness ) ;
677  }
678  }
679  catch ( ... )
680  {
681  vpERROR_TRACE ( "Error caught" ) ;
682  throw ;
683  }
684 }
685 
698 void
700  int i1, int j1, int i2, int j2,
701  const vpColor &color,
702  unsigned int w, unsigned int h,
703  unsigned int thickness)
704 {
705  try
706  {
707  if ( I.display != NULL )
708  {
709  vpImagePoint ip1, ip2;
710  ip1.set_i(i1);
711  ip1.set_j(j1);
712  ip2.set_i(i2);
713  ip2.set_j(j2);
714 
715  ( I.display )->displayArrow ( ip1, ip2, color, w, h, thickness ) ;
716  }
717  }
718  catch ( ... )
719  {
720  vpERROR_TRACE ( "Error caught" ) ;
721  throw ;
722  }
723 }
724 
739 void
741  const vpImagePoint &ip, const char *string,
742  const vpColor &color )
743 {
744  try
745  {
746  if ( I.display != NULL )
747  {
748  ( I.display )->displayCharString ( ip, string, color ) ;
749  }
750  }
751  catch ( ... )
752  {
753  vpERROR_TRACE ( "Error caught" ) ;
754  throw ;
755  }
756 }
757 
772 void
774  const vpImagePoint &ip, const char *string,
775  const vpColor &color )
776 {
777  try
778  {
779  if ( I.display != NULL )
780  {
781  ( I.display )->displayCharString ( ip, string, color ) ;
782  }
783  }
784  catch ( ... )
785  {
786  vpERROR_TRACE ( "Error caught" ) ;
787  throw ;
788  }
789 }
790 
805 void
807  int i, int j, const char *string,
808  const vpColor &color)
809 {
810  try
811  {
812  if ( I.display != NULL )
813  {
814  vpImagePoint ip;
815  ip.set_i( i );
816  ip.set_j( j );
817 
818  ( I.display )->displayCharString ( ip, string, color ) ;
819  }
820  }
821  catch ( ... )
822  {
823  vpERROR_TRACE ( "Error caught" ) ;
824  throw ;
825  }
826 }
827 
842 void
844  int i, int j, const char *string,
845  const vpColor &color)
846 {
847  try
848  {
849  if ( I.display != NULL )
850  {
851  vpImagePoint ip;
852  ip.set_i( i );
853  ip.set_j( j );
854  ( I.display )->displayCharString ( ip, string, color ) ;
855  }
856  }
857  catch ( ... )
858  {
859  vpERROR_TRACE ( "Error caught" ) ;
860  throw ;
861  }
862 }
863 
874 void
876  const vpImagePoint &center, unsigned int radius,
877  const vpColor &color,
878  bool fill,
879  unsigned int thickness)
880 {
881  try
882  {
883  if ( I.display != NULL )
884  {
885  ( I.display )->displayCircle ( center, radius, color, fill, thickness ) ;
886  }
887  }
888  catch ( ... )
889  {
890  vpERROR_TRACE ( "Error caught" ) ;
891  throw ;
892  }
893 }
904 void
906  const vpImagePoint &center, unsigned int radius,
907  const vpColor &color,
908  bool fill,
909  unsigned int thickness )
910 {
911  try
912  {
913  if ( I.display != NULL )
914  {
915  ( I.display )->displayCircle ( center, radius, color, fill, thickness ) ;
916  }
917  }
918  catch ( ... )
919  {
920  vpERROR_TRACE ( "Error caught" ) ;
921  throw ;
922  }
923 }
936 void
938  int i, int j, unsigned int radius,
939  const vpColor &color,
940  bool fill,
941  unsigned int thickness)
942 {
943  try
944  {
945  if ( I.display != NULL )
946  {
947  vpImagePoint ip;
948  ip.set_i( i );
949  ip.set_j( j );
950 
951  ( I.display )->displayCircle ( ip, radius, color, fill, thickness ) ;
952  }
953  }
954  catch ( ... )
955  {
956  vpERROR_TRACE ( "Error caught" ) ;
957  throw ;
958  }
959 }
960 
961 
974 void
976  int i, int j, unsigned int radius,
977  const vpColor &color,
978  bool fill,
979  unsigned int thickness)
980 {
981  try
982  {
983  if ( I.display != NULL )
984  {
985  vpImagePoint ip;
986  ip.set_i( i );
987  ip.set_j( j );
988  ( I.display )->displayCircle ( ip, radius, color, fill, thickness ) ;
989  }
990  }
991  catch ( ... )
992  {
993  vpERROR_TRACE ( "Error caught" ) ;
994  throw ;
995  }
996 }
997 
1007  const vpImagePoint &ip, unsigned int size,
1008  const vpColor &color,
1009  unsigned int thickness )
1010 {
1011  try
1012  {
1013  if ( I.display != NULL )
1014  {
1015  ( I.display )->displayCross ( ip, size, color, thickness ) ;
1016  }
1017  }
1018  catch ( ... )
1019  {
1020  vpERROR_TRACE ( "Error caught" ) ;
1021  throw ;
1022  }
1023 }
1024 
1034  const vpImagePoint &ip, unsigned int size,
1035  const vpColor &color,
1036  unsigned int thickness )
1037 {
1038  try
1039  {
1040  if ( I.display != NULL )
1041  {
1042  ( I.display )->displayCross ( ip, size, color, thickness ) ;
1043  }
1044  }
1045  catch ( ... )
1046  {
1047  vpERROR_TRACE ( "Error caught" ) ;
1048  throw ;
1049  }
1050 }
1060  int i, int j,
1061  unsigned int size, const vpColor &color,
1062  unsigned int thickness )
1063 {
1064  try
1065  {
1066  if ( I.display != NULL )
1067  {
1068  vpImagePoint ip;
1069  ip.set_i( i );
1070  ip.set_j( j );
1071 
1072  ( I.display )->displayCross ( ip, size, color, thickness ) ;
1073  }
1074  }
1075  catch ( ... )
1076  {
1077  vpERROR_TRACE ( "Error caught" ) ;
1078  throw ;
1079  }
1080 }
1081 
1091  int i, int j,
1092  unsigned int size, const vpColor &color,
1093  unsigned int thickness )
1094 {
1095  try
1096  {
1097  if ( I.display != NULL )
1098  {
1099  vpImagePoint ip;
1100  ip.set_i( i );
1101  ip.set_j( j );
1102  ( I.display )->displayCross ( ip, size, color, thickness ) ;
1103  }
1104  }
1105  catch ( ... )
1106  {
1107  vpERROR_TRACE ( "Error caught" ) ;
1108  throw ;
1109  }
1110 }
1111 
1120  const vpImagePoint &ip1,
1121  const vpImagePoint &ip2,
1122  const vpColor &color,
1123  unsigned int thickness )
1124 {
1125  try
1126  {
1127  if ( I.display != NULL )
1128  {
1129  ( I.display )->displayDotLine ( ip1, ip2, color, thickness );
1130  }
1131  }
1132  catch ( ... )
1133  {
1134  vpERROR_TRACE ( "Error caught" ) ;
1135  throw ;
1136  }
1137 }
1138 
1147  const vpImagePoint &ip1,
1148  const vpImagePoint &ip2,
1149  const vpColor &color,
1150  unsigned int thickness )
1151 {
1152  try
1153  {
1154  if ( I.display != NULL )
1155  {
1156  ( I.display )->displayDotLine ( ip1, ip2, color, thickness );
1157  }
1158  }
1159  catch ( ... )
1160  {
1161  vpERROR_TRACE ( "Error caught" ) ;
1162  throw ;
1163  }
1164 }
1175  int i1, int j1, int i2, int j2,
1176  const vpColor &color,
1177  unsigned int thickness )
1178 {
1179  try
1180  {
1181  if ( I.display != NULL )
1182  {
1183  vpImagePoint ip1, ip2;
1184  ip1.set_i( i1 );
1185  ip1.set_j( j1 );
1186  ip2.set_i( i2 );
1187  ip2.set_j( j2 );
1188  ( I.display )->displayDotLine ( ip1, ip2, color, thickness );
1189  }
1190  }
1191  catch ( ... )
1192  {
1193  vpERROR_TRACE ( "Error caught" ) ;
1194  throw ;
1195  }
1196 }
1197 
1207  int i1, int j1,
1208  int i2, int j2,
1209  const vpColor &color,
1210  unsigned int thickness )
1211 {
1212  try
1213  {
1214  if ( I.display != NULL )
1215  {
1216  vpImagePoint ip1, ip2;
1217  ip1.set_i( i1 );
1218  ip1.set_j( j1 );
1219  ip2.set_i( i2 );
1220  ip2.set_j( j2 );
1221  ( I.display )->displayDotLine ( ip1, ip2, color, thickness );
1222  }
1223  }
1224  catch ( ... )
1225  {
1226  vpERROR_TRACE ( "Error caught" ) ;
1227  throw ;
1228  }
1229 }
1230 
1239  const vpImagePoint &ip1,
1240  const vpImagePoint &ip2,
1241  const vpColor &color,
1242  unsigned int thickness )
1243 {
1244 
1245  try
1246  {
1247  if ( I.display != NULL )
1248  {
1249  ( I.display )->displayLine ( ip1, ip2, color, thickness );
1250  }
1251  }
1252  catch ( ... )
1253  {
1254  vpERROR_TRACE ( "Error caught" ) ;
1255  throw ;
1256  }
1257 }
1258 
1269  int i1, int j1, int i2, int j2,
1270  const vpColor &color,
1271  unsigned int thickness )
1272 {
1273 
1274  try
1275  {
1276  if ( I.display != NULL )
1277  {
1278  vpImagePoint ip1, ip2;
1279  ip1.set_i( i1 );
1280  ip1.set_j( j1 );
1281  ip2.set_i( i2 );
1282  ip2.set_j( j2 );
1283  ( I.display )->displayLine ( ip1, ip2, color, thickness );
1284  }
1285  }
1286  catch ( ... )
1287  {
1288  vpERROR_TRACE ( "Error caught" ) ;
1289  throw ;
1290  }
1291 }
1292 
1293 
1304  int i1, int j1,
1305  int i2, int j2,
1306  const vpColor &color,
1307  unsigned int thickness )
1308 {
1309 
1310  try
1311  {
1312  if ( I.display != NULL )
1313  {
1314  vpImagePoint ip1, ip2;
1315  ip1.set_i( i1 );
1316  ip1.set_j( j1 );
1317  ip2.set_i( i2 );
1318  ip2.set_j( j2 );
1319  ( I.display )->displayLine ( ip1, ip2, color, thickness );
1320  }
1321  }
1322  catch ( ... )
1323  {
1324  vpERROR_TRACE ( "Error caught" ) ;
1325  throw ;
1326  }
1327 }
1328 
1337  const vpImagePoint &ip1,
1338  const vpImagePoint &ip2,
1339  const vpColor &color,
1340  unsigned int thickness )
1341 {
1342 
1343  try
1344  {
1345  if ( I.display != NULL )
1346  {
1347  ( I.display )->displayLine ( ip1, ip2, color, thickness );
1348  }
1349  }
1350  catch ( ... )
1351  {
1352  vpERROR_TRACE ( "Error caught" ) ;
1353  throw ;
1354  }
1355 }
1356 
1364  const vpImagePoint &ip,
1365  const vpColor &color )
1366 {
1367  try
1368  {
1369  if ( I.display != NULL )
1370  {
1371  ( I.display )->displayPoint ( ip, color ) ;
1372  }
1373  }
1374  catch ( ... )
1375  {
1376  vpERROR_TRACE ( "Error caught" ) ;
1377  throw ;
1378  }
1379 }
1387  const vpImagePoint &ip,
1388  const vpColor &color )
1389 {
1390  try
1391  {
1392  if ( I.display != NULL )
1393  {
1394  ( I.display )->displayPoint ( ip, color ) ;
1395  }
1396  }
1397  catch ( ... )
1398  {
1399  vpERROR_TRACE ( "Error caught" ) ;
1400  throw ;
1401  }
1402 }
1403 
1411  int i, int j,
1412  const vpColor &color )
1413 {
1414  try
1415  {
1416  if ( I.display != NULL )
1417  {
1418  vpImagePoint ip;
1419  ip.set_i( i );
1420  ip.set_j( j );
1421  ( I.display )->displayPoint ( ip, color ) ;
1422  }
1423  }
1424  catch ( ... )
1425  {
1426  vpERROR_TRACE ( "Error caught" ) ;
1427  throw ;
1428  }
1429 }
1430 
1431 
1439  int i, int j,
1440  const vpColor &color )
1441 {
1442  try
1443  {
1444  if ( I.display != NULL )
1445  {
1446  vpImagePoint ip;
1447  ip.set_i( i );
1448  ip.set_j( j );
1449  ( I.display )->displayPoint ( ip, color ) ;
1450  }
1451  }
1452  catch ( ... )
1453  {
1454  vpERROR_TRACE ( "Error caught" ) ;
1455  throw ;
1456  }
1457 }
1458 
1473 void
1475  const vpImagePoint &topLeft,
1476  unsigned int width, unsigned int height,
1477  const vpColor &color, bool fill,
1478  unsigned int thickness)
1479 {
1480  try
1481  {
1482  if ( I.display != NULL )
1483  {
1484  ( I.display )->displayRectangle ( topLeft, width, height, color,
1485  fill, thickness ) ;
1486  }
1487  }
1488  catch ( ... )
1489  {
1490  vpERROR_TRACE ( "Error caught" ) ;
1491  throw ;
1492  }
1493 }
1494 
1495 
1510 void
1512  const vpImagePoint &topLeft,
1513  const vpImagePoint &bottomRight,
1514  const vpColor &color, bool fill,
1515  unsigned int thickness)
1516 {
1517  try
1518  {
1519  if ( I.display != NULL )
1520  {
1521  ( I.display )->displayRectangle ( topLeft, bottomRight, color,
1522  fill, thickness ) ;
1523  }
1524  }
1525  catch ( ... )
1526  {
1527  vpERROR_TRACE ( "Error caught" ) ;
1528  throw ;
1529  }
1530 }
1545 void
1547  const vpRect &rectangle,
1548  const vpColor &color, bool fill,
1549  unsigned int thickness )
1550 {
1551  try
1552  {
1553  if ( I.display != NULL )
1554  {
1555  ( I.display )->displayRectangle ( rectangle, color, fill, thickness ) ;
1556  }
1557  }
1558  catch ( ... )
1559  {
1560  vpERROR_TRACE ( "Error caught" ) ;
1561  throw ;
1562  }
1563 }
1564 
1565 
1581 void
1583  const vpImagePoint &center,
1584  float angle,
1585  unsigned int width, unsigned int height,
1586  const vpColor &color,
1587  unsigned int thickness)
1588 {
1589  try
1590  {
1591  if (I.display != NULL)
1592  {
1593  double i = center.get_i();
1594  double j = center.get_j();
1595 
1596  //A, B, C, D, corners of the rectangle clockwise
1597  vpImagePoint ipa, ipb, ipc, ipd;
1598  double cosinus = cos(angle);
1599  double sinus = sin(angle);
1600  ipa.set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1601  ipa.set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1602  ipb.set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1603  ipb.set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1604  ipc.set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1605  ipc.set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1606  ipd.set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1607  ipd.set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1608 
1609  ( I.display )->displayLine(I, ipa, ipb, color, thickness);
1610  ( I.display )->displayLine(I, ipa, ipd, color, thickness);
1611  ( I.display )->displayLine(I, ipc, ipb, color, thickness);
1612  ( I.display )->displayLine(I, ipc, ipd, color, thickness);
1613  }
1614  }
1615  catch(...)
1616  {
1617  vpERROR_TRACE("Error caught in displayRectangle") ;
1618  throw ;
1619  }
1620 }
1621 
1636 void
1638  const vpImagePoint &topLeft,
1639  unsigned int width, unsigned int height,
1640  const vpColor &color, bool fill,
1641  unsigned int thickness)
1642 {
1643  try
1644  {
1645  if ( I.display != NULL )
1646  {
1647  ( I.display )->displayRectangle ( topLeft, width, height, color,
1648  fill, thickness ) ;
1649  }
1650  }
1651  catch ( ... )
1652  {
1653  vpERROR_TRACE ( "Error caught" ) ;
1654  throw ;
1655  }
1656 }
1671 void
1673  const vpImagePoint &topLeft,
1674  const vpImagePoint &bottomRight,
1675  const vpColor &color, bool fill,
1676  unsigned int thickness)
1677 {
1678  try
1679  {
1680  if ( I.display != NULL )
1681  {
1682  ( I.display )->displayRectangle ( topLeft, bottomRight, color,
1683  fill, thickness ) ;
1684  }
1685  }
1686  catch ( ... )
1687  {
1688  vpERROR_TRACE ( "Error caught" ) ;
1689  throw ;
1690  }
1691 }
1706 void
1708  const vpRect &rectangle,
1709  const vpColor &color, bool fill,
1710  unsigned int thickness )
1711 {
1712  try
1713  {
1714  if ( I.display != NULL )
1715  {
1716  ( I.display )->displayRectangle ( rectangle, color, fill, thickness ) ;
1717  }
1718  }
1719  catch ( ... )
1720  {
1721  vpERROR_TRACE ( "Error caught" ) ;
1722  throw ;
1723  }
1724 }
1725 
1726 
1742 void
1744  const vpImagePoint &center,
1745  float angle,
1746  unsigned int width, unsigned int height,
1747  const vpColor &color,
1748  unsigned int thickness)
1749 {
1750  try
1751  {
1752  if (I.display != NULL)
1753  {
1754  double i = center.get_i();
1755  double j = center.get_j();
1756 
1757  //A, B, C, D, corners of the rectangle clockwise
1758  vpImagePoint ipa, ipb, ipc, ipd;
1759  double cosinus = cos(angle);
1760  double sinus = sin(angle);
1761  ipa.set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1762  ipa.set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1763  ipb.set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1764  ipb.set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1765  ipc.set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1766  ipc.set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1767  ipd.set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1768  ipd.set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1769 
1770  ( I.display )->displayLine(I, ipa, ipb, color, thickness);
1771  ( I.display )->displayLine(I, ipa, ipd, color, thickness);
1772  ( I.display )->displayLine(I, ipc, ipb, color, thickness);
1773  ( I.display )->displayLine(I, ipc, ipd, color, thickness);
1774  }
1775  }
1776  catch(...)
1777  {
1778  vpERROR_TRACE("Error caught in displayRectangle") ;
1779  throw ;
1780  }
1781 }
1782 
1799 void
1801  int i, int j,
1802  unsigned int width, unsigned int height,
1803  const vpColor &color, bool fill,
1804  unsigned int thickness)
1805 {
1806  try
1807  {
1808  if ( I.display != NULL )
1809  {
1810  vpImagePoint topLeft;
1811  topLeft.set_i( i );
1812  topLeft.set_j( j );
1813 
1814  ( I.display )->displayRectangle ( topLeft, width, height,
1815  color, fill, thickness ) ;
1816  }
1817  }
1818  catch ( ... )
1819  {
1820  vpERROR_TRACE ( "Error caught" ) ;
1821  throw ;
1822  }
1823 }
1839 void
1841  unsigned int i, unsigned int j, float angle,
1842  unsigned int width, unsigned int height,
1843  const vpColor &color,unsigned int thickness)
1844 {
1845  try
1846  {
1847  if (I.display != NULL)
1848  {
1849  //A, B, C, D, corners of the rectangle clockwise
1850  vpImagePoint ipa, ipb, ipc, ipd;
1851  float cosinus = cos(angle);
1852  float sinus = sin(angle);
1853  ipa.set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1854  ipa.set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1855  ipb.set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1856  ipb.set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1857  ipc.set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1858  ipc.set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1859  ipd.set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1860  ipd.set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1861 
1862  ( I.display )->displayLine(I, ipa, ipb, color, thickness);
1863  ( I.display )->displayLine(I, ipa, ipd, color, thickness);
1864  ( I.display )->displayLine(I, ipc, ipb, color, thickness);
1865  ( I.display )->displayLine(I, ipc, ipd, color, thickness);
1866  }
1867  }
1868  catch(...)
1869  {
1870  vpERROR_TRACE("Error caught in displayRectangle") ;
1871  throw ;
1872  }
1873 }
1874 
1891 void
1893  int i, int j,
1894  unsigned int width, unsigned int height,
1895  const vpColor &color, bool fill,
1896  unsigned int thickness)
1897 {
1898  try
1899  {
1900  if ( I.display != NULL )
1901  {
1902  vpImagePoint topLeft;
1903  topLeft.set_i( i );
1904  topLeft.set_j( j );
1905 
1906  ( I.display )->displayRectangle ( topLeft, width, height,
1907  color, fill, thickness ) ;
1908  }
1909  }
1910  catch ( ... )
1911  {
1912  vpERROR_TRACE ( "Error caught" ) ;
1913  throw ;
1914  }
1915 }
1930 void
1932  unsigned int i, unsigned int j, float angle,
1933  unsigned int width, unsigned int height,
1934  const vpColor &color, unsigned int thickness)
1935 {
1936  try
1937  {
1938  if (I.display != NULL)
1939  {
1940  //A, B, C, D, corners of the rectangle clockwise
1941  vpImagePoint ipa, ipb, ipc, ipd;
1942  float cosinus = cos(angle);
1943  float sinus = sin(angle);
1944  ipa.set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1945  ipa.set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1946  ipb.set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1947  ipb.set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1948  ipc.set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1949  ipc.set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1950  ipd.set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1951  ipd.set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1952 
1953  ( I.display )->displayLine(I, ipa, ipb, color, thickness);
1954  ( I.display )->displayLine(I, ipa, ipd, color, thickness);
1955  ( I.display )->displayLine(I, ipc, ipb, color, thickness);
1956  ( I.display )->displayLine(I, ipc, ipd, color, thickness);
1957  }
1958  }
1959  catch(...)
1960  {
1961  vpERROR_TRACE("Error caught in displayRectangle") ;
1962  throw ;
1963  }
1964 }
1965 
1995 {
1996 
1997  try
1998  {
1999  if ( I.display != NULL )
2000  {
2001  ( I.display )->flushDisplay() ;
2002  }
2003  }
2004  catch ( ... )
2005  {
2006  vpERROR_TRACE ( "Error caught" ) ;
2007  throw ;
2008  }
2009 }
2010 
2012 {
2013 
2014  try
2015  {
2016  if ( I.display != NULL )
2017  {
2018  ( I.display )->flushDisplayROI(roi.getTopLeft(),(unsigned int)roi.getWidth(),(unsigned int)roi.getHeight()) ;
2019  }
2020  }
2021  catch ( ... )
2022  {
2023  vpERROR_TRACE ( "Error caught" ) ;
2024  throw ;
2025  }
2026 }
2027 
2032 {
2033 
2034  try
2035  {
2036  if ( I.display != NULL )
2037  {
2038  ( I.display )->closeDisplay() ;
2039  I.display = NULL;
2040  }
2041  }
2042  catch ( ... )
2043  {
2044  vpERROR_TRACE ( "Error caught" ) ;
2045  throw ;
2046  }
2047 }
2048 
2049 
2055 void
2056 vpDisplay::setTitle ( const vpImage<vpRGBa> &I, const char *windowtitle )
2057 {
2058 
2059  try
2060  {
2061  if ( I.display != NULL )
2062  {
2063  ( I.display )->setTitle ( windowtitle ) ;
2064  }
2065  }
2066  catch ( ... )
2067  {
2068  vpERROR_TRACE ( "Error caught" ) ;
2069  throw ;
2070  }
2071 }
2072 
2082 void
2083 vpDisplay::setWindowPosition ( const vpImage<vpRGBa> &I, int winx, int winy )
2084 {
2085 
2086  try
2087  {
2088  if ( I.display != NULL )
2089  {
2090  ( I.display )->setWindowPosition ( winx, winy ) ;
2091  }
2092  }
2093  catch ( ... )
2094  {
2095  vpERROR_TRACE ( "Error caught" ) ;
2096  throw ;
2097  }
2098 }
2099 
2113 void
2114 vpDisplay::setFont ( const vpImage<vpRGBa> &I, const char *fontname )
2115 {
2116 
2117  try
2118  {
2119  if ( I.display != NULL )
2120  {
2121  ( I.display )->setFont ( fontname ) ;
2122  }
2123  }
2124  catch ( ... )
2125  {
2126  vpERROR_TRACE ( "Error caught" ) ;
2127  throw ;
2128  }
2129 }
2130 
2140 void
2142 {
2143  try
2144  {
2145  if ( I.display != NULL )
2146  {
2147  ( I.display )->clearDisplay ( color ) ;
2148  }
2149  }
2150  catch ( ... )
2151  {
2152  vpERROR_TRACE ( "Error caught" ) ;
2153  throw ;
2154  }
2155 }
2156 
2168 void
2170 {
2171 
2172  try
2173  {
2174  if ( I.display != NULL )
2175  {
2176  ( I.display )->displayImage ( I ) ;
2177  }
2178  }
2179  catch ( ... )
2180  {
2181  vpERROR_TRACE ( "Error caught" ) ;
2182  throw ;
2183  }
2184 }
2185 
2186 void
2188 {
2189  vpImagePoint topLeft;
2190  double top = floor(roi.getTop());
2191  double left = floor(roi.getLeft());
2192  double roiheight = floor(roi.getHeight());
2193  double roiwidth = floor(roi.getWidth());
2194  double iheight = (double)(I.getHeight());
2195  double iwidth = (double)(I.getWidth());
2196 
2197  if (top < 0 || top >= iheight || left < 0 || left >= iwidth || top+roiheight >= iheight || left+roiwidth >= iwidth)
2198  {
2199  vpERROR_TRACE ( "Region of interest outside of the image" ) ;
2201  "Region of interest outside of the image" ) ) ;
2202  }
2203 
2204  try
2205  {
2206  if ( I.display != NULL )
2207  {
2208  ( I.display )->displayImageROI ( I , vpImagePoint(top,left), (unsigned int)roiwidth,(unsigned int)roiheight ) ;
2209  }
2210  }
2211  catch ( ... )
2212  {
2213  vpERROR_TRACE ( "Error caught" ) ;
2214  throw ;
2215  }
2216 }
2217 
2218 
2285 void
2287 {
2288 
2289  try
2290  {
2291  if ( Isrc.display != NULL )
2292  {
2293  ( Isrc.display )->getImage ( Idest ) ;
2294  }
2295  else {
2296  Idest = Isrc;
2297  }
2298  }
2299  catch ( ... )
2300  {
2301  vpERROR_TRACE ( "Error caught" ) ;
2302  throw ;
2303  }
2304 }
2305 
2336 {
2337 
2338  try
2339  {
2340  if ( I.display != NULL )
2341  {
2342  ( I.display )->flushDisplay() ;
2343  }
2344  }
2345  catch ( ... )
2346  {
2347  vpERROR_TRACE ( "Error caught" ) ;
2348  throw ;
2349  }
2350 }
2351 
2352 void vpDisplay::flushROI ( const vpImage<vpRGBa> &I, const vpRect &roi )
2353 {
2354 
2355  try
2356  {
2357  if ( I.display != NULL )
2358  {
2359  ( I.display )->flushDisplayROI(roi.getTopLeft(),(unsigned int)roi.getWidth(),(unsigned int)roi.getHeight()) ;
2360  }
2361  }
2362  catch ( ... )
2363  {
2364  vpERROR_TRACE ( "Error caught" ) ;
2365  throw ;
2366  }
2367 }
2368 
2373 {
2374 
2375  try
2376  {
2377  if ( I.display != NULL )
2378  {
2379  ( I.display )->closeDisplay() ;
2380  I.display = NULL;
2381  }
2382  }
2383  catch ( ... )
2384  {
2385  vpERROR_TRACE ( "Error caught" ) ;
2386  throw ;
2387  }
2388 }
2389 
2407 bool vpDisplay::getClick ( const vpImage<unsigned char> &I, bool blocking )
2408 {
2409  try
2410  {
2411  if ( I.display != NULL )
2412  {
2413  return ( I.display )->getClick(blocking) ;
2414  }
2415  }
2416  catch ( ... )
2417  {
2418  vpERROR_TRACE ( "Error caught" ) ;
2419  throw ;
2420  }
2421  return false ;
2422 }
2423 
2445  vpImagePoint &ip, bool blocking )
2446 {
2447  try
2448  {
2449  if ( I.display != NULL )
2450  {
2451  return ( I.display )->getClick ( ip, blocking ) ;
2452  }
2453  }
2454  catch ( ... )
2455  {
2456  vpERROR_TRACE ( "Error caught" ) ;
2457  throw ;
2458  }
2459  return false ;
2460 }
2461 
2484  vpImagePoint &ip,
2486  bool blocking)
2487 {
2488  try
2489  {
2490  if ( I.display != NULL )
2491  {
2492  return ( I.display )->getClick ( ip, button, blocking ) ;
2493  }
2494  }
2495  catch ( ... )
2496  {
2497  vpERROR_TRACE ( "Error caught" ) ;
2498  throw ;
2499  }
2500  return false ;
2501 }
2502 
2524 bool
2526  vpImagePoint &ip,
2528  bool blocking )
2529 {
2530  try
2531  {
2532  if ( I.display != NULL )
2533  {
2534  return ( I.display )->getClickUp ( ip, button, blocking ) ;
2535  }
2536  }
2537  catch ( ... )
2538  {
2539  vpERROR_TRACE ( "Error caught" ) ;
2540  throw ;
2541  }
2542  return false ;
2543 }
2629 bool
2631 {
2632  try
2633  {
2634  if ( I.display != NULL )
2635  {
2636  return ( I.display )->getKeyboardEvent ( blocking ) ;
2637  }
2638  }
2639  catch ( ... )
2640  {
2641  vpERROR_TRACE ( "Error caught" ) ;
2642  throw ;
2643  }
2644  return false ;
2645 }
2646 
2736 bool
2738  char *string, bool blocking)
2739 {
2740  try
2741  {
2742  if ( I.display != NULL )
2743  {
2744  return ( I.display )->getKeyboardEvent ( string, blocking ) ;
2745  }
2746  }
2747  catch ( ... )
2748  {
2749  vpERROR_TRACE ( "Error caught" ) ;
2750  throw ;
2751  }
2752  return false ;
2753 }
2764 bool
2766  vpImagePoint &ip)
2767 {
2768  try
2769  {
2770  if ( I.display != NULL )
2771  {
2772  return ( I.display )->getPointerMotionEvent ( ip ) ;
2773  }
2774  }
2775  catch ( ... )
2776  {
2777  vpERROR_TRACE ( "Error caught" ) ;
2778  throw ;
2779  }
2780  return false;
2781 }
2782 
2793 bool
2795  vpImagePoint &ip)
2796 {
2797  try
2798  {
2799  if ( I.display != NULL )
2800  {
2801  return ( I.display )->getPointerPosition ( ip ) ;
2802  }
2803  }
2804  catch ( ... )
2805  {
2806  vpERROR_TRACE ( "Error caught" ) ;
2807  throw ;
2808  }
2809  return false;
2810 }
2811 
2825 bool vpDisplay::getClick ( const vpImage<vpRGBa> &I, bool blocking )
2826 {
2827  try
2828  {
2829  if ( I.display != NULL )
2830  {
2831  return ( I.display )->getClick(blocking) ;
2832  }
2833  }
2834  catch ( ... )
2835  {
2836  vpERROR_TRACE ( "Error caught" ) ;
2837  throw ;
2838  }
2839  return false;
2840 }
2841 
2842 
2862  vpImagePoint &ip, bool blocking )
2863 {
2864  try
2865  {
2866  if ( I.display != NULL )
2867  {
2868  return ( I.display )->getClick ( ip, blocking ) ;
2869  }
2870  }
2871  catch ( ... )
2872  {
2873  vpERROR_TRACE ( "Error caught" ) ;
2874  throw ;
2875  }
2876  return false ;
2877 }
2878 
2900  vpImagePoint &ip,
2902  bool blocking )
2903 {
2904  try
2905  {
2906  if ( I.display != NULL )
2907  {
2908  return ( I.display )->getClick ( ip, button, blocking ) ;
2909  }
2910  }
2911  catch ( ... )
2912  {
2913  vpERROR_TRACE ( "Error caught" ) ;
2914  throw ;
2915  }
2916  return false ;
2917 }
2918 
2939 bool
2941  vpImagePoint &ip,
2943  bool blocking )
2944 {
2945  try
2946  {
2947  if ( I.display != NULL )
2948  {
2949  return ( I.display )->getClickUp ( ip, button, blocking ) ;
2950  }
2951  }
2952  catch ( ... )
2953  {
2954  vpERROR_TRACE ( "Error caught" ) ;
2955  throw ;
2956  }
2957  return false ;
2958 }
2959 
3044 bool
3046 {
3047  try
3048  {
3049  if ( I.display != NULL )
3050  {
3051  return ( I.display )->getKeyboardEvent ( blocking ) ;
3052  }
3053  }
3054  catch ( ... )
3055  {
3056  vpERROR_TRACE ( "Error caught" ) ;
3057  throw ;
3058  }
3059  return false ;
3060 }
3061 
3149 bool
3151  char *string, bool blocking)
3152 {
3153  try
3154  {
3155  if ( I.display != NULL )
3156  {
3157  return ( I.display )->getKeyboardEvent ( string, blocking ) ;
3158  }
3159  }
3160  catch ( ... )
3161  {
3162  vpERROR_TRACE ( "Error caught" ) ;
3163  throw ;
3164  }
3165  return false ;
3166 }
3177 bool
3179 {
3180  try
3181  {
3182  if ( I.display != NULL )
3183  {
3184  return ( I.display )->getPointerMotionEvent ( ip ) ;
3185  }
3186  }
3187  catch ( ... )
3188  {
3189  vpERROR_TRACE ( "Error caught" ) ;
3190  throw ;
3191  }
3192  return false;
3193 }
3194 
3204 bool
3206 {
3207  try
3208  {
3209  if ( I.display != NULL )
3210  {
3211  return ( I.display )->getPointerPosition ( ip ) ;
3212  }
3213  }
3214  catch ( ... )
3215  {
3216  vpERROR_TRACE ( "Error caught" ) ;
3217  throw ;
3218  }
3219  return false;
3220 }
static void displayCamera(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size, const vpColor &color, unsigned int thickness)
Definition: vpDisplay.cpp:509
virtual void displayCircle(const vpImagePoint &center, unsigned int radius, const vpColor &color, bool fill=false, unsigned int thickness=1)=0
vpDisplay * display
Definition: vpImage.h:121
double getTop() const
Definition: vpRect.h:174
virtual void displayImage(const vpImage< unsigned char > &I)=0
Class that defines generic functionnalities for display.
Definition: vpDisplay.h:176
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
unsigned int width
Definition: vpDisplay.h:185
static void close(vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:2031
double get_i() const
Definition: vpImagePoint.h:194
unsigned int getWidth() const
Definition: vpImage.h:159
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...
#define vpERROR_TRACE
Definition: vpDebug.h:395
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.
Definition: vpColor.h:125
virtual void clearDisplay(const vpColor &color=vpColor::white)=0
static const vpColor none
Definition: vpColor.h:179
virtual bool getClickUp(vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking=true)=0
error that can be emited by ViSP classes.
Definition: vpException.h:76
void track(const vpHomogeneousMatrix &cMo)
double getHeight() const
Definition: vpRect.h:155
virtual bool getPointerMotionEvent(vpImagePoint &ip)=0
bool displayHasBeenInitialized
display has been initialized
Definition: vpDisplay.h:180
static const vpColor green
Definition: vpColor.h:170
static void flush(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:1994
double get_j() const
Definition: vpImagePoint.h:205
vpImagePoint getTopLeft() const
Definition: vpRect.h:180
static const vpColor red
Definition: vpColor.h:167
Class that defines what is a point.
Definition: vpPoint.h:65
virtual void flushDisplay()=0
void set_i(const double ii)
Definition: vpImagePoint.h:158
double getWidth() const
Definition: vpRect.h:193
virtual bool getPointerPosition(vpImagePoint &ip)=0
virtual bool getKeyboardEvent(bool blocking=true)=0
void set_u(const double u)
Definition: vpImagePoint.h:216
virtual void setWindowPosition(int winx, int winy)=0
static void display(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:206
unsigned int height
Definition: vpDisplay.h:186
virtual void displayCross(const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)=0
void set_v(const double v)
Definition: vpImagePoint.h:227
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)
Definition: vpDisplay.cpp:371
virtual ~vpDisplay()
Definition: vpDisplay.cpp:80
static void getImage(const vpImage< unsigned char > &Is, vpImage< vpRGBa > &Id)
Definition: vpDisplay.cpp:324
virtual void displayDotLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)=0
void set_j(const double jj)
Definition: vpImagePoint.h:169
virtual void closeDisplay()=0
virtual void displayCharString(const vpImagePoint &ip, const char *text, const vpColor &color=vpColor::green)=0
int windowXPosition
display position
Definition: vpDisplay.h:182
static void setBackground(const vpImage< unsigned char > &I, const vpColor &color)
Definition: vpDisplay.cpp:178
unsigned int getHeight() const
Definition: vpImage.h:150
Defines a rectangle in the plane.
Definition: vpRect.h:85
static void flushROI(const vpImage< unsigned char > &I, const vpRect &roi)
Definition: vpDisplay.cpp:2011
static void displayROI(const vpImage< unsigned char > &I, const vpRect &roi)
Definition: vpDisplay.cpp:225
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 ...
Definition: vpImagePoint.h:92
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
Definition: vpDisplay.h:184
double getLeft() const
Definition: vpRect.h:161
virtual void displayPoint(const vpImagePoint &ip, const vpColor &color)=0
vpColVector p
Definition: vpTracker.h:78
static const vpColor blue
Definition: vpColor.h:173
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...
Definition: vpPoint.cpp:74