Visual Servoing Platform  version 3.0.0
vpServoDisplay.cpp
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2015 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See http://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Interface with the image for feature display.
32  *
33  * Authors:
34  * Eric Marchand
35  *
36  *****************************************************************************/
37 
43 // Servo
44 #include <visp3/vs/vpServo.h>
45 
46 // Meter/pixel conversion
47 #include <visp3/core/vpCameraParameters.h>
48 
49 //Color / image / display
50 #include <visp3/core/vpColor.h>
51 #include <visp3/core/vpImage.h>
52 
53 #include <visp3/core/vpDisplay.h>
54 
55 #include <visp3/vs/vpServoDisplay.h>
56 
57 #include <visp3/visual_features/vpBasicFeature.h>
58 
80  const vpCameraParameters &cam,
81  const vpImage<unsigned char> &I,
82  vpColor currentColor,
83  vpColor desiredColor,
84  unsigned int thickness)
85 {
86  std::list<vpBasicFeature *>::const_iterator it_s;
87  std::list<vpBasicFeature *>::const_iterator it_s_star;
88 
89  for (it_s = s.featureList.begin(), it_s_star = s.desiredFeatureList.begin();
90  it_s != s.featureList.end();
91  ++it_s, ++it_s_star)
92  {
93  if (desiredColor != vpColor::none) {
94  // desired list
95  (*it_s_star)->display(cam, I, desiredColor, thickness ) ;
96  }
97  if (currentColor != vpColor::none) {
98  // current list
99  (*it_s)->display(cam, I, currentColor, thickness ) ;
100  }
101  }
102  // vpDisplay::flush(I) ;
103 }
104 
125 void
127  const vpCameraParameters &cam,
128  const vpImage<vpRGBa> &I,
129  vpColor currentColor,
130  vpColor desiredColor,
131  unsigned int thickness)
132 {
133  std::list<vpBasicFeature *>::const_iterator it_s;
134  std::list<vpBasicFeature *>::const_iterator it_s_star;
135 
136  for (it_s = s.featureList.begin(), it_s_star = s.desiredFeatureList.begin();
137  it_s != s.featureList.end();
138  ++it_s, ++it_s_star)
139  {
140  if (desiredColor != vpColor::none) {
141  // desired list
142  (*it_s_star)->display(cam, I, desiredColor, thickness ) ;
143  }
144  if (currentColor != vpColor::none) {
145  // current list
146  (*it_s)->display(cam, I, currentColor, thickness ) ;
147  }
148  }
149  // vpDisplay::flush(I) ;
150 }
Class to define colors available for display functionnalities.
Definition: vpColor.h:121
static const vpColor none
Definition: vpColor.h:175
Generic class defining intrinsic camera parameters.
std::list< vpBasicFeature * > desiredFeatureList
List of desired visual features .
Definition: vpServo.h:521
std::list< vpBasicFeature * > featureList
List of current visual features .
Definition: vpServo.h:519
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)