Document Quality Analyzer (SBSDKDocumentQualityAnalyzer)
- Analyzes the quality of text in a document on a still image.
- The result is an enum of type
SBSDKDocumentQuality
.
- Swift
- Objective-C
import UIKit
import ScanbotSDK
class DocumentQualityAnalyzerSwiftViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Initialize the analyzer.
let analyzer = SBSDKDocumentQualityAnalyzer()
// Set the desired image.
if let image = UIImage(named: "testDocument") {
// Analyze the quality of the image.
let quality = analyzer.analyze(on: image)
// Handle the result.
self.printResult(quality: quality)
}
}
// Print the result.
func printResult(quality: SBSDKDocumentQuality) {
switch quality {
case .noDocument:
print("No document was found")
case .veryPoor:
print("The quality of the document is very poor")
case .poor:
print("The quality of the document is poor")
case .reasonable:
print("The quality of the document is reasonable")
case .good:
print("The quality of the document is good")
case .excellent:
print("The quality of the document is excellent")
@unknown default: break
}
}
}
#import "DocumentQualityAnalyzerObjcViewController.h"
@import ScanbotSDK;
@interface DocumentQualityAnalyzerObjcViewController ()
@end
@implementation DocumentQualityAnalyzerObjcViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Initialize the analyzer.
SBSDKDocumentQualityAnalyzer *analyzer = [[SBSDKDocumentQualityAnalyzer alloc] init];
// Set the desired image.
UIImage *image = [UIImage imageNamed:@"testDocument"];
// Analyze the quality of the image.
SBSDKDocumentQuality quality = [analyzer analyzeOnImage:image];
// Handle the result.
[self printResult:quality];
}
// Print the result.
- (void) printResult:(SBSDKDocumentQuality)quality {
switch (quality) {
case SBSDKDocumentQualityNoDocument:
NSLog(@"No document was found");
break;
case SBSDKDocumentQualityVeryPoor:
NSLog(@"The quality of the document is very poor");
break;
case SBSDKDocumentQualityPoor:
NSLog(@"The quality of the document is poor");
break;
case SBSDKDocumentQualityReasonable:
NSLog(@"The quality of the document is reasonable");
break;
case SBSDKDocumentQualityGood:
NSLog(@"The quality of the document is good");
break;
case SBSDKDocumentQualityExcellent:
NSLog(@"The quality of the document is excellent");
break;
}
}
@end
Want to scan longer than one minute?
Generate your free "no-strings-attached" Trial License and properly test the Scanbot SDK.
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.