コード例 #1
0
ファイル: Controller.cs プロジェクト: togores/Vitruvius
        /// <summary>
        /// Construtor padrão.
        /// </summary>
        private Controller()
        {
            context = new Context();
            while (true)              // espera que o Kinect esteja corretamente conectado
            {
                try {
                    userManager = new UserManager(context);
                    depthSensor = new DepthSensor(context);
                    rgbCamera   = new RGBCamera(context);
                }
                catch (Exception) {
                    if (MessageBox.Show("Kinect is not connected. Connect and retry.", "Error", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                    {
                        continue;
                    }
                    Application.Current.Shutdown();
                }
                break;
            }

            depthImage     = new DepthImage();
            rgbImage       = new RGBImage();
            drawDepthImage = false;
            drawRGBImage   = false;

            time          = DateTime.Now;
            windowManager = new WindowManager();

            observer = new Observer(new GestureManager(), Parameterization.Extractor, Parameterization.Filter);
            recorder = new Recorder();
            realtime = true;
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: StitchDex/i-PPD
        public Form1()
        {
            try
            {
                Nuitrack.Init("");
            }
            catch (System.Exception exception)
            {
                Console.WriteLine("Cannot initialize Nuitrack.");
                throw exception;
            }

            try
            {
                // Create and setup all required modules
                _depthSensor     = DepthSensor.Create();
                _colorSensor     = ColorSensor.Create();
                _userTracker     = UserTracker.Create();
                _skeletonTracker = SkeletonTracker.Create();
            }
            catch (System.Exception exception)
            {
                Console.WriteLine("Cannot create Nuitrack module.");
                throw exception;
            }

            _depthSensor.SetMirror(false);

            // Add event handlers for all modules
            _depthSensor.OnUpdateEvent             += onDepthSensorUpdate;
            _colorSensor.OnUpdateEvent             += onColorSensorUpdate;
            _userTracker.OnUpdateEvent             += onUserTrackerUpdate;
            _skeletonTracker.OnSkeletonUpdateEvent += onSkeletonUpdate;

            Nuitrack.onIssueUpdateEvent += onIssueDataUpdate;

            mode      = _depthSensor.GetOutputMode();
            colorMode = _colorSensor.GetOutputMode();

            if (mode.XRes < colorMode.XRes)
            {
                mode.XRes = colorMode.XRes;
            }
            if (mode.YRes < colorMode.YRes)
            {
                mode.YRes = colorMode.YRes;
            }

            _bitmap = new DirectBitmap(mode.XRes, mode.YRes);
            for (int y = 0; y < mode.YRes; ++y)
            {
                for (int x = 0; x < mode.XRes; ++x)
                {
                    _bitmap.SetPixel(x, y, Color.FromKnownColor(KnownColor.Aqua));
                }
            }

            InitializeComponent();
        }
コード例 #3
0
        public DepthSensorThread() : base("depth-sensor-thread")
        {
            DisableThreadSleep = true;

            Update += new EventHandler <ThreadService>((obj, service) =>
            {
                _depthSensor = new DepthSensor();
                _depthSensor.Run();
                Thread.Sleep(100);
            });
        }
コード例 #4
0
        public override int GetHashCode()
        {
            int hash = 7;

            hash = (hash * 7) ^ RGB.GetHashCode();
            hash = (hash * 7) ^ Depth.GetHashCode();
            hash = (hash * 7) ^ Audio.GetHashCode();
            hash = (hash * 7) ^ DepthSensor.GetHashCode();
            hash = (hash * 7) ^ FirmwareBuild.GetHashCode();
            hash = (hash * 7) ^ FirmwareSignature.GetHashCode();
            return(hash);
        }
コード例 #5
0
    // Use this for initialization
    void Start()
    {
        Nuitrack.Init();

        depthSensor = DepthSensor.Create();
        depthSensor.OnUpdateEvent += DepthSensor_OnUpdateEvent;

        skeletonTracker = SkeletonTracker.Create();
        skeletonTracker.OnSkeletonUpdateEvent += SkeletonTracker_OnSkeletonUpdateEvent;

        Nuitrack.Run();
    }
コード例 #6
0
        public static SpreadBuilder <ColoredPoint> AddPoints(
            SpreadBuilder <ColoredPoint> builder,
            DepthSensor sensor,
            ColorFrame colorFrame,
            DepthFrame depthFrame,
            int minZ       = 100,
            int maxZ       = ushort.MaxValue,
            int decimation = 1)
        {
            if (builder is null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (sensor is null)
            {
                throw new ArgumentNullException(nameof(sensor));
            }
            if (colorFrame is null)
            {
                throw new ArgumentNullException(nameof(colorFrame));
            }
            if (depthFrame is null)
            {
                throw new ArgumentNullException(nameof(depthFrame));
            }
            if (colorFrame.Cols < depthFrame.Cols || colorFrame.Rows < depthFrame.Rows)
            {
                throw new ArgumentException("The color image must have at least the same size as the depth image.");
            }

            var width   = depthFrame.Cols;
            var height  = depthFrame.Rows;
            var strideX = colorFrame.Cols / depthFrame.Cols;
            var strideY = colorFrame.Rows / depthFrame.Rows;
            var step    = Math.Max(1, decimation);

            for (var y = 0; y < height; y += step)
            {
                for (var x = 0; x < width; x += step)
                {
                    var z = depthFrame[y, x];
                    if (z >= minZ && z <= maxZ)
                    {
                        var c = colorFrame[y * strideY, x *strideX];
                        var p = sensor.ConvertProjToRealCoords(x, y, z);
                        builder.Add(new ColoredPoint(AsVector3(ref p), ToColor(in c)));
                    }
                }
            }

            return(builder);
        }
コード例 #7
0
ファイル: Reader.cs プロジェクト: mlhoutel/iuF_Nuitrack
        /* Initialize the Nuitrack Environment */
        private void Initialize()
        {
            try {
                Nuitrack.Init("");
            }
            catch (nuitrack.Exception exception) {
                Console.WriteLine("Cannot initialize Nuitrack.");
                throw exception;
            }
            // Select the device
            _device = SelectDevice();

            // Select video configurations
            _configVideo = SelectVideoMode();


            // Activate the license
            ActivateDevice();

            Nuitrack.SetDevice(_device);

            // Add modules Sensors
            _depthSensor     = DepthSensor.Create();
            _colorSensor     = ColorSensor.Create();
            _userTracker     = UserTracker.Create();
            _skeletonTracker = SkeletonTracker.Create();

            // Add modules Events Handlers
            _depthSensor.OnUpdateEvent             += onDepthSensorUpdate;
            _colorSensor.OnUpdateEvent             += onColorSensorUpdate;
            _userTracker.OnUpdateEvent             += onUserTrackerUpdate;
            _userTracker.OnNewUserEvent            += onUserTrackerNewUser;
            _userTracker.OnLostUserEvent           += onUserTrackerLostUser;
            _skeletonTracker.OnSkeletonUpdateEvent += onSkeletonUpdate;

            // Connect to remote
            _streamer = SelectStreamer();


            // Run Nuitrack
            Nuitrack.Run();
            _running = true;

            Console.WriteLine("Nuitrack is Running...");
        }
コード例 #8
0
    void Start()
    {
        Debug.Log(Directory.GetCurrentDirectory());
        GameObject agent = transform.parent.gameObject;

        annotations          = agent.GetComponent <TargetAnnotation>();
        initializer          = agent.GetComponent <RandomInit>();
        positionDrawer       = agent.GetComponent <RandomPosition>();
        positionDrawer.agent = transform.gameObject;
        rbody         = GetComponent <Rigidbody>();
        engine        = transform.Find("Engine").GetComponent <Engine>();
        accelerometer = transform.Find("Accelerometer").GetComponent <Accelerometer>();
        depthSensor   = transform.Find("DepthSensor").GetComponent <DepthSensor>();
        // calculate max velocity with set parameters
        maxVelocity = new Vector3(engine.maxForceLateral / (rbody.drag * rbody.mass),
                                  engine.maxForceVertical / (rbody.drag * rbody.mass),
                                  engine.maxForceLongitudinal / (rbody.drag * rbody.mass));
        maxYawVelocity = engine.maxTorqueYaw / (rbody.inertiaTensor.y * rbody.angularDrag);
    }
コード例 #9
0
        public static IObservable <DepthFrameEventArgs> DepthFrameArrived(DepthSensor sensor)
        {
            if (sensor is null)
            {
                return(Observable.Empty <DepthFrameEventArgs>());
            }

            return(Observable.FromEvent <DepthSensor.OnUpdate, DepthFrameEventArgs>(handler =>
            {
                DepthSensor.OnUpdate cfaHandler = (x) =>
                {
                    handler(new DepthFrameEventArgs(x));
                };

                return cfaHandler;
            },
                                                                                    cfaHandler => sensor.OnUpdateEvent += cfaHandler,
                                                                                    cfaHandler => sensor.OnUpdateEvent -= cfaHandler));
        }
コード例 #10
0
ファイル: GUI.cs プロジェクト: tjrov/1819-Core
        public GUI()
        {
            InitializeComponent();

            portInfoLabel.Text = string.Format("{0}@{1}kbaud",
                                               ControlStation.Properties.Settings.Default.PortName,
                                               ControlStation.Properties.Settings.Default.BaudRate / 1000);

            //setup serial port
            BetterSerialPort port = new BetterSerialPort(ControlStation.Properties.Settings.Default.PortName,
                                                         ControlStation.Properties.Settings.Default.BaudRate);

            //handles communication thread
            comms = new SerialCommunication(port);
            //displays port info and connect/disconnect button
            comms.CommunicationException += OnCommunicationException;
            comms.Started         += OnCommunicationStarted;
            comms.Stopped         += OnCommunicationStopped;
            comms.TenElapsed      += OnTenElapsed;
            comms.FiftyElapsed    += OnHundredElapsed;
            comms.ThousandElapsed += OnThousandElapsed;

            //construct sensor and actuator objects
            depth = new DepthSensor(new DepthData());
            imu   = new OrientationSensor(new OrientationData());

            List <ToolData> toolList = new List <ToolData>();

            for (int i = 0; i < 3; i++)
            {
                toolList.Add(new ToolData());
            }
            tools = new ToolsActuator(toolList);

            List <ESCData> escList = new List <ESCData>();

            for (int i = 0; i < 6; i++)
            {
                escList.Add(new ESCData());
            }
            escs      = new PropulsionSensor(escList);
            thrusters = new PropulsionActuator(escList);

            StatusData state = new StatusData();

            status        = new StatusSensor(state);
            statusControl = new StatusActuator(state);

            versioning = new DiagnosticsSensor(new VersionData());

            //put them in the list
            devices = new List <GenericAbstractDevice>();
            devices.Add(depth);
            devices.Add(imu);
            devices.Add(escs);
            devices.Add(thrusters);
            devices.Add(tools);
            devices.Add(status);
            devices.Add(statusControl);
            devices.Add(versioning);

            statusPanel.Controls.Add(status, 0, 0);
            statusPanel.Controls.Add(statusControl, 0, 1);
            statusPanel.Controls.Add(versioning, 0, 2);
            statusPanel.Controls.Add(escs, 1, 0);
            statusPanel.SetRowSpan(escs, 3);

            toolsPanel.Controls.Add(tools);

            thrustersPanel.Controls.Add(thrusters);

            depthBox.Controls.Add(depth);
            attitudeBox.Controls.Add(imu);

            //disable all devices to start off
            foreach (GenericAbstractDevice device in devices)
            {
                device.Enabled = false;
            }
        }
コード例 #11
0
        public MainForm()
        {
            // Initialize Nuitrack. This should be called before using any Nuitrack module.
            // By passing the default arguments we specify that Nuitrack must determine
            // the location automatically.
            try
            {
                Nuitrack.Init("");
            }
            catch (Exception exception)
            {
                Console.WriteLine("Cannot initialize Nuitrack.");
                throw exception;
            }

            try
            {
                // Create and setup all required modules
                _depthSensor       = DepthSensor.Create();
                _colorSensor       = ColorSensor.Create();
                _userTracker       = UserTracker.Create();
                _skeletonTracker   = SkeletonTracker.Create();
                _handTracker       = HandTracker.Create();
                _gestureRecognizer = GestureRecognizer.Create();
            }
            catch (Exception exception)
            {
                Console.WriteLine("Cannot create Nuitrack module.");
                throw exception;
            }

            //_depthSensor.SetMirror(false);

            // Add event handlers for all modules
            _depthSensor.OnUpdateEvent             += onDepthSensorUpdate;
            _colorSensor.OnUpdateEvent             += onColorSensorUpdate;
            _userTracker.OnUpdateEvent             += onUserTrackerUpdate;
            _userTracker.OnNewUserEvent            += onUserTrackerNewUser;
            _userTracker.OnLostUserEvent           += onUserTrackerLostUser;
            _skeletonTracker.OnSkeletonUpdateEvent += onSkeletonUpdate;
            _handTracker.OnUpdateEvent             += onHandTrackerUpdate;
            _gestureRecognizer.OnNewGesturesEvent  += onNewGestures;

            // Add an event handler for the IssueUpdate event
            Nuitrack.onIssueUpdateEvent += onIssueDataUpdate;

            // Create and configure the Bitmap object according to the depth sensor output mode
            OutputMode mode      = _depthSensor.GetOutputMode();
            OutputMode colorMode = _colorSensor.GetOutputMode();

            if (mode.XRes < colorMode.XRes)
            {
                mode.XRes = colorMode.XRes;
            }
            if (mode.YRes < colorMode.YRes)
            {
                mode.YRes = colorMode.YRes;
            }

            _bitmap = new DirectBitmap(mode.XRes, mode.YRes);
            for (int y = 0; y < mode.YRes; ++y)
            {
                for (int x = 0; x < mode.XRes; ++x)
                {
                    _bitmap.SetPixel(x, y, Color.FromKnownColor(KnownColor.Aqua));
                }
            }

            // Set fixed form size
            this.MinimumSize = this.MaximumSize = new Size(mode.XRes, mode.YRes);

            // Disable unnecessary caption bar buttons
            this.MinimizeBox = this.MaximizeBox = false;

            // Enable double buffering to prevent flicker
            this.DoubleBuffered = true;

            // Run Nuitrack. This starts sensor data processing.
            try
            {
                Nuitrack.Run();
            }
            catch (Exception exception)
            {
                Console.WriteLine("Cannot start Nuitrack.");
                throw exception;
            }

            this.Show();
        }
コード例 #12
0
        /// <summary>
        ///3D扫描的构造函数 -byCQZ 2019.6.16
        ///
        /// </summary>
        private void NuitrackCreate()
        {
            try
            {
                Nuitrack.Init("");
                Console.WriteLine("Initialize succneed.");
            }
            catch (nuitrack.Exception exception)
            {
                Console.WriteLine("Cannot initialize Nuitrack.");
                //throw exception;
                MessageBoxX.Warning("3D摄像头初始化失败,请检查SDK配置和是否进行密钥认证。");
                Application.Current.Shutdown();
            }

            try
            {
                // Create and setup all required modules
                _depthSensor     = DepthSensor.Create();
                _colorSensor     = ColorSensor.Create();
                _userTracker     = UserTracker.Create();
                _skeletonTracker = SkeletonTracker.Create();
                //_handTracker = HandTracker.Create();
                _gestureRecognizer = GestureRecognizer.Create();
            }
            catch (nuitrack.Exception exception)
            {
                Console.WriteLine("Cannot create Nuitrack module.");
                //throw exception;
                MessageBoxX.Warning("3D摄像头初始化失败,请检查SDK配置和是否进行密钥认证。");
                Application.Current.Shutdown();
            }

            _depthSensor.SetMirror(false);
            // Add event handlers for all modules
            _depthSensor.OnUpdateEvent             += onDepthSensorUpdate;
            _colorSensor.OnUpdateEvent             += onColorSensorUpdate;
            _userTracker.OnUpdateEvent             += onUserTrackerUpdate;
            _skeletonTracker.OnSkeletonUpdateEvent += onSkeletonUpdate;
            //_handTracker.OnUpdateEvent += onHandTrackerUpdate;
            _gestureRecognizer.OnNewGesturesEvent += onNewGestures;
            // Add an event handler for the IssueUpdate event
            Nuitrack.onIssueUpdateEvent += onIssueDataUpdate;

            // Create and configure the Bitmap object according to the depth sensor output mode
            OutputMode mode      = _depthSensor.GetOutputMode();
            OutputMode colorMode = _colorSensor.GetOutputMode();

            if (mode.XRes < colorMode.XRes)
            {
                mode.XRes = colorMode.XRes;
            }
            if (mode.YRes < colorMode.YRes)
            {
                mode.YRes = colorMode.YRes;
            }
            Console.WriteLine(mode.XRes + "=====================" + mode.YRes);
            _bitmap = new DirectBitmap(mode.XRes, mode.YRes);
            for (int y = 0; y < mode.YRes; ++y)
            {
                for (int x = 0; x < mode.XRes; ++x)
                {
                    _bitmap.SetPixel(x, y, Color.FromKnownColor(KnownColor.Aqua));
                }
            }
            try
            {
                Nuitrack.Run();
                Console.WriteLine("Start Nuitrack.");
            }
            catch (nuitrack.Exception exception)
            {
                Console.WriteLine("Cannot start Nuitrack.");
                //throw exception;
                MessageBoxX.Warning("3D摄像头启动失败,请检查SDK配置和是否进行密钥认证。");
                Application.Current.Shutdown();
            }
        }
コード例 #13
0
        static void Main(string[] args)
        {//UDP writer for OSC
            UdpWriter udpWrite = new UdpWriter("127.0.0.1", 7000);

            try
            {
                Nuitrack.Init("");
            }
            catch (Exception exception)
            {
                Console.WriteLine("Cannot initialize Nuitrack.");
                throw exception;
            }

            try
            {
                // Create and setup all required modules
                _depthSensor     = DepthSensor.Create();
                _userTracker     = UserTracker.Create();
                _skeletonTracker = SkeletonTracker.Create();
            }
            catch (Exception exception)
            {
                Console.WriteLine("Cannot create Nuitrack module.");
                Console.WriteLine(exception.Message);
                throw exception;
            }
            // Add event handlers for all modules
            _depthSensor.OnUpdateEvent             += OnDepthSensorUpdate;
            _userTracker.OnNewUserEvent            += OnUserTrackerNewUser;
            _userTracker.OnLostUserEvent           += OnUserTrackerLostUser;
            _skeletonTracker.OnSkeletonUpdateEvent += OnSkeletonUpdate;

            // Add an event handler for the IssueUpdate event
            Nuitrack.onIssueUpdateEvent += OnIssueDataUpdate;

            try
            {
                Nuitrack.Run();
                Console.WriteLine(DateTime.Now.ToString());
            }
            catch (Exception exception)
            {
                Console.WriteLine("Cannot start Nuitrack.");
                throw exception;
            }
            bool a = true;

            while (a)
            {
                int start = (int)DateTime.Now.TimeOfDay.TotalMilliseconds;
                // Update Nuitrack data. Data will be synchronized with skeleton time stamps.
                try
                {
                    Nuitrack.Update(_skeletonTracker);
                }
                catch (LicenseNotAcquiredException exception)
                {
                    Console.WriteLine(DateTime.Now.ToString());
                    Console.WriteLine("LicenseNotAcquired exception. Exception: {0}", exception);
                    throw exception;
                }
                catch (Exception exception)
                {
                    Console.WriteLine("Nuitrack update failed. Exception: ", exception);
                }
                if (_skeletonData != null)
                {
                    //Create new bundle for each time skeleton data is refreshed
                    OscBundle bundle = new OscBundle();

                    //const int jointSize = 10;
                    foreach (var skeleton in _skeletonData.Skeletons)
                    {
                        foreach (var joint in skeleton.Joints)
                        {
                            float[] rotationMatrix = joint.Orient.Matrix;

                            //Ignore joints that are not currently used by Nuitrack
                            if (joint.Type == JointType.None || joint.Type == JointType.LeftFingertip || joint.Type == JointType.RightFingertip || joint.Type == JointType.LeftFoot || joint.Type == JointType.RightFoot)
                            {
                                continue;
                            }

                            //Create new message element for joint containing joint type and rotation matrix
                            OscElement jointMessage = new OscElement("/" + joint.Type, joint.Real.X, joint.Real.Y, joint.Real.Z, rotationMatrix[0], rotationMatrix[1], -1 * rotationMatrix[2], rotationMatrix[3], rotationMatrix[4], -1 * rotationMatrix[5], -1 * rotationMatrix[6], -1 * rotationMatrix[7], rotationMatrix[8]);
                            Console.WriteLine(joint.Real.X + " " + joint.Real.Y + " " + joint.Real.Z);
                            bundle.AddElement(jointMessage);
                        }
                        //Send the message bundle with the data
                        udpWrite.Send(bundle);
                        int difference = delay - start - (int)DateTime.Now.TimeOfDay.TotalMilliseconds;
                        System.Threading.Thread.Sleep(delay);
                    }
                }
            }

            Nuitrack.Release();
            Console.ReadLine();
        }
コード例 #14
0
    static public void Main()
    {
        Console.CancelKeyPress += new ConsoleCancelEventHandler(consoleEventHandler);
        try
        {
            Nuitrack.Init("");

            // get devices list
            List <NuitrackDevice> devices = Nuitrack.GetDeviceList();
            if (devices.Count == 0)
            {
                throw new nuitrack.Exception("No devices found.");
            }

            // print available devices
            Console.Write("\nAvailable devices:\n");
            for (int i = 0; i < devices.Count; i++)
            {
                Console.WriteLine("    [{0}] {1} ({2}), License: {3}",
                                  i,
                                  devices[i].GetInfo(DeviceInfoType.SERIAL_NUMBER),
                                  devices[i].GetInfo(DeviceInfoType.DEVICE_NAME),
                                  ToString(devices[i].GetActivationStatus()));
            }
            // select a device
            int            devIndex = UserInteraction.AskInt("\nSelect the device number: ", 0, devices.Count);
            NuitrackDevice device   = devices[devIndex];

            // select video modes
            selectDeviceVideoMode(device, StreamType.DEPTH);
            selectDeviceVideoMode(device, StreamType.COLOR);

            // activate selected device
            bool isActivated = Convert.ToBoolean(device.GetActivationStatus());
            if (isActivated)
            {
                isActivated = !UserInteraction.Confirm("The device is already activated. Do you want to reactivate it?");
            }

            if (!isActivated)
            {
                string activationKey = UserInteraction.AskString("Enter the activation key: ");
                device.Activate(activationKey);
                Console.WriteLine("Activation status: {0}", ToString(device.GetActivationStatus()));
            }

            // set device and run Nuitrack
            if (UserInteraction.Confirm("Do you want to run Nuitrack with the selected device?"))
            {
                Nuitrack.SetDevice(device);

                DepthSensor depthSensor = DepthSensor.Create();
                ColorSensor colorSensor = ColorSensor.Create();

                depthSensor.OnUpdateEvent += onDepthSensorUpdate;
                colorSensor.OnUpdateEvent += onColorSensorUpdate;

                Nuitrack.Run();
                _run = true;

                while (!_finished)
                {
                    Nuitrack.WaitUpdate(depthSensor);
                }

                colorSensor.OnUpdateEvent -= onColorSensorUpdate;
                depthSensor.OnUpdateEvent -= onDepthSensorUpdate;
            }

            Nuitrack.Release();
        }
        catch (nuitrack.Exception exception)
        {
            Console.WriteLine("Error: " + exception.ToString());
        }
    }
コード例 #15
0
        public MainWindow()
        {
            InitializeComponent();

            try
            {
                Nuitrack.Init();
            }
            catch (nuitrack.Exception exception)
            {
                Debug.WriteLine("Can not initialize Nuitrack. Exception: ", exception);
            }

            try
            {
                // Create and setup all required modules
                _depthSensor       = DepthSensor.Create();
                _colorSensor       = ColorSensor.Create();
                _userTracker       = UserTracker.Create();
                _skeletonTracker   = SkeletonTracker.Create();
                _handTracker       = HandTracker.Create();
                _gestureRecognizer = GestureRecognizer.Create();
            }
            catch (nuitrack.Exception exception)
            {
                Debug.WriteLine("Cannot create Nuitrack module.");
                throw exception;
            }

            // Add event handlers for all modules
            _depthSensor.OnUpdateEvent             += onDepthSensorUpdate;
            _colorSensor.OnUpdateEvent             += onColorSensorUpdate;
            _userTracker.OnUpdateEvent             += onUserTrackerUpdate;
            _skeletonTracker.OnSkeletonUpdateEvent += onSkeletonUpdate;
            _handTracker.OnUpdateEvent             += onHandTrackerUpdate;
            _gestureRecognizer.OnNewGesturesEvent  += onNewGestures;

            // Add an event handler for the IssueUpdate event
            Nuitrack.onIssueUpdateEvent += onIssueDataUpdate;

            // Create and configure the Bitmap object according to the depth sensor output mode
            OutputMode mode      = _depthSensor.GetOutputMode();
            OutputMode colorMode = _colorSensor.GetOutputMode();

            if (mode.XRes < colorMode.XRes)
            {
                mode.XRes = colorMode.XRes;
            }
            if (mode.YRes < colorMode.YRes)
            {
                mode.YRes = colorMode.YRes;
            }
            _bitmap = new DirectBitmap(mode.XRes, mode.YRes);

            for (int y = 0; y < mode.YRes; ++y)
            {
                for (int x = 0; x < mode.XRes; ++x)
                {
                    _bitmap.SetPixel(x, y, System.Drawing.Color.FromKnownColor(KnownColor.Aqua));
                }
            }
        }