23#ifndef _ARMARX_COMPONENT_VisionX_CoFusionProcessor_H
24#define _ARMARX_COMPONENT_VisionX_CoFusionProcessor_H
27#include <pcl/point_cloud.h>
28#include <pcl/point_types.h>
34#include <VisionX/interface/components/CoFusionProcessor.h>
37#include <RobotAPI/interface/core/RobotState.h>
41#include <Core/Callbacks.h>
42#include <Core/PoseMatch.h>
43#include <Core/Utils/Intrinsics.h>
63 "RobotStateComponent",
64 "Name of the RobotState of the Robot");
71 "isEnabled",
true,
"enable the capturing process immediately");
74 "ImageProviderName",
"ImageProvider",
"Name of the input image provider.");
78 "FramesBetweenUpdates", 1,
"Number of frames between two point cloud updates.");
82 visionx::eCaptureSynchronization,
83 "The point cloud sync mode ('capture' (default) or 'fps').")
84 .map(
"capture", visionx::eCaptureSynchronization)
85 .map(
"fps", visionx::eFpsSynchronization);
88 "DownsamplingLeafSize",
90 "If > 0, the result point cloud will be downsampled with the given leaf size.");
95 "If true, an execution time report is logged periodically.");
98 "ReferenceFrameName",
"DepthCamera",
"reference frame name.");
103 "cofusion.CountThresh", 35000,
"The CoFusion count thresh.");
110 "cofusion.PhotoThresh", 115,
"The CoFusion photo thresh.");
112 "cofusion.InitConfidenceGlobal", 4,
"The CoFusion init confidence global.");
114 "cofusion.InitConfidenceObject", 2,
"The CoFusion init confidence object.");
119 "cofusion.FernThresh", 0.3095,
"The CoFusion fern thresh.");
122 "cofusion.FrameToFrameRGB",
false,
"The CoFusion frame to frame r g b.");
124 "cofusion.ModelSpawnOffset", 20,
"The CoFusion model spawn offset.");
126 "cofusion.MatchingType", Model::MatchingType::Drost,
"The CoFusion matching type.");
128 "cofusion.ExportDirectory",
"",
"The CoFusion export directory.");
131 "The CoFusion export segmentation results.");
133#if USE_MASKFUSION == 1
136 "cofusion.FrameQueueSize", 5,
"Set size of frame-queue manually");
138 "cofusion.DeviceMaskRCNN", -1,
"Select GPU (device ID) which is running MaskRCNN.");
142 " Preallocate memory for a number of models, which can "
143 "increase performance (default: 0)");
162 virtual public visionx::CoFusionProcessorInterface
171 return "CoFusionProcessor";
176 const Ice::Current&
c = Ice::emptyCurrent)
override;
197 virtual void process()
override;
218 void onNewModel(std::shared_ptr<Model> model);
228 using OutPointT = pcl::PointXYZRGBL;
235 void initializeCoFusion();
244 void updateSurfelMaps();
250 void reconstructResultPointCloud();
253 void reportStopwatchStats();
256 std::string imageProviderName;
257 visionx::ImageProviderInterfacePrx imageProvider;
263#if USE_MASKFUSION == 1
264 std::unique_ptr<MaskFusion> cofusion;
266 std::unique_ptr<CoFusion> cofusion;
272 std::mutex imagesMutex;
279 CByteImage* images[2];
283 std::size_t framesBetweenUpdates;
285 std::size_t framesSinceLastUpdate = 0;
290 std::mutex surfelMapMutex;
293 std::map<unsigned int, Model::SurfelMap> surfelMaps;
295 pcl::PointCloud<OutPointT>::Ptr resultPointCloud;
298 float downsamplingLeafSize = 0.f;
307 std::string referenceFrameName;
309 std::atomic<bool> newFrameAvailable =
false;
CoFusionProcessorPropertyDefinitions(std::string prefix)
Brief description of class CoFusionProcessor.
virtual void onInitComponent() override
Pure virtual hook for the subclass.
virtual void onConnectImageProcessor() override
Allocates imageRgb and imageDepth and sets images[].
virtual bool doCapture() override
Main capturing function.
virtual void onExitCapturingPointCloudProvider() override
This is called when the Component::onExitComponent() setup is called.
virtual void onDisconnectComponent() override
Hook for subclass.
virtual void onExitImageProcessor() override
Exit the ImapeProcessor component.
void onNewModel(std::shared_ptr< Model > model)
virtual void onStartCapture(float framesPerSecond) override
This is called when the point cloud provider capturing has been started.
virtual visionx::MetaPointCloudFormatPtr getDefaultPointCloudFormat() override
default point cloud format used to initialize shared memory
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
virtual void process() override
Performs the image processing.
virtual void onInitCapturingPointCloudProvider() override
This is called when the Component::onInitComponent() is called.
virtual void onInitImageProcessor() override
Setup the vision component.
virtual void onConnectComponent() override
Pure virtual hook for the subclass.
virtual void onStopCapture() override
This is called when the point cloud provider capturing has been stopped.
virtual void onDisconnectImageProcessor() override
Frees imageRgb and imageDepth.
virtual void onExitComponent() override
Hook for subclass.
virtual void startCaptureForNumFrames(Ice::Int numFrames, const Ice::Current &c=Ice::emptyCurrent) override
std::string getDefaultName() const override
void onInactiveModel(std::shared_ptr< Model > model)
IceUtil::Handle< PeriodicTask< T > > pointer_type
Shared pointer type for convenience.
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
The CapturingPointCloudProvider provides a callback function to trigger the capturing of point clouds...
ImageProcessorPropertyDefinitions(std::string prefix)
The ImageProcessor class provides an interface for access to ImageProviders via Ice and shared memory...
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx
std::unique_ptr< CByteImage > CByteImageUPtr