23 #ifndef _ARMARX_COMPONENT_VisionX_IntelRealSenseProvider_H
24 #define _ARMARX_COMPONENT_VisionX_IntelRealSenseProvider_H
29 #include <ArmarXCore/interface/observers/ObserverInterface.h>
30 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
33 #include <VisionX/interface/components/RGBDImageProvider.h>
37 #include <opencv2/opencv.hpp>
41 #include <librealsense2/rs.hpp>
42 #include <librealsense2/h/rs_option.h>
57 defineOptionalProperty<Eigen::Vector2i>(
"Resolution", Eigen::Vector2i(1280, 720),
"Resolution of the RGB and depth image.")
58 .map(
"424x240", Eigen::Vector2i(424, 240))
59 .map(
"480x270", Eigen::Vector2i(480, 270))
60 .map(
"640x360", Eigen::Vector2i(640, 360))
61 .map(
"640x480", Eigen::Vector2i(640, 480))
62 .map(
"848x480", Eigen::Vector2i(848, 480))
63 .map(
"960x540", Eigen::Vector2i(960, 540))
64 .map(
"1280x720", Eigen::Vector2i(1280, 720));
68 defineOptionalProperty<std::string>(
"ConfigFile",
"",
"JSON config file (e.g. from the realsense-viewer) to load. If property is not set, the preset property is used.");
69 defineOptionalProperty<rs2_rs400_visual_preset>(
"Preset", RS2_RS400_VISUAL_PRESET_MEDIUM_DENSITY,
"RealSense preset. Only used if ConfigFile property is not set.").
70 setCaseInsensitive(
true).
71 map(
"CUSTOM", RS2_RS400_VISUAL_PRESET_CUSTOM).
72 map(
"DEFAULT", RS2_RS400_VISUAL_PRESET_DEFAULT).
73 map(
"HAND", RS2_RS400_VISUAL_PRESET_HAND).
74 map(
"HIGH_ACCURACY", RS2_RS400_VISUAL_PRESET_HIGH_ACCURACY).
75 map(
"HIGH_DENSITY", RS2_RS400_VISUAL_PRESET_HIGH_DENSITY).
76 map(
"MEDIUM_DENSITY", RS2_RS400_VISUAL_PRESET_MEDIUM_DENSITY).
77 map(
"REMOVE_IR_PATTERN", RS2_RS400_VISUAL_PRESET_REMOVE_IR_PATTERN);
82 defineOptionalProperty<bool>(
"ApplyTemporalFilter",
false,
"Apply a temporal filter that smoothes over several frames. Leads to artifacts in combination with motion.",
armarx::PropertyDefinitionBase::eModifiable);
100 virtual public visionx::RGBDPointCloudProviderInterface,
154 MetaPointCloudFormatPtr info =
new MetaPointCloudFormat();
156 info->type = PointContentType::eColoredPoints;
157 info->capacity = 1280 * 720 *
sizeof(ColoredPoint3D);
158 info->size = info->capacity;
165 rs2::colorizer color_map;
167 using CloudPointType = pcl::PointXYZRGBA;
168 pcl::PointCloud<CloudPointType>::Ptr pointcloud;
170 MetaPointCloudFormatPtr cloudFormat;
172 visionx::StereoCalibration calibration;
179 rs2::spatial_filter spat_filter;
180 std::unique_ptr<rs2::align> alignFilter;
181 rs2::temporal_filter temporal_filter;
182 rs2::disparity_transform depth_to_disparity_filter, disparity_to_depth_filter = rs2::disparity_transform(
false);
184 float depthScale = 1;