The SDK provides powerful image processing capabilities that transform raw camera captures into high-quality, readable documents. These capabilities include document detection, perspective correction, image enhancement, and quality analysis.
Document edge detection analyzes an image and returns a quadrangle representing the four corners of the detected document.
import GSSDK
let documentDetector = GSKDocumentDetector(configuration: .defaultConfiguration)
let result = try documentDetector.detectDocumentInImage(image, options: [])
let quadrangle = result.quadrangle
import com.geniusscansdk.core.DocumentDetector
val detector = DocumentDetector.create(context)
// From image file
val quadrangle = detector.detectDocument(imageFile)
// Or from image bitmap
val bitmap = BitmapFactory.decodeFile(imagePath)
val quadrangle = detector.detectDocument(bitmap)
…
The document processor takes an image and applies various enhancement operations. The SDK supports multiple processing operations that can be combined to achieve optimal results.
Operation | Description | Use Case |
---|---|---|
Perspective Correction | Corrects the viewing angle | Documents photographed at an angle |
Curvature Correction | Flattens curved documents | Books, magazines, curved papers |
Enhancement Filters | Improve readability | Various document types |
Rotation | Auto-rotate to proper orientation | Mixed orientation captures |
Readability Detection | Detect blur and quality issues | Quality assurance |
import GSSDK
let image = // Your captured image
let quadrangle = // Detected document boundaries
// Configure processing operations
let perspectiveCorrectionConfiguration = GSKPerspectiveCorrectionConfiguration.withQuadrangle(quadrangle)
let curvatureCorrectionConfiguration = GSKCurvatureCorrectionConfiguration.withCurvatureCorrection(true)
let enhancementConfiguration = GSKEnhancementConfiguration.withFilter(.blackAndWhite)
// Process the image
let result = try GSKScanProcessor().processImage(
image,
perspectiveCorrectionConfiguration: perspectiveCorrectionConfiguration,
curvatureCorrectionConfiguration: curvatureCorrectionConfiguration,
enhancementConfiguration: enhancementConfiguration,
rotationConfiguration: .automatic(),
readabilityConfiguration: .enabled(),
outputConfiguration: .defaultConfiguration
)
// Access results
let processedImage = UIImage(contentsOfFile: result.processedImagePath)
import com.geniusscansdk.core.*
val processor = ScanProcessor(context)
// Configure processing
val configuration = ScanProcessor.Configuration(
perspectiveCorrection = PerspectiveCorrection.automatic(),
enhancement = Enhancement.automatic(),
curvatureCorrection = true,
rotation = Rotation.automatic(),
outputConfiguration = OutputConfiguration.file(outputFolder)
}
// Process the image
val result = processor.process(imageFile, configuration)
// Access results
val processedImageFile = result.output
The SDK provides several enhancement filters optimized for different document types:
Filter | Description | Best For |
---|---|---|
No Op | No enhancement applied | Already good quality images |
Strong Monochrome | Strong document filter resulting in a monochrome document | Text documents, forms, high contrast needed |
Strong Grayscale | Strong document filter resulting in a grayscale document | Documents needing strong enhancement without color |
Strong Color | Strong document filter resulting in a color document | Colored documents needing strong enhancement |
Soft Grayscale | Soft document filter resulting in a grayscale document | Documents with subtle details, lighter enhancement |
Soft Color | Soft document filter resulting in a color document | Colored documents with lighter enhancement |
Photo | Filter specially designed for photos | Photos |
Dark Background | Filter for documents with dark backgrounds | White text on black background, inverted documents |
After processing your images, you can extract text using OCR:
© 2025 The Grizzly Labs. All rights reserved.