public bool ShouldAutocropCapturedImageWithModeManualShutter(SBSDKScannerViewController controller, SBSDKShutterMode mode, bool manual) { // Here you control whether to automatically crop the document image or not, // depending on the current shutter mode and how the shutter was released: manually or automatically. // Return true, if the detected polygon should be applied to the captured document image, false otherwise. return(true); }
public void DidCaptureImageWithDetectedPolygon(SBSDKScannerViewController controller, UIImage originalImage, SBSDKPolygon polygon, SBSDKLensCameraProperties properties) { // Here we get the original (uncropped) image from the camera and an optional polygon that was detected on the image. if (cameraDelegate != null) { cameraDelegate.DidCaptureOriginalImage(originalImage); } }
public UIView GetViewForDetectionStatus(SBSDKScannerViewController controller, SBSDKDocumentDetectionStatus status) { // Alternative method to "scannerController:localizedTextForDetectionStatus:". // Here you can return a custom view that you want to use to visualize the latest detection status. var label = new SBSDKDetectionStatusLabel(); label.BackgroundColor = UIColor.Red; label.TextColor = UIColor.White; if (scannerViewController.EnergySavingActive) { label.Text = "Energy Saving active.\nMove your device."; label.BackgroundColor = UIColor.Orange; } else { switch (status) { case SBSDKDocumentDetectionStatus.Ok: label.Text = "Don't move.\nCapturing..."; label.BackgroundColor = UIColor.Green; break; case SBSDKDocumentDetectionStatus.OK_SmallSize: label.Text = "Move closer"; break; case SBSDKDocumentDetectionStatus.OK_BadAngles: label.Text = "Perspective"; break; case SBSDKDocumentDetectionStatus.Error_NothingDetected: label.Text = "No Document"; break; case SBSDKDocumentDetectionStatus.Error_Noise: label.Text = "Background too noisy"; break; case SBSDKDocumentDetectionStatus.Error_Brightness: label.Text = "Poor light"; break; case SBSDKDocumentDetectionStatus.OK_BadAspectRatio: label.Text = "Wrong aspect ratio.\n Rotate your device"; break; default: return(null); } } label.SizeToFit(); return(label); }
public UIColor ScannerControllerPolygonColorForDetectionStatus(SBSDKScannerViewController controller, SBSDKDocumentDetectionStatus status) { // If the detector has found an acceptable polygon we show it with green color if (status == SBSDKDocumentDetectionStatus.Ok) { return(UIColor.Green); } return(UIColor.Red); }
public void ScannerControllerDidCaptureDocumentImage(SBSDKScannerViewController controller, UIImage documentImage) { // Here we get the perspective corrected and cropped document image after the shutter was (auto)released. if (cameraDelegate != null) { cameraDelegate.DidCaptureDocumentImage(documentImage); } NavigationController.PopToRootViewController(true); }
public void DidCaptureDocumentImage(SBSDKScannerViewController controller, UIImage documentImage) { // Here we get the cropped and perspective corrected document image. if (cameraDelegate != null) { cameraDelegate.DidCaptureDocumentImage(documentImage); } NavigationController.PopToRootViewController(true); }
public void ScannerControllerDidCaptureImageWithDetectedPolygon(SBSDKScannerViewController controller, UIImage image, SBSDKPolygon polygon, SBSDKLensCameraProperties properties) { // Here we get the full image from the camera and an optional polygon that was detected on the image. //this.detectedPolygon = polygon; if (cameraDelegate != null) { cameraDelegate.DidCaptureOriginalImage(image); } }
public override void ViewDidLoad() { base.ViewDidLoad(); var screenSize = UIScreen.MainScreen.Bounds.Size; // Create a view as container for bottom buttons: var buttonsContainerHeight = 120; bottomButtonsContainer = new UIView(new CGRect(0, screenSize.Height - buttonsContainerHeight, screenSize.Width, buttonsContainerHeight)); bottomButtonsContainer.BackgroundColor = UIColor.Blue; View.AddSubview(bottomButtonsContainer); // Create a view as container to embed the Scanbot SDK SBSDKScannerViewController: scanningContainerView = new UIView(new CGRect(0, 0, screenSize.Width, screenSize.Height - buttonsContainerHeight)); View.AddSubview(scanningContainerView); // Create the SBSDKScannerViewController, embedded into our custom scanningContainerView. // As we do not want automatic image storage we pass null here as image storage. scannerViewController = new SBSDKScannerViewController(this, scanningContainerView, null, false); // ================================================================= // // UI customizations can be implemented via delegate methods from "SBSDKScannerViewControllerDelegate". // See some examples below the #region SBSDKScannerViewControllerDelegate // // Please see the API docs of our native Scanbot SDK for iOS, since all those methods and properties // are also available as Scanbot Xamarin bindings. // // ================================================================= // Set the delegate to self. scannerViewController.WeakDelegate = this; // We want unscaled images in full size: scannerViewController.ImageScale = 1.0f; // The minimum score in percent (0 - 100) of the perspective distortion to accept a detected document. // Default is 75.0. Set lower values to accept more perspective distortion. Warning: Lower values result in more blurred document images. scannerViewController.AcceptedAngleScore = 70; // The minimum size in percent (0 - 100) of the screen size to accept a detected document. It is sufficient that height or width match the score. // Default is 80.0. Warning: Lower values result in low resolution document images. scannerViewController.AcceptedSizeScore = 80; // Sensitivity factor for automatic capturing. Must be in the range [0.0...1.0]. Invalid values are threated as 1.0. // Defaults to 0.66 (1 sec).s A value of 1.0 triggers automatic capturing immediately, a value of 0.0 delays the automatic by 3 seconds. scannerViewController.AutoCaptureSensitivity = 0.7f; // The orientation captured images are locked onto. By default it is SBSDKOrientationLockNone. // Setting this property to any other value will suppress the document detection status ‘SBSDKDocumentDetectionStatusOK_BadAspectRatio’. // If the lock is enabled the detection status UI will be orientation-locked too. scannerViewController.ImageOrientationLock = SBSDKOrientationLock.Portrait; }
public override void ViewDidLoad() { base.ViewDidLoad(); // Create the SBSDKScannerViewController. // We want it to be embedded into self. // As we do not want automatic image storage we pass nil here for the image storage. scannerViewController = new SBSDKScannerViewController(this, null); // ================================================================= // // UI customizations can be implemented via delegate methods from "SBSDKScannerViewControllerDelegate". // // Please check the API docs of our native Scanbot SDK for iOS, since all those methods and properties are also available as Scanbot Xamarin bindings. // // ================================================================= // Set the delegate to self. scannerViewController.WeakDelegate = this; // We want unscaled images in full size: scannerViewController.ImageScale = 1.0f; // The minimum score in percent (0 - 100) of the perspective distortion to accept a detected document. // Default is 75.0. Set lower values to accept more perspective distortion. Warning: Lower values result in more blurred document images. scannerViewController.AcceptedAngleScore = 70; // The minimum size in percent (0 - 100) of the screen size to accept a detected document. It is sufficient that height or width match the score. // Default is 80.0. Warning: Lower values result in low resolution document images. scannerViewController.AcceptedSizeScore = 80; // Sensitivity factor for automatic capturing. Must be in the range [0.0...1.0]. Invalid values are threated as 1.0. // Defaults to 0.66 (1 sec).s A value of 1.0 triggers automatic capturing immediately, a value of 0.0 delays the automatic by 3 seconds. scannerViewController.AutoCaptureSensitivity = 0.7f; // The orientation captured images are locked onto. By default it is SBSDKOrientationLockNone. // Setting this property to any other value will suppress the document detection status ‘SBSDKDocumentDetectionStatusOK_BadAspectRatio’. // If the lock is enabled the detection status UI will be orientation-locked too. scannerViewController.ImageOrientationLock = SBSDKOrientationLock.Portrait; }
public string ScannerControllerLocalizedTextForDetectionStatus(SBSDKScannerViewController controller, SBSDKDocumentDetectionStatus status) { // Alternative method to "scannerController:viewForDetectionStatus:" // Here you can return just the localized text for the status label depending on the detection status. return(null); }
public void ScannerControllerDidDetectPolygonWithStatus(SBSDKScannerViewController controller, SBSDKPolygon polygon, SBSDKDocumentDetectionStatus status) { // Everytime the document detector finishes detection it calls this delegate method. }
public bool ScannerControllerShouldAnalyseVideoFrame(SBSDKScannerViewController controller) { return(autoSnappingEnabled && viewAppeared && PresentedViewController == null); }
public CGPoint GetCenterForShutterButton(SBSDKScannerViewController controller) { return(new CGPoint(bottomButtonsContainer.Frame.Width / 2, bottomButtonsContainer.Frame.Height / 2)); }
public UIView GetSuperViewForShutterButton(SBSDKScannerViewController controller) { // Optional delegate for returning a custom view on which to place the shutter button. return(bottomButtonsContainer); }
public UIButton GetCustomShutterButton(SBSDKScannerViewController controller) { // Optional delegate for returning a custom shutter button. //return customShutterButton; return(null); }