![]() |
KudanCV
|
#include <KudanCV.h>
Public Member Functions | |
| KudanImageTrackable (std::shared_ptr< Private >) | |
| bool | isTrackingReliable () |
| int | isRecovered () |
| bool | isTracked () |
| KudanVector3 | getPosition () |
| KudanQuaternion | getOrientation () |
| int | getNumTrackedPoints () |
| std::vector< KudanVector2 > | getTrackedPoints () |
| std::vector< KudanVector2 > | getTrackedCorners () |
| std::string | getName () |
| void | setName (std::string name) |
| float | getWidth () |
| float | getHeight () |
| void | setWidth (float width) |
| void | setHeight (float height) |
| bool | setSize (float width, float height) |
| void | setScale (float scale) |
| void | allowRecoveryMode () |
| void | forceRecoveryMode () |
| void | prohibitRecoveryMode () |
| bool | queryRecoveryMode (bool globalSetting) |
Static Public Member Functions | |
| static std::shared_ptr< KudanImageTrackable > | createFromImageFile (std::string path, std::string name="") |
| static std::shared_ptr< KudanImageTrackable > | createFromFilePointer (FILE *filePointer) |
| static std::shared_ptr< KudanImageTrackable > | createFromImageData (const unsigned char *imageData, std::string name, int width, int height, int channels, int padding) |
Friends | |
| class | KudanImageTracker |
An image which can be tracked. An Image Trackable is a representation of an image which can be detected and tracked by the KudanImageTracker. It stores a representation of the 2D image suitable for tracking, with various other settings (such as its size in pixels). The class will also represent the pose of the tracked image with respect to the camera when tracking is successful, plus other state.
| KudanImageTrackable | ( | std::shared_ptr< Private > | ) |
This is the only constructor, which cannot be used (because it needs Private data access). Create a KudanImageTrackable using the createFromImageFile (etc) static methods
| void allowRecoveryMode | ( | ) |
Turn on recovery mode for this Trackable, if enabled. This Trackable can use recover mode if the global setting is switched on (default to global setting). This makes re-detection of previously seen Trackables quicker and possible from a greater range of angles.
|
static |
Create a new Trackable directly from a file. This is for loading data processed by the Kudan Toolkit in the .KARMarker format, not for reading image files.
| filePointer | A file pointer refering to a .KARMarker file, created with the Kudan Toolkit. |
|
static |
Create a new Trackable from image data. These data should be in the form of a pointer to an unsigned character array. The format of the data must match the specified size and number of channels, otherwise this can cause errors which won't be detected. If Kudan is being used with OpenCV this is easily used with a cv::Mat: createFromImageData(mat.data, "name", mat.size().width, mat.size().height, mat.channels(), 0); In general the image data should be ordered such that the channel c pixel at (x,y) is at position [(width * y + x)*channels + c] (in the same manner as OpenCV)
| imageData | Pointer to the actual image data |
| name | Name of this Trackable |
| width,height,channels,padding | Parameters of the image data |
| KudanException | is thrown if the data pointer is null or if a wrong number of channels is given |
|
static |
Create a new Trackable from an image file. The image is loaded from the specified path, if it exists, and processed to create a Trackable object.
| path | Location of th eimage file (jpeg or png) |
| name | Name of this Trackable (optional). If not given, the name is derived from the path |
| KudanException | is thrown if the image cannot be read or is empty. |
| void forceRecoveryMode | ( | ) |
Turn on recovery mode for this Trackable. This Trackable will have recovery mode emabled irrespective of the global setting.
| float getHeight | ( | ) |
Get the size of the Trackable image with respect to 3D units along its local Y axis. If the size has been set, this affects the height returned.
| std::string getName | ( | ) |
Get the name of this Trackable.
| int getNumTrackedPoints | ( | ) |
Return the number of points used to track this Trackable and estimate its pose. This can be used as a crude way of evaluating how well this Trackable is tracked.
| KudanQuaternion getOrientation | ( | ) |
Get the 6dof pose of the image Trackable, with respect to the camera. This represents the orientation of the image about its own centre, as a unit quaternion
| KudanVector3 getPosition | ( | ) |
Get the 6dof pose of the image Trackable, with respect to the camera. This represents the position of the centre of the image in 3D in the camera coordinate frame.
| std::vector<KudanVector2> getTrackedCorners | ( | ) |
Get a vector of exaclty 4 (or if tracking is not running, zero) points, which are the corners of the tracked region in the camera image
| std::vector<KudanVector2> getTrackedPoints | ( | ) |
Get a vector of 2D points representing the locations of points on the camera image used for tracking this Trackable. This will have length equivalent to getNumTrackedPoints()
| float getWidth | ( | ) |
Get the size of the Trackable image with respect to 3D units along its local X axis. If the size has been set, this affects the width returned.
| int isRecovered | ( | ) |
Query whether the current tracking state was achieved through recovery-based detection (related to the recovery mode). This returns 0 if detection happened in the usual way, and nonzero if recovery was used (1 indicates recovery re-detection, 2 indicates instant recovery while tracking)
| bool isTracked | ( | ) |
Is this Trackable currently detectd by the image tracker? This is equivalent to asking whether this Trackable will be in the detected Trackables list
| bool isTrackingReliable | ( | ) |
Query whether tracking of this Trackable is currently deemed reliable.
| void prohibitRecoveryMode | ( | ) |
Switch off recovery mode for this Trackable. This prevents this Trackable from using recovery mode, irrespective of the global setting.
| bool queryRecoveryMode | ( | bool | globalSetting | ) |
Query recovery mode for this Trackable. This could depend on the global setting, depending how it was set.
| globalSetting | Specifies whether recovery mode is allowed in the tracker |
| void setHeight | ( | float | height | ) |
Set the value which represents the height of this trackable (in the units / reference frame of your choice) This sets what size the trackable will have in the 3D coordinate frame in which its pose is represented. It does not affect tracking.
| height | The height of the trackable in some units |
| void setName | ( | std::string | name | ) |
Set the name on this Trackable. This is stored in the unerlying tracker state and is used to find the correct data (be careful with duplicates)
| name | The name which will be assigned to this trackable |
| void setScale | ( | float | scale | ) |
Set the scale at which this trackale is represented in the 3D coordinate system. This does not change internal state, and is equivalent to calling setSize. Using setScale(1) will mean the trackable's size is represented in pixel units of the actual trackable image
| scale | Scale factor relating the trackable image size to the apparent size in 3D |
| bool setSize | ( | float | width, |
| float | height | ||
| ) |
Set the Trackable's size. This might change some graphics but will not change the underlying image or tracking behaviour. It should be used to specify dimensions which make sense for the given Trackable (e.g. real world scale). This will not allow you to change the aspect ratio! Set only to consistent multiplies of the current size (altering the width or height independently does not make sense - this is really a scale factor)
| width,height | The dimensions of the Trackable image. These can be in any units, but should always have the same aspect ratio as the actual image. |
| KudanException | is thrown if the Trackable is not initialised or if the width or height are invalid |
| void setWidth | ( | float | width | ) |
Set the value which represents the width of this trackable (in the units / reference frame of your choice) This sets what size the trackable will have in the 3D coordinate frame in which its pose is represented. It does not affect tracking.
| width | The width of the trackable in some units |