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 
26 #include <mutex>
27 
28 #include <Eigen/Core>
29 #include <Eigen/Geometry>
30 
31 #include <opencv2/opencv.hpp>
32 
35 
37 #include <VisionX/interface/components/TrackingErrorInterface.h>
40 
41 #include <Image/IplImageAdaptor.h>
42 
43 namespace armarx
44 {
45  /**
46  * @class TrackingErrorPropertyDefinitions
47  * @brief
48  */
50  {
51  public:
54  {
55  //defineRequiredProperty<std::string>("PropertyName", "Description");
56  //defineOptionalProperty<std::string>("PropertyName", "DefaultValue", "Description");
57  defineOptionalProperty<float>("Framerate", 0.0, "the framerate");
58  defineOptionalProperty<std::string>(
59  "providerName", "Armar3ImageProvider", "ImageProvider name");
60  defineOptionalProperty<bool>(
61  "UseChessBoard", true, "use chessboard for feature tracking");
62  defineOptionalProperty<std::string>(
63  "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",
68  "DebugObserver",
69  "Name of the topic the DebugObserver listens on");
70  }
71  };
72 
73  /**
74  * @defgroup Component-TrackingError TrackingError
75  * @ingroup VisionX-Components
76  * A description of the component TrackingError.
77  *
78  * @class TrackingError
79  * @ingroup Component-TrackingError
80  * @brief Brief description of class TrackingError.
81  *
82  * Detailed description of class TrackingError.
83  */
84  class TrackingError : virtual public visionx::ImageProcessor
85  {
86  public:
87  /**
88  * @see armarx::ManagedIceObject::getDefaultName()
89  */
90  std::string
91  getDefaultName() const override
92  {
93  return "TrackingError";
94  }
95 
96  /**
97  * @see PropertyUser::createPropertyDefinitions()
98  */
100 
101  // ImageProcessor interface
102  protected:
103  void onInitImageProcessor() override;
104  void onConnectImageProcessor() override;
105  void onExitImageProcessor() override;
106  void process() override;
107 
108  private:
109  CByteImage** cameraImages;
110  std::string providerName;
111  std::mutex imageMutex;
112  cv::Mat previousImage, old2;
113  std::vector<cv::Point2f> previousFeatures, features2_prev;
114  bool useChessboard;
115 
116  int chessboardWidth, chessboardHeight, imageWidth, imageHeight;
117 
118  visionx::ImageProviderInterfacePrx imageProviderPrx;
119  TrackingErrorListenerPrx prx;
120 
121  DebugObserverInterfacePrx debugObserver;
122 
123  visionx::FPSCounter fpsCounter;
124  float frameRate;
125  };
126 } // namespace armarx
DebugObserver.h
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
armarx::TrackingError
Brief description of class TrackingError.
Definition: TrackingError.h:84
visionx::ImageProcessor
The ImageProcessor class provides an interface for access to ImageProviders via Ice and shared memory...
Definition: ImageProcessor.h:98
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
armarx::TrackingErrorPropertyDefinitions
Definition: TrackingError.h:49
visionx::ImageProcessorPropertyDefinitions::ImageProcessorPropertyDefinitions
ImageProcessorPropertyDefinitions(std::string prefix)
Definition: ImageProcessor.h:64
armarx::TrackingError::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: TrackingError.cpp:30
ImageProcessor.h
armarx::TrackingError::process
void process() override
Process the vision component.
Definition: TrackingError.cpp:86
armarx::TrackingError::getDefaultName
std::string getDefaultName() const override
Definition: TrackingError.h:91
armarx::TrackingError::onExitImageProcessor
void onExitImageProcessor() override
Exit the ImapeProcessor component.
Definition: TrackingError.cpp:81
Component.h
armarx::TrackingErrorPropertyDefinitions::TrackingErrorPropertyDefinitions
TrackingErrorPropertyDefinitions(std::string prefix)
Definition: TrackingError.h:52
armarx::TrackingError::onInitImageProcessor
void onInitImageProcessor() override
Setup the vision component.
Definition: TrackingError.cpp:37
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:27
visionx::FPSCounter
The FPSCounter class provides methods for calculating the frames per second (FPS) count in periodic t...
Definition: FPSCounter.h:36