KudanAR - iOS
ARImageTrackable Class Reference

#import <ARImageTrackable.h>

+ Inheritance diagram for ARImageTrackable:
+ Collaboration diagram for ARImageTrackable:

Instance Methods

(instancetype) - initWithPath:
 
(instancetype) - initWithBundledFile:
 
(instancetype) - initWithImage:name:
 
(instancetype) - initWithImage:name:autoCrop:
 
(instancetype) - initWithImage:name:width:height:
 
(instancetype) - initWithImage:name:width:height:autoCrop:
 
(void) - addTrackingEventTarget:action:forEvent:
 
(void) - removeTrackingEventTarget:action:forEvent:
 
(NSSet *) - allTrackingEventTargets
 
(void) - allowRecoveryMode
 
(void) - forceRecoveryMode
 
(void) - prohibitRecoveryMode
 
(void) - setExtensible:
 
(BOOL) - isExtensible
 
(BOOL) - isExtended
 
(void) - clearExtensions
 

Protected Member Functions

(typedef) - NS_ENUM
 

Properties

NSString * name
 
int width
 
int height
 
BOOL isDetected
 
ARNodeworld
 
ARNodeworldYUp
 
ARNodetouchableNode
 

Detailed Description

The ARImageTrackable class represents an image that can be tracked. The ARImageTrackerManager will automatically update properties. Attach content to the world property to have it rendered on the trackable.

Method Documentation

- (void) addTrackingEventTarget: (id)  target
action: (SEL)  action
forEvent: (ARImageTrackableEvents)  event 

Add an action for a given tracking event.

Example of use:

[imageTrackable addTrackingEventTarget:self action:@selector(detected:) forEvent:ARImageTrackableEventDetected];
Parameters
targetThe target object to add the event to.
actionThe action to get called on the target. It will get called with a single argument - the ARImageTrackable that triggered the event.
forEventThe event type, Detected, Tracked or Lost.
- (void) allowRecoveryMode

Set this marker to use flow recovery, if the global setting is switched on (default to global setting). Recovery mode is a feature that allows for quicker re-detection of a marker if it is lost. It is also easier to re-detect the marker from shallower angles and greater distances. It is recommended that this feature be enabled for as many markers as possible, though doing so will use a fraction more CPU power.

Example of use:

[imageTrackable allowRecoveryMode];
- (NSSet *) allTrackingEventTargets

The set of all tracking targets. Contains NSDictionary objects of target, action and forEvent keys.

- (void) clearExtensions

For extended markers: clear all current extensions (they can be re-created after this, if extended tracking has not been disabled).

Example of use:

[imageTrackable clearExtensions];
- (void) forceRecoveryMode

Make this marker use flow recovery irrespective of the global setting.

Example of use:

[imageTrackable forceRecoveryMode];
- (instancetype) initWithBundledFile: (NSString *)  bundledFile

Initialises an ARImageTrackable with a bundled marker set.

Example of use:

ARImageTrackable *imageTrackable = [[ARImageTrackable alloc] initWithBundledFile:@"Assets/example.KARMarker"];
Parameters
bundledFileThe file path to the trackable file relative to the project bundle, including the file extension. This file should have been generated by the Kudan AR Toolkit and be in the .KARMarker format.
Returns
the initialised object.
- (instancetype) initWithImage: (UIImage *)  image
name: (NSString *)  name 

Initialises this object with a UIImage and assigns it the given name.

Example of use:

ARImageTrackable *imageTrackable = [[ARImageTrackable alloc] initWithImage:[UIImage imageNamed:@"example.jpg"] name:@"Example Marker"];
Parameters
imageA UIImage representing the image to create this trackable from.
nameThe name to give to this trackable so the tracker can find it by name.
Returns
The initialised object.
- (instancetype) initWithImage: (UIImage *)  image
name: (NSString *)  name
autoCrop: (BOOL)  autoCrop 

Initialises this object with a UIImage, assigns it the given name and sets whether autocropping should be used. Autocropping is a feature that automatically finds the most useful sub-region of a trackable image, and uses that for tracking and detection. This allows images containing large borders to be used without sacrificing tracking resolution. Cropping is automatic and makes no difference to how the trackable objects are used the tracked region will never look cropped. This must be enabled for individual markers when they are created from images.

Example of use:

ARImageTrackable *imageTrackable = [[ARImageTrackable alloc] initWithImage:[UIImage imageNamed:@"example.jpg"] name:@"Example Marker" autoCrop:YES];
Parameters
imageA UIImage representing the image to create this trackable from.
nameThe name to give to this trackable so the tracker can find it by name.
autoCropSet whether this image will be optimally cropped internally for tracking.
Returns
The initialised object.
- (instancetype) initWithImage: (UIImage *)  image
name: (NSString *)  name
width: (int)  width
height: (int)  height 

