/// <summary>
        /// Initializes the freenect context
        /// </summary>
        private static void InitializeContext()
        {
            int result = KinectNative.freenect_init(ref KinectNative.freenectContext, IntPtr.Zero);

            if (result != 0)
            {
                throw new Exception("Could not initialize freenect context. Error Code:" + result);
            }

            // Set callbacks for logging
            KinectNative.freenect_set_log_callback(KinectNative.freenectContext, LogCallback);
        }