ImagePreprocessor

Stateless image preprocessing pipeline for OCR: grayscale conversion, Otsu binarization, and median denoising.

Types

Link copied to clipboard
data class PreprocessResult(val image: BufferedImage, val threshold: Int)

Result of image preprocessing containing the processed image and the Otsu threshold used.

Functions

Link copied to clipboard
fun applyPreprocessing(image: BufferedImage, useAdaptive: Boolean = false, logSignature: String = DEFAULT_LOG_SIGNATURE): ImagePreprocessor.PreprocessResult?

Core image preprocessing: grayscale conversion, binarization, and median denoising.

Link copied to clipboard
fun preprocessImage(image: BufferedImage, enabled: Boolean, useAdaptive: Boolean = false, logSignature: String = DEFAULT_LOG_SIGNATURE): BufferedImage

Preprocesses an image in-memory to improve OCR accuracy.

fun preprocessImage(inputFile: File, enabled: Boolean, useAdaptive: Boolean = false, logSignature: String = DEFAULT_LOG_SIGNATURE): BufferedImage

Preprocesses an image file to improve OCR accuracy. Applies: Grayscale conversion, adaptive binarization, noise reduction. All processing is in-memory; no temp files are written.