C# Class Tango.Tango3DReconstruction

Manages a single instance of the Tango 3D Reconstruction library, updating a single 3D model based on depth and color information.
Inheritance: IDisposable, ITangoLifecycle, ITangoDepthMultithreaded, ITangoVideoOverlayMultithreaded
Show file Open project: stetro/project-tango-poc Class Usage Examples

Public Methods

Method Description
Dispose ( ) : void

Releases all resource used by the Tango3DReconstruction object.

Call Dispose when you are finished using the Tango3DReconstruction. The Dispose method leaves the Tango3DReconstruction in an unusable state. After calling Dispose, you must release all references to the Tango3DReconstruction so the garbage collector can reclaim the memory that the Tango3DReconstruction was occupying.

OnTangoDepthMultithreadedAvailable ( TangoXYZij tangoDepth ) : void

This is called each time new depth data is available. On the Tango tablet, the depth callback occurs at 5 Hz.

OnTangoImageMultithreadedAvailable ( TangoEnums cameraId, TangoImageBuffer imageBuffer ) : void

This will be called when a new frame is available from the camera. The first scan-line of the color image is reserved for metadata instead of image pixels.

OnTangoPermissions ( bool permissionsGranted ) : void

This is called when the permission granting process is finished.

OnTangoServiceConnected ( ) : void

This is called when succesfully connected to the Tango service.

OnTangoServiceDisconnected ( ) : void

This is called when disconnected from the Tango service.

Private Methods

Method Description
Clear ( ) : void

Clear the current mesh in the 3D reconstruction.

ExtractMeshSegment ( GridIndex gridIndex, Vector3 vertices, Vector3 normals, Color32 colors, int triangles, int &numVertices, int &numTriangles ) : Status

Extract a mesh for a single grid index, into a suitable format for Unity Mesh.

ExtractWholeMesh ( Vector3 vertices, Vector3 normals, Color32 colors, int triangles, int &numVertices, int &numTriangles ) : Status

Extract a mesh for the entire 3D reconstruction, into a suitable format for Unity Mesh.

RegisterGridIndicesDirty ( OnTango3DReconstructionGridIndiciesDirtyEventHandler handler ) : void

Register a Unity main thread handler for the GridIndicesDirty event.

SendEventIfAvailable ( ) : void

Raise ITango3DReconstruction events if there is new data.

SetEnabled ( bool enabled ) : void

Set if the 3DReconstruction is enabled or not. If disabled, the 3D reconstruction will not get updated.

Tango3DReconstruction ( float resolution, bool generateColor, bool spaceClearing ) : System

Initializes a new instance of the Tango3DReconstruction class.

UnregisterGridIndicesDirty ( OnTango3DReconstructionGridIndiciesDirtyEventHandler handler ) : void

Unregister a Unity main thread handler for the Tango depth event.

_AddUpdatedIndices ( IntPtr rawUpdatedIndices ) : void

Add to the list of updated GridIndex objects that gets sent to the main thread.

_UpdateColor ( TangoImageBuffer image, Matrix4x4 imagePose ) : void

Update the 3D Reconstruction with a new image and pose. It is expected this will get called in from the Tango binder thread.

_UpdateDepth ( TangoXYZij depth, Matrix4x4 depthPose ) : void

Update the 3D Reconstruction with a new point cloud and pose. It is expected this will get called in from the Tango binder thread.

_UpdateExtrinsics ( ) : void

Calculate the camera extrinsics for this device.

Method Details

Dispose() public method

Releases all resource used by the Tango3DReconstruction object.
Call Dispose when you are finished using the Tango3DReconstruction. The Dispose method leaves the Tango3DReconstruction in an unusable state. After calling Dispose, you must release all references to the Tango3DReconstruction so the garbage collector can reclaim the memory that the Tango3DReconstruction was occupying.
public Dispose ( ) : void
return void

OnTangoDepthMultithreadedAvailable() public method

This is called each time new depth data is available. On the Tango tablet, the depth callback occurs at 5 Hz.
public OnTangoDepthMultithreadedAvailable ( TangoXYZij tangoDepth ) : void
tangoDepth TangoXYZij Tango depth.
return void

OnTangoImageMultithreadedAvailable() public method

This will be called when a new frame is available from the camera. The first scan-line of the color image is reserved for metadata instead of image pixels.
public OnTangoImageMultithreadedAvailable ( TangoEnums cameraId, TangoImageBuffer imageBuffer ) : void
cameraId TangoEnums Camera identifier.
imageBuffer TangoImageBuffer Image buffer.
return void

OnTangoPermissions() public method

This is called when the permission granting process is finished.
public OnTangoPermissions ( bool permissionsGranted ) : void
permissionsGranted bool true if permissions were granted, otherwise false.
return void

OnTangoServiceConnected() public method

This is called when succesfully connected to the Tango service.
public OnTangoServiceConnected ( ) : void
return void

OnTangoServiceDisconnected() public method

This is called when disconnected from the Tango service.
public OnTangoServiceDisconnected ( ) : void
return void