/// <summary>
///     Prepare the device to perform optical character recognition and initialize the <see cref="OcrService" />.
/// </summary>
        public static async Task InitializeOcrServiceAsync(SetMediaCaptureObjectAsync action)
        {
            //Get camera device of HoloLens.
            var deviceInformationCollection = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);

            var deviceInformation = deviceInformationCollection[0];

            var captureElementSource = new MediaCapture();
            await captureElementSource.InitializeAsync(new MediaCaptureInitializationSettings
            {
                VideoDeviceId = deviceInformation.Id
            });

            await action(captureElementSource);

            UWPBridgeService.AddService <CameraScript.IOcrService>(new OcrService(captureElementSource));
        }
Exemple #2
0
        /// <summary>
        ///     Initialize Service and add service.
        /// </summary>
        public static async Task InitizlizeServiceAsync(SetMediaCaptureObjectAsync action)
        {
            var devices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);

            var device   = devices[0];
            var capture  = new MediaCapture();
            var settings = new MediaCaptureInitializationSettings
            {
                VideoDeviceId = device.Id
            };
            await capture.InitializeAsync(settings);

            await action(capture);

            var service = new FaceDetectorService(capture);

            UWPBridgeServiceManager.Instance.AddService <FaceDetectBase>(service);
        }