![]() |
KudanAR - iOS
1.6.0
|
#import <ARImageTrackable.h>
Inherits NSObject.
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 Types | |
enum | ARImageTrackableEvents { ARImageTrackableEventDetected, ARImageTrackableEventLost, ARImageTrackableEventTracked } |
Properties | |
NSString * | name |
int | width |
int | height |
BOOL | isDetected |
ARNode * | world |
ARNode * | worldYUp |
ARNode * | touchableNode |
The ARImageTrackable class represents an image that can be tracked. Add ARImageTrackables to the ARImageTrackerManager in order to display content on those trackables. The ARImageTrackerManager will automatically update properties of any trackables added to it. Add ARNodes as children of the ARImageTrackable's world to render content on the trackable.
|
protected |
Tracking events:
- (void) addTrackingEventTarget: | (id) | target | |
action: | (SEL) | action | |
forEvent: | (ARImageTrackableEvents) | event | |
Add an action for a given tracking event.
NOTE: Any added tracking event targets must be removed before exiting an ARView.
Example of use:
target | The target object to add the event to. |
action | The action to get called on the target. It will get called with a single argument - the ARImageTrackable that triggered the event. |
forEvent | The 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:
- (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:
- (void) forceRecoveryMode |
Make this marker use flow recovery irrespective of the global setting.
Example of use:
- (instancetype) initWithBundledFile: | (NSString *) | bundledFile |
Initialises an ARImageTrackable using a .KARMarker data set in the main bundle.
Example of use:
bundledFile | The file path to the trackable file relative to the main project bundle, including the file extension. This file should have been generated by the Kudan AR Toolkit and be in the .KARMarker format. |
- (instancetype) initWithImage: | (UIImage *) | image | |
name: | (NSString *) | name | |
Initialises this object with a UIImage and assigns it the given name.
Example of use:
image | A UIImage representing the image to create this trackable from. |
name | The name to give to this trackable so the tracker can find it by name. |
- (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:
image | A UIImage representing the image to create this trackable from. |
name | The name to give to this trackable so the tracker can find it by name. |
autoCrop | Set whether this image will be optimally cropped internally for tracking. |
- (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:
image | A UIImage representing the image to create this trackable from. |
name | The name to give to this trackable so the tracker can find it by name. |
width,height | Set the size of the marker in world units |
- (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:
image | A UIImage representing the image to create this trackable from. |
name | The name to give to this trackable so the tracker can find it by name. |
autoCrop | Set whether this image will be optimally cropped internally for tracking. |
width,height | Set the size of the marker in world units |
- (instancetype) initWithPath: | (NSString *) | path |
Initialises an ARImageTrackable using a .KARMarker data set. A .KARMarker is a custom format that is more lightweight than that of a usual .jpg file. This means that, by converting marker images into .KARMarker files, a good deal of space can be saved.
Example of use:
path | The 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. |
- (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) isExtensible |
Get whether this marker is using Extended Tracking and Detection.
Example of use:
- (void) prohibitRecoveryMode |
Prevent this marker from using flow recovery, irrespective of the global setting.
Example of use:
- (void) removeTrackingEventTarget: | (id) | target | |
action: | (SEL) | action | |
forEvent: | (ARImageTrackableEvents) | event | |
Remove an existing tracking target.
Example of use:
target | The target object to remove the event from. |
action | The action to get called on the target. It will get called with a single argument - the ARImageTrackable that triggered the event. |
forEvent | The 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:
isExtensible | Set if the marker is extensible or not. Setting this to NO will prevent any more extensions being made (but not clear existing ones). |
|
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.
|
readnonatomicassign |
Whether this trackable is currently detected or not. Automatically controlled by the tracker.
|
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.
|
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.
|
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.