The image tracker, for detecting and tracking KudanImageTrackables in an image stram.
More...
#include <KudanCV.h>
The image tracker, for detecting and tracking KudanImageTrackables in an image stram.
◆ KudanImageTracker()
KudanImageTracker::KudanImageTracker |
( |
| ) |
|
Default constructor. This automatically initialises the tracker.
◆ ~KudanImageTracker()
KudanImageTracker::~KudanImageTracker |
( |
| ) |
|
This deinitialises the tracker automatically
◆ addTrackable() [1/2]
bool KudanImageTracker::addTrackable |
( |
const std::string |
path, |
|
|
std::string |
name = "" |
|
) |
| |
Create and add a single Trackable from an image.
- Parameters
-
path | The location of the image |
name | A name for the Trackable. If empty (default) the name is derived from the image path. |
- Returns
- boolean indicating if the Trackable was created and added successfully
◆ addTrackable() [2/2]
Add a Trackable to the tracker. The Trackable should be valid and created already.
- Returns
- Boolean indicating whether it was successfully added to the underlying tracker
◆ addTrackableSet() [1/2]
int KudanImageTracker::addTrackableSet |
( |
const std::string |
path | ) |
|
Load a Trackable set from an file (created with the Toolkit)
- Parameters
-
path | The location of the .KARMarker file |
- Returns
- The number of Trackables successfully loaded from this set
◆ addTrackableSet() [2/2]
int KudanImageTracker::addTrackableSet |
( |
const unsigned char * |
data, |
|
|
size_t |
length |
|
) |
| |
Load a Trackable set from data (created with the Toolkit)
- Parameters
-
data | Raw Trackable file data |
length | The length of the data |
- Returns
- The number of Trackables successfully loaded
◆ 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
- Returns
- A KudanMatrix3 representing the intrinsic parameters
- Exceptions
-
◆ getCameraParameters()
Get a (reference to) the camera parameters set on the tracker.
- Returns
- A reference to a KudanCameraParameters object. Altering this will change the one stored in the tracker
◆ getDetectedTrackables()
std::vector< std::shared_ptr< KudanImageTrackable > > KudanImageTracker::getDetectedTrackables |
( |
| ) |
|
Get a list of pointers to all Trackables successfuly tracked in the last frame
- Returns
- A list of (pointers to) KudanImageTrackable objects, representing all of the Trackables currently tracked.
◆ getNumberOfDetectedTrackables()
int KudanImageTracker::getNumberOfDetectedTrackables |
( |
| ) |
|
Get the number of Trackables successfully tracked in this frame
- Returns
- The number of currently tracked Trackables.
◆ getNumberOfTrackables()
int KudanImageTracker::getNumberOfTrackables |
( |
| ) |
|
Get the number of Trackables loaded successfully into the tracker
◆ getProjectionMatrix()
KudanMatrix4 KudanImageTracker::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.
- Parameters
-
nearPlane,farPlane | The clipping planes to be used for rendering (not part of the camera parameters). |
- Returns
- A KudanMatrix representing the intrinsic parameters plus clipping planes.
- Exceptions
-
◆ getTrackable()
◆ getTrackables()
Get a list of pointers to all existing Trackables
- Returns
- A list of (pointers to) KudanImageTrackable objects, representing all of the Trackables currently loaded.
◆ hasCameraCalibration()
bool KudanImageTracker::hasCameraCalibration |
( |
| ) |
|
Queries if a calibration has been set (with setCameraParameters).
- Returns
- A boolean which is true if the calibration has been set
◆ isDetectorParallel()
bool KudanImageTracker::isDetectorParallel |
( |
| ) |
|
Query whether the detector is allowed to look for multiple Trackables in parallel or not
- Returns
- Boolean indicating whether parallel detection is enabled.
Query whether the detector is allowed to look for multiple trackables in parallel or not
◆ processFrame()
bool KudanImageTracker::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.
- Parameters
-
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 |
- Returns
- A boolean indicating whether tracking happened (true) or not (false)
- Exceptions
-
KudanException | is thrown if there is no calibration data or an empty image. |
◆ prohibitRecoveryMode()
void KudanImageTracker::prohibitRecoveryMode |
( |
| ) |
|
Completely switch off recovery mode. Recovery mode cannot be used on ANY Trackable, despite individual settings.
◆ queryRecoveryMode() [1/2]
bool KudanImageTracker::queryRecoveryMode |
( |
| ) |
|
Query whether recovery mode is being used (for Trackables which are not set individually)
- Returns
- A boolean indicating if recovery mode is globally on or off
◆ queryRecoveryMode() [2/2]
Query whether recovery mode is being used for the specific Trackable. This needs to look at the global state to find out.
- Parameters
-
trackable | Pointer to a Trackable object. Returns false if Trackable is nullptr. |
- Returns
- A boolean indicating if recovery mode is on or off for the specified Trackable.
◆ removeTrackable()
bool KudanImageTracker::removeTrackable |
( |
std::shared_ptr< KudanImageTrackable > |
kudanTrackable | ) |
|
Caution: not implemented yet
◆ resetDetectionSensitiviy()
void KudanImageTracker::resetDetectionSensitiviy |
( |
| ) |
|
Resets the detector sensitivity to default values
◆ setApiKey()
void KudanImageTracker::setApiKey |
( |
std::string |
apiKey | ) |
|
A valid API key needs to be set before calling processFrame.
- Parameters
-
apiKey | A valid key can only be acquired from Kudan. |
◆ setCameraParameters()
Sets the camera parameters using given camera parameters.
- Parameters
-
- Exceptions
-
◆ setDetectionSensitivity()
void KudanImageTracker::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
- Parameters
-
sensitivity | Sensitivity value in range [0,1] |
◆ setMaximumSimultaneousTracking()
void KudanImageTracker::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
- Parameters
-
maxTrack | The maximum number of Trackables which can be tracked at a time. |
◆ setRecoveryMode()
void KudanImageTracker::setRecoveryMode |
( |
bool |
recovery | ) |
|
Toggle recover mode. This turns recovery mode on/off for all Trackables, unless set otherwise on individual Trackables
- Parameters
-
recovery | Set whether recovery mode is on or off |
◆ toggleParallelDetection()
void KudanImageTracker::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.
- Parameters
-
doParallel | Set if parallel detection is on or off |
Set whether the detector is allowed to look for multiple trackables in parallel or not
The documentation for this class was generated from the following files: