DocumentPreprocessor<T>
Models & Types · AiDotNet.Preprocessing.Document
DocumentPreprocessor - Comprehensive document image preprocessing pipeline.
Implements: IDisposable
For Beginners
Document preprocessing improves model accuracy by:
- Normalizing image characteristics
- Removing noise and artifacts
- Correcting geometric distortions
- Enhancing text contrast
Key features:
- Chained preprocessing pipeline
- Configurable operation order
- Quality-aware preprocessing
- Batch processing support
Example usage:
How It Works
DocumentPreprocessor provides a unified interface for applying multiple preprocessing operations to document images before feeding them to AI models.
Constructors
| Constructor | Summary |
|---|---|
DocumentPreprocessor() |
Creates a DocumentPreprocessor with default settings. |
Methods
| Method | Summary |
|---|---|
IList<Tensor<T>> PreprocessBatch(IEnumerable<Tensor<T>> images, DocumentPreprocessingOptions options) |
Applies preprocessing to multiple document images. |
Tensor<T> CenterCrop(Tensor<T> image, int targetWidth, int targetHeight) |
Center crops an image to the specified dimensions. |
Tensor<T> Pad(Tensor<T> image, int targetWidth, int targetHeight, T paddingValue) |
Pads an image to the specified dimensions. |
Tensor<T> Preprocess(Tensor<T> image, DocumentPreprocessingOptions options) |
Applies the full preprocessing pipeline to a document image. |
Tensor<T> Resize(Tensor<T> image, int targetWidth, int targetHeight, InterpolationMethod method) |
Resizes an image to the specified dimensions. |
Tensor<T> ToGrayscale(Tensor<T> image) |
Converts an RGB image to grayscale. |
void Dispose() |