itom 2.0.0
|
Inherit from AddInGrabber if you write a camera/grabber plugin. Please call the constructor of AddInGrabber within your plugin constructor. More...
Public Member Functions | |
AddInGrabber () | |
constructor | |
~AddInGrabber () | |
destructor | |
Protected Member Functions | |
void | timerEvent (QTimerEvent *event) |
if any live image has been connected to this camera, this event will be regularly fired. | |
virtual ito::RetVal | checkData (ito::DataObject *externalDataObject=NULL) |
implement this method in order to check if m_image should be (re)allocated with respect to the current sizex, sizey, bpp... | |
virtual ito::RetVal | retrieveData (ito::DataObject *externalDataObject=NULL)=0 |
implement this method in your camera plugin. In this method the image is grabbed and stored in the m_image variable. | |
ito::RetVal | sendDataToListeners (int waitMS) |
sends m_image to all registered listeners. | |
int | grabberStartedCount () |
void | incGrabberStarted () |
void | decGrabberStarted () |
void | setGrabberStarted (int value) |
Protected Attributes | |
ito::DataObject | m_data |
Private Attributes | |
int | m_started |
counter indicating how many times startDevice has been called |
Inherit from AddInGrabber if you write a camera/grabber plugin. Please call the constructor of AddInGrabber within your plugin constructor.
This class contains important variables and helper methods which simplify the creation of a camera plugin. Please consider that you should implement the methods checkImage() and retriveImage() (pure virtual in this class) in your own class.
ito::RetVal ito::AddInGrabber::checkData | ( | ito::DataObject * | externalDataObject = NULL | ) | [protected, virtual] |
implement this method in order to check if m_image should be (re)allocated with respect to the current sizex, sizey, bpp...
Call this method if the size or bitdepth of your camera has changed (e.g. in your constructor, too). In this method, compare if the new size is equal to the old one. If this is not the case, use the following example to set m_image to a newly allocated dataObject. The old dataObject is deleted automatically with respect to its internal reference counter:
m_image = ito::DataObject(futureHeight,futureWidth,futureType);
void ito::AddInGrabber::decGrabberStarted | ( | ) | [inline, protected] |
sets the number of started devices to a given value
int ito::AddInGrabber::grabberStartedCount | ( | ) | [inline, protected] |
void ito::AddInGrabber::incGrabberStarted | ( | ) | [inline, protected] |
decrements the number of started devices
virtual ito::RetVal ito::AddInGrabber::retrieveData | ( | ito::DataObject * | externalDataObject = NULL | ) | [protected, pure virtual] |
implement this method in your camera plugin. In this method the image is grabbed and stored in the m_image variable.
Call this method in getVal(...) in order to get the image from the camera and deeply copy it the the m_image variable. This method is equally called from timerEvent.
ito::RetVal ito::AddInGrabber::sendDataToListeners | ( | int | waitMS | ) | [protected] |
sends m_image to all registered listeners.
sends m_data to all registered listeners.
This method is continuously called from timerEvent. Also call this method from your getVal-Method (usually with 0-timeout)
[in] | waitMS | indicates the time (in ms) that should be waiting until every registered live image source node received m_image. 0: no wait, -1: infinit waiting time, else time in milliseconds |
void ito::AddInGrabber::timerEvent | ( | QTimerEvent * | event | ) | [protected] |
if any live image has been connected to this camera, this event will be regularly fired.
this method is called every time when the auto-grabbing-timer is fired. Usually you don't have to overwrite this method.
This event is continoulsy fired if auto grabbing is enabled. At first, the image is acquired (method acquire). Then the image is retrieved (retrieveImage) and finally the newly grabbed image is send to all registered listeners (sendImagetoListeners)
ito::DataObject ito::AddInGrabber::m_data [protected] |
variable for the recently grabbed image
int ito::AddInGrabber::m_started [private] |
counter indicating how many times startDevice has been called
increment this variable every time startDevice is called (by incGrabberStarted()) decrement this variable every time stopDevice is called (by decGrabberStarted())