|
Image processors in VisionX allow to retrieve images from an ImageProvider and process them. The visionx::ImageProcessor ManagedIceObject is the basic superclass for image processors. The superclass provides the following features
Integrating a new image processor is achieved by subclassing the visionx::ImageProcessor in the following way:
The methods that need to be implemented are derived from the armarx::ManagedIceObject :
As for every ManagedIceObject, the default name of the object needs to be provided using the getDefaultName() method.
The process method should be used to implement the processing of input images. It is started in a separate thread once the ImageProcessor is fully connected.
The setup of the image providers settings such as image format and number of images needs to be performed in the onInitImageProvider method:
The image is automatically converted from the ImageProvider image type to the desired image type, if possible. Possible image types are:
Multiple providers can be used by issuing multiple usingImageProvider and getImageProvider commands.
In order to process the images, the pure virtual process method can be implemented and several utility methods can be used to retrieve the images. The process method is called repeatedly, exit checking is done outside the process method. Consequently, the implementation of the process method should not block or loop but only trigger one processing step.
There are essentially two types of accessing the images: polling and waiting.
For retrieving images by polling, the visionx::ImageProcessor::getImages can be used in the following way:
The getImages method will return the most recent images available and the number of images a provided by the ImageProvider. This polling method is useful, if the image processing usually takes much longer then the framerate of input images.
For retrieving images by waiting, the visionx::ImageProcessor::waitForImages method can be used
The waitForImages method waits until new images are available from the provider. This guarantees that a subsequent call to getImages will succeed in reading the images.