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 
26 #include <mutex>
27 
28 #include <Eigen/Core>
29 #include <Eigen/Geometry>
30 
31 #include <opencv2/opencv.hpp>
32 
35 
39 
40 #include <Image/IplImageAdaptor.h>
41 
42 namespace armarx
43 {
44  /**
45  * @class BlurrinessMetricPropertyDefinitions
46  * @brief
47  */
49  {
50  public:
53  {
54  //defineRequiredProperty<std::string>("PropertyName", "Description");
55  //defineOptionalProperty<std::string>("PropertyName", "DefaultValue", "Description");
56  defineOptionalProperty<float>("Framerate", 30.0, "the framerate");
57  defineOptionalProperty<float>(
58  "ThresholdLaplaceBlur",
59  250.0,
60  "Threshold value below which the image is considered blurry");
61  defineOptionalProperty<float>(
62  "ThresholdPerceptualBlur",
63  0.97,
64  "Threshold value below which the image is considered blurry");
65  defineOptionalProperty<std::string>(
66  "providerName", "Armar3ImageProvider", "ImageProvider name");
67 
68  defineOptionalProperty<std::string>("DebugObserverName",
69  "DebugObserver",
70  "Name of the topic the DebugObserver listens on");
71  }
72  };
73 
74  /**
75  * @defgroup Component-BlurrinessMetric BlurrinessMetric
76  * @ingroup VisionX-Components
77  * A description of the component BlurrinessMetric.
78  *
79  * @class BlurrinessMetric
80  * @ingroup Component-BlurrinessMetric
81  * @brief Brief description of class BlurrinessMetric.
82  *
83  * Detailed description of class BlurrinessMetric.
84  */
86  {
87  public:
88  /**
89  * @see armarx::ManagedIceObject::getDefaultName()
90  */
91  std::string
92  getDefaultName() const override
93  {
94  return "BlurrinessMetric";
95  }
96 
97  /**
98  * @see PropertyUser::createPropertyDefinitions()
99  */
101 
102  // ImageProcessor interface
103  protected:
104  void onInitImageProcessor() override;
105  void onConnectImageProcessor() override;
106  void onExitImageProcessor() override;
107  void process() override;
108 
109  private:
110  CByteImage** cameraImages;
111  std::string providerName;
112  std::mutex imageMutex;
113 
114  visionx::ImageProviderInterfacePrx imageProviderPrx;
115 
116  DebugObserverInterfacePrx debugObserver;
117 
118  visionx::FPSCounter fpsCounter;
119  float frameRate, thresholdLaplace, thresholdPerceptual;
120 
121  size_t seq;
122 
123 
124  double laplaceVarianceBlurrinessMetric(cv::Mat& in);
125  double blurringPerceptual(const cv::Mat& src);
126  double blurringMarziliano(const cv::Mat& src);
127  };
128 } // namespace armarx
armarx::BlurrinessMetric::onExitImageProcessor
void onExitImageProcessor() override
Exit the ImapeProcessor component.
Definition: BlurrinessMetric.cpp:70
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:98
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
visionx::ImageProcessorPropertyDefinitions::ImageProcessorPropertyDefinitions
ImageProcessorPropertyDefinitions(std::string prefix)
Definition: ImageProcessor.h:64
armarx::BlurrinessMetric
Brief description of class BlurrinessMetric.
Definition: BlurrinessMetric.h:85
ImageProcessor.h
armarx::BlurrinessMetricPropertyDefinitions
Definition: BlurrinessMetric.h:48
Component.h
armarx::BlurrinessMetric::process
void process() override
Process the vision component.
Definition: BlurrinessMetric.cpp:75
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:37
armarx::BlurrinessMetric::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: BlurrinessMetric.cpp:30
FPSCounter.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::BlurrinessMetric::getDefaultName
std::string getDefaultName() const override
Definition: BlurrinessMetric.h:92
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:51