This is a subtype of DataIO for camera / framegrabber communication. Plugins of this type are inherited from ito::AddInGrabber. The data acquisition is managed as follows:
A typical sequence in python is
1 2 3 4 5 6 | device.startDevice()
device.acquire()
device.getVal(dObj)
device.acquire()
device.getVal(dObj)
device.stopDevice()
|
A sample header file of the DataIO’s plugin class is illustrated in the following code snippet:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | #include "common/addInGrabber.h"
#include <qsharedpointer.h>
class MyCamera : public ito::AddInGrabber
{
Q_OBJECT
protected:
~MyDataIO(); /*! < Destructor*/
MyDataIO(); /*! < Constructor*/
ito::RetVal retrieveData(ito::DataObject *externalDataObject = NULL); /*!< Wait for acquired picture */
public:
friend class MyDataIOInterface;
const ito::RetVal showConfDialog(void); //! Open the config nonmodal dialog to set camera parameters
int hasConfDialog(void) { return 1; }; //!< indicates that this plugin has got a configuration dialog
private:
public slots:
ito::RetVal getParam(QSharedPointer<ito::Param> val, ItomSharedSemaphore *waitCond);
ito::RetVal setParam(QSharedPointer<ito::Param> val, ItomSharedSemaphore *waitCond);
ito::RetVal init(QVector<ito::Param> *paramsMand, QVector<ito::Param> *paramsOpt, ItomSharedSemaphore *waitCond = NULL);
ito::RetVal close(ItomSharedSemaphore *waitCond);
ito::RetVal startDevice(ItomSharedSemaphore *waitCond);
ito::RetVal stopDevice(ItomSharedSemaphore *waitCond);
ito::RetVal acquire(const int trigger, ItomSharedSemaphore *waitCond = NULL);
ito::RetVal getVal(void *vpdObj, ItomSharedSemaphore *waitCond);
ito::RetVal copyVal(void *vpdObj, ItomSharedSemaphore *waitCond);
private slots:
void dockWidgetVisibilityChanged(bool visible);
};
class MyCameraInterface : public ito::AddInInterfaceBase
{
Q_OBJECT
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_PLUGIN_METADATA(IID "ito.AddInInterfaceBase" )
#endif
Q_INTERFACES(ito::AddInInterfaceBase)
PLUGIN_ITOM_API
protected:
public:
MyCameraInterface();
~MyCameraInterface();
ito::RetVal getAddInInst(ito::AddInBase **addInInst);
private:
ito::RetVal closeThisInst(ito::AddInBase **addInInst);
};
|
In order to have a unified behaviour of all camera plugins, respect the following unit conventions. That means, the plugin should store related parameters using these conventions, such that getParam and setParam returns and obtains values using these units. Internally, it is sometimes necessary to convert these units to the units required by the interface of the real camera device.
Implement the following mandatory parameters in the map m_params:
name of the plugin
current bit depth (will be read e.g. when opening a live window)
current width of the camera image (considering a possible ROI). This parameter is always read-only and needs to be changed if the optional parameters x0 or x1 change. This parameter is read e.g. when a live window is opened.
current height of the camera image (considering a possible ROI). This parameter is always read-only and needs to be changed if the optional parameters y0 or y1 change. This parameter is read e.g. when a live window is opened.
If desired implement the following optional parameters in the map m_params:
Exposure or integration time in seconds
The time between two frames (in seconds, often read-only)
Normalized gain in the range [0.0,1.0]
Normalized offset in the range [0.0,1.0]
pixel coordinate of the left top corner of the image or ROI [0..width-1/height-1] If this changes, “sizex” or “sizey” must be changed, too.
pixel coordinate of the right bottom corner of the image or ROI [x0+1/y0+1..width-1/height-1] If this changes, “sizex” or “sizey” must be changed, too.
AD-Converter plugins are directly inherited from ito::AddInDataIO.
Todo
documentation for AD-converters
Further IO plugins are directly inherited from ito::AddInDataIO.
Todo
documentation for other IO devices