ViSP  2.8.0
vpDisplay.cpp
1 /****************************************************************************
2  *
3  * $Id: vpDisplay.cpp 4323 2013-07-18 09:24:01Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Image display.
36  *
37  * Authors:
38  * Eric Marchand
39  * Fabien Spindler
40  *
41  *****************************************************************************/
42 
43 #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 {
63  windowXPosition = 0;
64  windowYPosition = 0;
65 
66  title = new char[1024];
67  strcpy (title, "" );
68 }
73 {
75 
76  if (title != NULL) {
77  delete [] title;
78  title = NULL;
79  }
80 }
81 
95 void
97  const char *fontname )
98 {
99 
100  try
101  {
102  if ( I.display != NULL )
103  {
104  ( I.display )->setFont ( fontname ) ;
105  }
106  }
107  catch ( ... )
108  {
109  vpERROR_TRACE ( "Error caught" ) ;
110  throw ;
111  }
112 }
118 void
120  const char *windowtitle )
121 {
122 
123  try
124  {
125  if ( I.display != NULL )
126  {
127  ( I.display )->setTitle ( windowtitle ) ;
128  }
129  }
130  catch ( ... )
131  {
132  vpERROR_TRACE ( "Error caught" ) ;
133  throw ;
134  }
135 }
136 
146 void
148  int winx, int winy )
149 {
150 
151  try
152  {
153  if ( I.display != NULL )
154  {
155  ( I.display )->setWindowPosition ( winx, winy ) ;
156  }
157  }
158  catch ( ... )
159  {
160  vpERROR_TRACE ( "Error caught" ) ;
161  throw ;
162  }
163 }
164 
174 void
176 {
177  try
178  {
179  if ( I.display != NULL )
180  {
181  ( I.display )->clearDisplay ( color ) ;
182  }
183  }
184  catch ( ... )
185  {
186  vpERROR_TRACE ( "Error caught" ) ;
187  throw ;
188  }
189 }
190 
202 void
204 {
205 
206  try
207  {
208  if ( I.display != NULL )
209  {
210  ( I.display )->displayImage ( I ) ;
211  }
212  }
213  catch ( ... )
214  {
215  vpERROR_TRACE ( "Error caught" ) ;
216  throw ;
217  }
218 }
219 
220 
221 void
223 {
224  vpImagePoint topLeft;
225  double top = floor(roi.getTop());
226  double left = floor(roi.getLeft());
227  double roiheight = floor(roi.getHeight());
228  double roiwidth = floor(roi.getWidth());
229  double iheight = (double)(I.getHeight());
230  double iwidth = (double)(I.getWidth());
231 
232  if (top < 0 || top > iheight || left < 0 || left > iwidth || top+roiheight > iheight || left+roiwidth > iwidth)
233  {
234  vpERROR_TRACE ( "Region of interest outside of the image" ) ;
235  throw ( vpException ( vpException::dimensionError,"Region of interest outside of the image" ) ) ;
236  }
237 
238  try
239  {
240  if ( I.display != NULL )
241  {
242  ( I.display )->displayImageROI ( I , vpImagePoint(top,left), (unsigned int)roiwidth,(unsigned int)roiheight ) ;
243  }
244  }
245  catch ( ... )
246  {
247  vpERROR_TRACE ( "Error caught" ) ;
248  throw ;
249  }
250 }
251 
252 
253 
320 void
322  vpImage<vpRGBa> &Idest )
323 {
324 
325  try
326  {
327  if ( Isrc.display != NULL )
328  {
329  ( Isrc.display )->getImage ( Idest ) ;
330  }
331  else
332  {
333  vpImageConvert::convert(Isrc, Idest);
334 // vpERROR_TRACE ( "Display not initialized" ) ;
335 // throw ( vpDisplayException ( vpDisplayException::notInitializedError,
336 // "Display not initialized" ) ) ;
337  }
338  }
339  catch ( ... )
340  {
341  vpERROR_TRACE ( "Error caught" ) ;
342  throw ;
343  }
344 }
345 
346 
367 void
369  const vpHomogeneousMatrix &cMo,
370  const vpCameraParameters &cam,
371  double size,
372  const vpColor &color, unsigned int thickness)
373 {
374  // used by display
375  vpPoint o; o.setWorldCoordinates ( 0.0,0.0,0.0 ) ;
376  vpPoint x; x.setWorldCoordinates ( size,0.0,0.0 ) ;
377  vpPoint y; y.setWorldCoordinates ( 0.0,size,0.0 ) ;
378  vpPoint z; z.setWorldCoordinates ( 0.0,0.0,size ) ;
379 
380  o.track ( cMo ) ;
381  x.track ( cMo ) ;
382  y.track ( cMo ) ;
383  z.track ( cMo ) ;
384 
385  vpImagePoint ipo, ip1;
386 
387  if ( color == vpColor::none )
388  {
389  vpMeterPixelConversion::convertPoint ( cam, o.p[0], o.p[1], ipo) ;
390 
391  vpMeterPixelConversion::convertPoint ( cam, x.p[0], x.p[1], ip1) ;
392  vpDisplay::displayArrow ( I, ipo, ip1, vpColor::red, 4*thickness, 2*thickness, thickness) ;
393 
394  vpMeterPixelConversion::convertPoint ( cam, y.p[0], y.p[1], ip1) ;
395  vpDisplay::displayArrow ( I, ipo, ip1, vpColor::green, 4*thickness, 2*thickness, thickness) ;
396 
397  vpMeterPixelConversion::convertPoint ( cam, z.p[0], z.p[1], ip1) ;
398  vpDisplay::displayArrow ( I,ipo, ip1, vpColor::blue, 4*thickness, 2*thickness, thickness) ;
399  }
400  else
401  {
402  vpMeterPixelConversion::convertPoint ( cam, o.p[0], o.p[1], ipo) ;
403 
404  vpMeterPixelConversion::convertPoint ( cam, x.p[0], x.p[1], ip1) ;
405  vpDisplay::displayArrow ( I, ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
406 
407  vpMeterPixelConversion::convertPoint ( cam, y.p[0], y.p[1], ip1) ;
408  vpDisplay::displayArrow ( I, ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
409 
410  vpMeterPixelConversion::convertPoint ( cam, z.p[0], z.p[1], ip1) ;
411  vpDisplay::displayArrow ( I,ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
412 
413  }
414 }
415 
416 
437 void
439  const vpHomogeneousMatrix &cMo,
440  const vpCameraParameters &cam,
441  double size, const vpColor &color,
442  unsigned int thickness )
443 {
444  // used by display
445  vpPoint o; o.setWorldCoordinates ( 0.0,0.0,0.0 ) ;
446  vpPoint x; x.setWorldCoordinates ( size,0.0,0.0 ) ;
447  vpPoint y; y.setWorldCoordinates ( 0.0,size,0.0 ) ;
448  vpPoint z; z.setWorldCoordinates ( 0.0,0.0,size ) ;
449 
450  o.track ( cMo ) ;
451  x.track ( cMo ) ;
452  y.track ( cMo ) ;
453  z.track ( cMo ) ;
454 
455  vpImagePoint ipo, ip1;
456  if ( color == vpColor::none )
457  {
458  vpMeterPixelConversion::convertPoint ( cam, o.p[0], o.p[1], ipo) ;
459 
460  vpMeterPixelConversion::convertPoint ( cam, x.p[0], x.p[1], ip1) ;
461  vpDisplay::displayArrow ( I, ipo, ip1, vpColor::red, 4, 2, thickness) ;
462 
463  vpMeterPixelConversion::convertPoint ( cam, y.p[0], y.p[1], ip1) ;
464  vpDisplay::displayArrow ( I, ipo, ip1, vpColor::green, 4, 2, thickness) ;
465 
466  vpMeterPixelConversion::convertPoint ( cam, z.p[0], z.p[1], ip1) ;
467  vpDisplay::displayArrow ( I,ipo, ip1, vpColor::blue, 4, 2, thickness) ;
468  }
469  else
470  {
471  vpMeterPixelConversion::convertPoint ( cam, o.p[0], o.p[1], ipo) ;
472 
473  vpMeterPixelConversion::convertPoint ( cam, x.p[0], x.p[1], ip1) ;
474  vpDisplay::displayArrow ( I, ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
475 
476  vpMeterPixelConversion::convertPoint ( cam, y.p[0], y.p[1], ip1) ;
477  vpDisplay::displayArrow ( I, ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
478 
479  vpMeterPixelConversion::convertPoint ( cam, z.p[0], z.p[1], ip1) ;
480  vpDisplay::displayArrow ( I,ipo, ip1, color, 4*thickness, 2*thickness, thickness) ;
481 
482  }
483 }
484 
505 void
507  const vpHomogeneousMatrix &cMo,
508  const vpCameraParameters &cam,
509  double size, const vpColor &color,
510  unsigned int thickness)
511 {
512  // used by display
513  double halfSize = size/2.0;
514  vpPoint pt[5];
515  pt[0].setWorldCoordinates ( -halfSize,-halfSize,0.0 );
516  pt[1].setWorldCoordinates ( halfSize,-halfSize,0.0 );
517  pt[2].setWorldCoordinates ( halfSize,halfSize,0.0 );
518  pt[3].setWorldCoordinates ( -halfSize,halfSize,0.0 );
519  pt[4].setWorldCoordinates ( 0.0,0.0,-size );
520 
521  for (int i = 0; i < 5; i++)
522  pt[i].track ( cMo ) ;
523 
524  vpImagePoint ip, ip_1, ip0;
525  vpMeterPixelConversion::convertPoint ( cam, pt[4].p[0], pt[4].p[1], ip0);
526 
527  for (int i = 0; i < 4; i++)
528  {
529  vpMeterPixelConversion::convertPoint ( cam, pt[i].p[0], pt[i].p[1], ip_1);
530  vpMeterPixelConversion::convertPoint ( cam, pt[(i+1)%4].p[0], pt[(i+1)%4].p[1], ip);
531  vpDisplay::displayLine ( I, ip_1, ip, color, thickness);
532  vpDisplay::displayLine ( I, ip0, ip_1, color, thickness);
533  }
534 }
535 
536 
557 void
559  const vpHomogeneousMatrix &cMo,
560  const vpCameraParameters &cam,
561  double size, const vpColor &color,
562  unsigned int thickness)
563 {
564  // used by display
565  double halfSize = size/2.0;
566  vpPoint pt[5];
567  pt[0].setWorldCoordinates ( -halfSize,-halfSize,0.0 );
568  pt[1].setWorldCoordinates ( halfSize,-halfSize,0.0 );
569  pt[2].setWorldCoordinates ( halfSize,halfSize,0.0 );
570  pt[3].setWorldCoordinates ( -halfSize,halfSize,0.0 );
571  pt[4].setWorldCoordinates ( 0.0,0.0,-size );
572 
573  for (int i = 0; i < 5; i++)
574  pt[i].track ( cMo ) ;
575 
576  vpImagePoint ip, ip_1, ip0;
577  vpMeterPixelConversion::convertPoint ( cam, pt[4].p[0], pt[4].p[1], ip0);
578 
579  for (int i = 0; i < 4; i++)
580  {
581  vpMeterPixelConversion::convertPoint ( cam, pt[i].p[0], pt[i].p[1], ip_1);
582  vpMeterPixelConversion::convertPoint ( cam, pt[(i+1)%4].p[0], pt[(i+1)%4].p[1], ip);
583  vpDisplay::displayLine ( I, ip_1, ip, color, thickness);
584  vpDisplay::displayLine ( I, ip0, ip_1, color, thickness);
585  }
586 }
587 
596 void
598  const vpImagePoint &ip1, const vpImagePoint &ip2,
599  const vpColor &color,
600  unsigned int w,unsigned int h,
601  unsigned int thickness )
602 {
603  try
604  {
605  if ( I.display != NULL )
606  {
607  ( I.display )->displayArrow ( ip1, ip2, color, w, h, thickness ) ;
608  }
609  }
610  catch ( ... )
611  {
612  vpERROR_TRACE ( "Error caught" ) ;
613  throw ;
614  }
615 }
616 
626 void
628  const vpImagePoint &ip1, const vpImagePoint &ip2,
629  const vpColor &color,
630  unsigned int w,unsigned int h,
631  unsigned int thickness )
632 {
633  try
634  {
635  if ( I.display != NULL )
636  {
637  ( I.display )->displayArrow ( ip1, ip2, color, w, h, thickness ) ;
638  }
639  }
640  catch ( ... )
641  {
642  vpERROR_TRACE ( "Error caught" ) ;
643  throw ;
644  }
645 }
646 
657 void
659  int i1, int j1, int i2, int j2,
660  const vpColor &color,
661  unsigned int w, unsigned int h,
662  unsigned int thickness)
663 {
664  try
665  {
666  if ( I.display != NULL )
667  {
668  vpImagePoint ip1, ip2;
669  ip1.set_i(i1);
670  ip1.set_j(j1);
671  ip2.set_i(i2);
672  ip2.set_j(j2);
673  ( I.display )->displayArrow ( ip1, ip2, color, w, h, thickness ) ;
674  }
675  }
676  catch ( ... )
677  {
678  vpERROR_TRACE ( "Error caught" ) ;
679  throw ;
680  }
681 }
682 
695 void
697  int i1, int j1, int i2, int j2,
698  const vpColor &color,
699  unsigned int w, unsigned int h,
700  unsigned int thickness)
701 {
702  try
703  {
704  if ( I.display != NULL )
705  {
706  vpImagePoint ip1, ip2;
707  ip1.set_i(i1);
708  ip1.set_j(j1);
709  ip2.set_i(i2);
710  ip2.set_j(j2);
711 
712  ( I.display )->displayArrow ( ip1, ip2, color, w, h, thickness ) ;
713  }
714  }
715  catch ( ... )
716  {
717  vpERROR_TRACE ( "Error caught" ) ;
718  throw ;
719  }
720 }
721 
736 void
738  const vpImagePoint &ip, const char *string,
739  const vpColor &color )
740 {
741  try
742  {
743  if ( I.display != NULL )
744  {
745  ( I.display )->displayCharString ( ip, string, color ) ;
746  }
747  }
748  catch ( ... )
749  {
750  vpERROR_TRACE ( "Error caught" ) ;
751  throw ;
752  }
753 }
754 
769 void
771  const vpImagePoint &ip, const char *string,
772  const vpColor &color )
773 {
774  try
775  {
776  if ( I.display != NULL )
777  {
778  ( I.display )->displayCharString ( ip, string, color ) ;
779  }
780  }
781  catch ( ... )
782  {
783  vpERROR_TRACE ( "Error caught" ) ;
784  throw ;
785  }
786 }
787 
802 void
804  int i, int j, const char *string,
805  const vpColor &color)
806 {
807  try
808  {
809  if ( I.display != NULL )
810  {
811  vpImagePoint ip;
812  ip.set_i( i );
813  ip.set_j( j );
814 
815  ( I.display )->displayCharString ( ip, string, color ) ;
816  }
817  }
818  catch ( ... )
819  {
820  vpERROR_TRACE ( "Error caught" ) ;
821  throw ;
822  }
823 }
824 
839 void
841  int i, int j, const char *string,
842  const vpColor &color)
843 {
844  try
845  {
846  if ( I.display != NULL )
847  {
848  vpImagePoint ip;
849  ip.set_i( i );
850  ip.set_j( j );
851  ( I.display )->displayCharString ( ip, string, color ) ;
852  }
853  }
854  catch ( ... )
855  {
856  vpERROR_TRACE ( "Error caught" ) ;
857  throw ;
858  }
859 }
860 
871 void
873  const vpImagePoint &center, unsigned int radius,
874  const vpColor &color,
875  bool fill,
876  unsigned int thickness)
877 {
878  try
879  {
880  if ( I.display != NULL )
881  {
882  ( I.display )->displayCircle ( center, radius, color, fill, thickness ) ;
883  }
884  }
885  catch ( ... )
886  {
887  vpERROR_TRACE ( "Error caught" ) ;
888  throw ;
889  }
890 }
901 void
903  const vpImagePoint &center, unsigned int radius,
904  const vpColor &color,
905  bool fill,
906  unsigned int thickness )
907 {
908  try
909  {
910  if ( I.display != NULL )
911  {
912  ( I.display )->displayCircle ( center, radius, color, fill, thickness ) ;
913  }
914  }
915  catch ( ... )
916  {
917  vpERROR_TRACE ( "Error caught" ) ;
918  throw ;
919  }
920 }
933 void
935  int i, int j, unsigned int radius,
936  const vpColor &color,
937  bool fill,
938  unsigned int thickness)
939 {
940  try
941  {
942  if ( I.display != NULL )
943  {
944  vpImagePoint ip;
945  ip.set_i( i );
946  ip.set_j( j );
947 
948  ( I.display )->displayCircle ( ip, radius, color, fill, thickness ) ;
949  }
950  }
951  catch ( ... )
952  {
953  vpERROR_TRACE ( "Error caught" ) ;
954  throw ;
955  }
956 }
957 
958 
971 void
973  int i, int j, unsigned int radius,
974  const vpColor &color,
975  bool fill,
976  unsigned int thickness)
977 {
978  try
979  {
980  if ( I.display != NULL )
981  {
982  vpImagePoint ip;
983  ip.set_i( i );
984  ip.set_j( j );
985  ( I.display )->displayCircle ( ip, radius, color, fill, 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 }
1021 
1031  const vpImagePoint &ip, unsigned int size,
1032  const vpColor &color,
1033  unsigned int thickness )
1034 {
1035  try
1036  {
1037  if ( I.display != NULL )
1038  {
1039  ( I.display )->displayCross ( ip, size, color, thickness ) ;
1040  }
1041  }
1042  catch ( ... )
1043  {
1044  vpERROR_TRACE ( "Error caught" ) ;
1045  throw ;
1046  }
1047 }
1057  int i, int j,
1058  unsigned int size, const vpColor &color,
1059  unsigned int thickness )
1060 {
1061  try
1062  {
1063  if ( I.display != NULL )
1064  {
1065  vpImagePoint ip;
1066  ip.set_i( i );
1067  ip.set_j( j );
1068 
1069  ( I.display )->displayCross ( ip, size, color, thickness ) ;
1070  }
1071  }
1072  catch ( ... )
1073  {
1074  vpERROR_TRACE ( "Error caught" ) ;
1075  throw ;
1076  }
1077 }
1078 
1088  int i, int j,
1089  unsigned int size, const vpColor &color,
1090  unsigned int thickness )
1091 {
1092  try
1093  {
1094  if ( I.display != NULL )
1095  {
1096  vpImagePoint ip;
1097  ip.set_i( i );
1098  ip.set_j( j );
1099  ( I.display )->displayCross ( ip, size, 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 }
1135 
1144  const vpImagePoint &ip1,
1145  const vpImagePoint &ip2,
1146  const vpColor &color,
1147  unsigned int thickness )
1148 {
1149  try
1150  {
1151  if ( I.display != NULL )
1152  {
1153  ( I.display )->displayDotLine ( ip1, ip2, color, thickness );
1154  }
1155  }
1156  catch ( ... )
1157  {
1158  vpERROR_TRACE ( "Error caught" ) ;
1159  throw ;
1160  }
1161 }
1172  int i1, int j1, int i2, int j2,
1173  const vpColor &color,
1174  unsigned int thickness )
1175 {
1176  try
1177  {
1178  if ( I.display != NULL )
1179  {
1180  vpImagePoint ip1, ip2;
1181  ip1.set_i( i1 );
1182  ip1.set_j( j1 );
1183  ip2.set_i( i2 );
1184  ip2.set_j( j2 );
1185  ( I.display )->displayDotLine ( ip1, ip2, color, thickness );
1186  }
1187  }
1188  catch ( ... )
1189  {
1190  vpERROR_TRACE ( "Error caught" ) ;
1191  throw ;
1192  }
1193 }
1194 
1204  int i1, int j1,
1205  int i2, int j2,
1206  const vpColor &color,
1207  unsigned int thickness )
1208 {
1209  try
1210  {
1211  if ( I.display != NULL )
1212  {
1213  vpImagePoint ip1, ip2;
1214  ip1.set_i( i1 );
1215  ip1.set_j( j1 );
1216  ip2.set_i( i2 );
1217  ip2.set_j( j2 );
1218  ( I.display )->displayDotLine ( ip1, ip2, color, thickness );
1219  }
1220  }
1221  catch ( ... )
1222  {
1223  vpERROR_TRACE ( "Error caught" ) ;
1224  throw ;
1225  }
1226 }
1227 
1236  const vpImagePoint &ip1,
1237  const vpImagePoint &ip2,
1238  const vpColor &color,
1239  unsigned int thickness )
1240 {
1241 
1242  try
1243  {
1244  if ( I.display != NULL )
1245  {
1246  ( I.display )->displayLine ( ip1, ip2, color, thickness );
1247  }
1248  }
1249  catch ( ... )
1250  {
1251  vpERROR_TRACE ( "Error caught" ) ;
1252  throw ;
1253  }
1254 }
1255 
1266  int i1, int j1, int i2, int j2,
1267  const vpColor &color,
1268  unsigned int thickness )
1269 {
1270 
1271  try
1272  {
1273  if ( I.display != NULL )
1274  {
1275  vpImagePoint ip1, ip2;
1276  ip1.set_i( i1 );
1277  ip1.set_j( j1 );
1278  ip2.set_i( i2 );
1279  ip2.set_j( j2 );
1280  ( I.display )->displayLine ( ip1, ip2, color, thickness );
1281  }
1282  }
1283  catch ( ... )
1284  {
1285  vpERROR_TRACE ( "Error caught" ) ;
1286  throw ;
1287  }
1288 }
1289 
1290 
1301  int i1, int j1,
1302  int i2, int j2,
1303  const vpColor &color,
1304  unsigned int thickness )
1305 {
1306 
1307  try
1308  {
1309  if ( I.display != NULL )
1310  {
1311  vpImagePoint ip1, ip2;
1312  ip1.set_i( i1 );
1313  ip1.set_j( j1 );
1314  ip2.set_i( i2 );
1315  ip2.set_j( j2 );
1316  ( I.display )->displayLine ( ip1, ip2, color, thickness );
1317  }
1318  }
1319  catch ( ... )
1320  {
1321  vpERROR_TRACE ( "Error caught" ) ;
1322  throw ;
1323  }
1324 }
1325 
1334  const vpImagePoint &ip1,
1335  const vpImagePoint &ip2,
1336  const vpColor &color,
1337  unsigned int thickness )
1338 {
1339 
1340  try
1341  {
1342  if ( I.display != NULL )
1343  {
1344  ( I.display )->displayLine ( ip1, ip2, color, thickness );
1345  }
1346  }
1347  catch ( ... )
1348  {
1349  vpERROR_TRACE ( "Error caught" ) ;
1350  throw ;
1351  }
1352 }
1353 
1361  const vpImagePoint &ip,
1362  const vpColor &color )
1363 {
1364  try
1365  {
1366  if ( I.display != NULL )
1367  {
1368  ( I.display )->displayPoint ( ip, color ) ;
1369  }
1370  }
1371  catch ( ... )
1372  {
1373  vpERROR_TRACE ( "Error caught" ) ;
1374  throw ;
1375  }
1376 }
1384  const vpImagePoint &ip,
1385  const vpColor &color )
1386 {
1387  try
1388  {
1389  if ( I.display != NULL )
1390  {
1391  ( I.display )->displayPoint ( ip, color ) ;
1392  }
1393  }
1394  catch ( ... )
1395  {
1396  vpERROR_TRACE ( "Error caught" ) ;
1397  throw ;
1398  }
1399 }
1400 
1408  int i, int j,
1409  const vpColor &color )
1410 {
1411  try
1412  {
1413  if ( I.display != NULL )
1414  {
1415  vpImagePoint ip;
1416  ip.set_i( i );
1417  ip.set_j( j );
1418  ( I.display )->displayPoint ( ip, color ) ;
1419  }
1420  }
1421  catch ( ... )
1422  {
1423  vpERROR_TRACE ( "Error caught" ) ;
1424  throw ;
1425  }
1426 }
1427 
1428 
1436  int i, int j,
1437  const vpColor &color )
1438 {
1439  try
1440  {
1441  if ( I.display != NULL )
1442  {
1443  vpImagePoint ip;
1444  ip.set_i( i );
1445  ip.set_j( j );
1446  ( I.display )->displayPoint ( ip, color ) ;
1447  }
1448  }
1449  catch ( ... )
1450  {
1451  vpERROR_TRACE ( "Error caught" ) ;
1452  throw ;
1453  }
1454 }
1455 
1470 void
1472  const vpImagePoint &topLeft,
1473  unsigned int width, unsigned int height,
1474  const vpColor &color, bool fill,
1475  unsigned int thickness)
1476 {
1477  try
1478  {
1479  if ( I.display != NULL )
1480  {
1481  ( I.display )->displayRectangle ( topLeft, width, height, color,
1482  fill, thickness ) ;
1483  }
1484  }
1485  catch ( ... )
1486  {
1487  vpERROR_TRACE ( "Error caught" ) ;
1488  throw ;
1489  }
1490 }
1491 
1492 
1507 void
1509  const vpImagePoint &topLeft,
1510  const vpImagePoint &bottomRight,
1511  const vpColor &color, bool fill,
1512  unsigned int thickness)
1513 {
1514  try
1515  {
1516  if ( I.display != NULL )
1517  {
1518  ( I.display )->displayRectangle ( topLeft, bottomRight, color,
1519  fill, thickness ) ;
1520  }
1521  }
1522  catch ( ... )
1523  {
1524  vpERROR_TRACE ( "Error caught" ) ;
1525  throw ;
1526  }
1527 }
1542 void
1544  const vpRect &rectangle,
1545  const vpColor &color, bool fill,
1546  unsigned int thickness )
1547 {
1548  try
1549  {
1550  if ( I.display != NULL )
1551  {
1552  ( I.display )->displayRectangle ( rectangle, color, fill, thickness ) ;
1553  }
1554  }
1555  catch ( ... )
1556  {
1557  vpERROR_TRACE ( "Error caught" ) ;
1558  throw ;
1559  }
1560 }
1561 
1562 
1578 void
1580  const vpImagePoint &center,
1581  float angle,
1582  unsigned int width, unsigned int height,
1583  const vpColor &color,
1584  unsigned int thickness)
1585 {
1586  try
1587  {
1588  if (I.display != NULL)
1589  {
1590  double i = center.get_i();
1591  double j = center.get_j();
1592 
1593  //A, B, C, D, corners of the rectangle clockwise
1594  vpImagePoint ipa, ipb, ipc, ipd;
1595  double cosinus = cos(angle);
1596  double sinus = sin(angle);
1597  ipa.set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1598  ipa.set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1599  ipb.set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1600  ipb.set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1601  ipc.set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1602  ipc.set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1603  ipd.set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1604  ipd.set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1605 
1606  ( I.display )->displayLine(I, ipa, ipb, color, thickness);
1607  ( I.display )->displayLine(I, ipa, ipd, color, thickness);
1608  ( I.display )->displayLine(I, ipc, ipb, color, thickness);
1609  ( I.display )->displayLine(I, ipc, ipd, color, thickness);
1610  }
1611  }
1612  catch(...)
1613  {
1614  vpERROR_TRACE("Error caught in displayRectangle") ;
1615  throw ;
1616  }
1617 }
1618 
1633 void
1635  const vpImagePoint &topLeft,
1636  unsigned int width, unsigned int height,
1637  const vpColor &color, bool fill,
1638  unsigned int thickness)
1639 {
1640  try
1641  {
1642  if ( I.display != NULL )
1643  {
1644  ( I.display )->displayRectangle ( topLeft, width, height, color,
1645  fill, thickness ) ;
1646  }
1647  }
1648  catch ( ... )
1649  {
1650  vpERROR_TRACE ( "Error caught" ) ;
1651  throw ;
1652  }
1653 }
1668 void
1670  const vpImagePoint &topLeft,
1671  const vpImagePoint &bottomRight,
1672  const vpColor &color, bool fill,
1673  unsigned int thickness)
1674 {
1675  try
1676  {
1677  if ( I.display != NULL )
1678  {
1679  ( I.display )->displayRectangle ( topLeft, bottomRight, color,
1680  fill, thickness ) ;
1681  }
1682  }
1683  catch ( ... )
1684  {
1685  vpERROR_TRACE ( "Error caught" ) ;
1686  throw ;
1687  }
1688 }
1703 void
1705  const vpRect &rectangle,
1706  const vpColor &color, bool fill,
1707  unsigned int thickness )
1708 {
1709  try
1710  {
1711  if ( I.display != NULL )
1712  {
1713  ( I.display )->displayRectangle ( rectangle, color, fill, thickness ) ;
1714  }
1715  }
1716  catch ( ... )
1717  {
1718  vpERROR_TRACE ( "Error caught" ) ;
1719  throw ;
1720  }
1721 }
1722 
1723 
1739 void
1741  const vpImagePoint &center,
1742  float angle,
1743  unsigned int width, unsigned int height,
1744  const vpColor &color,
1745  unsigned int thickness)
1746 {
1747  try
1748  {
1749  if (I.display != NULL)
1750  {
1751  double i = center.get_i();
1752  double j = center.get_j();
1753 
1754  //A, B, C, D, corners of the rectangle clockwise
1755  vpImagePoint ipa, ipb, ipc, ipd;
1756  double cosinus = cos(angle);
1757  double sinus = sin(angle);
1758  ipa.set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1759  ipa.set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1760  ipb.set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1761  ipb.set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1762  ipc.set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1763  ipc.set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1764  ipd.set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1765  ipd.set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1766 
1767  ( I.display )->displayLine(I, ipa, ipb, color, thickness);
1768  ( I.display )->displayLine(I, ipa, ipd, color, thickness);
1769  ( I.display )->displayLine(I, ipc, ipb, color, thickness);
1770  ( I.display )->displayLine(I, ipc, ipd, color, thickness);
1771  }
1772  }
1773  catch(...)
1774  {
1775  vpERROR_TRACE("Error caught in displayRectangle") ;
1776  throw ;
1777  }
1778 }
1779 
1796 void
1798  int i, int j,
1799  unsigned int width, unsigned int height,
1800  const vpColor &color, bool fill,
1801  unsigned int thickness)
1802 {
1803  try
1804  {
1805  if ( I.display != NULL )
1806  {
1807  vpImagePoint topLeft;
1808  topLeft.set_i( i );
1809  topLeft.set_j( j );
1810 
1811  ( I.display )->displayRectangle ( topLeft, width, height,
1812  color, fill, thickness ) ;
1813  }
1814  }
1815  catch ( ... )
1816  {
1817  vpERROR_TRACE ( "Error caught" ) ;
1818  throw ;
1819  }
1820 }
1836 void
1838  unsigned int i, unsigned int j, float angle,
1839  unsigned int width, unsigned int height,
1840  const vpColor &color,unsigned int thickness)
1841 {
1842  try
1843  {
1844  if (I.display != NULL)
1845  {
1846  //A, B, C, D, corners of the rectangle clockwise
1847  vpImagePoint ipa, ipb, ipc, ipd;
1848  float cosinus = cos(angle);
1849  float sinus = sin(angle);
1850  ipa.set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1851  ipa.set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1852  ipb.set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1853  ipb.set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1854  ipc.set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1855  ipc.set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1856  ipd.set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1857  ipd.set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1858 
1859  ( I.display )->displayLine(I, ipa, ipb, color, thickness);
1860  ( I.display )->displayLine(I, ipa, ipd, color, thickness);
1861  ( I.display )->displayLine(I, ipc, ipb, color, thickness);
1862  ( I.display )->displayLine(I, ipc, ipd, color, thickness);
1863  }
1864  }
1865  catch(...)
1866  {
1867  vpERROR_TRACE("Error caught in displayRectangle") ;
1868  throw ;
1869  }
1870 }
1871 
1888 void
1890  int i, int j,
1891  unsigned int width, unsigned int height,
1892  const vpColor &color, bool fill,
1893  unsigned int thickness)
1894 {
1895  try
1896  {
1897  if ( I.display != NULL )
1898  {
1899  vpImagePoint topLeft;
1900  topLeft.set_i( i );
1901  topLeft.set_j( j );
1902 
1903  ( I.display )->displayRectangle ( topLeft, width, height,
1904  color, fill, thickness ) ;
1905  }
1906  }
1907  catch ( ... )
1908  {
1909  vpERROR_TRACE ( "Error caught" ) ;
1910  throw ;
1911  }
1912 }
1927 void
1929  unsigned int i, unsigned int j, float angle,
1930  unsigned int width, unsigned int height,
1931  const vpColor &color, unsigned int thickness)
1932 {
1933  try
1934  {
1935  if (I.display != NULL)
1936  {
1937  //A, B, C, D, corners of the rectangle clockwise
1938  vpImagePoint ipa, ipb, ipc, ipd;
1939  float cosinus = cos(angle);
1940  float sinus = sin(angle);
1941  ipa.set_u(j + 0.5*width*cosinus + 0.5*height*sinus);
1942  ipa.set_v(i + 0.5*width*sinus - 0.5*height*cosinus);
1943  ipb.set_u(j + 0.5*width*cosinus - 0.5*height*sinus);
1944  ipb.set_v(i + 0.5*width*sinus + 0.5*height*cosinus);
1945  ipc.set_u(j - 0.5*width*cosinus - 0.5*height*sinus);
1946  ipc.set_v(i - 0.5*width*sinus + 0.5*height*cosinus);
1947  ipd.set_u(j - 0.5*width*cosinus + 0.5*height*sinus);
1948  ipd.set_v(i - 0.5*width*sinus - 0.5*height*cosinus);
1949 
1950  ( I.display )->displayLine(I, ipa, ipb, color, thickness);
1951  ( I.display )->displayLine(I, ipa, ipd, color, thickness);
1952  ( I.display )->displayLine(I, ipc, ipb, color, thickness);
1953  ( I.display )->displayLine(I, ipc, ipd, color, thickness);
1954  }
1955  }
1956  catch(...)
1957  {
1958  vpERROR_TRACE("Error caught in displayRectangle") ;
1959  throw ;
1960  }
1961 }
1962 
1992 {
1993 
1994  try
1995  {
1996  if ( I.display != NULL )
1997  {
1998  ( I.display )->flushDisplay() ;
1999  }
2000  }
2001  catch ( ... )
2002  {
2003  vpERROR_TRACE ( "Error caught" ) ;
2004  throw ;
2005  }
2006 }
2007 
2009 {
2010 
2011  try
2012  {
2013  if ( I.display != NULL )
2014  {
2015  ( I.display )->flushDisplayROI(roi.getTopLeft(),(unsigned int)roi.getWidth(),(unsigned int)roi.getHeight()) ;
2016  }
2017  }
2018  catch ( ... )
2019  {
2020  vpERROR_TRACE ( "Error caught" ) ;
2021  throw ;
2022  }
2023 }
2024 
2029 {
2030 
2031  try
2032  {
2033  if ( I.display != NULL )
2034  {
2035  ( I.display )->closeDisplay() ;
2036  I.display = NULL;
2037  }
2038  }
2039  catch ( ... )
2040  {
2041  vpERROR_TRACE ( "Error caught" ) ;
2042  throw ;
2043  }
2044 }
2045 
2046 
2052 void
2053 vpDisplay::setTitle ( const vpImage<vpRGBa> &I, const char *windowtitle )
2054 {
2055 
2056  try
2057  {
2058  if ( I.display != NULL )
2059  {
2060  ( I.display )->setTitle ( windowtitle ) ;
2061  }
2062  }
2063  catch ( ... )
2064  {
2065  vpERROR_TRACE ( "Error caught" ) ;
2066  throw ;
2067  }
2068 }
2069 
2079 void
2080 vpDisplay::setWindowPosition ( const vpImage<vpRGBa> &I, int winx, int winy )
2081 {
2082 
2083  try
2084  {
2085  if ( I.display != NULL )
2086  {
2087  ( I.display )->setWindowPosition ( winx, winy ) ;
2088  }
2089  }
2090  catch ( ... )
2091  {
2092  vpERROR_TRACE ( "Error caught" ) ;
2093  throw ;
2094  }
2095 }
2096 
2110 void
2111 vpDisplay::setFont ( const vpImage<vpRGBa> &I, const char *fontname )
2112 {
2113 
2114  try
2115  {
2116  if ( I.display != NULL )
2117  {
2118  ( I.display )->setFont ( fontname ) ;
2119  }
2120  }
2121  catch ( ... )
2122  {
2123  vpERROR_TRACE ( "Error caught" ) ;
2124  throw ;
2125  }
2126 }
2127 
2137 void
2139 {
2140  try
2141  {
2142  if ( I.display != NULL )
2143  {
2144  ( I.display )->clearDisplay ( color ) ;
2145  }
2146  }
2147  catch ( ... )
2148  {
2149  vpERROR_TRACE ( "Error caught" ) ;
2150  throw ;
2151  }
2152 }
2153 
2165 void
2167 {
2168 
2169  try
2170  {
2171  if ( I.display != NULL )
2172  {
2173  ( I.display )->displayImage ( I ) ;
2174  }
2175  }
2176  catch ( ... )
2177  {
2178  vpERROR_TRACE ( "Error caught" ) ;
2179  throw ;
2180  }
2181 }
2182 
2183 void
2185 {
2186  vpImagePoint topLeft;
2187  double top = floor(roi.getTop());
2188  double left = floor(roi.getLeft());
2189  double roiheight = floor(roi.getHeight());
2190  double roiwidth = floor(roi.getWidth());
2191  double iheight = (double)(I.getHeight());
2192  double iwidth = (double)(I.getWidth());
2193 
2194  if (top < 0 || top >= iheight || left < 0 || left >= iwidth || top+roiheight >= iheight || left+roiwidth >= iwidth)
2195  {
2196  vpERROR_TRACE ( "Region of interest outside of the image" ) ;
2198  "Region of interest outside of the image" ) ) ;
2199  }
2200 
2201  try
2202  {
2203  if ( I.display != NULL )
2204  {
2205  ( I.display )->displayImageROI ( I , vpImagePoint(top,left), (unsigned int)roiwidth,(unsigned int)roiheight ) ;
2206  }
2207  }
2208  catch ( ... )
2209  {
2210  vpERROR_TRACE ( "Error caught" ) ;
2211  throw ;
2212  }
2213 }
2214 
2215 
2282 void
2284 {
2285 
2286  try
2287  {
2288  if ( Isrc.display != NULL )
2289  {
2290  ( Isrc.display )->getImage ( Idest ) ;
2291  }
2292  else {
2293  Idest = Isrc;
2294  }
2295  }
2296  catch ( ... )
2297  {
2298  vpERROR_TRACE ( "Error caught" ) ;
2299  throw ;
2300  }
2301 }
2302 
2333 {
2334 
2335  try
2336  {
2337  if ( I.display != NULL )
2338  {
2339  ( I.display )->flushDisplay() ;
2340  }
2341  }
2342  catch ( ... )
2343  {
2344  vpERROR_TRACE ( "Error caught" ) ;
2345  throw ;
2346  }
2347 }
2348 
2349 void vpDisplay::flushROI ( const vpImage<vpRGBa> &I, const vpRect &roi )
2350 {
2351 
2352  try
2353  {
2354  if ( I.display != NULL )
2355  {
2356  ( I.display )->flushDisplayROI(roi.getTopLeft(),(unsigned int)roi.getWidth(),(unsigned int)roi.getHeight()) ;
2357  }
2358  }
2359  catch ( ... )
2360  {
2361  vpERROR_TRACE ( "Error caught" ) ;
2362  throw ;
2363  }
2364 }
2365 
2370 {
2371 
2372  try
2373  {
2374  if ( I.display != NULL )
2375  {
2376  ( I.display )->closeDisplay() ;
2377  I.display = NULL;
2378  }
2379  }
2380  catch ( ... )
2381  {
2382  vpERROR_TRACE ( "Error caught" ) ;
2383  throw ;
2384  }
2385 }
2386 
2404 bool vpDisplay::getClick ( const vpImage<unsigned char> &I, bool blocking )
2405 {
2406  try
2407  {
2408  if ( I.display != NULL )
2409  {
2410  return ( I.display )->getClick(blocking) ;
2411  }
2412  }
2413  catch ( ... )
2414  {
2415  vpERROR_TRACE ( "Error caught" ) ;
2416  throw ;
2417  }
2418  return false ;
2419 }
2420 
2442  vpImagePoint &ip, bool blocking )
2443 {
2444  try
2445  {
2446  if ( I.display != NULL )
2447  {
2448  return ( I.display )->getClick ( ip, blocking ) ;
2449  }
2450  }
2451  catch ( ... )
2452  {
2453  vpERROR_TRACE ( "Error caught" ) ;
2454  throw ;
2455  }
2456  return false ;
2457 }
2458 
2481  vpImagePoint &ip,
2483  bool blocking)
2484 {
2485  try
2486  {
2487  if ( I.display != NULL )
2488  {
2489  return ( I.display )->getClick ( ip, button, blocking ) ;
2490  }
2491  }
2492  catch ( ... )
2493  {
2494  vpERROR_TRACE ( "Error caught" ) ;
2495  throw ;
2496  }
2497  return false ;
2498 }
2499 
2521 bool
2523  vpImagePoint &ip,
2525  bool blocking )
2526 {
2527  try
2528  {
2529  if ( I.display != NULL )
2530  {
2531  return ( I.display )->getClickUp ( ip, button, blocking ) ;
2532  }
2533  }
2534  catch ( ... )
2535  {
2536  vpERROR_TRACE ( "Error caught" ) ;
2537  throw ;
2538  }
2539  return false ;
2540 }
2626 bool
2628 {
2629  try
2630  {
2631  if ( I.display != NULL )
2632  {
2633  return ( I.display )->getKeyboardEvent ( blocking ) ;
2634  }
2635  }
2636  catch ( ... )
2637  {
2638  vpERROR_TRACE ( "Error caught" ) ;
2639  throw ;
2640  }
2641  return false ;
2642 }
2643 
2733 bool
2735  char *string, bool blocking)
2736 {
2737  try
2738  {
2739  if ( I.display != NULL )
2740  {
2741  return ( I.display )->getKeyboardEvent ( string, blocking ) ;
2742  }
2743  }
2744  catch ( ... )
2745  {
2746  vpERROR_TRACE ( "Error caught" ) ;
2747  throw ;
2748  }
2749  return false ;
2750 }
2761 bool
2763  vpImagePoint &ip)
2764 {
2765  try
2766  {
2767  if ( I.display != NULL )
2768  {
2769  return ( I.display )->getPointerMotionEvent ( ip ) ;
2770  }
2771  }
2772  catch ( ... )
2773  {
2774  vpERROR_TRACE ( "Error caught" ) ;
2775  throw ;
2776  }
2777  return false;
2778 }
2779 
2790 bool
2792  vpImagePoint &ip)
2793 {
2794  try
2795  {
2796  if ( I.display != NULL )
2797  {
2798  return ( I.display )->getPointerPosition ( ip ) ;
2799  }
2800  }
2801  catch ( ... )
2802  {
2803  vpERROR_TRACE ( "Error caught" ) ;
2804  throw ;
2805  }
2806  return false;
2807 }
2808 
2822 bool vpDisplay::getClick ( const vpImage<vpRGBa> &I, bool blocking )
2823 {
2824  try
2825  {
2826  if ( I.display != NULL )
2827  {
2828  return ( I.display )->getClick(blocking) ;
2829  }
2830  }
2831  catch ( ... )
2832  {
2833  vpERROR_TRACE ( "Error caught" ) ;
2834  throw ;
2835  }
2836  return false;
2837 }
2838 
2839 
2859  vpImagePoint &ip, bool blocking )
2860 {
2861  try
2862  {
2863  if ( I.display != NULL )
2864  {
2865  return ( I.display )->getClick ( ip, blocking ) ;
2866  }
2867  }
2868  catch ( ... )
2869  {
2870  vpERROR_TRACE ( "Error caught" ) ;
2871  throw ;
2872  }
2873  return false ;
2874 }
2875 
2897  vpImagePoint &ip,
2899  bool blocking )
2900 {
2901  try
2902  {
2903  if ( I.display != NULL )
2904  {
2905  return ( I.display )->getClick ( ip, button, blocking ) ;
2906  }
2907  }
2908  catch ( ... )
2909  {
2910  vpERROR_TRACE ( "Error caught" ) ;
2911  throw ;
2912  }
2913  return false ;
2914 }
2915 
2936 bool
2938  vpImagePoint &ip,
2940  bool blocking )
2941 {
2942  try
2943  {
2944  if ( I.display != NULL )
2945  {
2946  return ( I.display )->getClickUp ( ip, button, blocking ) ;
2947  }
2948  }
2949  catch ( ... )
2950  {
2951  vpERROR_TRACE ( "Error caught" ) ;
2952  throw ;
2953  }
2954  return false ;
2955 }
2956 
3041 bool
3043 {
3044  try
3045  {
3046  if ( I.display != NULL )
3047  {
3048  return ( I.display )->getKeyboardEvent ( blocking ) ;
3049  }
3050  }
3051  catch ( ... )
3052  {
3053  vpERROR_TRACE ( "Error caught" ) ;
3054  throw ;
3055  }
3056  return false ;
3057 }
3058 
3146 bool
3148  char *string, bool blocking)
3149 {
3150  try
3151  {
3152  if ( I.display != NULL )
3153  {
3154  return ( I.display )->getKeyboardEvent ( string, blocking ) ;
3155  }
3156  }
3157  catch ( ... )
3158  {
3159  vpERROR_TRACE ( "Error caught" ) ;
3160  throw ;
3161  }
3162  return false ;
3163 }
3174 bool
3176 {
3177  try
3178  {
3179  if ( I.display != NULL )
3180  {
3181  return ( I.display )->getPointerMotionEvent ( ip ) ;
3182  }
3183  }
3184  catch ( ... )
3185  {
3186  vpERROR_TRACE ( "Error caught" ) ;
3187  throw ;
3188  }
3189  return false;
3190 }
3191 
3201 bool
3203 {
3204  try
3205  {
3206  if ( I.display != NULL )
3207  {
3208  return ( I.display )->getPointerPosition ( ip ) ;
3209  }
3210  }
3211  catch ( ... )
3212  {
3213  vpERROR_TRACE ( "Error caught" ) ;
3214  throw ;
3215  }
3216  return false;
3217 }
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:506
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:121
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
static void close(vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:2028
double get_i() const
Definition: vpImagePoint.h:181
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: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 ...
Class to define colors available for display functionnalities.
Definition: vpColor.h:125
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:179
virtual bool getClickUp(vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking=true)=0
error that can be emited by ViSP classes.
Definition: vpException.h:75
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:185
bool displayHasBeenInitialized
display has been initialized
Definition: vpDisplay.h:179
static const vpColor green
Definition: vpColor.h:170
static void flush(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:1991
double get_j() const
Definition: vpImagePoint.h:192
vpImagePoint getTopLeft() const
Definition: vpRect.h:175
static const vpColor red
Definition: vpColor.h:167
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:203
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:368
virtual ~vpDisplay()
Definition: vpDisplay.cpp:72
static void getImage(const vpImage< unsigned char > &Is, vpImage< vpRGBa > &Id)
Definition: vpDisplay.cpp:321
virtual void displayDotLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)=0
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:181
static void setBackground(const vpImage< unsigned char > &I, const vpColor &color)
Definition: vpDisplay.cpp:175
unsigned int getHeight() const
Definition: vpImage.h:150
Defines a rectangle in the plane.
Definition: vpRect.h:82
static void flushROI(const vpImage< unsigned char > &I, const vpRect &roi)
Definition: vpDisplay.cpp:2008
static void displayROI(const vpImage< unsigned char > &I, const vpRect &roi)
Definition: vpDisplay.cpp:222
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:183
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: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