TrackingError.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package VisionX::ArmarXObjects::TrackingError
17  * @author David Sippel ( uddoe at student dot kit dot edu )
18  * @date 2016
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 
28 
32 
33 #include <VisionX/interface/components/TrackingErrorInterface.h>
34 
35 #include <opencv2/opencv.hpp>
36 
37 #include <Image/IplImageAdaptor.h>
38 
39 #include <Eigen/Core>
40 #include <Eigen/Geometry>
41 
42 #include <mutex>
43 
44 
45 namespace armarx
46 {
47  /**
48  * @class TrackingErrorPropertyDefinitions
49  * @brief
50  */
53  {
54  public:
57  {
58  //defineRequiredProperty<std::string>("PropertyName", "Description");
59  //defineOptionalProperty<std::string>("PropertyName", "DefaultValue", "Description");
60  defineOptionalProperty<float>("Framerate", 0.0, "the framerate");
61  defineOptionalProperty<std::string>("providerName", "Armar3ImageProvider", "ImageProvider name");
62  defineOptionalProperty<bool>("UseChessBoard", true, "use chessboard for feature tracking");
63  defineOptionalProperty<std::string>("TrackingErrorTopicName", "TrackingErrorTopic", "TrackingErrorTopicName name");
64  defineOptionalProperty<int>("Chessboard.Width", 7, "Chessboard width");
65  defineOptionalProperty<int>("Chessboard.Height", 5, "Chessboard height");
66 
67  defineOptionalProperty<std::string>("DebugObserverName", "DebugObserver", "Name of the topic the DebugObserver listens on");
68  }
69  };
70 
71  /**
72  * @defgroup Component-TrackingError TrackingError
73  * @ingroup VisionX-Components
74  * A description of the component TrackingError.
75  *
76  * @class TrackingError
77  * @ingroup Component-TrackingError
78  * @brief Brief description of class TrackingError.
79  *
80  * Detailed description of class TrackingError.
81  */
82  class TrackingError :
83  virtual public visionx::ImageProcessor
84  {
85  public:
86  /**
87  * @see armarx::ManagedIceObject::getDefaultName()
88  */
89  std::string getDefaultName() const override
90  {
91  return "TrackingError";
92  }
93 
94  /**
95  * @see PropertyUser::createPropertyDefinitions()
96  */
98 
99  // ImageProcessor interface
100  protected:
101  void onInitImageProcessor() override;
102  void onConnectImageProcessor() override;
103  void onExitImageProcessor() override;
104  void process() override;
105 
106  private:
107  CByteImage** cameraImages;
108  std::string providerName;
109  std::mutex imageMutex;
110  cv::Mat previousImage, old2;
111  std::vector< cv::Point2f > previousFeatures, features2_prev;
112  bool useChessboard;
113 
114  int chessboardWidth, chessboardHeight, imageWidth, imageHeight;
115 
116  visionx::ImageProviderInterfacePrx imageProviderPrx;
117  TrackingErrorListenerPrx prx;
118 
119  DebugObserverInterfacePrx debugObserver;
120 
121  visionx::FPSCounter fpsCounter;
122  float frameRate;
123  };
124 }
125 
DebugObserver.h
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
armarx::TrackingError
Brief description of class TrackingError.
Definition: TrackingError.h:82
visionx::ImageProcessor
The ImageProcessor class provides an interface for access to ImageProviders via Ice and shared memory...
Definition: ImageProcessor.h:87
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
armarx::TrackingErrorPropertyDefinitions
Definition: TrackingError.h:51
visionx::ImageProcessorPropertyDefinitions::ImageProcessorPropertyDefinitions
ImageProcessorPropertyDefinitions(std::string prefix)
Definition: ImageProcessor.h:65
armarx::TrackingError::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: TrackingError.cpp:31
ImageProcessor.h
armarx::TrackingError::process
void process() override
Process the vision component.
Definition: TrackingError.cpp:81
armarx::TrackingError::getDefaultName
std::string getDefaultName() const override
Definition: TrackingError.h:89
armarx::TrackingError::onExitImageProcessor
void onExitImageProcessor() override
Exit the ImapeProcessor component.
Definition: TrackingError.cpp:77
Component.h
armarx::TrackingErrorPropertyDefinitions::TrackingErrorPropertyDefinitions
TrackingErrorPropertyDefinitions(std::string prefix)
Definition: TrackingError.h:55
armarx::TrackingError::onInitImageProcessor
void onInitImageProcessor() override
Setup the vision component.
Definition: TrackingError.cpp:38
IceUtil::Handle< class PropertyDefinitionContainer >
visionx::ImageProcessorPropertyDefinitions
Definition: ImageProcessor.h:61
IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface >
ImageUtil.h
armarx::TrackingError::onConnectImageProcessor
void onConnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component is fully initia...
Definition: TrackingError.cpp:55
FPSCounter.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
visionx::FPSCounter
The FPSCounter class provides methods for calculating the frames per second (FPS) count in periodic t...
Definition: FPSCounter.h:36