After capture, use the image processing APIs to turn a camera image into a clean document image. Most custom integrations detect the document outline, correct perspective, optionally flatten curved pages, apply an enhancement filter, and then write the result to an image file.
Document edge detection analyzes an image and returns a quadrangle representing the four corners of the detected document. Use this quadrangle to prefill the edit frame screen or to run perspective correction directly when no manual review is needed.
import GSSDK
let documentDetector = GSKDocumentDetector()
let result = try documentDetector.detectDocument(in: image)
let quadrangle = result.quadrangle
import android.graphics.BitmapFactory
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 applies the operations that produce the final image. You can run only the steps your workflow needs, but a typical document pipeline combines perspective correction, optional curvature correction, image enhancement, rotation, and readability analysis.
Perspective correction uses a detected or user-adjusted quadrangle to crop and straighten the document. Curvature correction is useful for books, magazines, or curved sheets. Enhancement filters improve contrast and readability. Rotation can normalize orientation, and readability analysis lets your app decide whether to warn the user about blur or low quality.
import GSSDK
let image = // Your captured image
let quadrangle = // Detected document boundaries
let perspectiveCorrectionConfiguration = GSKPerspectiveCorrectionConfiguration(
quadrangle: quadrangle
)
let curvatureCorrectionConfiguration = GSKCurvatureCorrectionConfiguration(
curvatureCorrection: true
)
let enhancementConfiguration = GSKEnhancementConfiguration.fixed(
filterConfiguration: .strongMonochrome
)
let configuration = GSKProcessingConfiguration(
perspectiveCorrectionConfiguration: perspectiveCorrectionConfiguration,
curvatureCorrectionConfiguration: curvatureCorrectionConfiguration,
enhancementConfiguration: enhancementConfiguration,
rotationConfiguration: .automatic(),
readabilityConfiguration: .default(),
outputConfiguration: .default()
)
let result = try GSKScanProcessor().processImage(image, configuration: configuration)
let processedImage = UIImage(contentsOfFile: result.processedImagePath)
import com.geniusscansdk.core.FilterConfiguration
import com.geniusscansdk.core.ScanProcessor
val processor = ScanProcessor(context)
val configuration = ScanProcessor.Configuration(
perspectiveCorrection = ScanProcessor.PerspectiveCorrection.automatic(),
curvatureCorrection = ScanProcessor.CurvatureCorrection.create(correctCurvature = true),
enhancement = ScanProcessor.Enhancement.withFilterConfiguration(
FilterConfiguration.strongMonochrome()
),
rotation = ScanProcessor.Rotation.automatic(),
readability = ScanProcessor.Readability.enabled(),
outputConfiguration = ScanProcessor.OutputConfiguration.file(outputFolder)
)
val result = processor.process(imageFile, configuration)
val processedImageFile = result.output
In most cases, leave enhancement on Automatic so the SDK can choose the best filter for each image. Force a specific filter only when your app always scans a known document type and you know which result is appropriate. For example, text-heavy forms may benefit from monochrome or grayscale filters, while mixed documents with photos often look better with color or softer filters.
| Filter | Description | Best For |
|---|---|---|
| Automatic | Lets the SDK choose the most appropriate enhancement | Recommended default for most documents |
| 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 |
Start with a free trial license to test the SDK, or contact us directly for a custom quote tailored to your needs.
© 2026 The Grizzly Labs. All rights reserved.