ViSP  2.10.0
vpServoDisplay.cpp
1 /****************************************************************************
2  *
3  * $Id: vpServoDisplay.cpp 4645 2014-02-05 17:44:06Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * 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 
84  const vpCameraParameters &cam,
85  const vpImage<unsigned char> &I,
86  vpColor currentColor,
87  vpColor desiredColor,
88  unsigned int thickness)
89 {
90  std::list<vpBasicFeature *>::const_iterator it_s;
91  std::list<vpBasicFeature *>::const_iterator it_s_star;
92 
93  for (it_s = s.featureList.begin(), it_s_star = s.desiredFeatureList.begin();
94  it_s != s.featureList.end();
95  ++it_s, ++it_s_star)
96  {
97  if (desiredColor != vpColor::none) {
98  // desired list
99  (*it_s_star)->display(cam, I, desiredColor, thickness ) ;
100  }
101  if (currentColor != vpColor::none) {
102  // current list
103  (*it_s)->display(cam, I, currentColor, thickness ) ;
104  }
105  }
106  // vpDisplay::flush(I) ;
107 }
108 
129 void
131  const vpCameraParameters &cam,
132  const vpImage<vpRGBa> &I,
133  vpColor currentColor,
134  vpColor desiredColor,
135  unsigned int thickness)
136 {
137  std::list<vpBasicFeature *>::const_iterator it_s;
138  std::list<vpBasicFeature *>::const_iterator it_s_star;
139 
140  for (it_s = s.featureList.begin(), it_s_star = s.desiredFeatureList.begin();
141  it_s != s.featureList.end();
142  ++it_s, ++it_s_star)
143  {
144  if (desiredColor != vpColor::none) {
145  // desired list
146  (*it_s_star)->display(cam, I, desiredColor, thickness ) ;
147  }
148  if (currentColor != vpColor::none) {
149  // current list
150  (*it_s)->display(cam, I, currentColor, thickness ) ;
151  }
152  }
153  // vpDisplay::flush(I) ;
154 }
Class to define colors available for display functionnalities.
Definition: vpColor.h:125
static const vpColor none
Definition: vpColor.h:179
Generic class defining intrinsic camera parameters.
std::list< vpBasicFeature * > desiredFeatureList
List of desired visual features .
Definition: vpServo.h:496
std::list< vpBasicFeature * > featureList
List of current visual features .
Definition: vpServo.h:494
static void display(const vpServo &s, const vpCameraParameters &cam, const vpImage< unsigned char > &I, vpColor currentColor=vpColor::green, vpColor desiredColor=vpColor::red, unsigned int thickness=1)