/scanner

a simple library to take an image of a document against a dull, contrasting background, and flatten it to create a scan-like image

Primary LanguagePython

Image Processing Library

The Image Processing Library is a Python library that provides functions for preprocessing images, detecting and approximating corners of objects, and applying perspective transformations.

Installation

To use this library, you can install it using pip:

pip install image-processing-library

Usage

from image_processing_library import process_image

# Provide the path to the input image
image_path = "path/to/your/image.jpg"

# Process the image
process_image(image_path)

Functions

1. preprocessing(image)

Preprocesses the input image by converting it to grayscale, applying Gaussian blur, thresholding, and morphological operations.

morph_image = preprocessing(image)

2. corner_get(morph)

Detects and approximates the corners of the object in the processed image.

corners_result = corner_get(morph_image)

3. warp(image, corners)

Applies a perspective transformation to the input image based on the detected corners.

warp(image, corners_result)

4. process_image(image_path)

Processes an image using the provided image path, combining the above functions.

process_image("path/to/your/image.jpg")

License

This project is licensed under the MIT License.


Make sure to replace the placeholders with the appropriate information, and include a license file (`LICENSE`) with the content of your chosen license (in this case, MIT License). This README provides a basic structure and usage instructions for your library.