ImageProcessor.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package VisionX::Core
19  * @author Kai Welke (kai dot welke at kit dot edu)
20  * @author Jan Issac (jan dot issac at gmx dot net)
21  * @date 2011
22  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
23  * GNU General Public License
24  */
25 
26 #pragma once
27 
28 // ArmarXCore
32 #include <ArmarXCore/interface/core/SharedMemory.h>
33 
34 // IVT
35 #include <Image/ByteImage.h>
36 #include <Image/FloatImage.h>
37 
38 // VisionXInterfaces
39 #include <VisionX/interface/core/DataTypes.h>
40 #include <VisionX/interface/core/ImageProcessorInterface.h>
41 
42 // VisionXTools
45 
46 #include <condition_variable>
47 #include <shared_mutex>
48 #include <mutex>
49 
50 namespace visionx
51 {
52  // forward declaration
53  class ImageTransferStats;
54  class ImageProviderInfo;
55  class ResultImageProvider;
56 
57  /**
58  * @class ImageProcessorPropertyDefinitions
59  * @brief
60  */
63  {
64  public:
67  {
68  //defineRequiredProperty<std::string>("PropertyName", "Description");
69  defineOptionalProperty<CompressionType>("CompressionType", eNoCompression, "Compression algorithms to be used. Values: None, PNG, JPEG", armarx::PropertyDefinitionBase::eModifiable)
70  .setCaseInsensitive(false)
71  .map("None", eNoCompression)
72  .map("PNG", ePNG)
73  .map("JPEG", eJPEG)
74  .map("JPG", eJPEG);
75  defineOptionalProperty<int>("CompressionQuality", 95, "Quality of the compression: PNG: 0-9 (9: best compression, but slowest), JPEG: 0-100 (100: best quality) ", armarx::PropertyDefinitionBase::eModifiable);
76  defineOptionalProperty<bool>("ForceIceTransfer", false, "If set to true, this image processor will always use the Ice transfer for images instead of shared memory.");
77  }
78  };
79 
80  /**
81  * The ImageProcessor class provides an interface for access to
82  * ImageProviders via Ice and shared memory. The interface defines a set of
83  * convenience methods which simplify the image access. ImageProcessor
84  * implements the ImageProcessorBase Ice interface for new image announcement
85  * and the armarx::ImageProvider providing visualizations.
86  */
88  virtual public armarx::Component,
89  virtual public ImageProcessorInterface
90  {
91  public:
92  static std::string ListenerSuffix;
93  std::string getImageListenerTopicName(std::string providerName) const;
94 
95  protected:
96  /**
97  * Registers a delayed topic subscription and a delayed provider proxy
98  * retrieval which all will be available on the start of the component.
99  *
100  * @param name Provider name
101  */
102  void usingImageProvider(std::string name);
103  void releaseImageProvider(std::string providerName);
104 
105  /**
106  * Select an ImageProvider.
107  *
108  * This method subscribes to an an ImageProvider and makes the provider
109  * available in the waitForImages() and getImages() methods.
110  *
111  * @param name Ice adapter name of the ImageProvider
112  * @param destinationImageType Image's type after image transmission
113  *
114  * @return Information of the image provider
115  */
117  std::string name,
118  ImageType destinationImageType = eRgb,
119  bool waitForProxy = false);
121  std::string name,
122  bool waitForProxy,
123  ImageType destinationImageType = eRgb);
124 
125  /**
126  * Enables visualization
127  *
128  * @param numberImages number of images provided by the visualization
129  * @param imageDimension size of images
130  * @param imageType type of images
131  * @param name The topic name to use (if empty getName() + "Result" is used)
132  *
133  * @return Information of the image provider
134  */
135  void enableResultImages(int numberImages,
136  ImageDimension imageDimension,
137  ImageType imageType,
138  const std::string& name = "");
139 
140  /**
141  * sends result images for visualization
142  * @see enableVisualization
143  *
144  * @param images array of images to send
145  */
146  void provideResultImages(CByteImage** images, armarx::MetaInfoSizeBasePtr info = nullptr);
147  void provideResultImages(const std::vector<CByteImageUPtr>& images, armarx::MetaInfoSizeBasePtr info = nullptr);
148 
149  /**
150  * Wait for new images.
151  *
152  * Wait for new image of an image provider. Use if only one
153  * ImageProvider is used (see useImageProvider).
154  *
155  * @param milliseconds Timeout for waiting
156  *
157  * @return True if new images are available. False in case of error or
158  * timeout
159  */
160  bool waitForImages(int milliseconds = 1000);
161 
162  /**
163  * Wait for new images.
164  *
165  * Wait for new image of an image provider. Use if multiple
166  * ImageProviders are used (see useImageProvider).
167  *
168  * @param providerName Name of provider to wait for images
169  * @param milliseconds Timeout for waiting
170  *
171  * @return True if new images are available. False in case of error or
172  * timeout
173  */
174  bool waitForImages(std::string providerName, int milliseconds = 1000);
175 
176  bool waitForImages(std::string providerName, IceUtil::Time waitTime);
177 
178  bool isNewImageAvailable();
179  bool isNewImageAvailable(const std::string& providerName);
180 
181  /**
182  * Poll images from provider.
183  *
184  * Polls images from a used ImageProvider either via shared memory or
185  * via Ice. If both components run on the same machine, shared memory
186  * transfer is used. Otherwise Ice is used for image transmission. The
187  * transfer type is decided in the useImageProvider method and is set
188  * in the corresponding ImageFormatInfo.
189  *
190  * Use this method if only one ImageProvider is used.
191  *
192  * @param ppImages Image buffers where the images are
193  * copied to. The buffers have to be
194  * initialized by the component. All
195  * required information for the allocation
196  * of the buffers can be found in the
197  * corresponding ImageFormatInfo.
198  *
199  * @return Number of images copied. Zero if no new images have been
200  * available.
201  */
202  int getImages(CByteImage** ppImages);
203 
204  /**
205  * Poll images from provider.
206  *
207  * Polls images from a used ImageProvider either via shared memory or
208  * via Ice. If both components run on the same machine, shared memory
209  * transfer is used. Otherwise Ice is used for image transmission. The
210  * transfer type is decided in the useImageProvider method and is set
211  * in the corresponding ImageFormatInfo.
212  *
213  * Use this method if multiple ImageProviders are used.
214  *
215  * @param providerName Name of provider to poll from
216  *
217  * @param ppImages Image buffers where the images are
218  * copied to. The buffers have to be
219  * initialized by the component. All
220  * required information for the allocation
221  * of the buffers can be found in the
222  * corresponding ImageFormatInfo.
223  *
224  * @return Number of images copied. Zero if no new images have been
225  * available.
226  */
227  int getImages(std::string providerName, CByteImage** ppImages, armarx::MetaInfoSizeBasePtr& info);
228  int getImages(std::string providerName, const std::vector<CByteImageUPtr>& ppImages, armarx::MetaInfoSizeBasePtr& info);
229 
230  /**
231  * @see ImageProcessorBase::getImages(CByteImage*)
232  */
233  int getImages(CFloatImage** ppImages);
234 
235  /**
236  * @see ImageProcessorBase::getImages(std::string, CByteImage**)
237  */
238  int getImages(std::string providerName, CFloatImage** ppImages, armarx::MetaInfoSizeBasePtr& info);
239 
240  /**
241  * Retrieve statistics for a connection to an ImageProvider.
242  *
243  * @param provideNname Name of the provider
244  * @param resetStats Reset statistics
245  *
246  * @return Reference to statistics for the connection to the provder
247  */
248  ImageTransferStats getImageTransferStats(std::string provideNname,
249  bool resetStats = false);
250 
251 
252  /**
253  * @brief Get meta information from the image provider.
254  * @param imageProviderName Name of image provider. If empty, returns first entry in ImageProvider map.
255  * @return Null if no ImageProvider used or name could not be found.
256  */
257  armarx::MetaInfoSizeBasePtr getImageMetaInfo(const std::string& imageProviderName = "") const;
258 
259  void setFramerate(float fps);
260  float getFramerate() const;
261 
262  /**
263  * Sets the compression type and compression quality. Quality needs to fit to compressionType: PNG: 0-9 (9: best compression, but slowest), JPEG: 0-100 (100: best quality) *
264  */
265  void setCompressionType(CompressionType compressionType = ePNG, int compressionQuality = 9);
266  CompressionType getCompressionType() const;
267  int getCompressionQuality() const;
268 
269 
270 
271  // ================================================================== //
272  // == Interface of an ImageProcessor ================================ //
273  // ================================================================== //
274  /**
275  * Setup the vision component.
276  *
277  * Implement this method in the ImageProcessor in order to setup its
278  * parameters. Use this for the registration of adaptars and
279  * subscription to topics
280  *
281  * @param argc number of filtered command line arguments
282  * @param argv filtered command line arguments
283  */
284  virtual void onInitImageProcessor() = 0;
285 
286  /**
287  * Implement this method in the ImageProcessor in order execute parts
288  * when the component is fully initialized and about to run.
289  */
290  virtual void onConnectImageProcessor() = 0;
291 
292  /**
293  * Implement this method in the ImageProcessor in order execute parts
294  * when the component looses network connectivity.
295  */
296  virtual void onDisconnectImageProcessor() { }
297 
298  /**
299  * Exit the ImapeProcessor component.
300  *
301  * Implement this method in order to clean up the ImageProcessor
302  */
303  virtual void onExitImageProcessor() = 0;
304 
305  /**
306  * Process the vision component.
307  *
308  * The main loop of the imageprocessor to be implemented in the
309  * subclass. Do not block this method. One process should execute
310  * exactly one image processing step.
311  * The rate at which this function is called can be set with setFramerate().
312  * If no framerate is set, the process will run as fast as possible.
313  * @see setFramerate
314  */
315  virtual void process() = 0;
316 
317  // ================================================================== //
318  // == RunningComponent implementation =============================== //
319  // ================================================================== //
320  /**
321  * @see Component::onInitComponent()
322  */
323  void onInitComponent() override;
324 
325  /**
326  * @see Component::onConnectComponent()
327  */
328  void onConnectComponent() override;
329 
330  /**
331  * @see Component::onDisconnectComponent()
332  */
333  void onDisconnectComponent() override;
334 
335  /**
336  * @see Component::onExitComponent()
337  */
338  void onExitComponent() override;
339 
340  /**
341  * @see PropertyUser::createPropertyDefinitions()
342  */
344  void componentPropertiesUpdated(const std::set<std::string>& changedProperties) override;
345 
346  protected:
347  /**
348  * @see PeriodicTask
349  */
350  virtual void runProcessor();
351 
352  // ================================================================== //
353  // == SharedMemoryComponent Ice interface =========================== //
354  // ================================================================== //
355  /**
356  * Returns machines hardware Id string
357  */
358  std::string getHardwareId(const Ice::Current& c = Ice::emptyCurrent);
359 
360  // ================================================================== //
361  // == ImageListener Ice interface =================================== //
362  // ================================================================== //
363  /**
364  * Listener callback function. This is called by the used image
365  * providers to report the availability of a newly captured
366  * image.
367  *
368  * @param providerName The reporting image provider name
369  */
370  void reportImageAvailable(const std::string& providerName,
371  const Ice::Current& c = Ice::emptyCurrent) override;
372 
373  // ================================================================== //
374  // == ImageProcessor internals ====================================== //
375  // ================================================================== //
376  /**
377  * @see ImageProcessorBase::getImages(CByteImage**)
378  */
379  int getImages(void** ppBuffer);
380 
381  /**
382  * @see ImageProcessorBase::getImages(std::string, CByteImage**)
383  */
384  int getImages(std::string providerName, void** ppBuffer, armarx::MetaInfoSizeBasePtr& info);
385 
386  /**
387  * Returns the number of images provided by the specified image provider
388  * If no provider is specified, the first provider is taken.
389  *
390  * @param providerName Requested image provider
391  */
392  int getNumberOfImages(const std::string& providerName = "");
393 
394  /**
395  * clean up memory
396  */
397  void cleanup();
398 
399  // image provider
400  using ImageProviderMap = std::map<std::string, armarx::IceSharedMemoryConsumer<unsigned char>::pointer_type>;
402 
403  std::map<std::string, ImageProviderInfo> imageProviderInfoMap;
404  std::shared_mutex imageProviderInfoMutex;
405 
406  // result image visualization
408 
409  // statistics
410  std::mutex statisticsMutex;
411  std::map<std::string, ImageTransferStats> statistics;
412 
414 
415  float desiredFps = 0;
416  bool startProcessorTask = true;
417 
418 
419 
420  CompressionType compressionType = eNoCompression;
422 
423  };
424 
425  /**
426  * Shared pointer for convenience
427  */
429 
430 
431  // ====================================================================== //
432  // == class ImageTransferStats declaration ============================== //
433  // ====================================================================== //
434 
435  /**
436  * The ImageTransferStats class provides information on the connection
437  * between ImageProvider and ImageProcessor. Use
438  * ImageProcessorBase::getImageTransferStats() in order to retrieve the
439  * statistics
440  */
442  {
443  public:
445  {
447  pollingFPS.reset();
448  }
449 
450  /**
451  * Statistics for the images announced by the ImageProvider.
452  */
454 
455  /**
456  * Statistics for the images polled by the ImageProcessor.
457  */
459  };
460 
461 
462  // ====================================================================== //
463  // == class ImageProviderInfo declaration =============================== //
464  // ====================================================================== //
465 
467  {
468  public:
469  /**
470  * proxy to image provider
471  */
472  ImageProviderInterfacePrx proxy;
473 
474  /**
475  * memory block
476  */
477  std::vector<unsigned char> buffer;
478 
479  /**
480  * meta info
481  */
482  armarx::MetaInfoSizeBasePtr info;
483 
484  /**
485  * Required image destination type.
486  *
487  * This is used to convert the transmitted image into an image with the
488  * desired image type if necessary, since the transmitted image type is
489  * given by the provider.
490  */
492 
493  /**
494  * Image format struct that contains all necessary image information
495  */
496  ImageFormatInfo imageFormat;
497 
498  /**
499  * Transfer mode of images
500  */
501  ImageTransferMode imageTransferMode;
502 
503  /**
504  * Number of images.
505  */
507 
508  /**
509  * Indicates whether an image is available.
510  */
512 
513  /**
514  * Conditional variable used internally for synchronization purposes
515  */
516  std::shared_ptr<std::condition_variable> imageAvailableEvent;
517 
518  };
519 
520  // ====================================================================== //
521  // == class ResultImageProvider declaration ============================= //
522  // ====================================================================== //
523  /**
524  * The ResultImageProvider is used by the ImageProcessor to stream
525  * result images to any other processor (e.g. ImageMonitor)
526  * Use ImageProcessor::enableVisualization() and ImageProcessor::provideResultImages()
527  * in order to offer result images in an image processor.
528  */
530  : public ImageProvider
531  {
532  friend class ImageProcessor;
533 
534  public:
535 
537  : resultImageProviderName("ResultImageProvider")
538  {
539 
540  }
541 
543  {
544  this->numberResultImages = numberResultImages;
545  }
546 
547  void setResultImageFormat(ImageDimension resultImageDimension, ImageType resultImageType)
548  {
549  this->resultImageDimension = resultImageDimension;
550  this->resultImageType = resultImageType;
551  }
552 
553  void provideResultImages(CByteImage** images, Ice::Long timestamp)
554  {
555  updateTimestamp(timestamp);
556  provideImages(images, IceUtil::Time::microSeconds(timestamp));
557  }
558  void provideResultImages(const std::vector<CByteImageUPtr>& images, Ice::Long timestamp)
559  {
560  updateTimestamp(timestamp);
561  provideImages(images, IceUtil::Time::microSeconds(timestamp));
562  }
563 
564 
565  protected:
566  void setResultImageProviderName(const std::string& name)
567  {
568  this->resultImageProviderName = name;
569  }
570 
571  std::string getDefaultName() const override
572  {
573  return resultImageProviderName;
574  }
575 
576  void onInitImageProvider() override
577  {
579  setImageFormat(resultImageDimension, resultImageType);
580  }
581 
582  void onExitImageProvider() override {}
583 
585  private:
586  std::string resultImageProviderName;
587 
588  visionx::ImageDimension resultImageDimension;
589  visionx::ImageType resultImageType;
590  };
591 
592 }
593 
594 
armarx::ManagedIceObject::waitForProxy
void waitForProxy(std::string const &name, bool addToDependencies)
Definition: ManagedIceObject.cpp:174
visionx::ImageProcessor::runProcessor
virtual void runProcessor()
Definition: ImageProcessor.cpp:103
visionx::ImageProviderInfo::numberImages
int numberImages
Number of images.
Definition: ImageProcessor.h:506
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
visionx::ImageProcessor::onInitComponent
void onInitComponent() override
Definition: ImageProcessor.cpp:52
visionx::ResultImageProvider::ResultImageProvider
ResultImageProvider()
Definition: ImageProcessor.h:536
visionx::ImageProcessor
The ImageProcessor class provides an interface for access to ImageProviders via Ice and shared memory...
Definition: ImageProcessor.h:87
visionx::ImageProcessor::onExitComponent
void onExitComponent() override
Definition: ImageProcessor.cpp:89
visionx::ImageTransferStats
The ImageTransferStats class provides information on the connection between ImageProvider and ImagePr...
Definition: ImageProcessor.h:441
visionx::ImageProcessor::getFramerate
float getFramerate() const
Definition: ImageProcessor.cpp:691
visionx::ImageProcessor::getImageProvider
ImageProviderInfo getImageProvider(std::string name, ImageType destinationImageType=eRgb, bool waitForProxy=false)
Select an ImageProvider.
Definition: ImageProcessor.cpp:152
visionx::ImageTransferStats::pollingFPS
FPSCounter pollingFPS
Statistics for the images polled by the ImageProcessor.
Definition: ImageProcessor.h:458
visionx::ImageTransferStats::imageProviderFPS
FPSCounter imageProviderFPS
Statistics for the images announced by the ImageProvider.
Definition: ImageProcessor.h:453
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
PeriodicTask.h
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
visionx::ResultImageProvider::onExitImageProvider
void onExitImageProvider() override
This is called when the Component::onExitComponent() setup is called.
Definition: ImageProcessor.h:582
visionx::ImageProviderInfo::imageFormat
ImageFormatInfo imageFormat
Image format struct that contains all necessary image information.
Definition: ImageProcessor.h:496
visionx::ImageProcessor::setCompressionType
void setCompressionType(CompressionType compressionType=ePNG, int compressionQuality=9)
Sets the compression type and compression quality.
Definition: ImageProcessor.cpp:696
visionx::ImageProvider::setImageFormat
void setImageFormat(ImageDimension imageDimension, ImageType imageType, BayerPatternType bayerPatternType=visionx::eBayerPatternRg)
Sets the image basic format data.
Definition: ImageProvider.cpp:275
visionx::ImageProcessorPropertyDefinitions::ImageProcessorPropertyDefinitions
ImageProcessorPropertyDefinitions(std::string prefix)
Definition: ImageProcessor.h:65
visionx::ResultImageProvider::provideResultImages
void provideResultImages(CByteImage **images, Ice::Long timestamp)
Definition: ImageProcessor.h:553
visionx::ImageProcessor::ListenerSuffix
static std::string ListenerSuffix
Definition: ImageProcessor.h:92
visionx::ImageProvider::updateTimestamp
void updateTimestamp(Ice::Long timestamp, bool threadSafe=true)
Updates the timestamp of the currently captured image.
Definition: ImageProvider.cpp:165
visionx::ImageProcessor::onConnectImageProcessor
virtual void onConnectImageProcessor()=0
Implement this method in the ImageProcessor in order execute parts when the component is fully initia...
visionx::ImageProviderInfo
Definition: ImageProcessor.h:466
IceInternal::Handle
Definition: forward_declarations.h:8
visionx::ImageProcessor::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: ImageProcessor.cpp:97
visionx::ImageProcessor::compressionQuality
int compressionQuality
Definition: ImageProcessor.h:421
visionx::ImageProcessor::getImageMetaInfo
armarx::MetaInfoSizeBasePtr getImageMetaInfo(const std::string &imageProviderName="") const
Get meta information from the image provider.
Definition: ImageProcessor.cpp:653
visionx::ImageProcessor::onConnectComponent
void onConnectComponent() override
Definition: ImageProcessor.cpp:72
visionx::FPSCounter::reset
void reset()
Resets the FPS counter to its initial state.
Definition: FPSCounter.cpp:49
visionx::ImageProcessor::imageProviderInfoMutex
std::shared_mutex imageProviderInfoMutex
Definition: ImageProcessor.h:404
visionx::ResultImageProvider::onInitImageProvider
void onInitImageProvider() override
This is called when the Component::onInitComponent() is called.
Definition: ImageProcessor.h:576
visionx::ImageProviderInfo::imageAvailable
bool imageAvailable
Indicates whether an image is available.
Definition: ImageProcessor.h:511
visionx::ImageProcessor::onInitImageProcessor
virtual void onInitImageProcessor()=0
Setup the vision component.
visionx::ImageProcessor::compressionType
CompressionType compressionType
Definition: ImageProcessor.h:420
visionx::ImageProcessor::cleanup
void cleanup()
clean up memory
Definition: ImageProcessor.cpp:728
visionx::ImageProcessor::isNewImageAvailable
bool isNewImageAvailable()
Definition: ImageProcessor.cpp:331
visionx::ImageProcessor::getImageTransferStats
ImageTransferStats getImageTransferStats(std::string provideNname, bool resetStats=false)
Retrieve statistics for a connection to an ImageProvider.
Definition: ImageProcessor.cpp:625
IceSharedMemoryConsumer.h
visionx::ImageProcessor::usingImageProvider
void usingImageProvider(std::string name)
Registers a delayed topic subscription and a delayed provider proxy retrieval which all will be avail...
Definition: ImageProcessor.cpp:117
armarx::VariantType::Long
const VariantTypeId Long
Definition: Variant.h:917
IceManager.h
visionx::ImageProviderInfo::imageAvailableEvent
std::shared_ptr< std::condition_variable > imageAvailableEvent
Conditional variable used internally for synchronization purposes.
Definition: ImageProcessor.h:516
visionx::ImageProcessor::imageProviderInfoMap
std::map< std::string, ImageProviderInfo > imageProviderInfoMap
Definition: ImageProcessor.h:403
visionx::ResultImageProvider::numberResultImages
int numberResultImages
Definition: ImageProcessor.h:584
visionx::ImageProcessor::getImages
int getImages(CByteImage **ppImages)
Poll images from provider.
Definition: ImageProcessor.cpp:351
visionx::ImageProcessor::ImageProviderMap
std::map< std::string, armarx::IceSharedMemoryConsumer< unsigned char >::pointer_type > ImageProviderMap
Definition: ImageProcessor.h:400
visionx::ImageProcessor::setFramerate
void setFramerate(float fps)
Definition: ImageProcessor.cpp:682
visionx::ImageProvider::provideImages
void provideImages(void **inputBuffers, const IceUtil::Time &imageTimestamp=IceUtil::Time())
send images raw.
Definition: ImageProvider.cpp:319
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
visionx::ResultImageProvider::setResultImageProviderName
void setResultImageProviderName(const std::string &name)
Definition: ImageProcessor.h:566
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
visionx::ImageProvider::setNumberImages
void setNumberImages(int numberImages)
Sets the number of images on each capture.
Definition: ImageProvider.cpp:313
visionx::ImageProcessor::getCompressionType
CompressionType getCompressionType() const
Definition: ImageProcessor.cpp:763
visionx::ResultImageProvider::setResultImageFormat
void setResultImageFormat(ImageDimension resultImageDimension, ImageType resultImageType)
Definition: ImageProcessor.h:547
visionx::ResultImageProvider::setNumberResultImages
void setNumberResultImages(int numberResultImages)
Definition: ImageProcessor.h:542
visionx::ImageProvider
ImageProvider abstract class defines a component which provide images via ice or shared memory.
Definition: ImageProvider.h:66
visionx::ResultImageProvider::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: ImageProcessor.h:571
visionx::ImageTransferStats::ImageTransferStats
ImageTransferStats()
Definition: ImageProcessor.h:444
visionx::ImageProcessor::onExitImageProcessor
virtual void onExitImageProcessor()=0
Exit the ImapeProcessor component.
visionx::ImageProviderInfo::destinationImageType
ImageType destinationImageType
Required image destination type.
Definition: ImageProcessor.h:491
visionx::ImageProviderInfo::proxy
ImageProviderInterfacePrx proxy
proxy to image provider
Definition: ImageProcessor.h:472
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:70
visionx::ResultImageProvider::provideResultImages
void provideResultImages(const std::vector< CByteImageUPtr > &images, Ice::Long timestamp)
Definition: ImageProcessor.h:558
IceUtil::Handle< class PropertyDefinitionContainer >
visionx::ImageProcessor::enableResultImages
void enableResultImages(int numberImages, ImageDimension imageDimension, ImageType imageType, const std::string &name="")
Enables visualization.
Definition: ImageProcessor.cpp:227
visionx::ImageProcessorPropertyDefinitions
Definition: ImageProcessor.h:61
visionx::ImageProcessor::getNumberOfImages
int getNumberOfImages(const std::string &providerName="")
Returns the number of images provided by the specified image provider If no provider is specified,...
Definition: ImageProcessor.cpp:577
visionx::ImageProcessor::processorTask
armarx::PeriodicTask< ImageProcessor >::pointer_type processorTask
Definition: ImageProcessor.h:413
armarx::ComponentPropertyDefinitions::ComponentPropertyDefinitions
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition: Component.cpp:37
visionx::ImageProcessor::provideResultImages
void provideResultImages(CByteImage **images, armarx::MetaInfoSizeBasePtr info=nullptr)
sends result images for visualization
Definition: ImageProcessor.cpp:245
visionx::ImageProviderInfo::info
armarx::MetaInfoSizeBasePtr info
meta info
Definition: ImageProcessor.h:482
visionx::ResultImageProvider
The ResultImageProvider is used by the ImageProcessor to stream result images to any other processor ...
Definition: ImageProcessor.h:529
visionx::ImageProcessor::getImageListenerTopicName
std::string getImageListenerTopicName(std::string providerName) const
Definition: ImageProcessor.cpp:112
visionx::ImageProcessor::usedImageProviders
ImageProviderMap usedImageProviders
Definition: ImageProcessor.h:401
visionx::ImageProcessor::onDisconnectImageProcessor
virtual void onDisconnectImageProcessor()
Implement this method in the ImageProcessor in order execute parts when the component looses network ...
Definition: ImageProcessor.h:296
visionx::ImageProviderInfo::buffer
std::vector< unsigned char > buffer
memory block
Definition: ImageProcessor.h:477
visionx::ImageProcessor::releaseImageProvider
void releaseImageProvider(std::string providerName)
Definition: ImageProcessor.cpp:137
visionx::ImageProcessor::statistics
std::map< std::string, ImageTransferStats > statistics
Definition: ImageProcessor.h:411
visionx::ImageProcessor::startProcessorTask
bool startProcessorTask
Definition: ImageProcessor.h:416
visionx::ImageProcessor::reportImageAvailable
void reportImageAvailable(const std::string &providerName, const Ice::Current &c=Ice::emptyCurrent) override
Listener callback function.
Definition: ImageProcessor.cpp:703
visionx::ImageProviderInfo::imageTransferMode
ImageTransferMode imageTransferMode
Transfer mode of images.
Definition: ImageProcessor.h:501
visionx::ImageProcessor::getCompressionQuality
int getCompressionQuality() const
Definition: ImageProcessor.cpp:758
visionx::ImageProcessor::componentPropertiesUpdated
void componentPropertiesUpdated(const std::set< std::string > &changedProperties) override
Implement this function if you would like to react to changes in the properties.
Definition: ImageProcessor.cpp:743
visionx::ImageProcessor::desiredFps
float desiredFps
Definition: ImageProcessor.h:415
visionx::ImageProcessor::getHardwareId
std::string getHardwareId(const Ice::Current &c=Ice::emptyCurrent)
Returns machines hardware Id string.
armarx::PropertyDefinitionBase::eModifiable
@ eModifiable
Definition: PropertyDefinitionInterface.h:57
ImageProvider.h
visionx::ImageProcessor::resultImageProvider
IceInternal::Handle< ResultImageProvider > resultImageProvider
Definition: ImageProcessor.h:407
visionx::ImageProcessor::onDisconnectComponent
void onDisconnectComponent() override
Definition: ImageProcessor.cpp:83
FPSCounter.h
visionx::ImageProcessor::statisticsMutex
std::mutex statisticsMutex
Definition: ImageProcessor.h:410
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
visionx::FPSCounter
The FPSCounter class provides methods for calculating the frames per second (FPS) count in periodic t...
Definition: FPSCounter.h:36
visionx::ImageProcessor::process
virtual void process()=0
Process the vision component.
visionx::ImageProcessor::waitForImages
bool waitForImages(int milliseconds=1000)
Wait for new images.
Definition: ImageProcessor.cpp:275