BlurrinessMetric.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::BlurrinessMetric
17  * @author David Sippel ( uddoe at student dot kit dot edu )
18  * @date 2017
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 <opencv2/opencv.hpp>
34 
35 #include <Image/IplImageAdaptor.h>
36 
37 #include <Eigen/Core>
38 #include <Eigen/Geometry>
39 
40 #include <mutex>
41 
42 
43 namespace armarx
44 {
45  /**
46  * @class BlurrinessMetricPropertyDefinitions
47  * @brief
48  */
51  {
52  public:
55  {
56  //defineRequiredProperty<std::string>("PropertyName", "Description");
57  //defineOptionalProperty<std::string>("PropertyName", "DefaultValue", "Description");
58  defineOptionalProperty<float>("Framerate", 30.0, "the framerate");
59  defineOptionalProperty<float>("ThresholdLaplaceBlur", 250.0, "Threshold value below which the image is considered blurry");
60  defineOptionalProperty<float>("ThresholdPerceptualBlur", 0.97, "Threshold value below which the image is considered blurry");
61  defineOptionalProperty<std::string>("providerName", "Armar3ImageProvider", "ImageProvider name");
62 
63  defineOptionalProperty<std::string>("DebugObserverName", "DebugObserver", "Name of the topic the DebugObserver listens on");
64  }
65  };
66 
67  /**
68  * @defgroup Component-BlurrinessMetric BlurrinessMetric
69  * @ingroup VisionX-Components
70  * A description of the component BlurrinessMetric.
71  *
72  * @class BlurrinessMetric
73  * @ingroup Component-BlurrinessMetric
74  * @brief Brief description of class BlurrinessMetric.
75  *
76  * Detailed description of class BlurrinessMetric.
77  */
79  virtual public visionx::ImageProcessor
80  {
81  public:
82  /**
83  * @see armarx::ManagedIceObject::getDefaultName()
84  */
85  std::string getDefaultName() const override
86  {
87  return "BlurrinessMetric";
88  }
89 
90  /**
91  * @see PropertyUser::createPropertyDefinitions()
92  */
94 
95  // ImageProcessor interface
96  protected:
97  void onInitImageProcessor() override;
98  void onConnectImageProcessor() override;
99  void onExitImageProcessor() override;
100  void process() override;
101 
102  private:
103  CByteImage** cameraImages;
104  std::string providerName;
105  std::mutex imageMutex;
106 
107  visionx::ImageProviderInterfacePrx imageProviderPrx;
108 
109  DebugObserverInterfacePrx debugObserver;
110 
111  visionx::FPSCounter fpsCounter;
112  float frameRate, thresholdLaplace, thresholdPerceptual;
113 
114  size_t seq;
115 
116 
117  double laplaceVarianceBlurrinessMetric(cv::Mat& in);
118  double blurringPerceptual(const cv::Mat& src);
119  double blurringMarziliano(const cv::Mat& src);
120  };
121 }
122 
armarx::BlurrinessMetric::onExitImageProcessor
void onExitImageProcessor() override
Exit the ImapeProcessor component.
Definition: BlurrinessMetric.cpp:69
DebugObserver.h
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
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
visionx::ImageProcessorPropertyDefinitions::ImageProcessorPropertyDefinitions
ImageProcessorPropertyDefinitions(std::string prefix)
Definition: ImageProcessor.h:65
armarx::BlurrinessMetric
Brief description of class BlurrinessMetric.
Definition: BlurrinessMetric.h:78
ImageProcessor.h
armarx::BlurrinessMetricPropertyDefinitions
Definition: BlurrinessMetric.h:49
Component.h
armarx::BlurrinessMetric::process
void process() override
Process the vision component.
Definition: BlurrinessMetric.cpp:73
IceUtil::Handle< class PropertyDefinitionContainer >
visionx::ImageProcessorPropertyDefinitions
Definition: ImageProcessor.h:61
IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface >
ImageUtil.h
armarx::BlurrinessMetric::onConnectImageProcessor
void onConnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component is fully initia...
Definition: BlurrinessMetric.cpp:49
armarx::BlurrinessMetric::onInitImageProcessor
void onInitImageProcessor() override
Setup the vision component.
Definition: BlurrinessMetric.cpp:38
armarx::BlurrinessMetric::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: BlurrinessMetric.cpp:31
FPSCounter.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::BlurrinessMetric::getDefaultName
std::string getDefaultName() const override
Definition: BlurrinessMetric.h:85
visionx::FPSCounter
The FPSCounter class provides methods for calculating the frames per second (FPS) count in periodic t...
Definition: FPSCounter.h:36
armarx::BlurrinessMetricPropertyDefinitions::BlurrinessMetricPropertyDefinitions
BlurrinessMetricPropertyDefinitions(std::string prefix)
Definition: BlurrinessMetric.h:53