Example #1
0
        /// <summary>
        /// Get the version of Tango API.
        /// </summary>
        /// <returns> String representing the current version of the API.</returns>
        public static string GetVersionString()
        {
            IntPtr buf           = IntPtr.Zero;
            string versionString = string.Empty;

            try
            {
                const int BufferSize = 1024;
                buf = Marshal.AllocHGlobal(BufferSize);
                TangoUtilAPI.UtilAPIVersionString(buf, BufferSize);
                versionString = Marshal.PtrToStringAnsi(buf);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            finally
            {
                if (buf != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(buf);
                }
            }
            return(versionString);
        }
Example #2
0
        void Awake()
        {
            TangoUtilAPI.UtilSetDepthNoiseLevel(2);
            TangoUtilAPI.UtilSetDepthConfidenceLevel(2);
            mApplicationHandler = TangoApplicationAPI.ApplicationInitialize("[Superframes Small-Peanut]");
            if (mApplicationHandler == System.IntPtr.Zero)
            {
                ErrorHandler.instance.presentErrorMessage("Application initialization failed");
            }

            //let's hardcode depth image reoslution
            //but eventially we can get resolution using VideoMode interface
            mDepthBufferResolution             = new Resolution();
            mDepthBufferResolution.width       = 320;
            mDepthBufferResolution.height      = 180;
            mDepthBufferResolution.refreshRate = 5;
        }
Example #3
0
        public bool getDepthBuffer(ref int [] buffer, ref double timestamp)
        {
            if (buffer.Length < getDepthBufferSize())
            {
                DebugLogger.WriteToLog(DebugLogger.EDebugLevel.DEBUG_WARN, "Wrong depth buffer size");
                return(false);
            }

            GCHandle bufferHandler = GCHandle.Alloc(buffer, GCHandleType.Pinned);

            Common.RetCodes retCode = (Common.RetCodes)TangoUtilAPI.UtilGetDepthFrame(mApplicationHandler, bufferHandler.AddrOfPinnedObject(),
                                                                                      mDepthBufferResolution.width * mDepthBufferResolution.height,
                                                                                      ref timestamp);
            if (retCode != Common.RetCodes.kCAPISuccess)
            {
                DebugLogger.WriteToLog(DebugLogger.EDebugLevel.DEBUG_WARN, "Failed to get depth buffer with error:" + retCode);
            }
            bufferHandler.Free();
            return(retCode == Common.RetCodes.kCAPISuccess);
        }
Example #4
0
 public int getDepthConfidenceLevel()
 {
     return(TangoUtilAPI.UtilGetDepthConfidenceLevel());
 }
Example #5
0
 public int getDepthNoiseLevel()
 {
     return(TangoUtilAPI.UtilGetDepthNoiseLevel());
 }