Scanning a document from an image
The Scanbot SDK provides two abstractions to incapsulate scanned documents. Using these you can directly detect document on an image.
SBSDKDocumentPage
- This class represents a scanned document page.
It contains all the needed information about the scanned page and gives you the ability to manage the scanned image in a variety of ways.
SBSDKDocument
- This class represents a thread-safe container for SBSDKDocumentPage
instances.
It gives the ability to add, remove and replace pages in an array-like fashion.
Both these classes are widely used in all Ready-to-use UI components (more about RTU UI).
Example of detection on the Image
- Swift
- Objective-C
// For this example we're going to create a mock scanned document image.
guard let documentImage = UIImage(named: "documentImage") else { return }
// Create a page with a UIImage instance.
let page = SBSDKDocumentPage(image: documentImage, polygon: nil, filter: .none)
// Return the result of the detected document on an image.
let result = page.detectDocument(applyPolygonIfOkay: true)
// For this example we're going to create a mock scanned document image.
UIImage *documentImage = [UIImage imageNamed:@"documentImage"];
// Create a page with a UIImage instance.
SBSDKDocumentPage *page = [[SBSDKDocumentPage alloc] initWithImage:documentImage
polygon:nil
filter:SBSDKImageFilterTypeNone];
// Return the result of the detected document on an image.
SBSDKDocumentDetectorResult *result = [page detectDocumentAndApplyPolygonIfOkay:YES];
Want to scan longer than one minute?
Generate a free trial license to test the Scanbot SDK thoroughly.
Get your free Trial LicenseWhat do you think of this documentation?
What can we do to improve it? Please be as detailed as you like.