Fawkes API
Fawkes Development Version
|
Vision Master. More...
#include <>>
Public Member Functions | |
virtual | ~VisionMaster () |
Virtual empty destructor. More... | |
virtual Camera * | register_for_camera (const char *camera_string, fawkes::Thread *thread, colorspace_t cspace=YUV422_PLANAR)=0 |
Register thread for camera. More... | |
virtual Camera * | register_for_raw_camera (const char *camera_string, fawkes::Thread *thread)=0 |
Register thread for camera. More... | |
virtual void | unregister_thread (fawkes::Thread *thread)=0 |
Unregister a thread. More... | |
virtual CameraControl * | acquire_camctrl (const char *cam_string)=0 |
Retrieve a CameraControl for the specified camera string. More... | |
virtual void | release_camctrl (CameraControl *cc)=0 |
Release a camera control. More... | |
template<class CC > | |
CC * | acquire_camctrl (const char *camera_string) |
Retrieve a typed camera control instance. More... | |
template<class CC > | |
CC * | acquire_camctrl (const char *camera_string, CC *&cc) |
Retrieve a typed camera control instance. More... | |
template<class CC > | |
CC * | register_for_raw_camera (const char *camera_string, fawkes::Thread *thread) |
Get typed raw camera. More... | |
Protected Member Functions | |
virtual CameraControl * | acquire_camctrl (const char *cam_string, const std::type_info &typeinf)=0 |
Retrieve a CameraControl for the specified camera string and type info. More... | |
Vision Master.
The vision master shall be the entry point for vision plugins. It shall allow for requesting cameras that are opened in a central place such that the very same camera can be used in multiple plugins.
It shall also be responsible for the central timing of all vision threads.
Definition at line 46 of file vision_master.h.
|
virtual |
Virtual empty destructor.
Definition at line 132 of file vision_master.cpp.
|
pure virtual |
Retrieve a CameraControl for the specified camera string.
This control (if available) can be used to control certain aspects of the Camera. The cam_string
argument either is the string that has been used to register for a particular camera, or it is a string denoting a camera control by itself. In the former case the vision master will look if the camera has been registered, and then checks if the camera provides a camera control. If so the control is returned. Note that it might implement multiple different camera controls. If you want a specific camera control use one of the template methods to get a correctly typed and verified control. If no camera that matches the cam_string
is found, the vision master will try to instantiate a new camera control using the cam_string
as argument to the CameraControlFactory.
cam_string | Camera argument string, see method description for details |
Exception | no camera was found matching the cam_string and the factory could not instantiate a camera control with the given string. |
Implemented in FvBaseThread.
CC * firevision::VisionMaster::acquire_camctrl | ( | const char * | camera_string | ) |
Retrieve a typed camera control instance.
Like the non-template method this class will try to instantiate the camera control based on the camera string (see there for details on the two possible contents of the string). The camera control will be verified to be of the desired type.
camera_string | camera string of camera for the control or the argument string for a new instance. See documentation of non-template method. |
TypeMismatchException | thrown if requested camera control does not match the requested type. |
Definition at line 146 of file vision_master.h.
CC * firevision::VisionMaster::acquire_camctrl | ( | const char * | camera_string, |
CC *& | cc | ||
) |
Retrieve a typed camera control instance.
Like the non-template method this class will try to instantiate the camera control based on the camera string (see there for details on the two possible contents of the string). The camera control will be verified to be of the desired type. Unlike the other template method you do not need to explicitly state the type of the requested type as it is inferred based on the cc
argument. You can write something like this:
instead of
camera_string | camera string of camera for the control or the argument string for a new instance. See documentation of non-template method. |
cc | reference to pointer of camera control of the intended type, used to automatically infer the template method. On successful return points to the camera control instance |
cc
) TypeMismatchException | thrown if requested camera control does not match the requested type. |
Definition at line 128 of file vision_master.h.
|
protectedpure virtual |
Retrieve a CameraControl for the specified camera string and type info.
This utility method is used by the template methods to instantiate the cameras with a specified intended type.
cam_string | Camera argument string, see method description for details |
typeinf | type info for intended camera control type |
Exception | no camera was found matching the cam_string and the factory could not instantiate a camera control with the given string. |
Implemented in FvBaseThread.
|
pure virtual |
Register thread for camera.
This will register a relation between the given thread and the camera identified by the camera string. If the requested camera has not been opened before this is done and the camera is started. If that fails for whatever reason an exception is thrown. In that case the thread is not registered with the vision master. If the camera is available the thread is registered with the vision master. From then on it is woken up whenever new image data is available and it will wait for the thread to finished computation on that very image. It is a critical error that can not be recovered if the thread fails for whatever reason. If there is a critical error condition in the vision thread it must not stop execution but just the computation.
camera_string | camera that can be used by CameraFactory to open a camera. |
thread | thread to register for this camera |
cspace | the colorspace in which the images should be provided for the camera. Note that using images in different formats at the same time can cause a severe performance penalty. The default is to produce YUV422_PLANAR images, which is used in the FireVision framework as main image format. |
Implemented in FvBaseThread.
Referenced by FvRetrieverThread::init().
|
pure virtual |
Register thread for camera.
This will register a relation between the given thread and the camera identified by the camera string similar to register_for_camera(). However, unlike register_for_camera() this method will provide access to the raw camera implementation, without possibly proxies. Once you gathered the camera, you can dynamically cast it to the expected camera type (or use the template method instead. Raw access to a camera is only granted for a single thread. Note that you may not call capture() or dispose() on the camera, this will still be done by the vision master, as the camera may be used by other threads that registered for the camera with register_for_camera().
camera_string | camera that can be used by CameraFactory to open a camera. |
thread | thread to register for this camera |
Implemented in FvBaseThread.
Referenced by FvSrSavePipelineThread::init().
CC * firevision::VisionMaster::register_for_raw_camera | ( | const char * | camera_string, |
fawkes::Thread * | thread | ||
) |
Get typed raw camera.
Like the non-template variant this method can be used to get access to the raw camera implementation, without going through a proxy. See the other method for risks and implication of using the raw device.
camera_string | camera that can be used by CameraFactory to open a camera. |
thread | thread to register for this camera |
Definition at line 162 of file vision_master.h.
|
pure virtual |
Release a camera control.
This has to be called when you are done with the camera control. This will release the control and it is no longer valid. The vision master might collect the memory that has been used for the control.
cc | camera control instance to release |
Implemented in FvBaseThread.
|
pure virtual |
Unregister a thread.
The thread is unregistered and it is removed from the internal structures. The thread is no longer called for new image material that can be processed.
If the unregistered thread was the last thread accessing the camera, it shall be held open for a specified time, such that if the thread is just being restarted the camera does not have to be re-opened. The time to wait is defined by the implementation.
thread | thread to unregister |
Implemented in FvBaseThread.
Referenced by FvSrSavePipelineThread::finalize(), and FvRetrieverThread::finalize().