MotionTrackerCameraDevice Class¶
This type is an EasyAR Sense API in C#: MotionTrackerCameraDevice . Some descriptions may not apply to Unity environment on this page.
This type is partially wrapped into Unity components: MotionTrackerFrameSource . Members and instances of this type are not required to be used directly in most situations. Use this type by MotionTrackerFrameSource.Device instead of creating new instances when a few unwrapped API is desired for use.
Description¶
MotionTrackerCameraDevice implements a camera device with metric-scale six degree-of-freedom motion tracking, which outputs InputFrame (including image, camera parameters, timestamp, 6DOF pose and tracking status).
After creation, start/stop can be invoked to start or stop data flow.
When the component is not needed anymore, call close function to close it. It shall not be used after calling close.
MotionTrackerCameraDevice outputs InputFrame from inputFrameSource. inputFrameSource shall be connected to InputFrameSink for further use. Refer to Overview .
Methods¶
.ctor¶
- C#
public MotionTrackerCameraDevice()
Create MotionTrackerCameraDevice object.
isAvailable¶
- C#
public static bool isAvailable()
Check if the devices supports motion tracking. It returns True if the device supports Motion Tracking, otherwise it returns False.
getQualityLevel¶
- C#
public static MotionTrackerCameraDeviceQualityLevel getQualityLevel()
Get the quality of Motion Tracking on the device. You can decide whether to start Motion Tracking.
setFrameRateType¶
- C#
public virtual bool setFrameRateType( MotionTrackerCameraDeviceFPS fps)
Sets current frame rate. Call before start. If this function is not called, the default is 30 fps.
setFocusMode¶
- C#
public virtual bool setFocusMode( MotionTrackerCameraDeviceFocusMode focusMode)
Sets focus mode. Call before start. If this function is not called, the default is Continousauto.
setFrameResolutionType¶
- C#
public virtual bool setFrameResolutionType( MotionTrackerCameraDeviceResolution resolution)
Sets frame resolution. Call before start. If this function is not called, the default is 1280 x 960 or 1280 x 720.
setTrackingMode¶
- C#
public virtual bool setTrackingMode( MotionTrackerCameraDeviceTrackingMode trackingMode)
Sets tracking mode. Call before start. If this function is not called, the default is Anchor.
setBufferCapacity¶
- C#
public virtual void setBufferCapacity(int capacity)
Set InputFrame buffer capacity.
bufferCapacity is the capacity of InputFrame buffer. If the count of InputFrame which has been output from the device and have not been released is higher than this number, the device will not output new InputFrame until previous InputFrame has been released. This may cause screen stuck. Refer to Overview .
bufferCapacity¶
- C#
public virtual int bufferCapacity()
Get InputFrame buffer capacity. The default is 8.
inputFrameSource¶
- C#
public virtual InputFrameSource inputFrameSource()
InputFrame output port.
inputFrameSourceType¶
- C#
public virtual InputFrameSourceType inputFrameSourceType()
Source type of input frames.
start¶
- C#
public virtual bool start()
Start motion tracking or resume motion tracking after pause.
Notice: Calling start after pausing will trigger device relocalization. Tracking will resume when the relocalization process succeeds.
stop¶
- C#
public virtual void stop()
Pause motion tracking. Call start to trigger relocation, resume motion tracking if the relocation succeeds.
close¶
- C#
public virtual void close()
Close motion tracking. The component shall not be used after calling close.
hitTestAgainstPointCloud¶
Perform hit test against the point cloud and return the nearest 3D point. The 3D point is represented by three consecutive values, representing X, Y, Z position coordinates in the world coordinate space.
For the camera image coordinate system ([0, 1]^2), x-right, y-down, and origin is at left-top corner. CameraParameters.imageCoordinatesFromScreenCoordinates can be used to convert points from screen coordinate system to camera image coordinate system.
hitTestAgainstHorizontalPlane¶
Performs ray cast from the user’s device in the direction of given screen point.
Intersections with horizontal plane is detected in real time in the current field of view,and return the 3D point nearest to ray on horizontal plane.
For the camera image coordinate system ([0, 1]^2), x-right, y-down, and origin is at left-top corner. CameraParameters.imageCoordinatesFromScreenCoordinates can be used to convert points from screen coordinate system to camera image coordinate system.
The output point cloud coordinate on Horizontal plane is in the world coordinate system. The 3D point is represented by three consecutive values, representing X, Y, Z position coordinates in the world coordinate space.
getLocalPointsCloud¶
- C#
public virtual List< Vec3F > getLocalPointsCloud()
Returns the vector of point cloud coordinate. Each 3D point is represented by three consecutive values, representing X, Y, Z position coordinates in the world coordinate space.