public static int Tango3DR_update(IntPtr context, ref APIPointCloud cloud, ref APIPose cloud_pose,
                                   IntPtr image, IntPtr image_pose, IntPtr calibration,
                                   out IntPtr updated_indices)
 {
     updated_indices = IntPtr.Zero;
     return((int)Status.SUCCESS);
 }
Ejemplo n.º 2
0
 public static extern int Tango3DR_update(IntPtr context, ref APIPointCloud cloud, ref APIPose cloud_pose,
                                          ref APIImageBuffer image, ref APIPose image_pose,
                                          ref APICameraCalibration calibration, out IntPtr updated_indices);
 public static extern int Tango3DR_update(IntPtr context, ref APIPointCloud cloud, ref APIPose cloud_pose,
                                          IntPtr image, IntPtr image_pose, IntPtr calibration,
                                          out IntPtr updated_indices);
 public static int Tango3DR_update(IntPtr context, ref APIPointCloud cloud, ref APIPose cloud_pose,
                                   IntPtr image, IntPtr image_pose, IntPtr calibration,
                                   out IntPtr updated_indices)
 {
     updated_indices = IntPtr.Zero;
     return (int)Status.SUCCESS;
 }
 public static extern int Tango3DR_update(IntPtr context, ref APIPointCloud cloud, ref APIPose cloud_pose,
                                          IntPtr image, IntPtr image_pose, IntPtr calibration, 
                                          out IntPtr updated_indices);
 public static extern int Tango3DR_update(IntPtr context, ref APIPointCloud cloud, ref APIPose cloud_pose,
                                          ref APIImageBuffer image, ref APIPose image_pose,
                                          ref APICameraCalibration calibration, out IntPtr updated_indices);
        /// <summary>
        /// Update the 3D Reconstruction with a new point cloud and pose.
        /// 
        /// It is expected this will get called in from the Tango binder thread.
        /// </summary>
        /// <param name="depth">Point cloud from Tango.</param>
        /// <param name="depthPose">Pose matrix the point cloud corresponds too.</param>
        private void _UpdateDepth(TangoXYZij depth, Matrix4x4 depthPose)
        {
            if (m_context == IntPtr.Zero)
            {
                Debug.Log("Update called before creating a reconstruction context." + Environment.StackTrace);
                return;
            }

            APIPointCloud apiCloud;
            apiCloud.numPoints = depth.xyz_count;
            apiCloud.points = depth.xyz;
            apiCloud.timestamp = depth.timestamp;

            APIPose apiDepthPose = APIPose.FromMatrix4x4(ref depthPose);

            if (!m_sendColorToUpdate)
            {
                // No need to wait for a color image, update reconstruction immediately.
                IntPtr rawUpdatedIndices;
                Status result = (Status)API.Tango3DR_update(
                    m_context, ref apiCloud, ref apiDepthPose, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero,
                    out rawUpdatedIndices);
                if (result != Status.SUCCESS)
                {
                    Debug.Log("Tango3DR_update returned non-success." + Environment.StackTrace);
                    return;
                }

                _AddUpdatedIndices(rawUpdatedIndices);
                API.Tango3DR_GridIndexArray_destroy(rawUpdatedIndices);
            }
            else
            {
                lock (m_lockObject)
                {
                    // We need both a color image and a depth cloud to update reconstruction.  Cache the depth cloud
                    // because there are much less depth points than pixels.
                    m_mostRecentDepth = apiCloud;
                    m_mostRecentDepth.points = IntPtr.Zero;
                    m_mostRecentDepthPose = apiDepthPose;

                    Marshal.Copy(apiCloud.points, m_mostRecentDepthPoints, 0, apiCloud.numPoints * 3);
                    m_mostRecentDepthIsValid = true;
                }
            }
        }