C API wrapper for the Tango depth interface.
Example #1
0
        /// <summary>
        /// Fill out <c>pointCloudData</c> with emulated values from Tango.
        /// </summary>
        /// <param name="pointCloudData">The point cloud data to fill out.</param>
        private static void _FillEmulatedPointCloud(ref TangoPointCloudData pointCloud)
        {
            List <Vector3> emulated = DepthProvider.GetTangoEmulation(out pointCloud.m_timestamp);

            pointCloud.m_numPoints = emulated.Count;
            for (int it = 0; it < emulated.Count; ++it)
            {
                pointCloud.m_points[(it * 4) + 0] = emulated[it].x;
                pointCloud.m_points[(it * 4) + 1] = emulated[it].y;
                pointCloud.m_points[(it * 4) + 2] = emulated[it].z;
                pointCloud.m_points[(it * 4) + 3] = 1;
            }
        }
        /// <summary>
        /// Fill out <c>pointCloudData</c> with emulated values from Tango.
        /// </summary>
        /// <param name="pointCloudData">The point cloud data to fill out.</param>
        private void _FillEmulatedPointCloudData(TangoUnityDepth pointCloudData)
        {
            List <Vector3> pointCloud = DepthProvider.GetTangoEmulation(out pointCloudData.m_timestamp);

            pointCloudData.m_version = 0; // Not actually used

            pointCloudData.m_pointCount = pointCloud.Count;
            for (int it = 0; it < pointCloud.Count; ++it)
            {
                pointCloudData.m_points[(it * 3) + 0] = pointCloud[it].x;
                pointCloudData.m_points[(it * 3) + 1] = pointCloud[it].y;
                pointCloudData.m_points[(it * 3) + 2] = pointCloud[it].z;
            }

            pointCloudData.m_ijRows    = 0;
            pointCloudData.m_ijColumns = 0;
            for (int it = 0; it < pointCloudData.m_ij.Length; ++it)
            {
                pointCloudData.m_ij[it] = -1;
            }
        }
Example #3
0
        /// <summary>
        /// Initialize application and providers.
        /// </summary>
        public void InitApplication()
        {
            if (m_applicationHandle != System.IntPtr.Zero)
            {
                DebugLogger.GetInstance.WriteToLog(DebugLogger.EDebugLevel.DEBUG_ERROR,
                                                   "Duplicated application handler");
                return;
            }

            // let's hardcode depth image reoslution
            // but eventially we can get resolution using VideoMode interface
            Resolution imageResolution = new Resolution();

            imageResolution.width       = 320;
            imageResolution.height      = 180;
            imageResolution.refreshRate = 5;
            Common.DepthFrameResolution = imageResolution;
            Common.DepthBufferSize      = 320 * 180;

            m_applicationHandle = TangoApplicationAPI.ApplicationInitialize("[Superframes Small-Peanut]");
            if (m_applicationHandle == System.IntPtr.Zero)
            {
                ErrorHandler.instance.presentErrorMessage("Application initialization failed");
            }
            if (m_enableVio)
            {
                VIOProvider.SetAutoReset(m_vioAutoReset);
                VIOProvider.Init(m_operationMode, m_sparseMapPath);
            }
            if (m_enableDepth)
            {
                DepthProvider.Init();
            }
            if (m_enableVideoOverlay)
            {
                VideoOverlayProvider.Init();
            }
        }
Example #4
0
 /// <summary>
 /// Shut down the providers and application.
 /// </summary>
 public void ShutDownApplication()
 {
     if (m_enableVio)
     {
         VIOProvider.ShutDown();
     }
     if (m_enableDepth)
     {
         DepthProvider.ShutDown();
     }
     if (m_enableVideoOverlay)
     {
         VideoOverlayProvider.Shutdown();
     }
     if (m_applicationHandle == System.IntPtr.Zero)
     {
         DebugLogger.GetInstance.WriteToLog(
             DebugLogger.EDebugLevel.DEBUG_ERROR, "No application initialized");
         return;
     }
     TangoApplicationAPI.ApplicationShutdown(m_applicationHandle);
     m_applicationHandle = System.IntPtr.Zero;
 }