23 #ifndef _ARMARX_COMPONENT_VisionX_IntelRealSenseProvider_H
24 #define _ARMARX_COMPONENT_VisionX_IntelRealSenseProvider_H
29 #include <opencv2/opencv.hpp>
32 #include <ArmarXCore/interface/observers/ObserverInterface.h>
34 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
39 #include <VisionX/interface/components/RGBDImageProvider.h>
41 #include <librealsense2/h/rs_option.h>
42 #include <librealsense2/rs.hpp>
57 defineOptionalProperty<Eigen::Vector2i>(
58 "Resolution", Eigen::Vector2i(1280, 720),
"Resolution of the RGB and depth image.")
59 .map(
"424x240", Eigen::Vector2i(424, 240))
60 .map(
"480x270", Eigen::Vector2i(480, 270))
61 .map(
"640x360", Eigen::Vector2i(640, 360))
62 .map(
"640x480", Eigen::Vector2i(640, 480))
63 .map(
"848x480", Eigen::Vector2i(848, 480))
64 .map(
"960x540", Eigen::Vector2i(960, 540))
65 .map(
"1280x720", Eigen::Vector2i(1280, 720));
68 Eigen::Vector2f(69.4, 42.5),
69 "The horizontal and vertical field of view.");
71 defineOptionalProperty<std::string>(
74 "JSON config file (e.g. from the realsense-viewer) to load. If property is not "
75 "set, the preset property is used.");
76 defineOptionalProperty<rs2_rs400_visual_preset>(
78 RS2_RS400_VISUAL_PRESET_MEDIUM_DENSITY,
79 "RealSense preset. Only used if ConfigFile property is not set.")
80 .setCaseInsensitive(
true)
81 .map(
"CUSTOM", RS2_RS400_VISUAL_PRESET_CUSTOM)
82 .map(
"DEFAULT", RS2_RS400_VISUAL_PRESET_DEFAULT)
83 .map(
"HAND", RS2_RS400_VISUAL_PRESET_HAND)
84 .map(
"HIGH_ACCURACY", RS2_RS400_VISUAL_PRESET_HIGH_ACCURACY)
85 .map(
"HIGH_DENSITY", RS2_RS400_VISUAL_PRESET_HIGH_DENSITY)
86 .map(
"MEDIUM_DENSITY", RS2_RS400_VISUAL_PRESET_MEDIUM_DENSITY)
87 .map(
"REMOVE_IR_PATTERN", RS2_RS400_VISUAL_PRESET_REMOVE_IR_PATTERN);
89 defineOptionalProperty<float>(
92 "Max depth values allowed in Millimeters. Values above these are set to nan.",
94 defineOptionalProperty<bool>(
"ApplySpatialFilter",
96 "Apply a spatial filter to the depth image.",
98 defineOptionalProperty<bool>(
"ApplyAlignmentFilter",
100 "Align the depth image with the rgb image.",
102 defineOptionalProperty<bool>(
"ApplyTemporalFilter",
104 "Apply a temporal filter that smoothes over several "
105 "frames. Leads to artifacts in combination with motion.",
107 defineOptionalProperty<bool>(
"ApplyDisparityFilter",
109 "Apply the disparity transformation filter.",
126 virtual public visionx::RGBDPointCloudProviderInterface,
153 visionx::StereoCalibration
159 visionx::StereoCalibration
182 MetaPointCloudFormatPtr
185 MetaPointCloudFormatPtr info =
new MetaPointCloudFormat();
187 info->type = PointContentType::eColoredPoints;
188 info->capacity = 1280 * 720 *
sizeof(ColoredPoint3D);
189 info->size = info->capacity;
195 rs2::colorizer color_map;
197 using CloudPointType = pcl::PointXYZRGBA;
198 pcl::PointCloud<CloudPointType>::Ptr pointcloud;
200 MetaPointCloudFormatPtr cloudFormat;
202 visionx::StereoCalibration calibration;
209 rs2::spatial_filter spat_filter;
210 std::unique_ptr<rs2::align> alignFilter;
211 rs2::temporal_filter temporal_filter;
212 rs2::disparity_transform depth_to_disparity_filter,
213 disparity_to_depth_filter = rs2::disparity_transform(
false);
215 float depthScale = 1;