32#include <ArmarXCore/interface/core/SharedMemory.h>
35#include <Image/ByteImage.h>
36#include <Image/FloatImage.h>
39#include <VisionX/interface/core/DataTypes.h>
40#include <VisionX/interface/core/ImageProcessorInterface.h>
43#include <condition_variable>
45#include <shared_mutex>
71 "Compression algorithms to be used. Values: None, PNG, JPEG",
73 .setCaseInsensitive(
false)
74 .map(
"None", eNoCompression)
81 "Quality of the compression: PNG: 0-9 (9: best compression, but slowest), JPEG: "
82 "0-100 (100: best quality) ",
86 "If set to true, this image processor will always use the "
87 "Ice transfer for images instead of shared memory.");
126 ImageType destinationImageType = eRgb,
130 ImageType destinationImageType = eRgb);
143 ImageDimension imageDimension,
145 const std::string& name =
"");
155 armarx::MetaInfoSizeBasePtr info =
nullptr);
182 bool waitForImages(std::string providerName,
int milliseconds = 1000);
184 bool waitForImages(std::string providerName, IceUtil::Time waitTime);
236 CByteImage** ppImages,
237 armarx::MetaInfoSizeBasePtr& info);
239 const std::vector<CByteImageUPtr>& ppImages,
240 armarx::MetaInfoSizeBasePtr& info);
251 CFloatImage** ppImages,
252 armarx::MetaInfoSizeBasePtr& info);
270 armarx::MetaInfoSizeBasePtr
387 const Ice::Current&
c = Ice::emptyCurrent)
override;
400 int getImages(std::string providerName,
void** ppBuffer, armarx::MetaInfoSizeBasePtr& info);
417 std::map<std::string, armarx::IceSharedMemoryConsumer<unsigned char>::pointer_type>;
495 armarx::MetaInfoSizeBasePtr
info;
559 this->resultImageDimension = resultImageDimension;
560 this->resultImageType = resultImageType;
582 this->resultImageProviderName = name;
588 return resultImageProviderName;
606 std::string resultImageProviderName;
608 visionx::ImageDimension resultImageDimension;
609 visionx::ImageType resultImageType;
Default component property definition container.
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Baseclass for all ArmarX ManagedIceObjects requiring properties.
void waitForProxy(std::string const &name, bool addToDependencies)
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 FPSCounter class provides methods for calculating the frames per second (FPS) count in periodic t...
ImageProcessorPropertyDefinitions(std::string prefix)
The ImageProcessor class provides an interface for access to ImageProviders via Ice and shared memory...
void onInitComponent() override
IceInternal::Handle< ResultImageProvider > resultImageProvider
virtual void process()=0
Process the vision component.
std::string getHardwareId(const Ice::Current &c=Ice::emptyCurrent)
Returns machines hardware Id string.
void componentPropertiesUpdated(const std::set< std::string > &changedProperties) override
Implement this function if you would like to react to changes in the properties.
std::map< std::string, ImageProviderInfo > imageProviderInfoMap
void enableResultImages(int numberImages, ImageDimension imageDimension, ImageType imageType, const std::string &name="")
Enables visualization.
int getImages(std::string providerName, const std::vector< CByteImageUPtr > &ppImages, armarx::MetaInfoSizeBasePtr &info)
armarx::PeriodicTask< ImageProcessor >::pointer_type processorTask
void usingImageProvider(std::string name)
Registers a delayed topic subscription and a delayed provider proxy retrieval which all will be avail...
virtual void onInitImageProcessor()=0
Setup the vision component.
bool waitForImages(int milliseconds=1000)
Wait for new images.
virtual void onConnectImageProcessor()=0
Implement this method in the ImageProcessor in order execute parts when the component is fully initia...
bool isNewImageAvailable()
ImageProviderInfo getImageProvider(std::string name, ImageType destinationImageType=eRgb, bool waitForProxy=false)
Select an ImageProvider.
void onDisconnectComponent() override
static std::string ListenerSuffix
int getImages(CByteImage **ppImages)
Poll images from provider.
void cleanup()
clean up memory
CompressionType compressionType
virtual void runProcessor()
int getCompressionQuality() const
armarx::MetaInfoSizeBasePtr getImageMetaInfo(const std::string &imageProviderName="") const
Get meta information from the image provider.
CompressionType getCompressionType() const
virtual void onDisconnectImageProcessor()
Implement this method in the ImageProcessor in order execute parts when the component looses network ...
std::map< std::string, armarx::IceSharedMemoryConsumer< unsigned char >::pointer_type > ImageProviderMap
ImageTransferStats getImageTransferStats(std::string provideNname, bool resetStats=false)
Retrieve statistics for a connection to an ImageProvider.
void setCompressionType(CompressionType compressionType=ePNG, int compressionQuality=9)
Sets the compression type and compression quality.
int getNumberOfImages(const std::string &providerName="")
Returns the number of images provided by the specified image provider If no provider is specified,...
virtual void onExitImageProcessor()=0
Exit the ImapeProcessor component.
void onConnectComponent() override
void provideResultImages(CByteImage **images, armarx::MetaInfoSizeBasePtr info=nullptr)
sends result images for visualization
std::map< std::string, ImageTransferStats > statistics
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void releaseImageProvider(std::string providerName)
void reportImageAvailable(const std::string &providerName, const Ice::Current &c=Ice::emptyCurrent) override
Listener callback function.
void provideResultImages(const std::vector< CByteImageUPtr > &images, armarx::MetaInfoSizeBasePtr info=nullptr)
void setFramerate(float fps)
void onExitComponent() override
std::string getImageListenerTopicName(std::string providerName) const
std::shared_mutex imageProviderInfoMutex
ImageProviderMap usedImageProviders
float getFramerate() const
std::mutex statisticsMutex
ImageType destinationImageType
Required image destination type.
bool imageAvailable
Indicates whether an image is available.
ImageTransferMode imageTransferMode
Transfer mode of images.
std::vector< unsigned char > buffer
memory block
int numberImages
Number of images.
armarx::MetaInfoSizeBasePtr info
meta info
ImageFormatInfo imageFormat
Image format struct that contains all necessary image information.
ImageProviderInterfacePrx proxy
proxy to image provider
std::shared_ptr< std::condition_variable > imageAvailableEvent
Conditional variable used internally for synchronization purposes.
ImageProvider abstract class defines a component which provide images via ice or shared memory.
void updateTimestamp(Ice::Long timestamp, bool threadSafe=true)
Updates the timestamp of the currently captured image.
void setImageFormat(ImageDimension imageDimension, ImageType imageType, BayerPatternType bayerPatternType=visionx::eBayerPatternRg)
Sets the image basic format data.
void provideImages(void **inputBuffers, const IceUtil::Time &imageTimestamp=IceUtil::Time())
send images raw.
void setNumberImages(int numberImages)
Sets the number of images on each capture.
The ImageTransferStats class provides information on the connection between ImageProvider and ImagePr...
FPSCounter pollingFPS
Statistics for the images polled by the ImageProcessor.
FPSCounter imageProviderFPS
Statistics for the images announced by the ImageProvider.
The ResultImageProvider is used by the ImageProcessor to stream result images to any other processor ...
void provideResultImages(CByteImage **images, Ice::Long timestamp)
void setResultImageProviderName(const std::string &name)
void provideResultImages(const std::vector< CByteImageUPtr > &images, Ice::Long timestamp)
friend class ImageProcessor
void setResultImageFormat(ImageDimension resultImageDimension, ImageType resultImageType)
void onInitImageProvider() override
This is called when the Component::onInitComponent() is called.
void onExitImageProvider() override
This is called when the Component::onExitComponent() setup is called.
void setNumberResultImages(int numberResultImages)
std::string getDefaultName() const override
Retrieve default name of component.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
IceInternal::Handle< ImageProcessor > ImageProcessorPtr
Shared pointer for convenience.