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 {
38  {
39  public:
42 
43  // helper functions
44  void preOnInitImageProcessor() override;
45  void preOnConnectImageProcessor() override;
46  void postOnConnectImageProcessor() override;
47  void preOnDisconnectImageProcessor() override;
48  void postOnDisconnectImageProcessor() override;
49 
50  void postCreatePropertyDefinitions(PropertyDefinitionsPtr& properties) override;
51 
52  // OpenPoseEstimation Interface
53  void stop(const Ice::Current& = Ice::emptyCurrent) override;
54  void start3DPoseEstimation(const Ice::Current& = Ice::emptyCurrent) override;
55  void stop3DPoseEstimation(const Ice::Current& = Ice::emptyCurrent) override;
56 
57  // HumanPoseEstimation Interface
58  void enableHumanPoseEstimation(const EnableHumanPoseEstimationInput& input, 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 
72  public:
73  // Depth image info
74  unsigned int radius = 10;
75  unsigned int maxDepth = 3000;
76  unsigned int maxDepthDifference = 700;
77 
78  // Image calibration
79  const CCalibration* calibration = nullptr;
80  std::string cameraNodeName = "AzureKinectCamera";
82 
83  // ImageBuffer und ImageInformations
84  CByteImage* maskedrgbImageBuffer;
85 
86  CByteImage* depthImageBuffer;
88  int brightnessIncrease = 100;
89 
90  // Meta (Properties)
92 
93  // Topics
94  OpenPose3DListenerPrx listener3DPrx;
95 
96  // OpenPose Buffers
97  HumanPose3DMap openposeResult3D;
98 
99  // Robot
102 
103  // Threads and program flow information
104  std::atomic_bool running3D;
105  };
106 }
armarx::RGBDOpenPoseEstimationComponentPluginUser::maskedrgbImageBuffer
CByteImage * maskedrgbImageBuffer
Definition: RGBDOpenPoseEstimationComponent.h:84
armarx::RGBDOpenPoseEstimationComponentPluginUser::stop
void stop(const Ice::Current &=Ice::emptyCurrent) override
Definition: RGBDOpenPoseEstimationComponent.cpp:293
armarx::RGBDOpenPoseEstimationComponentPluginUser::brightnessIncrease
int brightnessIncrease
Definition: RGBDOpenPoseEstimationComponent.h:88
armarx::OpenPoseEstimationComponentPluginUser::OpenPoseEstimationComponentPluginUser
OpenPoseEstimationComponentPluginUser()
Definition: OpenPoseEstimationComponent.cpp:94
armarx::RGBDOpenPoseEstimationComponentPluginUser
Definition: RGBDOpenPoseEstimationComponent.h:36
armarx::RGBDOpenPoseEstimationComponentPluginUser::localRobot
VirtualRobot::RobotPtr localRobot
Definition: RGBDOpenPoseEstimationComponent.h:101
armarx::RGBDOpenPoseEstimationComponentPluginUser::enableHumanPoseEstimation
void enableHumanPoseEstimation(const EnableHumanPoseEstimationInput &input, const Ice::Current &) override
Definition: RGBDOpenPoseEstimationComponent.cpp:322
armarx::RGBDOpenPoseEstimationComponentPluginUser::running3D
std::atomic_bool running3D
Definition: RGBDOpenPoseEstimationComponent.h:104
armarx::RGBDOpenPoseEstimationComponentPluginUser::preOnConnectImageProcessor
void preOnConnectImageProcessor() override
Definition: RGBDOpenPoseEstimationComponent.cpp:95
armarx::RGBDOpenPoseEstimationComponentPluginUser::stop3DPoseEstimation
void stop3DPoseEstimation(const Ice::Current &=Ice::emptyCurrent) override
Definition: RGBDOpenPoseEstimationComponent.cpp:312
armarx::RGBDOpenPoseEstimationComponentPluginUser::depthImageBuffer
CByteImage * depthImageBuffer
Definition: RGBDOpenPoseEstimationComponent.h:86
armarx::RGBDOpenPoseEstimationComponentPluginUser::postCreatePropertyDefinitions
void postCreatePropertyDefinitions(PropertyDefinitionsPtr &properties) override
Definition: RGBDOpenPoseEstimationComponent.cpp:36
armarx::RGBDOpenPoseEstimationComponentPluginUser::listener3DPrx
OpenPose3DListenerPrx listener3DPrx
Definition: RGBDOpenPoseEstimationComponent.h:94
armarx::RGBDOpenPoseEstimationComponentPluginUser::reportOnlyNearestPerson
bool reportOnlyNearestPerson
Definition: RGBDOpenPoseEstimationComponent.h:91
armarx::RGBDOpenPoseEstimationComponentPluginUser::openposeResult3D
HumanPose3DMap openposeResult3D
Definition: RGBDOpenPoseEstimationComponent.h:97
armarx::RGBDOpenPoseEstimationComponentPluginUser::maxDepthDifference
unsigned int maxDepthDifference
Definition: RGBDOpenPoseEstimationComponent.h:76
armarx::RGBDOpenPoseEstimationComponentPluginUser::robotStateInterface
armarx::RobotStateComponentInterfacePrx robotStateInterface
Definition: RGBDOpenPoseEstimationComponent.h:100
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:19
armarx::RGBDOpenPoseEstimationComponentPluginUser::renderOutputImage
void renderOutputImage(const op::Array< float > &) override
Definition: RGBDOpenPoseEstimationComponent.cpp:109
armarx::RGBDOpenPoseEstimationComponentPluginUser::radius
unsigned int radius
Definition: RGBDOpenPoseEstimationComponent.h:74
armarx::RGBDOpenPoseEstimationComponentPluginUser::postOnConnectImageProcessor
void postOnConnectImageProcessor() override
Definition: RGBDOpenPoseEstimationComponent.cpp:53
armarx::RGBDOpenPoseEstimationComponentPluginUser::start3DPoseEstimation
void start3DPoseEstimation(const Ice::Current &=Ice::emptyCurrent) override
Definition: RGBDOpenPoseEstimationComponent.cpp:299
armarx::RGBDOpenPoseEstimationComponentPluginUser::visualize
void visualize() override
Definition: RGBDOpenPoseEstimationComponent.cpp:428
armarx::OpenPoseEstimationComponentPluginUser
Definition: OpenPoseEstimationComponent.h:52
armarx::RGBDOpenPoseEstimationComponentPluginUser::calibration
const CCalibration * calibration
Definition: RGBDOpenPoseEstimationComponent.h:79
armarx::RGBDOpenPoseEstimationComponentPluginUser::RGBDOpenPoseEstimationComponentPluginUser
RGBDOpenPoseEstimationComponentPluginUser()
Definition: RGBDOpenPoseEstimationComponent.cpp:105
armarx::RGBDOpenPoseEstimationComponentPluginUser::reportEntities
void reportEntities() override
Definition: RGBDOpenPoseEstimationComponent.cpp:187
armarx::RGBDOpenPoseEstimationComponentPluginUser::preOnDisconnectImageProcessor
void preOnDisconnectImageProcessor() override
Definition: RGBDOpenPoseEstimationComponent.cpp:82
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::RGBDOpenPoseEstimationComponentPluginUser::cameraNodeName
std::string cameraNodeName
Definition: RGBDOpenPoseEstimationComponent.h:80
armarx::RGBDOpenPoseEstimationComponentPluginUser::maxDepth
unsigned int maxDepth
Definition: RGBDOpenPoseEstimationComponent.h:75
IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface >
armarx::RGBDOpenPoseEstimationComponentPluginUser::preOnInitImageProcessor
void preOnInitImageProcessor() override
Definition: RGBDOpenPoseEstimationComponent.cpp:90
armarx::RGBDOpenPoseEstimationComponentPluginUser::depthImageBufferMutex
std::mutex depthImageBufferMutex
Definition: RGBDOpenPoseEstimationComponent.h:87
OpenPoseEstimationComponent.h
armarx::RGBDOpenPoseEstimationComponentPluginUser::postOnDisconnectImageProcessor
void postOnDisconnectImageProcessor() override
Definition: RGBDOpenPoseEstimationComponent.cpp:100
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18
armarx::RGBDOpenPoseEstimationComponentPluginUser::useDistortionParameters
bool useDistortionParameters
Definition: RGBDOpenPoseEstimationComponent.h:81