![]() |
KudanCV
|
The image tracker, for detecting and tracking KudanImageTrackables in an image stram. More...
#include <KudanCV.h>
Public Member Functions | |
| KudanImageTracker () | |
| ~KudanImageTracker () | |
| bool | processFrame (const unsigned char *image, int width, int height, int channels, int padding, bool requireFlip) |
| int | getNumberOfTrackables () |
| std::vector< std::shared_ptr< KudanImageTrackable > > | getTrackables () |
| int | getNumberOfDetectedTrackables () |
| std::vector< std::shared_ptr< KudanImageTrackable > > | getDetectedTrackables () |
| bool | addTrackable (const std::string path, std::string name="") |
| int | addTrackableSet (const std::string path) |
| int | addTrackableSet (const unsigned char *data, size_t length) |
| bool | addTrackable (std::shared_ptr< KudanImageTrackable > kudanTrackable) |
| bool | removeTrackable (std::shared_ptr< KudanImageTrackable > kudanTrackable) |
| std::shared_ptr< KudanImageTrackable > | getTrackable (std::string name) |
| void | setApiKey (std::string apiKey) |
| bool | hasCameraCalibration () |
| void | setCameraParameters (KudanCameraParameters &cameraParameters) |
| KudanCameraParameters & | getCameraParameters () |
| KudanMatrix3 | getCameraMatrix () |
| KudanMatrix4 | getProjectionMatrix (float nearPlane, float farPlane) |
| void | setDetectionSensitivity (float sensitivity) |
| void | resetDetectionSensitiviy () |
| void | setMaximumSimultaneousTracking (int maxTrack) |
| void | toggleParallelDetection (bool doParallel) |
| bool | isDetectorParallel () |
| void | setRecoveryMode (bool recovery) |
| void | prohibitRecoveryMode () |
| bool | queryRecoveryMode () |
| bool | queryRecoveryMode (std::shared_ptr< KudanImageTrackable > trackable) |
The image tracker, for detecting and tracking KudanImageTrackables in an image stram.
Default constructor. This automatically initialises the tracker.
| ~KudanImageTracker | ( | ) |
This deinitialises the tracker automatically
| bool addTrackable | ( | const std::string | path, |
| std::string | name = "" |
||
| ) |
Create and add a single Trackable from an image.
| path | The location of the image |
| name | A name for the Trackable. If empty (default) the name is derived from the image path. |
| bool addTrackable | ( | std::shared_ptr< KudanImageTrackable > | kudanTrackable | ) |
Add a Trackable to the tracker. The Trackable should be valid and created already.
| int addTrackableSet | ( | const std::string | path | ) |
Load a Trackable set from an file (created with the Toolkit)
| path | The location of the .KARMarker file |
| int addTrackableSet | ( | const unsigned char * | data, |
| size_t | length | ||
| ) |
Load a Trackable set from data (created with the Toolkit)
| data | Raw Trackable file data |
| length | The length of the data |
| KudanMatrix3 getCameraMatrix | ( | ) |
Get the calibration matrix for this camera, derived from the intrinsic parameters. This is a 3x3 matrix represented as the float array within a KudanMatrix3
| KudanException | is thrown if the parameters have not been set |
| KudanCameraParameters& getCameraParameters | ( | ) |
Get a (reference to) the camera parameters set on the tracker.
| std::vector<std::shared_ptr<KudanImageTrackable> > getDetectedTrackables | ( | ) |
Get a list of pointers to all Trackables successfuly tracked in the last frame
| int getNumberOfDetectedTrackables | ( | ) |
Get the number of Trackables successfully tracked in this frame
| int getNumberOfTrackables | ( | ) |
Get the number of Trackables loaded successfully into the tracker
| KudanMatrix4 getProjectionMatrix | ( | float | nearPlane, |
| float | farPlane | ||
| ) |
Get the projection matrix for this camera, derived from the intrinsic parameters and the given clipping planes This is a 4x4 matrix represented as the float array within a KudanMatrix.
| nearPlane,farPlane | The clipping planes to be used for rendering (not part of the camera parameters). |
| KudanException | is thrown if the parameters have not been set |
| std::shared_ptr<KudanImageTrackable> getTrackable | ( | std::string | name | ) |
Get a pointer to a KudanImageTrackable by its name. This is so that settigns can be set on it
| std::vector<std::shared_ptr<KudanImageTrackable> > getTrackables | ( | ) |
Get a list of pointers to all existing Trackables
| bool hasCameraCalibration | ( | ) |
Queries if a calibration has been set (with setCameraParameters).
| bool isDetectorParallel | ( | ) |
Query whether the detector is allowed to look for multiple Trackables in parallel or not
| bool processFrame | ( | const unsigned char * | image, |
| int | width, | ||
| int | height, | ||
| int | channels, | ||
| int | padding, | ||
| bool | requireFlip | ||
| ) |
Process a new frame for detection and tracking. Any non-tracked Trackables will be searched for (depending on settings), and any Trackables visible in the previous frame will be tracked into this frame. This will fail (return false) if a valid license is not set.
| image | 8bpp greyscale image data. |
| width,height | size of the image |
| channels | number of channels in the image (mono, colour, colour+alpha) |
| padding | the number of bytes to ignore at the end of each line |
| requireFlip | some devices provide the image upside down (rotation of 180 degrees). This flips the image (in both axes) before processing |
| KudanException | is thrown if there is no calibration data or an empty image. |
| void prohibitRecoveryMode | ( | ) |
Completely switch off recovery mode. Recovery mode cannot be used on ANY Trackable, despite individual settings.
| bool queryRecoveryMode | ( | ) |
Query whether recovery mode is being used (for Trackables which are not set individually)
| bool queryRecoveryMode | ( | std::shared_ptr< KudanImageTrackable > | trackable | ) |
Query whether recovery mode is being used for the specific Trackable. This needs to look at the global state to find out.
| trackable | Pointer to a Trackable object. Returns false if Trackable is nullptr. |
| bool removeTrackable | ( | std::shared_ptr< KudanImageTrackable > | kudanTrackable | ) |
Caution: not implemented yet
| void resetDetectionSensitiviy | ( | ) |
Resets the detector sensitivity to default values
| void setApiKey | ( | std::string | apiKey | ) |
A valid API key needs to be set before calling processFrame.
| apiKey | A valid key can only be acquired from Kudan. |
| void setCameraParameters | ( | KudanCameraParameters & | cameraParameters | ) |
Sets the camera parameters using given camera parameters.
| cameraParameters | Object of KudanCameraParameters which defines the camera intrinsics and image size. |
| KudanException | is thrown if the parameters are invalid |
| void setDetectionSensitivity | ( | float | sensitivity | ) |
Set the detector sensitivity. High sensitivity values mean the detector will more readily make detections (at the expense of accuracy). Lower values indicate more caution / robustness at the expense of missing detections
| sensitivity | Sensitivity value in range [0,1] |
| void setMaximumSimultaneousTracking | ( | int | maxTrack | ) |
Set the maximum number of Trackables that can be tracked at any one time. This does not limit the number which are searched for, until all possible Trackables are being tracked (at which point detection stops) Setting to 0 means there is no limit
| maxTrack | The maximum number of Trackables which can be tracked at a time. |
| void setRecoveryMode | ( | bool | recovery | ) |
Toggle recover mode. This turns recovery mode on/off for all Trackables, unless set otherwise on individual Trackables
| recovery | Set whether recovery mode is on or off |
| void toggleParallelDetection | ( | bool | doParallel | ) |
Set whether the detector is allowed to look for multiple Trackables in parallel or not. The number of threads used (if on) is set automatcally and is platform-specific.
| doParallel | Set if parallel detection is on or off |