示例#1
0
        internal void StopFaceDetectionAndRestartUvcAndRestartFaceDetection()
        {
            bool isToDetectFacesPrevious = Settings.IsToDetectFaces.Value;

            if (Settings.IsToDetectFaces.Value != false)
            {
                Settings.IsToDetectFaces.Value = false;
            }

            // NOTE: Wait completion of host face detection
            var sw = Stopwatch.StartNew();

            while (sw.ElapsedMilliseconds < FaceDetectionOnHost.DetectFaceIntervalMillisecondsMinimum.Value * 2 && FaceDetectionOnHost.IsDetecting)
            {
                System.Threading.Thread.Sleep(100);
            }
            ResetHidReportObjects();

            if (CameraViewImageSourceBitmapCapture.IsCameraDeviceConnected)
            {
                CameraViewImageSourceBitmapCapture.SetupCameraDevice();
            }
            // NOTE: Maybe necessary!
            System.Threading.Thread.Sleep(1000);

            if (Settings.IsToDetectFaces.Value != isToDetectFacesPrevious)
            {
                Settings.IsToDetectFaces.Value = isToDetectFacesPrevious;
            }
        }
示例#2
0
        /// <summary>
        /// This method should be called only from EgsDevicesManager.  This updates only connection state of "Camera".
        /// </summary>
        internal void TrySetIsCameraDeviceConnectedToTrue()
        {
            Debug.WriteLine("[EgsDevice] TrySetIsCameraDeviceConnectedToTrue() called.  DateTime.Now = " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff", CultureInfo.InvariantCulture));

            // NOTE (en): We confirmed there is time lag, from setting "CameraViewImageSourceBitmapSize" to becoming that the app can get correct values related to the "CameraViewImageSourceBitmapSize".
            // NOTE (ja): PCの機種によっては??カメラの解像度設定から、表示領域の内部状態が更新されてHIDで取得できるようになるまで、タイムラグがあることを確認した!!
            System.Threading.Thread.Sleep(300);

            // The next line updates device.CameraViewImageSourceBitmapCapture.IsCameraDeviceConnected
            CameraViewImageSourceBitmapCapture.SetupCameraDevice();
            CameraViewImageSourceBitmapCapture.UpdateIsUpdatingImageSource();
            // MUSTDO: Check if the application works correctly or not, if the next block is activated.  Currently it works correctly.
            if (true)
            {
                System.Threading.Thread.Sleep(300);
                // NOTE: Just in case, I leave the code to get the value again.
                GetReadonlyHidAccessPropertyByGetHidFeatureReport(Settings.CaptureImageSize);
                System.Threading.Thread.Sleep(100);
                GetReadonlyHidAccessPropertyByGetHidFeatureReport(Settings.CameraViewImageSourceRectInCaptureImage);
                EgsGestureHidReport.UpdateImageSizeRelatedProperties();
            }
        }