Skip to main content

Scanning a generic document from an image

If you want to perform detection on a single still image. You can use SBSDKGenericDocumentRecognizer's recognizeDocument(on:) method, which takes an image as input, performs detection on the image, and returns the result.

Example for detecting Generic Document on the Image

import Foundation
import ScanbotSDK

func detectGenericDocumentOnImage() {

// Image containing generic document.
guard let image = UIImage(named: "genericDocumentImage") else { return }

// Types of generic documents you want to detect.
let typesToDetect = SBSDKGenericDocumentRootType.allDocumentTypes

// Creates an instance of `SBSDKGenericDocumentRecognizer`.
let detector = SBSDKGenericDocumentRecognizer(acceptedDocumentTypes: typesToDetect)

// Returns the result after running detector on the image.
let result = detector.recognize(on: image)
}

Want to scan longer than one minute?

Generate a free trial license to test the Scanbot SDK thoroughly.

Get your free Trial License

What do you think of this documentation?