C++ Java Unity
C++ Reference
ModelTarget Class Referenceabstract

Detailed Description

A type of ObjectTarget that recognizes and tracks objects by shape using existing 3D models.

A Model Target tracks a real world object by its shape, based on a 3D model of the object.

In order to initialize tracking of a Model Target, the user is required to position their device so that the object to be tracked appears in the camera at a particular position and orientation. This initialization pose is called a Guide View. To assist in this process, your application will typically render an overlay in the camera image representing the position and orientation of the object for the active Guide View. (Usually you will do this by rendering the image returned by GuideView::getImage()).

A Model Target dataset may contain multiple objects and/or multiple Guide Views.

  • If you have a Model Target dataset containing a single object with multiple Guide Views, you can switch between the Guide Views using setActiveGuideViewIndex().
  • If you have an Advanced Model Target dataset with multiple objects and/or multiple Guide Views, the activated Guide View changes automatically when recognized.
  • If you have an Advanced 360 Model Target dataset, no Guide View access is necessary.
Note
It is not possible to modify a ModelTarget while its DataSet is active. See the DataSet class for more information.
Inheritance diagram for ModelTarget:
ObjectTarget Trackable NonCopyable

Public Types

enum  TRACKING_MODE {
  DEFAULT = 0,
  CAR = 1,
  SCAN = 2
}
 Tracking modes to optimize tracking quality and robustness for different target types. More...
 
- Public Types inherited from ObjectTarget
enum  MOTION_HINT {
  STATIC,
  ADAPTIVE
}
 Target property that indicates how the target moves in space. More...
 

Public Member Functions

virtual const Obb3DgetBoundingBox () const =0
 Get the bounding box of this target. More...
 
virtual List< GuideViewgetGuideViews ()=0
 Returns a list of guide views (write access). More...
 
virtual List< const GuideViewgetGuideViews () const =0
 Returns a list of guide views (read-only access). More...
 
virtual bool setActiveGuideViewIndex (int idx)=0
 Set the index of the Guide View you want to be active. More...
 
virtual int getActiveGuideViewIndex () const =0
 Get the index of the currently active GuideView. More...
 
virtual bool setTrackingMode (TRACKING_MODE mode)=0
 Set the tracking mode to indicate the type of the model target. More...
 
virtual TRACKING_MODE getTrackingMode () const =0
 Get the tracking mode of this target. More...
 
virtual bool setActiveStateName (const char *name)=0
 Set the active model state based on state name. More...
 
virtual const char * getActiveStateName () const =0
 Returns the active state name. More...
 
- Public Member Functions inherited from ObjectTarget
virtual const char * getUniqueTargetId () const =0
 Get the persistent system-wide unique id for this target. More...
 
virtual Vec3F getSize () const =0
 Get the size of this target. More...
 
virtual bool setSize (const Vec3F &size)=0
 Apply a uniform scale to this target that makes it the given size. More...
 
virtual bool setMotionHint (MOTION_HINT hint)=0
 Set the motion hint to indicate how the target moves in space. More...
 
virtual MOTION_HINT getMotionHint () const =0
 Get the motion hint of this target. More...
 
- Public Member Functions inherited from Trackable
virtual Type getType () const =0
 Get the Type for this instance (typically a subclass of Trackable). More...
 
virtual bool isOfType (Type type) const =0
 Check whether this instance is of the given Type or any of its subclasses. More...
 
virtual int getId () const =0
 Get a unique id for this Trackable. More...
 
virtual const char * getName () const =0
 Get the name of this Trackable's name. More...
 
virtual bool setUserData (void *userData)=0
 Set user data for this Trackable. More...
 
virtual void * getUserData () const =0
 Get the user data that was previously set using setUserData(). More...
 
virtual ~Trackable ()
 

Static Public Member Functions

static Type getClassType ()
 Return the Type for class "ModelTarget". More...
 
- Static Public Member Functions inherited from ObjectTarget
static Type getClassType ()
 Get the Type for class "ObjectTarget". More...
 
- Static Public Member Functions inherited from Trackable
static Type getClassType ()
 Get the Type of class 'Trackable'. More...
 

Member Enumeration Documentation

Tracking modes to optimize tracking quality and robustness for different target types.

Enumerator
DEFAULT 

Tracking parameters optimized to work well on a broad range of object types.

CAR 

Tracking parameters optimized for car exteriors.

SCAN 

Tracking parameters optimized for scanned models with photorealistic textures.

Member Function Documentation

static Type getClassType ( )
static

Return the Type for class "ModelTarget".

virtual const Obb3D& getBoundingBox ( ) const
pure virtual

Get the bounding box of this target.

Note
A call to setSize() will change the bounding box. If you have cached the result of getBoundingBox(), you will need to call it again to obtain an updated bounding box after every call to setSize().
Returns
An axis-aligned box that completely encloses the 3D geometry that this ModelTarget represents, including any scaling applied via setSize().
virtual List<GuideView> getGuideViews ( )
pure virtual

Returns a list of guide views (write access).

Return a list of the GuideViews defined for this Model Target.

virtual List<const GuideView> getGuideViews ( ) const
pure virtual

Returns a list of guide views (read-only access).

Return a list of the Guide Views defined for this Model Target.

virtual bool setActiveGuideViewIndex ( int  idx)
pure virtual

Set the index of the Guide View you want to be active.

Note
It is possible to use this function even when the dataset is deactivated.
The default active GuideView is the first one in the dataset, i.e. the one with index 0.
If you are using an Advanced Model Target dataset containing either multiple Model Targets and/or multiple Guide Views, the active Guide View index is set automatically when a Model Target/Guide View is recognized.
If you are using an Advanced 360 Model Target, setting an active Guide View is not necessary.
Parameters
idxThe index of the GuideView to set as active, in the range 0..(getGuideViews().size()-1) .
Returns
true on success, false on failure (check application logs for failure details).
virtual int getActiveGuideViewIndex ( ) const
pure virtual

Get the index of the currently active GuideView.

Note
The default active GuideView is the first one in the dataset, i.e. the one with index 0 for Model Targets. Advanced Model Targets will not have an active Guide View set until one is recognized.
Returns
The index of the active GuideView in the range 0..(getGuideViews().size()-1), or -1 in case no Guide View is active.
virtual bool setTrackingMode ( TRACKING_MODE  mode)
pure virtual

Set the tracking mode to indicate the type of the model target.

virtual TRACKING_MODE getTrackingMode ( ) const
pure virtual

Get the tracking mode of this target.

For more details on the meaning of the value, please see the documentation of setTrackingMode().

Returns
The current tracking mode of this target.
virtual bool setActiveStateName ( const char *  name)
pure virtual

Set the active model state based on state name.

Set the model state to the specified value

Note
Calling this function causes the active guide view's image to be regenerated and the previous image to be invalidated. Subsequent calls to GuideView::getImage() will therefore return the new image.
Parameters
namethe name of the active model state
Returns
true if the given name points to a valid scene
virtual const char* getActiveStateName ( ) const
pure virtual

Returns the active state name.

Returns
the active state name