This class provides a high-level API to a touch-screen. More...
#include <MultiTouch/MultiTouch.hpp>
Public Types | |
| typedef std::function< void(bool)> | LicenseActivationWizardDisplayCallback |
Public Member Functions | |
| void | addCVExtension (CVExtension *ext) |
| Adds a new computer vision extension to be ran before the main image processing pipeline. More... | |
| void | commitUpdate () |
| Finish pending samples by setting latestSampleNumber = pendingSampleNumber. | |
| float | framesPerSecond () const |
| Return the frame-rate of the touch-screen input sampling. More... | |
| bool | hasNetBridge () const |
| Check if the tracker is using a NetBridge setup (i.e. More... | |
| bool | initialize (const char *configfile, const QString &licenseFile="", QString *errorMessage=nullptr, const char *appname=nullptr, Luminous::MultiHead *multiHead=nullptr) |
| Initialize the touch-screen, based on settings in the configuration file. More... | |
| bool | initializeDummy (const QString &licenseFile, const char *appname=0, Luminous::MultiHead *multiHead=0) |
| Initialize a dummy tracker. More... | |
| bool | initializeWithConfig (const Radiant::Config &config, const QString &licenseFile="", const char *appname=nullptr, Luminous::MultiHead *multiHead=nullptr) |
| Same as initialize(), except configuration is given in-memory instead of as an file path. More... | |
| Radiant::Config & | inputConfig () |
| Get the input configuration. More... | |
| QString & | inputConfigFileName () |
| Get the configuration filename. More... | |
| bool | isRunning () const |
| Check if the touch-tracking is operational. More... | |
| MultiTouch::Sample | latestSample () const |
| Get the latest sample. More... | |
| int | latestSampleNumber () const |
| Returns the latest sample number. More... | |
| int | pendingSampleNumber () const |
| Samples that are pending but not yet finalized by committing can still be modified. More... | |
| void | reloadConfiguration () |
| Reload the touch-screen configuration. | |
| size_t | ringBufferSize () const |
| Get the ring-buffer size. More... | |
| MultiTouch::Sample | sample (size_t index) const |
| Returns the sample with the given index. More... | |
| Screen () | |
| Constructor. | |
| void | setLicenseActivationWizardDisplayCallback (LicenseActivationWizardDisplayCallback callback) |
| This function is used to set a callback function for the license activation. | |
| void | setSaveSettingsOnExit (int save, const char *filename=0) |
| Control whether the system saves settings on exit (default = false). More... | |
| void | stop () |
| Stops the touch-screen operation. More... | |
| void | synthesizeFingerInput (int sample, TrackedObject::Id handId, int handAge, TrackedObject::Id fingerId, int fingerAge, Nimble::Vector2 loc, Nimble::Vector2 motion, Nimble::Vector2 dir) |
| Synthesize fake input data. More... | |
| void | synthesizeHandInput (int sample, TrackedObject::Id id, int age, Nimble::Vector2 loc) |
| Synthesize fake input data. More... | |
| void | synthesizeMarkerInput (int sampleNo, TrackedObject::Id markerId, int markerAge, long code, Nimble::Vector2 loc, float rot, Nimble::Vector2 motion) |
| Synthesize fake input data. More... | |
| void | synthesizePenInput (int sample, TrackedObject::Id penId, int penAge, Nimble::Vector2 loc, Nimble::Vector2 motion) |
| Synthesize fake input data. More... | |
| Nimble::Rect | totalOutputArea () const |
| The total output area of the multi-touch engine. More... | |
| void | update (unsigned timeoutMs, bool autoCommit=true) |
| Update the ring-buffer. More... | |
| ~Screen () | |
| Destructor. | |
This class provides a high-level API to a touch-screen.
Typically there is a single instance of this class. This class stores the input sample data in a ring-buffer. This data is updated through update() function calls. The application can run faster or slower than the input capture rate. If the application does not process samples fast enough some are dropped.
| void MultiTouch::Screen::addCVExtension | ( | CVExtension * | ext | ) |
Adds a new computer vision extension to be ran before the main image processing pipeline.
The extensions need to be added before the image processing can take place.
| ext | An extension to the computer vision pipeline. |
| float MultiTouch::Screen::framesPerSecond | ( | ) | const |
Return the frame-rate of the touch-screen input sampling.
| bool MultiTouch::Screen::hasNetBridge | ( | ) | const |
Check if the tracker is using a NetBridge setup (i.e.
transmitting data over network).
| bool MultiTouch::Screen::initialize | ( | const char * | configfile, |
| const QString & | licenseFile = "", |
||
| QString * | errorMessage = nullptr, |
||
| const char * | appname = nullptr, |
||
| Luminous::MultiHead * | multiHead = nullptr |
||
| ) |
Initialize the touch-screen, based on settings in the configuration file.
| configfile | A filename of text file that contains the parameters of all cameras. |
| licenseFile | license file to use. Leave empty for default. |
| errorMessage | ignored |
| appname | application name for license check |
| multiHead | optional multihead configuration for getting the default output area / input resolution. Used by TUIO import. |
| bool MultiTouch::Screen::initializeDummy | ( | const QString & | licenseFile, |
| const char * | appname = 0, |
||
| Luminous::MultiHead * | multiHead = 0 |
||
| ) |
Initialize a dummy tracker.
Initializes a dummy tracker that won't actually perform any input tracking. It only provides the mouse/keyboard emulation input support.
| licenseFile | name of the license file to use. Leave empty for default. |
| bool MultiTouch::Screen::initializeWithConfig | ( | const Radiant::Config & | config, |
| const QString & | licenseFile = "", |
||
| const char * | appname = nullptr, |
||
| Luminous::MultiHead * | multiHead = nullptr |
||
| ) |
Same as initialize(), except configuration is given in-memory instead of as an file path.
| Radiant::Config& MultiTouch::Screen::inputConfig | ( | ) |
Get the input configuration.
| QString& MultiTouch::Screen::inputConfigFileName | ( | ) |
Get the configuration filename.
| bool MultiTouch::Screen::isRunning | ( | ) | const |
Check if the touch-tracking is operational.
| MultiTouch::Sample MultiTouch::Screen::latestSample | ( | ) | const |
Get the latest sample.
| int MultiTouch::Screen::latestSampleNumber | ( | ) | const |
Returns the latest sample number.
| int MultiTouch::Screen::pendingSampleNumber | ( | ) | const |
Samples that are pending but not yet finalized by committing can still be modified.
| size_t MultiTouch::Screen::ringBufferSize | ( | ) | const |
Get the ring-buffer size.
| MultiTouch::Sample MultiTouch::Screen::sample | ( | size_t | index | ) | const |
Returns the sample with the given index.
If the sample cannot be found (it is too old, or in the future), then null sample is returned.
| index | sample index to get |
| void MultiTouch::Screen::setSaveSettingsOnExit | ( | int | save, |
| const char * | filename = 0 |
||
| ) |
Control whether the system saves settings on exit (default = false).
By default the tracker does not save settings as the application is stopped. In many cases you do want to save settings because they have been adjusted.
| save | If save is zero nothing is saved. If save is non-zero configuration is saved. If save is two then all of the settings concerning configuration of machine vision is saved (applies only to MT467 & MT469). |
| filename | The name of the file for saving the settings. If it is zero, then the original configuration file name will be used. |
| void MultiTouch::Screen::stop | ( | ) |
Stops the touch-screen operation.
Typically you do not need to call this function explicitly, as it is called in the object destructor automatically.
| void MultiTouch::Screen::synthesizeFingerInput | ( | int | sample, |
| TrackedObject::Id | handId, | ||
| int | handAge, | ||
| TrackedObject::Id | fingerId, | ||
| int | fingerAge, | ||
| Nimble::Vector2 | loc, | ||
| Nimble::Vector2 | motion, | ||
| Nimble::Vector2 | dir | ||
| ) |
Synthesize fake input data.
This function can be used to generate simulated touch-input. Note that the fingerId and handId must be unique from the ids coming from the real computer vision system. In practice the best way to accomplish this is that your application has an internal counter for these values, and the counter starts from a large value (e.g. one billion) that is likely to be larger than any value coming from computer vision. If your application assumes that greater id values indicate newer hand/finger, this may be a problem - but only if you use fake input and real input at the same time.
| sample | Sample number to inject the data, see Sample::index |
| handId | Hand id to inject, corresponds to Hand::id |
| handAge | Hand age to inject, corresponds to Hand::age |
| fingerId | Finger id to inject, corresponds to Finger::id |
| fingerAge | Finger age to inject, corresponds to Finger::age |
| loc | Location of the finger tip, corresponds to Finger::tipLocation |
| motion | Motion of the finger, corresponds to Finger::tipMotion |
| dir | direction of the finger tip, corresponds to Finger::tipDirection |
| void MultiTouch::Screen::synthesizeHandInput | ( | int | sample, |
| TrackedObject::Id | id, | ||
| int | age, | ||
| Nimble::Vector2 | loc | ||
| ) |
Synthesize fake input data.
This function can be used to generate simulated hand on the touch screen. This does not add any fingers to the hand. Those needs to be added afterwards using synthesizeFingerInput-function.
| sample | Sample number to inject the data, see Sample::index |
| id | Hand id to inject, corresponds to Hand::id |
| age | Hand age to inject, corresponds to Hand::age |
| loc | Location of the hand palm, corresponds to Hand::palmCenter |
| void MultiTouch::Screen::synthesizeMarkerInput | ( | int | sampleNo, |
| TrackedObject::Id | markerId, | ||
| int | markerAge, | ||
| long | code, | ||
| Nimble::Vector2 | loc, | ||
| float | rot, | ||
| Nimble::Vector2 | motion | ||
| ) |
Synthesize fake input data.
This function can be used to generate simulated marker-input. Note that the markerId must be unique from the ids coming from the real computer vision system.
| sampleNo | Sample number to inject the data, see Sample::index |
| markerId | Marker id to inject, corresponds to Marker::id |
| markerAge | Marker age to inject, corresponds to Marker::age |
| code | marker code to inject, corresponds to Marker::code |
| loc | Location of the marker, corresponds to Marker::centerLocation |
| rot | Rotation of the marker, corresponds to Marker::rotation |
| motion | Ignored parameter, Marker doesn't have motion at the moment |
| void MultiTouch::Screen::synthesizePenInput | ( | int | sample, |
| TrackedObject::Id | penId, | ||
| int | penAge, | ||
| Nimble::Vector2 | loc, | ||
| Nimble::Vector2 | motion | ||
| ) |
Synthesize fake input data.
This function can be used to generate simulated pen-input. Note that the penId must be unique from the ids coming from the real computer vision system.
| sample | Sample number to inject the data, see Sample::index |
| penId | Pen id to inject, corresponds to Pen::id |
| penAge | Pen age to inject, corresponds to Pen::age |
| loc | Location of the pen, corresponds to Pen::location |
| motion | Ignored parameter, Pen doesn't have motion at the moment |
| Nimble::Rect MultiTouch::Screen::totalOutputArea | ( | ) | const |
The total output area of the multi-touch engine.
This function returns a rectangle that includes the nominal output area.
| void MultiTouch::Screen::update | ( | unsigned | timeoutMs, |
| bool | autoCommit = true |
||
| ) |
Update the ring-buffer.
Gets a new sample from the tracker optionally blocking until a new sample is available. This will update latestSampleNumber if autoCommit is true, otherwise it will just update pendingSampleNumber.
| timeoutMs | how many milliseconds to wait for a new sample. |
| autoCommit | run commitUpdate() automatically |