Loading...
z

ImageSdk Modules Pixelnetica™ Document Scanning SDK for .NET MAUI

Processing

The Processing module handles document detection, correction, and binarization.

⚠️ Important: All methods of this module (including creation) must be called from the same thread.

Module Creation

ImageProcessing sdk = new ImageProcessing();

Resource Management

We recommend utilizing the using statement to ensure proper disposal of resources:

using (ImageProcessing ip = new ImageProcessing())
{
    // your processing code here
}

Loading Image Metadata with MetaImage

The most convenient way to load metadata is by using a ContentResolver and an image Uri:

string imageUri = ... // basic Uri
MetaImage sourceImage = MetaImage.FromStream(stream, imageUri);

There are multiple methods available to create a MetaImage.

Document Detection

Corners corners = sdk.DetectDocumentCorners(sourceImage);

After detection, you can allow users to confirm or adjust the detected document boundaries.

Document Cropping and Correction

This step aligns the document image, applies perspective correction, and crops it according to the detected or user-adjusted boundaries.

MetaImage croppedImage = sdk.CorrectDocument(sourceImage, corners);

Image Processing and Binarization

Use this set of methods depending on the desired output format: black-and-white for OCR and archival, grayscale for compact storage, enhanced color for readability, or orientation correction when only alignment is needed.

The SDK provides four image processing methods:

// Binarize to **Black and White** image
targetImage = sdk.ImageBWBinarization(croppedImage);

// Convert to **Grayscale** image
targetImage = sdk.ImageGrayBinarization(croppedImage);

// Convert to a **Color** image with content-aware enhancements such as noise removal, background cleaning, and improved contrast and color balance
targetImage = sdk.ImageColorBinarization(croppedImage);

// Rotate to the correct orientation while keeping **Original** colors
targetImage = sdk.ImageOriginal(croppedImage);
Top