ViSP  2.6.2
vpDisplay.cpp
1 /****************************************************************************
2  *
3  * $Id: vpDisplay.cpp 3675 2012-04-05 12:21:45Z 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 #include <visp/vpDisplay.h>
44 #include <visp/vpDisplayException.h>
45 
46 #include <visp/vpPoint.h>
47 #include <visp/vpMeterPixelConversion.h>
48 #include <visp/vpMath.h>
49 
50 
60 {
61  title = NULL ;
63 }
64 
78 void
80  const char *fontname )
81 {
82 
83  try
84  {
85  if ( I.display != NULL )
86  {
87  ( I.display )->setFont ( fontname ) ;
88  }
89  }
90  catch ( ... )
91  {
92  vpERROR_TRACE ( "Error caught" ) ;
93  throw ;
94  }
95 }
101 void
103  const char *windowtitle )
104 {
105 
106  try
107  {
108  if ( I.display != NULL )
109  {
110  ( I.display )->setTitle ( windowtitle ) ;
111  }
112  }
113  catch ( ... )
114  {
115  vpERROR_TRACE ( "Error caught" ) ;
116  throw ;
117  }
118 }
119 
129 void
131  int winx, int winy )
132 {
133 
134  try
135  {
136  if ( I.display != NULL )
137  {
138  ( I.display )->setWindowPosition ( winx, winy ) ;
139  }
140  }
141  catch ( ... )
142  {
143  vpERROR_TRACE ( "Error caught" ) ;
144  throw ;
145  }
146 }
147 
157 void
159 {
160  try
161  {
162  if ( I.display != NULL )
163  {
164  ( I.display )->clearDisplay ( color ) ;
165  }
166  }
167  catch ( ... )
168  {
169  vpERROR_TRACE ( "Error caught" ) ;
170  throw ;
171  }
172 }
173 
185 void
187 {
188 
189  try
190  {
191  if ( I.display != NULL )
192  {
193  ( I.display )->displayImage ( I ) ;
194  }
195  }
196  catch ( ... )
197  {
198  vpERROR_TRACE ( "Error caught" ) ;
199  throw ;
200  }
201 }
202 
203 
204 void
206 {
207  vpImagePoint topLeft;
208  double top = floor(roi.getTop());
209  double left = floor(roi.getLeft());
210  double roiheight = floor(roi.getHeight());
211  double roiwidth = floor(roi.getWidth());
212  double iheight = (double)(I.getHeight());
213  double iwidth = (double)(I.getWidth());
214 
215  if (top < 0 || top > iheight || left < 0 || left > iwidth || top+roiheight > iheight || left+roiwidth > iwidth)
216  {
217  vpERROR_TRACE ( "Region of interest outside of the image" ) ;
218  throw ( vpException ( vpException::dimensionError,"Region of interest outside of the image" ) ) ;
219  }
220 
221  try
222  {
223  if ( I.display != NULL )
224  {
225  ( I.display )->displayImageROI ( I , vpImagePoint(top,left), (unsigned int)roiwidth,(unsigned int)roiheight ) ;
226  }
227  }
228  catch ( ... )
229  {
230  vpERROR_TRACE ( "Error caught" ) ;
231  throw ;
232  }
233 }
234 
235 
236 
299 void
301  vpImage<vpRGBa> &Idest )
302 {
303 
304  try
305  {
306  if ( Isrc.display != NULL )
307  {
308  ( Isrc.display )->getImage ( Idest ) ;
309  }
310  else
311  {
312  vpERROR_TRACE ( "Display not initialized" ) ;
314  "Display not initialized" ) ) ;
315  }
316  }
317  catch ( ... )
318  {
319  vpERROR_TRACE ( "Error caught" ) ;
320  throw ;
321  }
322 }
323 
324 
345 void
347  const vpHomogeneousMatrix &cMo,
348  const vpCameraParameters &cam,
349  double size,
350  const vpColor &color, unsigned int thickness)
351 {
352  // used by display
353  vpPoint o; o.setWorldCoordinates ( 0.0,0.0,0.0 ) ;
354  vpPoint x; x.setWorldCoordinates ( size,0.0,0.0 ) ;
355  vpPoint y; y.setWorldCoordinates ( 0.0,size,0.0 ) ;
356  vpPoint z; z.setWorldCoordinates ( 0.0,0.0,size ) ;
357 
358  o.track ( cMo ) ;
359  x.track ( cMo ) ;
360  y.track ( cMo ) ;
361  z.track ( cMo ) ;
362 
363  vpImagePoint ipo, ip1;
364 
365  if ( color == vpColor::none )
366  {
367  vpMeterPixelConversion::convertPoint ( cam, o.p[0], o.p[1], ipo) ;
368 
369  vpMeterPixelConversion::convertPoint ( cam, x.p[0], x.p[1], ip1) ;
370  vpDisplay::displayArrow ( I, ipo, ip1, vpColor::red, 4*thickness, 2*thickness, thickness) ;
371 
372  vpMeterPixelConversion::convertPoint ( cam, y.p[0], y.p[1], ip1) ;
373  vpDisplay::displayArrow ( I, ipo, ip1, vpColor::green, 4*thickness, 2*thickness, thickness) ;
374 
375  vpMeterPixelConversion::convertPoint ( cam, z.p[0], z.p[1], ip1) ;
376  vpDisplay::displayArrow ( I,ipo, ip1, vpColor::blue, 4*thickness, 2*thickness, thickness) ;
377  }
378  else
379  {
380  vpMeterPixelConversion::convertPoint ( cam, o.p[0], o.p[1], ipo) ;
381 
382  vpMeterPixelConversion::convertPoint ( cam, x.p[0], x.p[1], ip1) ;
383  vpDisplay::displayArrow ( I, ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
384 
385  vpMeterPixelConversion::convertPoint ( cam, y.p[0], y.p[1], ip1) ;
386  vpDisplay::displayArrow ( I, ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
387 
388  vpMeterPixelConversion::convertPoint ( cam, z.p[0], z.p[1], ip1) ;
389  vpDisplay::displayArrow ( I,ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
390 
391  }
392 }
393 
394 
415 void
417  const vpHomogeneousMatrix &cMo,
418  const vpCameraParameters &cam,
419  double size, const vpColor &color,
420  unsigned int thickness )
421 {
422  // used by display
423  vpPoint o; o.setWorldCoordinates ( 0.0,0.0,0.0 ) ;
424  vpPoint x; x.setWorldCoordinates ( size,0.0,0.0 ) ;
425  vpPoint y; y.setWorldCoordinates ( 0.0,size,0.0 ) ;
426  vpPoint z; z.setWorldCoordinates ( 0.0,0.0,size ) ;
427 
428  o.track ( cMo ) ;
429  x.track ( cMo ) ;
430  y.track ( cMo ) ;
431  z.track ( cMo ) ;
432 
433  vpImagePoint ipo, ip1;
434  if ( color == vpColor::none )
435  {
436  vpMeterPixelConversion::convertPoint ( cam, o.p[0], o.p[1], ipo) ;
437 
438  vpMeterPixelConversion::convertPoint ( cam, x.p[0], x.p[1], ip1) ;
439  vpDisplay::displayArrow ( I, ipo, ip1, vpColor::red, 4, 2, thickness) ;
440 
441  vpMeterPixelConversion::convertPoint ( cam, y.p[0], y.p[1], ip1) ;
442  vpDisplay::displayArrow ( I, ipo, ip1, vpColor::green, 4, 2, thickness) ;
443 
444  vpMeterPixelConversion::convertPoint ( cam, z.p[0], z.p[1], ip1) ;
445  vpDisplay::displayArrow ( I,ipo, ip1, vpColor::blue, 4, 2, thickness) ;
446  }
447  else
448  {
449  vpMeterPixelConversion::convertPoint ( cam, o.p[0], o.p[1], ipo) ;
450 
451  vpMeterPixelConversion::convertPoint ( cam, x.p[0], x.p[1], ip1) ;
452  vpDisplay::displayArrow ( I, ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
453 
454  vpMeterPixelConversion::convertPoint ( cam, y.p[0], y.p[1], ip1) ;
455  vpDisplay::displayArrow ( I, ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
456 
457  vpMeterPixelConversion::convertPoint ( cam, z.p[0], z.p[1], ip1) ;
458  vpDisplay::displayArrow ( I,ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
459 
460  }
461 }
462 
481 void
483  const vpHomogeneousMatrix &cMo,
484  const vpCameraParameters &cam,
485  double size,
486  const vpColor &color)
487 {
488  // used by display
489  double halfSize = size/2.0;
490  vpPoint pt[5];
491  pt[0].setWorldCoordinates ( -halfSize,-halfSize,0.0 );
492  pt[1].setWorldCoordinates ( halfSize,-halfSize,0.0 );
493  pt[2].setWorldCoordinates ( halfSize,halfSize,0.0 );
494  pt[3].setWorldCoordinates ( -halfSize,halfSize,0.0 );
495  pt[4].setWorldCoordinates ( 0.0,0.0,-size );
496 
497  for (int i = 0; i < 5; i++)
498  pt[i].track ( cMo ) ;
499 
500  vpImagePoint ip, ip_1, ip0;
501  vpMeterPixelConversion::convertPoint ( cam, pt[4].p[0], pt[4].p[1], ip0);
502 
503  for (int i = 0; i < 4; i++)
504  {
505  vpMeterPixelConversion::convertPoint ( cam, pt[i].p[0], pt[i].p[1], ip_1);
506  vpMeterPixelConversion::convertPoint ( cam, pt[(i+1)%4].p[0], pt[(i+1)%4].p[1], ip);
507  vpDisplay::displayLine ( I, ip_1, ip, color, 1);
508  vpDisplay::displayLine ( I, ip0, ip_1, color, 1);
509  }
510 }
511 
512 
531 void
533  const vpHomogeneousMatrix &cMo,
534  const vpCameraParameters &cam,
535  double size, const vpColor &color)
536 {
537  // used by display
538  double halfSize = size/2.0;
539  vpPoint pt[5];
540  pt[0].setWorldCoordinates ( -halfSize,-halfSize,0.0 );
541  pt[1].setWorldCoordinates ( halfSize,-halfSize,0.0 );
542  pt[2].setWorldCoordinates ( halfSize,halfSize,0.0 );
543  pt[3].setWorldCoordinates ( -halfSize,halfSize,0.0 );
544  pt[4].setWorldCoordinates ( 0.0,0.0,-size );
545 
546  for (int i = 0; i < 5; i++)
547  pt[i].track ( cMo ) ;
548 
549  vpImagePoint ip, ip_1, ip0;
550  vpMeterPixelConversion::convertPoint ( cam, pt[4].p[0], pt[4].p[1], ip0);
551 
552  for (int i = 0; i < 4; i++)
553  {
554  vpMeterPixelConversion::convertPoint ( cam, pt[i].p[0], pt[i].p[1], ip_1);
555  vpMeterPixelConversion::convertPoint ( cam, pt[(i+1)%4].p[0], pt[(i+1)%4].p[1], ip);
556  vpDisplay::displayLine ( I, ip_1, ip, color, 1);
557  vpDisplay::displayLine ( I, ip0, ip_1, color, 1);
558  }
559 }
560 
569 void
571  const vpImagePoint &ip1, const vpImagePoint &ip2,
572  const vpColor &color,
573  unsigned int w,unsigned int h,
574  unsigned int thickness )
575 {
576  try
577  {
578  if ( I.display != NULL )
579  {
580  ( I.display )->displayArrow ( ip1, ip2, color, w, h, thickness ) ;
581  }
582  }
583  catch ( ... )
584  {
585  vpERROR_TRACE ( "Error caught" ) ;
586  throw ;
587  }
588 }
589 
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 
630 void
632  int i1, int j1, int i2, int j2,
633  const vpColor &color,
634  unsigned int w, unsigned int h,
635  unsigned int thickness)
636 {
637  try
638  {
639  if ( I.display != NULL )
640  {
641  vpImagePoint ip1, ip2;
642  ip1.set_i(i1);
643  ip1.set_j(j1);
644  ip2.set_i(i2);
645  ip2.set_j(j2);
646  ( I.display )->displayArrow ( ip1, ip2, color, w, h, thickness ) ;
647  }
648  }
649  catch ( ... )
650  {
651  vpERROR_TRACE ( "Error caught" ) ;
652  throw ;
653  }
654 }
655 
668 void
670  int i1, int j1, int i2, int j2,
671  const vpColor &color,
672  unsigned int w, unsigned int h,
673  unsigned int thickness)
674 {
675  try
676  {
677  if ( I.display != NULL )
678  {
679  vpImagePoint ip1, ip2;
680  ip1.set_i(i1);
681  ip1.set_j(j1);
682  ip2.set_i(i2);
683  ip2.set_j(j2);
684 
685  ( I.display )->displayArrow ( ip1, ip2, color, w, h, thickness ) ;
686  }
687  }
688  catch ( ... )
689  {
690  vpERROR_TRACE ( "Error caught" ) ;
691  throw ;
692  }
693 }
694 
709 void
711  const vpImagePoint &ip, const char *string,
712  const vpColor &color )
713 {
714  try
715  {
716  if ( I.display != NULL )
717  {
718  ( I.display )->displayCharString ( ip, string, color ) ;
719  }
720  }
721  catch ( ... )
722  {
723  vpERROR_TRACE ( "Error caught" ) ;
724  throw ;
725  }
726 }
727 
742 void
744  const vpImagePoint &ip, const char *string,
745  const vpColor &color )
746 {
747  try
748  {
749  if ( I.display != NULL )
750  {
751  ( I.display )->displayCharString ( ip, string, color ) ;
752  }
753  }
754  catch ( ... )
755  {
756  vpERROR_TRACE ( "Error caught" ) ;
757  throw ;
758  }
759 }
760 
775 void
777  int i, int j, const char *string,
778  const vpColor &color)
779 {
780  try
781  {
782  if ( I.display != NULL )
783  {
784  vpImagePoint ip;
785  ip.set_i( i );
786  ip.set_j( j );
787 
788  ( I.display )->displayCharString ( ip, string, color ) ;
789  }
790  }
791  catch ( ... )
792  {
793  vpERROR_TRACE ( "Error caught" ) ;
794  throw ;
795  }
796 }
797 
812 void
814  int i, int j, const char *string,
815  const vpColor &color)
816 {
817  try
818  {
819  if ( I.display != NULL )
820  {
821  vpImagePoint ip;
822  ip.set_i( i );
823  ip.set_j( j );
824  ( I.display )->displayCharString ( ip, string, color ) ;
825  }
826  }
827  catch ( ... )
828  {
829  vpERROR_TRACE ( "Error caught" ) ;
830  throw ;
831  }
832 }
833 
844 void
846  const vpImagePoint &center, unsigned int radius,
847  const vpColor &color,
848  bool fill,
849  unsigned int thickness)
850 {
851  try
852  {
853  if ( I.display != NULL )
854  {
855  ( I.display )->displayCircle ( center, radius, color, fill, thickness ) ;
856  }
857  }
858  catch ( ... )
859  {
860  vpERROR_TRACE ( "Error caught" ) ;
861  throw ;
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 }
906 void
908  int i, int j, unsigned int radius,
909  const vpColor &color,
910  bool fill,
911  unsigned int thickness)
912 {
913  try
914  {
915  if ( I.display != NULL )
916  {
917  vpImagePoint ip;
918  ip.set_i( i );
919  ip.set_j( j );
920 
921  ( I.display )->displayCircle ( ip, radius, color, fill, thickness ) ;
922  }
923  }
924  catch ( ... )
925  {
926  vpERROR_TRACE ( "Error caught" ) ;
927  throw ;
928  }
929 }
930 
931 
944 void
946  int i, int j, unsigned int radius,
947  const vpColor &color,
948  bool fill,
949  unsigned int thickness)
950 {
951  try
952  {
953  if ( I.display != NULL )
954  {
955  vpImagePoint ip;
956  ip.set_i( i );
957  ip.set_j( j );
958  ( I.display )->displayCircle ( ip, radius, color, fill, thickness ) ;
959  }
960  }
961  catch ( ... )
962  {
963  vpERROR_TRACE ( "Error caught" ) ;
964  throw ;
965  }
966 }
967 
977  const vpImagePoint &ip, unsigned int size,
978  const vpColor &color,
979  unsigned int thickness )
980 {
981  try
982  {
983  if ( I.display != NULL )
984  {
985  ( I.display )->displayCross ( ip, size, color, thickness ) ;
986  }
987  }
988  catch ( ... )
989  {
990  vpERROR_TRACE ( "Error caught" ) ;
991  throw ;
992  }
993 }
994 
1004  const vpImagePoint &ip, unsigned int size,
1005  const vpColor &color,
1006  unsigned int thickness )
1007 {
1008  try
1009  {
1010  if ( I.display != NULL )
1011  {
1012  ( I.display )->displayCross ( ip, size, color, thickness ) ;
1013  }
1014  }
1015  catch ( ... )
1016  {
1017  vpERROR_TRACE ( "Error caught" ) ;
1018  throw ;
1019  }
1020 }
1030  int i, int j,
1031  unsigned int size, const vpColor &color,
1032  unsigned int thickness )
1033 {
1034  try
1035  {
1036  if ( I.display != NULL )
1037  {
1038  vpImagePoint ip;
1039  ip.set_i( i );
1040  ip.set_j( j );
1041 
1042  ( I.display )->displayCross ( ip, size, color, thickness ) ;
1043  }
1044  }
1045  catch ( ... )
1046  {
1047  vpERROR_TRACE ( "Error caught" ) ;
1048  throw ;
1049  }
1050 }
1051 
1061  int i, int j,
1062  unsigned int size, const vpColor &color,
1063  unsigned int thickness )
1064 {
1065  try
1066  {
1067  if ( I.display != NULL )
1068  {
1069  vpImagePoint ip;
1070  ip.set_i( i );
1071  ip.set_j( j );
1072  ( I.display )->displayCross ( ip, size, color, thickness ) ;
1073  }
1074  }
1075  catch ( ... )
1076  {
1077  vpERROR_TRACE ( "Error caught" ) ;
1078  throw ;
1079  }
1080 }
1081 
1090  const vpImagePoint &ip1,
1091  const vpImagePoint &ip2,
1092  const vpColor &color,
1093  unsigned int thickness )
1094 {
1095  try
1096  {
1097  if ( I.display != NULL )
1098  {
1099  ( I.display )->displayDotLine ( ip1, ip2, color, thickness );
1100  }
1101  }
1102  catch ( ... )
1103  {
1104  vpERROR_TRACE ( "Error caught" ) ;
1105  throw ;
1106  }
1107 }
1108 
1117  const vpImagePoint &ip1,
1118  const vpImagePoint &ip2,
1119  const vpColor &color,
1120  unsigned int thickness )
1121 {
1122  try
1123  {
1124  if ( I.display != NULL )
1125  {
1126  ( I.display )->displayDotLine ( ip1, ip2, color, thickness );
1127  }
1128  }
1129  catch ( ... )
1130  {
1131  vpERROR_TRACE ( "Error caught" ) ;
1132  throw ;
1133  }
1134 }
1145  int i1, int j1, int i2, int j2,
1146  const vpColor &color,
1147  unsigned int thickness )
1148 {
1149  try
1150  {
1151  if ( I.display != NULL )
1152  {
1153  vpImagePoint ip1, ip2;
1154  ip1.set_i( i1 );
1155  ip1.set_j( j1 );
1156  ip2.set_i( i2 );
1157  ip2.set_j( j2 );
1158  ( I.display )->displayDotLine ( ip1, ip2, color, thickness );
1159  }
1160  }
1161  catch ( ... )
1162  {
1163  vpERROR_TRACE ( "Error caught" ) ;
1164  throw ;
1165  }
1166 }
1167 
1177  int i1, int j1,
1178  int i2, int j2,
1179  const vpColor &color,
1180  unsigned int thickness )
1181 {
1182  try
1183  {
1184  if ( I.display != NULL )
1185  {
1186  vpImagePoint ip1, ip2;
1187  ip1.set_i( i1 );
1188  ip1.set_j( j1 );
1189  ip2.set_i( i2 );
1190  ip2.set_j( j2 );
1191  ( I.display )->displayDotLine ( ip1, ip2, color, thickness );
1192  }
1193  }
1194  catch ( ... )
1195  {
1196  vpERROR_TRACE ( "Error caught" ) ;
1197  throw ;
1198  }
1199 }
1200 
1209  const vpImagePoint &ip1,
1210  const vpImagePoint &ip2,
1211  const vpColor &color,
1212  unsigned int thickness )
1213 {
1214 
1215  try
1216  {
1217  if ( I.display != NULL )
1218  {
1219  ( I.display )->displayLine ( ip1, ip2, color, thickness );
1220  }
1221  }
1222  catch ( ... )
1223  {
1224  vpERROR_TRACE ( "Error caught" ) ;
1225  throw ;
1226  }
1227 }
1228 
1239  int i1, int j1, int i2, int j2,
1240  const vpColor &color,
1241  unsigned int thickness )
1242 {
1243 
1244  try
1245  {
1246  if ( I.display != NULL )
1247  {
1248  vpImagePoint ip1, ip2;
1249  ip1.set_i( i1 );
1250  ip1.set_j( j1 );
1251  ip2.set_i( i2 );
1252  ip2.set_j( j2 );
1253  ( I.display )->displayLine ( ip1, ip2, color, thickness );
1254  }
1255  }
1256  catch ( ... )
1257  {
1258  vpERROR_TRACE ( "Error caught" ) ;
1259  throw ;
1260  }
1261 }
1262 
1263 
1274  int i1, int j1,
1275  int i2, int j2,
1276  const vpColor &color,
1277  unsigned int thickness )
1278 {
1279 
1280  try
1281  {
1282  if ( I.display != NULL )
1283  {
1284  vpImagePoint ip1, ip2;
1285  ip1.set_i( i1 );
1286  ip1.set_j( j1 );
1287  ip2.set_i( i2 );
1288  ip2.set_j( j2 );
1289  ( I.display )->displayLine ( ip1, ip2, color, thickness );
1290  }
1291  }
1292  catch ( ... )
1293  {
1294  vpERROR_TRACE ( "Error caught" ) ;
1295  throw ;
1296  }
1297 }
1298 
1307  const vpImagePoint &ip1,
1308  const vpImagePoint &ip2,
1309  const vpColor &color,
1310  unsigned int thickness )
1311 {
1312 
1313  try
1314  {
1315  if ( I.display != NULL )
1316  {
1317  ( I.display )->displayLine ( ip1, ip2, color, thickness );
1318  }
1319  }
1320  catch ( ... )
1321  {
1322  vpERROR_TRACE ( "Error caught" ) ;
1323  throw ;
1324  }
1325 }
1326 
1334  const vpImagePoint &ip,
1335  const vpColor &color )
1336 {
1337  try
1338  {
1339  if ( I.display != NULL )
1340  {
1341  ( I.display )->displayPoint ( ip, color ) ;
1342  }
1343  }
1344  catch ( ... )
1345  {
1346  vpERROR_TRACE ( "Error caught" ) ;
1347  throw ;
1348  }
1349 }
1357  const vpImagePoint &ip,
1358  const vpColor &color )
1359 {
1360  try
1361  {
1362  if ( I.display != NULL )
1363  {
1364  ( I.display )->displayPoint ( ip, color ) ;
1365  }
1366  }
1367  catch ( ... )
1368  {
1369  vpERROR_TRACE ( "Error caught" ) ;
1370  throw ;
1371  }
1372 }
1373 
1381  int i, int j,
1382  const vpColor &color )
1383 {
1384  try
1385  {
1386  if ( I.display != NULL )
1387  {
1388  vpImagePoint ip;
1389  ip.set_i( i );
1390  ip.set_j( j );
1391  ( I.display )->displayPoint ( ip, color ) ;
1392  }
1393  }
1394  catch ( ... )
1395  {
1396  vpERROR_TRACE ( "Error caught" ) ;
1397  throw ;
1398  }
1399 }
1400 
1401 
1409  int i, int j,
1410  const vpColor &color )
1411 {
1412  try
1413  {
1414  if ( I.display != NULL )
1415  {
1416  vpImagePoint ip;
1417  ip.set_i( i );
1418  ip.set_j( j );
1419  ( I.display )->displayPoint ( ip, color ) ;
1420  }
1421  }
1422  catch ( ... )
1423  {
1424  vpERROR_TRACE ( "Error caught" ) ;
1425  throw ;
1426  }
1427 }
1428 
1443 void
1445  const vpImagePoint &topLeft,
1446  unsigned int width, unsigned int height,
1447  const vpColor &color, bool fill,
1448  unsigned int thickness)
1449 {
1450  try
1451  {
1452  if ( I.display != NULL )
1453  {
1454  ( I.display )->displayRectangle ( topLeft, width, height, color,
1455  fill, thickness ) ;
1456  }
1457  }
1458  catch ( ... )
1459  {
1460  vpERROR_TRACE ( "Error caught" ) ;
1461  throw ;
1462  }
1463 }
1464 
1465 
1480 void
1482  const vpImagePoint &topLeft,
1483  const vpImagePoint &bottomRight,
1484  const vpColor &color, bool fill,
1485  unsigned int thickness)
1486 {
1487  try
1488  {
1489  if ( I.display != NULL )
1490  {
1491  ( I.display )->displayRectangle ( topLeft, bottomRight, color,
1492  fill, thickness ) ;
1493  }
1494  }
1495  catch ( ... )
1496  {
1497  vpERROR_TRACE ( "Error caught" ) ;
1498  throw ;
1499  }
1500 }
1515 void
1517  const vpRect &rectangle,
1518  const vpColor &color, bool fill,
1519  unsigned int thickness )
1520 {
1521  try
1522  {
1523  if ( I.display != NULL )
1524  {
1525  ( I.display )->displayRectangle ( rectangle, color, fill, thickness ) ;
1526  }
1527  }
1528  catch ( ... )
1529  {
1530  vpERROR_TRACE ( "Error caught" ) ;
1531  throw ;
1532  }
1533 }
1534 
1535 
1551 void
1553  const vpImagePoint &center,
1554  float angle,
1555  unsigned int width, unsigned int height,
1556  const vpColor &color,
1557  unsigned int thickness)
1558 {
1559  try
1560  {
1561  if (I.display != NULL)
1562  {
1563  double i = center.get_i();
1564  double j = center.get_j();
1565 
1566  //A, B, C, D, corners of the rectangle clockwise
1567  vpImagePoint ipa, ipb, ipc, ipd;
1568  double cosinus = cos(angle);
1569  double sinus = sin(angle);
1570  ipa.set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1571  ipa.set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1572  ipb.set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1573  ipb.set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1574  ipc.set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1575  ipc.set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1576  ipd.set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1577  ipd.set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1578 
1579  ( I.display )->displayLine(I, ipa, ipb, color, thickness);
1580  ( I.display )->displayLine(I, ipa, ipd, color, thickness);
1581  ( I.display )->displayLine(I, ipc, ipb, color, thickness);
1582  ( I.display )->displayLine(I, ipc, ipd, color, thickness);
1583  }
1584  }
1585  catch(...)
1586  {
1587  vpERROR_TRACE("Error caught in displayRectangle") ;
1588  throw ;
1589  }
1590 }
1591 
1606 void
1608  const vpImagePoint &topLeft,
1609  unsigned int width, unsigned int height,
1610  const vpColor &color, bool fill,
1611  unsigned int thickness)
1612 {
1613  try
1614  {
1615  if ( I.display != NULL )
1616  {
1617  ( I.display )->displayRectangle ( topLeft, width, height, color,
1618  fill, thickness ) ;
1619  }
1620  }
1621  catch ( ... )
1622  {
1623  vpERROR_TRACE ( "Error caught" ) ;
1624  throw ;
1625  }
1626 }
1641 void
1643  const vpImagePoint &topLeft,
1644  const vpImagePoint &bottomRight,
1645  const vpColor &color, bool fill,
1646  unsigned int thickness)
1647 {
1648  try
1649  {
1650  if ( I.display != NULL )
1651  {
1652  ( I.display )->displayRectangle ( topLeft, bottomRight, color,
1653  fill, thickness ) ;
1654  }
1655  }
1656  catch ( ... )
1657  {
1658  vpERROR_TRACE ( "Error caught" ) ;
1659  throw ;
1660  }
1661 }
1676 void
1678  const vpRect &rectangle,
1679  const vpColor &color, bool fill,
1680  unsigned int thickness )
1681 {
1682  try
1683  {
1684  if ( I.display != NULL )
1685  {
1686  ( I.display )->displayRectangle ( rectangle, color, fill, thickness ) ;
1687  }
1688  }
1689  catch ( ... )
1690  {
1691  vpERROR_TRACE ( "Error caught" ) ;
1692  throw ;
1693  }
1694 }
1695 
1696 
1712 void
1714  const vpImagePoint &center,
1715  float angle,
1716  unsigned int width, unsigned int height,
1717  const vpColor &color,
1718  unsigned int thickness)
1719 {
1720  try
1721  {
1722  if (I.display != NULL)
1723  {
1724  double i = center.get_i();
1725  double j = center.get_j();
1726 
1727  //A, B, C, D, corners of the rectangle clockwise
1728  vpImagePoint ipa, ipb, ipc, ipd;
1729  double cosinus = cos(angle);
1730  double sinus = sin(angle);
1731  ipa.set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1732  ipa.set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1733  ipb.set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1734  ipb.set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1735  ipc.set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1736  ipc.set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1737  ipd.set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1738  ipd.set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1739 
1740  ( I.display )->displayLine(I, ipa, ipb, color, thickness);
1741  ( I.display )->displayLine(I, ipa, ipd, color, thickness);
1742  ( I.display )->displayLine(I, ipc, ipb, color, thickness);
1743  ( I.display )->displayLine(I, ipc, ipd, color, thickness);
1744  }
1745  }
1746  catch(...)
1747  {
1748  vpERROR_TRACE("Error caught in displayRectangle") ;
1749  throw ;
1750  }
1751 }
1752 
1769 void
1771  int i, int j,
1772  unsigned int width, unsigned int height,
1773  const vpColor &color, bool fill,
1774  unsigned int thickness)
1775 {
1776  try
1777  {
1778  if ( I.display != NULL )
1779  {
1780  vpImagePoint topLeft;
1781  topLeft.set_i( i );
1782  topLeft.set_j( j );
1783 
1784  ( I.display )->displayRectangle ( topLeft, width, height,
1785  color, fill, thickness ) ;
1786  }
1787  }
1788  catch ( ... )
1789  {
1790  vpERROR_TRACE ( "Error caught" ) ;
1791  throw ;
1792  }
1793 }
1809 void
1811  unsigned int i, unsigned int j, float angle,
1812  unsigned int width, unsigned int height,
1813  const vpColor &color,unsigned int thickness)
1814 {
1815  try
1816  {
1817  if (I.display != NULL)
1818  {
1819  //A, B, C, D, corners of the rectangle clockwise
1820  vpImagePoint ipa, ipb, ipc, ipd;
1821  float cosinus = cos(angle);
1822  float sinus = sin(angle);
1823  ipa.set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1824  ipa.set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1825  ipb.set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1826  ipb.set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1827  ipc.set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1828  ipc.set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1829  ipd.set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1830  ipd.set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1831 
1832  ( I.display )->displayLine(I, ipa, ipb, color, thickness);
1833  ( I.display )->displayLine(I, ipa, ipd, color, thickness);
1834  ( I.display )->displayLine(I, ipc, ipb, color, thickness);
1835  ( I.display )->displayLine(I, ipc, ipd, color, thickness);
1836  }
1837  }
1838  catch(...)
1839  {
1840  vpERROR_TRACE("Error caught in displayRectangle") ;
1841  throw ;
1842  }
1843 }
1844 
1861 void
1863  int i, int j,
1864  unsigned int width, unsigned int height,
1865  const vpColor &color, bool fill,
1866  unsigned int thickness)
1867 {
1868  try
1869  {
1870  if ( I.display != NULL )
1871  {
1872  vpImagePoint topLeft;
1873  topLeft.set_i( i );
1874  topLeft.set_j( j );
1875 
1876  ( I.display )->displayRectangle ( topLeft, width, height,
1877  color, fill, thickness ) ;
1878  }
1879  }
1880  catch ( ... )
1881  {
1882  vpERROR_TRACE ( "Error caught" ) ;
1883  throw ;
1884  }
1885 }
1900 void
1902  unsigned int i, unsigned int j, float angle,
1903  unsigned int width, unsigned int height,
1904  const vpColor &color, unsigned int thickness)
1905 {
1906  try
1907  {
1908  if (I.display != NULL)
1909  {
1910  //A, B, C, D, corners of the rectangle clockwise
1911  vpImagePoint ipa, ipb, ipc, ipd;
1912  float cosinus = cos(angle);
1913  float sinus = sin(angle);
1914  ipa.set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1915  ipa.set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1916  ipb.set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1917  ipb.set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1918  ipc.set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1919  ipc.set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1920  ipd.set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1921  ipd.set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1922 
1923  ( I.display )->displayLine(I, ipa, ipb, color, thickness);
1924  ( I.display )->displayLine(I, ipa, ipd, color, thickness);
1925  ( I.display )->displayLine(I, ipc, ipb, color, thickness);
1926  ( I.display )->displayLine(I, ipc, ipd, color, thickness);
1927  }
1928  }
1929  catch(...)
1930  {
1931  vpERROR_TRACE("Error caught in displayRectangle") ;
1932  throw ;
1933  }
1934 }
1935 
1965 {
1966 
1967  try
1968  {
1969  if ( I.display != NULL )
1970  {
1971  ( I.display )->flushDisplay() ;
1972  }
1973  }
1974  catch ( ... )
1975  {
1976  vpERROR_TRACE ( "Error caught" ) ;
1977  throw ;
1978  }
1979 }
1980 
1982 {
1983 
1984  try
1985  {
1986  if ( I.display != NULL )
1987  {
1988  ( I.display )->flushDisplayROI(roi.getTopLeft(),(unsigned int)roi.getWidth(),(unsigned int)roi.getHeight()) ;
1989  }
1990  }
1991  catch ( ... )
1992  {
1993  vpERROR_TRACE ( "Error caught" ) ;
1994  throw ;
1995  }
1996 }
1997 
2002 {
2003 
2004  try
2005  {
2006  if ( I.display != NULL )
2007  {
2008  ( I.display )->closeDisplay() ;
2009  }
2010  }
2011  catch ( ... )
2012  {
2013  vpERROR_TRACE ( "Error caught" ) ;
2014  throw ;
2015  }
2016 }
2017 
2018 
2024 void
2025 vpDisplay::setTitle ( const vpImage<vpRGBa> &I, const char *windowtitle )
2026 {
2027 
2028  try
2029  {
2030  if ( I.display != NULL )
2031  {
2032  ( I.display )->setTitle ( windowtitle ) ;
2033  }
2034  }
2035  catch ( ... )
2036  {
2037  vpERROR_TRACE ( "Error caught" ) ;
2038  throw ;
2039  }
2040 }
2041 
2051 void
2052 vpDisplay::setWindowPosition ( const vpImage<vpRGBa> &I, int winx, int winy )
2053 {
2054 
2055  try
2056  {
2057  if ( I.display != NULL )
2058  {
2059  ( I.display )->setWindowPosition ( winx, winy ) ;
2060  }
2061  }
2062  catch ( ... )
2063  {
2064  vpERROR_TRACE ( "Error caught" ) ;
2065  throw ;
2066  }
2067 }
2068 
2082 void
2083 vpDisplay::setFont ( const vpImage<vpRGBa> &I, const char *fontname )
2084 {
2085 
2086  try
2087  {
2088  if ( I.display != NULL )
2089  {
2090  ( I.display )->setFont ( fontname ) ;
2091  }
2092  }
2093  catch ( ... )
2094  {
2095  vpERROR_TRACE ( "Error caught" ) ;
2096  throw ;
2097  }
2098 }
2099 
2109 void
2111 {
2112  try
2113  {
2114  if ( I.display != NULL )
2115  {
2116  ( I.display )->clearDisplay ( color ) ;
2117  }
2118  }
2119  catch ( ... )
2120  {
2121  vpERROR_TRACE ( "Error caught" ) ;
2122  throw ;
2123  }
2124 }
2125 
2137 void
2139 {
2140 
2141  try
2142  {
2143  if ( I.display != NULL )
2144  {
2145  ( I.display )->displayImage ( I ) ;
2146  }
2147  else
2148  {
2149  vpERROR_TRACE ( "Display not initialized" ) ;
2151  "Display not initialized" ) ) ;
2152  }
2153  }
2154  catch ( ... )
2155  {
2156  vpERROR_TRACE ( "Error caught" ) ;
2157  throw ;
2158  }
2159 }
2160 
2161 void
2163 {
2164  vpImagePoint topLeft;
2165  double top = floor(roi.getTop());
2166  double left = floor(roi.getLeft());
2167  double roiheight = floor(roi.getHeight());
2168  double roiwidth = floor(roi.getWidth());
2169  double iheight = (double)(I.getHeight());
2170  double iwidth = (double)(I.getWidth());
2171 
2172  if (top < 0 || top >= iheight || left < 0 || left >= iwidth || top+roiheight >= iheight || left+roiwidth >= iwidth)
2173  {
2174  vpERROR_TRACE ( "Region of interest outside of the image" ) ;
2176  "Region of interest outside of the image" ) ) ;
2177  }
2178 
2179  try
2180  {
2181  if ( I.display != NULL )
2182  {
2183  ( I.display )->displayImageROI ( I , vpImagePoint(top,left), (unsigned int)roiwidth,(unsigned int)roiheight ) ;
2184  }
2185  }
2186  catch ( ... )
2187  {
2188  vpERROR_TRACE ( "Error caught" ) ;
2189  throw ;
2190  }
2191 }
2192 
2193 
2256 void
2258 {
2259 
2260  try
2261  {
2262  if ( Isrc.display != NULL )
2263  {
2264  ( Isrc.display )->getImage ( Idest ) ;
2265  }
2266  else
2267  {
2268  vpERROR_TRACE ( "Display not initialized" ) ;
2270  "Display not initialized" ) ) ;
2271  }
2272  }
2273  catch ( ... )
2274  {
2275  vpERROR_TRACE ( "Error caught" ) ;
2276  throw ;
2277  }
2278 }
2279 
2310 {
2311 
2312  try
2313  {
2314  if ( I.display != NULL )
2315  {
2316  ( I.display )->flushDisplay() ;
2317  }
2318  }
2319  catch ( ... )
2320  {
2321  vpERROR_TRACE ( "Error caught" ) ;
2322  throw ;
2323  }
2324 }
2325 
2326 void vpDisplay::flushROI ( const vpImage<vpRGBa> &I, const vpRect &roi )
2327 {
2328 
2329  try
2330  {
2331  if ( I.display != NULL )
2332  {
2333  ( I.display )->flushDisplayROI(roi.getTopLeft(),(unsigned int)roi.getWidth(),(unsigned int)roi.getHeight()) ;
2334  }
2335  }
2336  catch ( ... )
2337  {
2338  vpERROR_TRACE ( "Error caught" ) ;
2339  throw ;
2340  }
2341 }
2342 
2347 {
2348 
2349  try
2350  {
2351  if ( I.display != NULL )
2352  {
2353  ( I.display )->closeDisplay() ;
2354  }
2355  }
2356  catch ( ... )
2357  {
2358  vpERROR_TRACE ( "Error caught" ) ;
2359  throw ;
2360  }
2361 }
2362 
2380 bool vpDisplay::getClick ( const vpImage<unsigned char> &I, bool blocking )
2381 {
2382  try
2383  {
2384  if ( I.display != NULL )
2385  {
2386  return ( I.display )->getClick(blocking) ;
2387  }
2388  else {
2389  vpERROR_TRACE ( "Display not initialized " ) ;
2391  "Display not initialized" ) ) ;
2392  }
2393  }
2394  catch ( ... )
2395  {
2396  vpERROR_TRACE ( "Error caught" ) ;
2397  throw ;
2398  }
2399  return false ;
2400 }
2401 
2423  vpImagePoint &ip, bool blocking )
2424 {
2425  try
2426  {
2427  if ( I.display != NULL )
2428  {
2429  return ( I.display )->getClick ( ip, blocking ) ;
2430  }
2431  else {
2432  vpERROR_TRACE ( "Display not initialized " ) ;
2434  "Display not initialized" ) ) ;
2435  }
2436  }
2437  catch ( ... )
2438  {
2439  vpERROR_TRACE ( "Error caught" ) ;
2440  throw ;
2441  }
2442  return false ;
2443 }
2444 
2467  vpImagePoint &ip,
2469  bool blocking)
2470 {
2471  try
2472  {
2473  if ( I.display != NULL )
2474  {
2475  return ( I.display )->getClick ( ip, button, blocking ) ;
2476  }
2477  else {
2478  vpERROR_TRACE ( "Display not initialized " ) ;
2480  "Display not initialized" ) ) ;
2481  }
2482  }
2483  catch ( ... )
2484  {
2485  vpERROR_TRACE ( "Error caught" ) ;
2486  throw ;
2487  }
2488  return false ;
2489 }
2490 
2512 bool
2514  vpImagePoint &ip,
2516  bool blocking )
2517 {
2518  try
2519  {
2520  if ( I.display != NULL )
2521  {
2522  return ( I.display )->getClickUp ( ip, button, blocking ) ;
2523  }
2524  else {
2525  vpERROR_TRACE ( "Display not initialized " ) ;
2527  "Display not initialized" ) ) ;
2528  }
2529  }
2530  catch ( ... )
2531  {
2532  vpERROR_TRACE ( "Error caught" ) ;
2533  throw ;
2534  }
2535  return false ;
2536 }
2618 bool
2620 {
2621  try
2622  {
2623  if ( I.display != NULL )
2624  {
2625  return ( I.display )->getKeyboardEvent ( blocking ) ;
2626  }
2627  }
2628  catch ( ... )
2629  {
2630  vpERROR_TRACE ( "Error caught" ) ;
2631  throw ;
2632  }
2633  return false ;
2634 }
2635 
2721 bool
2723  char *string, bool blocking)
2724 {
2725  try
2726  {
2727  if ( I.display != NULL )
2728  {
2729  return ( I.display )->getKeyboardEvent ( string, blocking ) ;
2730  }
2731  }
2732  catch ( ... )
2733  {
2734  vpERROR_TRACE ( "Error caught" ) ;
2735  throw ;
2736  }
2737  return false ;
2738 }
2749 bool
2751  vpImagePoint &ip)
2752 {
2753  try
2754  {
2755  if ( I.display != NULL )
2756  {
2757  return ( I.display )->getPointerMotionEvent ( ip ) ;
2758  }
2759  }
2760  catch ( ... )
2761  {
2762  vpERROR_TRACE ( "Error caught" ) ;
2763  throw ;
2764  }
2765  return false;
2766 }
2767 
2778 bool
2780  vpImagePoint &ip)
2781 {
2782  try
2783  {
2784  if ( I.display != NULL )
2785  {
2786  return ( I.display )->getPointerPosition ( ip ) ;
2787  }
2788  }
2789  catch ( ... )
2790  {
2791  vpERROR_TRACE ( "Error caught" ) ;
2792  throw ;
2793  }
2794  return false;
2795 }
2796 
2810 bool vpDisplay::getClick ( const vpImage<vpRGBa> &I, bool blocking )
2811 {
2812  try
2813  {
2814  if ( I.display != NULL )
2815  {
2816  return ( I.display )->getClick(blocking) ;
2817  }
2818  else {
2819  vpERROR_TRACE ( "Display not initialized " ) ;
2821  "Display not initialized" ) ) ;
2822  }
2823  }
2824  catch ( ... )
2825  {
2826  vpERROR_TRACE ( "Error caught" ) ;
2827  throw ;
2828  }
2829  return false;
2830 }
2831 
2832 
2852  vpImagePoint &ip, bool blocking )
2853 {
2854  try
2855  {
2856  if ( I.display != NULL )
2857  {
2858  return ( I.display )->getClick ( ip, blocking ) ;
2859  }
2860  else {
2861  vpERROR_TRACE ( "Display not initialized " ) ;
2863  "Display not initialized" ) ) ;
2864  }
2865  }
2866  catch ( ... )
2867  {
2868  vpERROR_TRACE ( "Error caught" ) ;
2869  throw ;
2870  }
2871  return false ;
2872 }
2873 
2895  vpImagePoint &ip,
2897  bool blocking )
2898 {
2899  try
2900  {
2901  if ( I.display != NULL )
2902  {
2903  return ( I.display )->getClick ( ip, button, blocking ) ;
2904  }
2905  else {
2906  vpERROR_TRACE ( "Display not initialized " ) ;
2908  "Display not initialized" ) ) ;
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  else {
2952  vpERROR_TRACE ( "Display not initialized " ) ;
2954  "Display not initialized" ) ) ;
2955  }
2956  }
2957  catch ( ... )
2958  {
2959  vpERROR_TRACE ( "Error caught" ) ;
2960  throw ;
2961  }
2962  return false ;
2963 }
2964 
3045 bool
3047 {
3048  try
3049  {
3050  if ( I.display != NULL )
3051  {
3052  return ( I.display )->getKeyboardEvent ( blocking ) ;
3053  }
3054  }
3055  catch ( ... )
3056  {
3057  vpERROR_TRACE ( "Error caught" ) ;
3058  throw ;
3059  }
3060  return false ;
3061 }
3062 
3148 bool
3150  char *string, bool blocking)
3151 {
3152  try
3153  {
3154  if ( I.display != NULL )
3155  {
3156  return ( I.display )->getKeyboardEvent ( string, blocking ) ;
3157  }
3158  }
3159  catch ( ... )
3160  {
3161  vpERROR_TRACE ( "Error caught" ) ;
3162  throw ;
3163  }
3164  return false ;
3165 }
3176 bool
3178 {
3179  try
3180  {
3181  if ( I.display != NULL )
3182  {
3183  return ( I.display )->getPointerMotionEvent ( ip ) ;
3184  }
3185  }
3186  catch ( ... )
3187  {
3188  vpERROR_TRACE ( "Error caught" ) ;
3189  throw ;
3190  }
3191  return false;
3192 }
3193 
3203 bool
3205 {
3206  try
3207  {
3208  if ( I.display != NULL )
3209  {
3210  return ( I.display )->getPointerPosition ( ip ) ;
3211  }
3212  }
3213  catch ( ... )
3214  {
3215  vpERROR_TRACE ( "Error caught" ) ;
3216  throw ;
3217  }
3218  return false;
3219 }
void set_j(const double j)
Definition: vpImagePoint.h:156
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:116
double getTop() const
Definition: vpRect.h:169
virtual void displayImage(const vpImage< unsigned char > &I)=0
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
double get_i() const
Definition: vpImagePoint.h:181
unsigned int getWidth() const
Definition: vpImage.h:154
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:379
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 ...
static void displayCamera(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size, const vpColor &color)
Definition: vpDisplay.cpp:482
Class to define colors available for display functionnalities.
Definition: vpColor.h:123
virtual void clearDisplay(const vpColor &color=vpColor::white)=0
void set_i(const double i)
Definition: vpImagePoint.h:145
static const vpColor none
Definition: vpColor.h:177
virtual bool getClickUp(vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking=true)=0
void track(const vpHomogeneousMatrix &cMo)
double getHeight() const
Definition: vpRect.h:150
virtual bool getPointerMotionEvent(vpImagePoint &ip)=0
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
static void flush(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:1964
double get_j() const
Definition: vpImagePoint.h:192
vpImagePoint getTopLeft() const
Definition: vpRect.h:175
static const vpColor red
Definition: vpColor.h:165
Class that defines what is a point.
Definition: vpPoint.h:65
virtual void flushDisplay()=0
double getWidth() const
Definition: vpRect.h:188
virtual bool getPointerPosition(vpImagePoint &ip)=0
virtual bool getKeyboardEvent(bool blocking=true)=0
void set_u(const double u)
Definition: vpImagePoint.h:203
virtual void setWindowPosition(int winx, int winy)=0
static void display(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp: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:214
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:346
static void close(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:2001
static void getImage(const vpImage< unsigned char > &Is, vpImage< vpRGBa > &Id)
Definition: vpDisplay.cpp:300
virtual void displayDotLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)=0
Error that can be emited by the vpDisplay class and its derivates.
virtual void closeDisplay()=0
virtual void displayCharString(const vpImagePoint &ip, const char *text, const vpColor &color=vpColor::green)=0
static void setBackground(const vpImage< unsigned char > &I, const vpColor &color)
Definition: vpDisplay.cpp:158
unsigned int getHeight() const
Definition: vpImage.h:145
Defines a rectangle in the plane.
Definition: vpRect.h:82
static void flushROI(const vpImage< unsigned char > &I, const vpRect &roi)
Definition: vpDisplay.cpp:1981
static void displayROI(const vpImage< unsigned char > &I, const vpRect &roi)
Definition: vpDisplay.cpp:205
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
double getLeft() const
Definition: vpRect.h:156
virtual void displayPoint(const vpImagePoint &ip, const vpColor &color)=0
vpColVector p
Definition: vpTracker.h:78
static const vpColor blue
Definition: vpColor.h:171
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