RoboceptionUser.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::RoboceptionUser
17  * @author Raphael Grimm ( raphael dot grimm at kit dot edu )
18  * @date 2019
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 #include <VisionX/interface/components/Calibration.h>
26 
27 #include <Image/ImageProcessor.h>
28 #include <rc_genicam_api/device.h>
29 #include <rc_genicam_api/stream.h>
30 
31 namespace rcg
32 {
33  using DevicePtr = std::shared_ptr<rcg::Device>;
34  using StreamPtr = std::shared_ptr<rcg::Stream>;
35  class Image;
36 } // namespace rcg
37 
39 {
40  class CNodeMapRef;
41 }
42 
43 namespace visionx
44 {
45  /**
46  * @defgroup Library-RoboceptionUtility RoboceptionUtility
47  * @ingroup Component-RCImageProvider
48  * A description of the library RoboceptionUtility.
49  *
50  * @class RoboceptionUser
51  * @ingroup Library-RoboceptionUtility
52  * @brief This class contains common implementation for
53  * \ref RCImageProvider and \ref RCPointCloudProvider
54  */
56  {
57  //Functions: setup
58  protected:
59  bool initDevice(const std::string& dname);
60 
61  void enableIntensity(bool enabled);
63  void enableDisparity(bool enabled);
64  void enableConfidence(bool enabled);
65  void enableError(bool enabled);
66 
67  void setupStreamAndCalibration(float scalefactor, const std::string& calibSavePath);
68 
69  //Functions: runtime
70  protected:
71  void startRC();
72  void stopRC();
73  void cleanupRC();
74 
75  void printNodeMap() const;
76 
77  static void fillCameraImageRGB(unsigned char* outputPixels,
78  size_t nImage,
79  const uint8_t* inputPixels,
80  size_t width,
81  size_t height,
82  uint64_t pixelFormat,
83  size_t xpadding);
84  static void
85  fillCameraImageRGB(unsigned char* outputPixels, size_t nImage, const rcg::Image& inputRgb);
86  static void fillCameraImageDepth(unsigned char* outputPixels,
87  double f,
88  double t,
89  double scale,
90  const rcg::Image& disparity,
91  size_t upscale = 1);
92 
93  //Data
94  protected:
95  //rc
98  std::shared_ptr<GenApi::CNodeMapRef> nodemap;
99  //settings
100  size_t numImages = 0;
101  float scaleFactor = 1;
102  double focalLengthFactor = 1.0;
103  double baseline = 1.0;
104  //VisionX
105  CByteImage** cameraImages{nullptr};
106  CByteImage** smallImages{nullptr};
107  visionx::StereoCalibration stereoCalibration;
108  visionx::ImageDimension dimensions;
109  };
110 
111 } // namespace visionx
visionx::RoboceptionUser::stream
rcg::StreamPtr stream
Definition: RoboceptionUser.h:97
rcg::StreamPtr
std::shared_ptr< rcg::Stream > StreamPtr
Definition: RCImageProvider.h:46
GENAPI_NAMESPACE
Definition: RoboceptionUser.h:38
visionx::RoboceptionUser::printNodeMap
void printNodeMap() const
Definition: RoboceptionUser.cpp:278
visionx::RoboceptionUser::cleanupRC
void cleanupRC()
Definition: RoboceptionUser.cpp:254
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
visionx::RoboceptionUser::dimensions
visionx::ImageDimension dimensions
Definition: RoboceptionUser.h:108
visionx::RoboceptionUser::dev
rcg::DevicePtr dev
Definition: RoboceptionUser.h:96
visionx::RoboceptionUser
This class contains common implementation for RCImageProvider and RCPointCloudProvider.
Definition: RoboceptionUser.h:55
visionx::RoboceptionUser::nodemap
std::shared_ptr< GenApi::CNodeMapRef > nodemap
Definition: RoboceptionUser.h:98
visionx::RoboceptionUser::enableError
void enableError(bool enabled)
Definition: RoboceptionUser.cpp:137
rcg
Definition: RCImageProvider.h:42
visionx::RoboceptionUser::initDevice
bool initDevice(const std::string &dname)
Definition: RoboceptionUser.cpp:56
visionx::RoboceptionUser::fillCameraImageDepth
static void fillCameraImageDepth(unsigned char *outputPixels, double f, double t, double scale, const rcg::Image &disparity, size_t upscale=1)
Definition: RoboceptionUser.cpp:373
enabled
std::atomic< bool > * enabled
Definition: RemoteGuiWidgetController.cpp:75
visionx::RoboceptionUser::enableDisparity
void enableDisparity(bool enabled)
Definition: RoboceptionUser.cpp:123
visionx::RoboceptionUser::stereoCalibration
visionx::StereoCalibration stereoCalibration
Definition: RoboceptionUser.h:107
visionx::RoboceptionUser::cameraImages
CByteImage ** cameraImages
Definition: RoboceptionUser.h:105
rcg::DevicePtr
std::shared_ptr< rcg::Device > DevicePtr
Definition: RCImageProvider.h:45
visionx::RoboceptionUser::baseline
double baseline
Definition: RoboceptionUser.h:103
visionx::RoboceptionUser::numImages
size_t numImages
Definition: RoboceptionUser.h:100
visionx::RoboceptionUser::startRC
void startRC()
Definition: RoboceptionUser.cpp:237
visionx::RoboceptionUser::enableIntensity
void enableIntensity(bool enabled)
Definition: RoboceptionUser.cpp:109
visionx::RoboceptionUser::enableConfidence
void enableConfidence(bool enabled)
Definition: RoboceptionUser.cpp:130
visionx::RoboceptionUser::enableIntensityCombined
void enableIntensityCombined(bool enabled)
Definition: RoboceptionUser.cpp:116
visionx::RoboceptionUser::smallImages
CByteImage ** smallImages
Definition: RoboceptionUser.h:106
visionx::RoboceptionUser::setupStreamAndCalibration
void setupStreamAndCalibration(float scalefactor, const std::string &calibSavePath)
Definition: RoboceptionUser.cpp:144
visionx::RoboceptionUser::focalLengthFactor
double focalLengthFactor
Definition: RoboceptionUser.h:102
visionx::RoboceptionUser::fillCameraImageRGB
static void fillCameraImageRGB(unsigned char *outputPixels, size_t nImage, const uint8_t *inputPixels, size_t width, size_t height, uint64_t pixelFormat, size_t xpadding)
Definition: RoboceptionUser.cpp:296
visionx::RoboceptionUser::stopRC
void stopRC()
Definition: RoboceptionUser.cpp:246
visionx::RoboceptionUser::scaleFactor
float scaleFactor
Definition: RoboceptionUser.h:101