Initialises this object with a UIImage, assigns it the given name and sets its width and height.

Example of use:

ARImageTrackable *imageTrackable = [[ARImageTrackable alloc] initWithImage:[UIImage imageNamed:@"example.jpg"] name:@"Example Marker" width:100 height:100];
Parameters
imageA UIImage representing the image to create this trackable from.
nameThe name to give to this trackable so the tracker can find it by name.
width,heightSet the size of the marker in world units
Returns
The initialised object.
- (instancetype) initWithImage: (UIImage *)  image
name: (NSString *)  name
width: (int)  width
height: (int)  height
autoCrop: (BOOL)  autoCrop 

Initialises this object with a UIImage, assigns it the given name, sets its width and height and sets whether autocropping should be used.

Example of use:

ARImageTrackable *imageTrackable = [[ARImageTrackable alloc] initWithImage:[UIImage imageNamed:@"example.jpg"] name:@"Example Marker" width:100 height:100 autoCrop:YES];
Parameters
imageA UIImage representing the image to create this trackable from.
nameThe name to give to this trackable so the tracker can find it by name.
autoCropSet whether this image will be optimally cropped internally for tracking.
width,heightSet the size of the marker in world units
Returns
The initialised object.
- (instancetype) initWithPath: (NSString *)  path

Initialises an ARImageTrackable with a marker set.

Example of use:

NSString *filePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"example.KARMarker"];
ARImageTrackable *imageTrackable = [[ARImageTrackable alloc] initWithPath:filePath];
Parameters
pathThe full file path to the trackable file, including all folders and file extension. This file should have been generated by the Kudan AR Toolkit and be in the .KARMarker format.
Returns
the initialised object.
- (BOOL) isExtended

Get whether any extensions have been made of this marker, or if this marker is itself an extension of a marker.

Example of use:

BOOL extendedStatus = [imageTrackable isExtended];
Returns
Whether this one trackable has extensions (YES) or not (NO).
- (BOOL) isExtensible

Get whether this marker is using Extended Tracking and Detection.

Example of use:

BOOL extensibilityStatus = [imageTrackable isExtensible];
Returns
Whether extensibility is enabled (YES) or not (NO) on this trackable.
- (typedef) NS_ENUM (NSInteger) 
(ARImageTrackableEvents)   

Tracking events:

ARImageTrackableEventDetected - The first frame that a marker has been detected.

ARImageTrackableEventLost - The first frame since it started being tracker that it is no longer being tracked.

ARImageTrackableEventTracked - Marker was tracked. This can be sent in the same frame as ARImageTrackableEventDetected.

- (void) prohibitRecoveryMode

Prevent this marker from using flow recovery, irrespective of the global setting.

Example of use:

[imageTrackable prohibitRecoveryMode];
- (void) removeTrackingEventTarget: (id)  target
action: (SEL)  action
forEvent: (ARImageTrackableEvents)  event 

Remove an existing tracking target.

Example of use:

[imageTrackable removeTrackingEventTarget:self action:@selector(detected:) forEvent:ARImageTrackableEventDetected];
Parameters
targetThe target object to remove the event from.
actionThe action to get called on the target. It will get called with a single argument - the ARImageTrackable that triggered the event.
forEventThe event type, Detected, Tracked or Lost.
- (void) setExtensible: (BOOL)  isExtensible

Set whether this marker should use Extended Tracking and Detection. Extended Tracking and Detection is a feature where trackables can be extended by automatically creating new markers from the surrounding scene. This means that after being expanded, trackables can be detected and tracked from much further away. This can be activated on a per-trackable basis and should ideally only be used for stationary markers, such as posters. Extended Tracking is good for tracking small objects at large distances when moving away from the marker. Extended Tracking is not designed for use with markers that are not stationary. Enabling this feature will require slightly more memory space.

Example of use:

[imageTrackable setExtensible:YES];
Parameters
isExtensibleSet if the marker is extensible or not. Setting this to NO will prevent any more extensions being made (but not clear existing ones).

Property Documentation

- (int) height
readwritenonatomicassign

The scene height of this trackable. This can be arbitrary but is used to determine the scale of the coordinate system that is attached to this node.

- (BOOL) isDetected
readnonatomicassign

Whether this trackable is currently detected or not. Automatically controlled by the tracker.

- (NSString*) name
readwritenonatomicassign

The name of this trackable. This needs to be unique, otherwise the tracker will not be able to find it. If initialised from a trackable file then it is read in automatically.

- (int) width
readwritenonatomicassign

The scene width of this trackable. This can be arbitrary but is used to determine the scale of the coordinate system that is attached to this node.

- (ARNode*) world
readwritenonatomicassign

The node whose transformation is automatically updated by the tracker to represent the trackable's pose in the camera image. Content attached here will be tracked whilst the trackable is being detected..


The documentation for this class was generated from the following file: