ViSP  2.8.0
vpServoDisplay.cpp
1 /****************************************************************************
2  *
3  * $Id: vpServoDisplay.cpp 4056 2013-01-05 13:04:42Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Interface with the image for feature display.
36  *
37  * Authors:
38  * Eric Marchand
39  *
40  *****************************************************************************/
41 
47 // Servo
48 #include <visp/vpServo.h>
49 
50 // Meter/pixel conversion
51 #include <visp/vpCameraParameters.h>
52 
53 //Color / image / display
54 #include <visp/vpColor.h>
55 #include <visp/vpImage.h>
56 
57 #include <visp/vpDisplay.h>
58 
59 #include <visp/vpServoDisplay.h>
60 
61 #include <visp/vpBasicFeature.h>
62 
83 void
85  const vpCameraParameters &cam,
87  vpColor currentColor,
88  vpColor desiredColor,
89  unsigned int thickness)
90 {
91 
92 
93 
94  for (s.featureList.front(),
96  !s.featureList.outside() ;
97  s.featureList.next(),
99  {
100  vpBasicFeature *s_ptr = NULL;
101 
102  if (desiredColor != vpColor::none) {
103  // desired list
104  s_ptr = s.desiredFeatureList.value() ;
105  s_ptr->display(cam, I, desiredColor, thickness ) ;
106  }
107  if (currentColor != vpColor::none) {
108  // current list
109  s_ptr = s.featureList.value() ;
110  s_ptr->display(cam, I, currentColor, thickness ) ;
111  }
112  }
113  // vpDisplay::flush(I) ;
114 }
115 
136 void
138  const vpCameraParameters &cam,
139  vpImage<vpRGBa> &I,
140  vpColor currentColor,
141  vpColor desiredColor,
142  unsigned int thickness)
143 {
144 
145 
146 
147  for (s.featureList.front(),
149  !s.featureList.outside() ;
150  s.featureList.next(),
152  {
153  vpBasicFeature *s_ptr = NULL;
154 
155  if (desiredColor != vpColor::none) {
156  // desired list
157  s_ptr = s.desiredFeatureList.value() ;
158  s_ptr->display(cam, I, desiredColor, thickness ) ;
159  }
160  if (currentColor != vpColor::none) {
161  // current list
162  s_ptr = s.featureList.value() ;
163  s_ptr->display(cam, I, currentColor, thickness ) ;
164  }
165  }
166  // vpDisplay::flush(I) ;
167 }
168 
169 /*
170  * Local variables:
171  * c-basic-offset: 2
172  * End:
173  */
static void display(vpServo &s, const vpCameraParameters &cam, vpImage< unsigned char > &I, vpColor currentColor=vpColor::green, vpColor desiredColor=vpColor::red, unsigned int thickness=1)
vpList< vpBasicFeature * > desiredFeatureList
List of desired visual features (produce )
Definition: vpServo.h:467
bool outside(void) const
Test if the current element is outside the list (on the virtual element)
Definition: vpList.h:431
Class to define colors available for display functionnalities.
Definition: vpColor.h:125
static const vpColor none
Definition: vpColor.h:179
void next(void)
position the current element on the next one
Definition: vpList.h:275
class that defines what is a visual feature
vpList< vpBasicFeature * > featureList
List of visual features (produce )
Definition: vpServo.h:465
void front(void)
Position the current element on the first element of the list.
Definition: vpList.h:386
type & value(void)
return the value of the current element
Definition: vpList.h:303
Generic class defining intrinsic camera parameters.
Class required to compute the visual servoing control law descbribed in and .
Definition: vpServo.h:153
virtual void display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const =0