示例#1
0
        public void DidFinishProcessingPhoto(AVCapturePhotoOutput captureOutput, CoreMedia.CMSampleBuffer photoSampleBuffer, CoreMedia.CMSampleBuffer previewPhotoSampleBuffer, AVCaptureResolvedPhotoSettings resolvedSettings, AVCaptureBracketedStillImageSettings bracketSettings, NSError error)
        {
            var imageData = AVCapturePhotoOutput.GetJpegPhotoDataRepresentation(photoSampleBuffer, previewPhotoSampleBuffer);

            if (imageData != null)
            {
                var capturedImage = new UIImage(imageData);


                var storyboard      = UIStoryboard.FromName("Main", NSBundle.MainBundle);
                UIViewController vc = new UIViewController();
                if (came_from == Constants.personal)
                {
                    CropCameraViewController.currentImage = capturedImage;
                    vc = storyboard.InstantiateViewController(nameof(CropCameraViewController));
                }
                else if (came_from == Constants.company_logo)
                {
                    CropCompanyLogoViewController.currentImage = capturedImage;
                    vc = storyboard.InstantiateViewController(nameof(CropCompanyLogoViewController));
                }

                this.NavigationController.PushViewController(vc, true);
            }
        }
示例#2
0
        /// <summary>
        /// <see cref="LabelReaderBase.GetFullTextFromImage(object)"/>
        /// </summary>
        /// <param name="image"></param>
        /// <returns></returns>
        public override async Task <string> GetFullTextFromImageAsync(object image)
        {
            CoreMedia.CMSampleBuffer iOSImage = (CoreMedia.CMSampleBuffer)image;
            VisionImage visionImage           = new VisionImage(iOSImage);

            visionImage.Metadata = new VisionImageMetadata {
                Orientation = GetOrientation()
            };
            VisionApi            api            = VisionApi.Create();
            VisionTextRecognizer textRecognizer = api.GetOnDeviceTextRecognizer();
            VisionText           textResult     = await textRecognizer.ProcessImageAsync(visionImage);

            return(textResult?.Text);
        }
示例#3
0
        /// <summary>
        /// <see cref="LabelReaderBase.GetRawBarcodeTextFromImageAsync(object)"/>
        /// </summary>
        /// <param name="image"></param>
        /// <returns></returns>
        public override async Task <string> GetRawBarcodeTextFromImageAsync(object image)
        {
            CoreMedia.CMSampleBuffer iOSImage = (CoreMedia.CMSampleBuffer)image;
            VisionImage visionImage           = new VisionImage(iOSImage);

            visionImage.Metadata = new VisionImageMetadata {
                Orientation = GetOrientation()
            };
            VisionApi             api             = VisionApi.Create();
            VisionBarcodeDetector barcodeDetector = api.GetBarcodeDetector(new VisionBarcodeDetectorOptions(VisionBarcodeFormat.QRCode));

            VisionBarcode[] barcodes = await barcodeDetector.DetectAsync(visionImage);

            if (barcodes.Length <= 0)
            {
                return(String.Empty);
            }
            return(barcodes.First().RawValue);
        }
        public virtual void DidOutputSampleBuffer(AVCaptureOutput captureOutput, CoreMedia.CMSampleBuffer sampleBuffer, AVCaptureConnection connection)
        {
            if (!capture)
            {
                sampleBuffer.Dispose();
                return;
            }

            InvokeOnMainThread(() =>
            {
                // Image is prepared
                var orientation             = UIApplication.SharedApplication.StatusBarOrientation;
                connection.VideoOrientation = VideoOrientation(orientation);

                textCaptureService.AddSampleBuffer(sampleBuffer.Handle);

                sampleBuffer.Dispose();
            });
        }
 public override void DidOutputSampleBuffer(AVCaptureOutput captureOutput, CoreMedia.CMSampleBuffer sampleBuffer, AVCaptureConnection connection)
 {
 }
示例#6
0
 public override void ProcessSampleBuffer(CoreMedia.CMSampleBuffer sampleBuffer, RPSampleBufferType sampleBufferType)
 {
     screenShareService.ProcessSampleBuffer(sampleBuffer, sampleBufferType);
 }