Esempio n. 1
0
        void Awake()
        {
            _MainThreadID = Thread.CurrentThread.ManagedThreadId;

            _AzureKinectSensor = gameObject.GetComponent <AzureKinectSensor>();
            _AzureKinectSensor.OpenSensor();

            if (_AzureKinectSensor != null)
            {
                _CancellationTokenSource = new CancellationTokenSource();
                RunAnotherThread(_CancellationTokenSource.Token);
            }
        }
Esempio n. 2
0
        void Awake()
        {
            _MainThreadID = Thread.CurrentThread.ManagedThreadId;

            int deviceCount = AzureKinectSensor.GetDeviceCount();

            for (int i = 0; i < deviceCount; i++)
            {
                var kinectSensor = new AzureKinectSensor(ColorImageFormat, ColorCameraMode, DepthCameraMode);
                if (kinectSensor.OpenSensor(i))
                {
                    _AzureKinectSensorList.Add(kinectSensor);
                }
            }

            _CancellationTokenSource = new CancellationTokenSource();
            foreach (var kinectSensor in _AzureKinectSensorList)
            {
                RunAnotherThread(_CancellationTokenSource.Token, kinectSensor);
            }
        }
Esempio n. 3
0
        public void Initialize()
        {
            if (!_Initialized)
            {
                // _MainThreadID = Thread.CurrentThread.ManagedThreadId;

                int deviceCount = AzureKinectSensor.GetDeviceCount();
                for (int i = 0; i < deviceCount; i++)
                {
                    var kinectSensor = new AzureKinectSensor(ColorImageFormat, ColorCameraMode, DepthCameraMode);
                    if (kinectSensor.OpenSensor(i))
                    {
                        _AzureKinectSensorList.Add(kinectSensor);
                        _DeviceSerialNumList.Add(kinectSensor.Device.SerialNum);
                        _CancellationTokenSourceList.Add(new CancellationTokenSource());

                        kinectSensor.CloseSensor();
                    }
                }

                _Initialized = true;
            }
        }