RGBDOpenPoseEstimationComponent.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::OpenPoseEstimation
17  * @author Stefan Reither ( stef dot reither at web dot de )
18  * @date 2018
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 #pragma once
23 
24 // STD/STL
25 
26 // IVT
27 #include <Calibration/Calibration.h>
28 #include <Calibration/StereoCalibration.h>
29 
30 
31 // Base class
33 
34 namespace armarx
35 {
37  {
38  public:
41 
42  // helper functions
43  void preOnInitImageProcessor() override;
44  void preOnConnectImageProcessor() override;
45  void postOnConnectImageProcessor() override;
46  void preOnDisconnectImageProcessor() override;
47  void postOnDisconnectImageProcessor() override;
48 
49  void postCreatePropertyDefinitions(PropertyDefinitionsPtr& properties) override;
50 
51  // OpenPoseEstimation Interface
52  void stop(const Ice::Current& = Ice::emptyCurrent) override;
53  void start3DPoseEstimation(const Ice::Current& = Ice::emptyCurrent) override;
54  void stop3DPoseEstimation(const Ice::Current& = Ice::emptyCurrent) override;
55 
56  // HumanPoseEstimation Interface
57  void enableHumanPoseEstimation(const EnableHumanPoseEstimationInput& input,
58  const Ice::Current&) override;
59 
60  void renderOutputImage(const op::Array<float>&) override;
61  void reportEntities() override;
62  void visualize() override;
63 
64  private:
65  void maskOutputImageBasedOnDepth();
66  int getMedianDepthFromImage(int x, int y, int radius) const;
67 
68  void filterToNearest();
69 
70 
71  public:
72  // Depth image info
73  unsigned int radius = 10;
74  unsigned int maxDepth = 3000;
75  unsigned int maxDepthDifference = 700;
76 
77  // Image calibration
78  const CCalibration* calibration = nullptr;
79  std::string cameraNodeName = "AzureKinectCamera";
81 
82  // ImageBuffer und ImageInformations
83  CByteImage* maskedrgbImageBuffer;
84 
85  CByteImage* depthImageBuffer;
87  int brightnessIncrease = 100;
88 
89  // Meta (Properties)
91 
92  // Topics
93  OpenPose3DListenerPrx listener3DPrx;
94 
95  // OpenPose Buffers
96  HumanPose3DMap openposeResult3D;
97 
98  // Robot
101 
102  // Threads and program flow information
103  std::atomic_bool running3D;
104  };
105 } // namespace armarx
armarx::RGBDOpenPoseEstimationComponentPluginUser::maskedrgbImageBuffer
CByteImage * maskedrgbImageBuffer
Definition: RGBDOpenPoseEstimationComponent.h:83
armarx::RGBDOpenPoseEstimationComponentPluginUser::stop
void stop(const Ice::Current &=Ice::emptyCurrent) override
Definition: RGBDOpenPoseEstimationComponent.cpp:337
armarx::RGBDOpenPoseEstimationComponentPluginUser::brightnessIncrease
int brightnessIncrease
Definition: RGBDOpenPoseEstimationComponent.h:87
armarx::OpenPoseEstimationComponentPluginUser::OpenPoseEstimationComponentPluginUser
OpenPoseEstimationComponentPluginUser()
Definition: OpenPoseEstimationComponent.cpp:132
armarx::RGBDOpenPoseEstimationComponentPluginUser
Definition: RGBDOpenPoseEstimationComponent.h:36
armarx::RGBDOpenPoseEstimationComponentPluginUser::localRobot
VirtualRobot::RobotPtr localRobot
Definition: RGBDOpenPoseEstimationComponent.h:100
armarx::RGBDOpenPoseEstimationComponentPluginUser::enableHumanPoseEstimation
void enableHumanPoseEstimation(const EnableHumanPoseEstimationInput &input, const Ice::Current &) override
Definition: RGBDOpenPoseEstimationComponent.cpp:369
armarx::RGBDOpenPoseEstimationComponentPluginUser::running3D
std::atomic_bool running3D
Definition: RGBDOpenPoseEstimationComponent.h:103
armarx::RGBDOpenPoseEstimationComponentPluginUser::preOnConnectImageProcessor
void preOnConnectImageProcessor() override
Definition: RGBDOpenPoseEstimationComponent.cpp:115
armarx::RGBDOpenPoseEstimationComponentPluginUser::stop3DPoseEstimation
void stop3DPoseEstimation(const Ice::Current &=Ice::emptyCurrent) override
Definition: RGBDOpenPoseEstimationComponent.cpp:358
armarx::RGBDOpenPoseEstimationComponentPluginUser::depthImageBuffer
CByteImage * depthImageBuffer
Definition: RGBDOpenPoseEstimationComponent.h:85
armarx::RGBDOpenPoseEstimationComponentPluginUser::postCreatePropertyDefinitions
void postCreatePropertyDefinitions(PropertyDefinitionsPtr &properties) override
Definition: RGBDOpenPoseEstimationComponent.cpp:37
armarx::RGBDOpenPoseEstimationComponentPluginUser::listener3DPrx
OpenPose3DListenerPrx listener3DPrx
Definition: RGBDOpenPoseEstimationComponent.h:93
armarx::RGBDOpenPoseEstimationComponentPluginUser::reportOnlyNearestPerson
bool reportOnlyNearestPerson
Definition: RGBDOpenPoseEstimationComponent.h:90
armarx::RGBDOpenPoseEstimationComponentPluginUser::openposeResult3D
HumanPose3DMap openposeResult3D
Definition: RGBDOpenPoseEstimationComponent.h:96
armarx::RGBDOpenPoseEstimationComponentPluginUser::maxDepthDifference
unsigned int maxDepthDifference
Definition: RGBDOpenPoseEstimationComponent.h:75
armarx::RGBDOpenPoseEstimationComponentPluginUser::robotStateInterface
armarx::RobotStateComponentInterfacePrx robotStateInterface
Definition: RGBDOpenPoseEstimationComponent.h:99
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:12
armarx::RGBDOpenPoseEstimationComponentPluginUser::renderOutputImage
void renderOutputImage(const op::Array< float > &) override
Definition: RGBDOpenPoseEstimationComponent.cpp:131
armarx::RGBDOpenPoseEstimationComponentPluginUser::radius
unsigned int radius
Definition: RGBDOpenPoseEstimationComponent.h:73
armarx::RGBDOpenPoseEstimationComponentPluginUser::postOnConnectImageProcessor
void postOnConnectImageProcessor() override
Definition: RGBDOpenPoseEstimationComponent.cpp:66
armarx::RGBDOpenPoseEstimationComponentPluginUser::start3DPoseEstimation
void start3DPoseEstimation(const Ice::Current &=Ice::emptyCurrent) override
Definition: RGBDOpenPoseEstimationComponent.cpp:344
armarx::RGBDOpenPoseEstimationComponentPluginUser::visualize
void visualize() override
Definition: RGBDOpenPoseEstimationComponent.cpp:480
armarx::OpenPoseEstimationComponentPluginUser
Definition: OpenPoseEstimationComponent.h:54
armarx::RGBDOpenPoseEstimationComponentPluginUser::calibration
const CCalibration * calibration
Definition: RGBDOpenPoseEstimationComponent.h:78
armarx::RGBDOpenPoseEstimationComponentPluginUser::RGBDOpenPoseEstimationComponentPluginUser
RGBDOpenPoseEstimationComponentPluginUser()
Definition: RGBDOpenPoseEstimationComponent.cpp:126
armarx::RGBDOpenPoseEstimationComponentPluginUser::reportEntities
void reportEntities() override
Definition: RGBDOpenPoseEstimationComponent.cpp:219
armarx::RGBDOpenPoseEstimationComponentPluginUser::preOnDisconnectImageProcessor
void preOnDisconnectImageProcessor() override
Definition: RGBDOpenPoseEstimationComponent.cpp:100
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::RGBDOpenPoseEstimationComponentPluginUser::cameraNodeName
std::string cameraNodeName
Definition: RGBDOpenPoseEstimationComponent.h:79
armarx::RGBDOpenPoseEstimationComponentPluginUser::maxDepth
unsigned int maxDepth
Definition: RGBDOpenPoseEstimationComponent.h:74
IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface >
armarx::RGBDOpenPoseEstimationComponentPluginUser::preOnInitImageProcessor
void preOnInitImageProcessor() override
Definition: RGBDOpenPoseEstimationComponent.cpp:109
armarx::RGBDOpenPoseEstimationComponentPluginUser::depthImageBufferMutex
std::mutex depthImageBufferMutex
Definition: RGBDOpenPoseEstimationComponent.h:86
OpenPoseEstimationComponent.h
armarx::RGBDOpenPoseEstimationComponentPluginUser::postOnDisconnectImageProcessor
void postOnDisconnectImageProcessor() override
Definition: RGBDOpenPoseEstimationComponent.cpp:121
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:19
armarx::RGBDOpenPoseEstimationComponentPluginUser::useDistortionParameters
bool useDistortionParameters
Definition: RGBDOpenPoseEstimationComponent.h:80