com.craftar
Class CraftARTracking
- java.lang.Object
-
- com.craftar.CraftARTracking
public class CraftARTracking extends java.lang.Object
Module that manages the AR experience allowing to add AR items and contents and rendering the contents in the camera preview.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static interface
CraftARTracking.TrackingEventsHandler
Interface to receive the tracking events
-
Field Summary
Fields Modifier and Type Field and Description protected byte[]
mGrayFrame
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description CraftARError
addItem(CraftARItemAR item)
Add aCraftARItemAR
to track.float
checkImageQuality(Bitmap bmp)
Check the Quality of an image for AR.static CraftARTracking
Instance()
boolean
isTracking()
Returns whether the tracking is enabled or not (startTracking has been called)void
onAppFinish()
void
onAppPause()
void
onAppResume()
void
removeAllItems()
Remove all the AR items from the trackingboolean
removeItem(CraftARItemAR item)
Remove a specific AR items from the trackingvoid
setCollection(CraftAROnDeviceCollection collection, SetOnDeviceCollectionListener collectionListener)
Loads all AR items of an on-device AR to the trackingboolean
setMaxItemsTrackedSimultaneously(int maxItems)
Set the maximum number of items to be tracked simultaneously.void
setTrackingEventsHandler(CraftARTracking.TrackingEventsHandler handler)
Sets the receiver for trackingStarted and trackingLost events.boolean
startTracking()
Call startTracking afterCraftARSDK#init()
.boolean
startTrackingWithTimeout(long timeOut)
boolean
stopTracking()
Call stopTracking to stop tracking.
-
-
-
Method Detail
-
Instance
public static CraftARTracking Instance()
-
startTracking
public boolean startTracking()
Call startTracking afterCraftARSDK#init()
.
-
stopTracking
public boolean stopTracking()
Call stopTracking to stop tracking. You can call startTracking() at any moment to resume.
-
startTrackingWithTimeout
public boolean startTrackingWithTimeout(long timeOut)
-
isTracking
public boolean isTracking()
Returns whether the tracking is enabled or not (startTracking has been called)
-
setTrackingEventsHandler
public void setTrackingEventsHandler(CraftARTracking.TrackingEventsHandler handler)
Sets the receiver for trackingStarted and trackingLost events.
-
setCollection
public void setCollection(CraftAROnDeviceCollection collection, SetOnDeviceCollectionListener collectionListener)
Loads all AR items of an on-device AR to the tracking- Parameters:
collection
- On-device collection to load.collectionListener
- Listener that receives the callbacks
-
addItem
public CraftARError addItem(CraftARItemAR item)
Add aCraftARItemAR
to track. Note that you can track up to several references simultaneously.- Returns:
- CraftARError if there was an error adding the item.
-
removeAllItems
public void removeAllItems()
Remove all the AR items from the tracking
-
removeItem
public boolean removeItem(CraftARItemAR item)
Remove a specific AR items from the tracking- Returns:
- true if the item could be removed, false otherwise.
-
checkImageQuality
public float checkImageQuality(Bitmap bmp)
Check the Quality of an image for AR. Tests how good the image is for tracking based on the texture it has. Calls back onSuccess with the trackability or onError if it was not possible to do the operation. Do not call this method while tracking, it may affect its performance.- Parameters:
bmp
- image for which to check the quality- Returns:
- float value from 0 to 1 representing how good the image is for AR.
-
onAppResume
public void onAppResume()
-
onAppPause
public void onAppPause()
-
onAppFinish
public void onAppFinish()
-
setMaxItemsTrackedSimultaneously
public boolean setMaxItemsTrackedSimultaneously(int maxItems)
Set the maximum number of items to be tracked simultaneously. This limit only affects the number of ARItems that will be augmented at the same time, not how many items can be added for augmentation.- Parameters:
maxItems
- The default vaule is 3- Returns:
- True if the operation was successful
-
-
Comments
0 comments
Article is closed for comments.