Skip to main content

Image Enhancer AI

An AI-assisted image enhancement and document correction toolkit built with Python, OpenCV and TensorFlow.

The package automatically analyzes an input image and applies appropriate enhancement operations based on the detected image type and image quality.

Features

General Image Enhancement

  • Image type detection
  • Blur detection
  • Blur correction and sharpening
  • Noise detection
  • Noise removal
  • Brightness analysis
  • Brightness correction
  • Contrast analysis
  • Contrast enhancement
  • CLAHE enhancement
  • Image quality evaluation

Rotation Correction

  • CNN-based major rotation detection
  • 0°, 90°, 180° and 270° classification
  • Confidence-based rotation correction
  • Safety threshold to avoid unsafe automatic corrections

Document Processing

  • Document image detection
  • Perspective detection
  • Perspective correction
  • Document rotation detection
  • Table detection
  • Table angle detection
  • Minor table rotation correction
  • Document enhancement
  • Final document quality evaluation

Architecture

The system uses an automatic processing engine.

Input Image
     |
     v
Image Type Detection
     |
     +--------------------+
     |                    |
     v                    v
Photo Pipeline       Document Pipeline
     |                    |
     v                    v
Rotation              Perspective
Blur                  Rotation
Noise                 Table Analysis
Brightness            Noise
Contrast              Blur
CLAHE                 Brightness
Quality               Contrast
                      Enhancement
                           |
                           v
                    Quality Evaluation
                           |
Installation
From source

Clone or download the project.

Create a virtual environment:

python -m venv .venv

Activate it on Windows:

.venv\Scripts\activate

Install the package:

python -m pip install --upgrade pip
pip install .
Install as a wheel

Build the package:

python -m pip install build
python -m build

This creates:

dist/
    image_enhancer_ai-1.0.0-py3-none-any.whl
    image_enhancer_ai-1.0.0.tar.gz

Install the wheel:

pip install dist\image_enhancer_ai-1.0.0-py3-none-any.whl
Basic Usage
from image_enhancer import ImageEnhancer


enhancer = ImageEnhancer()


image, report = enhancer.process(
    "input.jpg"
)


enhancer.save(
    image,
    "output.jpg"
)


for line in report:
    print(line)
Access Metadata

For applications that require detailed processing information:

from image_enhancer import ImageEnhancer


enhancer = ImageEnhancer()


result = enhancer.process_result(
    "input.jpg"
)


print("Quality:", result.metadata["quality_score"])


print("Grade:", result.metadata["quality_grade"])


print("Blur:", result.metadata["blur_detected"])


print("Noise:", result.metadata["noise_level"])


print("Rotation:",
      result.metadata["major_rotation_angle"])


enhancer.save(
    result.image,
    "output.jpg"
)
Example
from image_enhancer import ImageEnhancer


enhancer = ImageEnhancer()


result = enhancer.process_result(
    "photo.jpg"
)


print("Processing completed")


for line in result.report:
    print(line)


enhancer.save(
    result.image,
    "enhanced_photo.jpg"
)
Processing Result

The package returns an EnhancementResult containing:

image
report
metadata
Image

The final enhanced image as a NumPy array.

Report

A list of human-readable processing results.

Example:

Detected Image Type : document
Detection Confidence : 66.7%
Perspective Correction : Not Required
Major Rotation : 180
Major Rotation Confidence : 0.311
Major Rotation Correction : Skipped
Noise Level : Medium
Blur Correction : Not Required
Final Quality Score : 85.24
Final Quality Grade : Good
Document Enhancement : Completed
Metadata

Machine-readable processing information.

Example:

{
    "image_type_confidence": 0.667,
    "perspective_confidence": 0.0,
    "perspective_corrected": False,
    "major_rotation_angle": 180,
    "major_rotation_confidence": 0.311,
    "major_rotation_corrected": False,
    "noise_level": "Medium",
    "blur_detected": False,
    "blur_score": 699.44,
    "quality_score": 85.24,
    "quality_grade": "Good"
}
Rotation Safety

Major rotation correction is confidence-based.

The CNN predicts one of:

0°
90°
180°
270°

A correction is applied only when the model confidence reaches the configured safety threshold.

If the confidence is below the threshold, the original orientation is preserved.

This prevents uncertain CNN predictions from automatically rotating an image incorrectly.

Testing

The project contains individual tests for:

Blur
Noise
Brightness
Quality
Perspective detection
Perspective correction
Table detection
Table rotation
CNN rotation
Document pipeline
Photo pipeline
Full engine
Public API

Run the tests individually:

python tests/test_blur.py
python tests/test_noise.py
python tests/test_brightness.py
python tests/test_quality.py
python tests/test_perspective_detector.py
python tests/test_perspective.py
python tests/test_table.py
python tests/test_table_rotation_step.py
python tests/test_table_correction.py
python tests/test_cnn_mapping.py
python tests/test_cnn_prediction.py
python tests/test_document_pipeline.py
python tests/test_photo_pipeline.py
python tests/test_engine.py
python tests/test_public_api.py
Model Files

The rotation model is packaged inside:

image_enhancer/models/rotation_model.h5

The corresponding class mapping is:

image_enhancer/models/class_mapping.json

The package includes these files when building the wheel.

Supported Python Versions

The package targets:

Python 3.10
Python 3.11
Python 3.12
Main Dependencies
NumPy
OpenCV
TensorFlow
Project Status

Version 1.0.0

The core image enhancement pipelines, document processing pipeline, rotation detection, table processing, quality evaluation, engine and public API have been tested.

License

MIT License



---


# 11. Check your model directory


Run:


```cmd
cd /d D:\intern\image-enhancer-ai


dir image_enhancer\models

You should see:

rotation_model.h5
class_mapping.json

If you see them, good.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

image_enhancer_ai_upload-1.0.0.tar.gz (68.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

image_enhancer_ai_upload-1.0.0-py3-none-any.whl (68.1 MB view details)

Uploaded Python 3

File details

Details for the file image_enhancer_ai_upload-1.0.0.tar.gz.

File metadata

  • Download URL: image_enhancer_ai_upload-1.0.0.tar.gz
  • Upload date:
  • Size: 68.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for image_enhancer_ai_upload-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1f5c9ab48f5a60267437994aa1d8e7734782c45c9bb8b46802cb315330278b73
MD5 d92cba8433b58567c899839d7df80ad4
BLAKE2b-256 d8f7cee8003005bc8d766137b264cf7aab2debb41208231823c0e5b0666602eb

See more details on using hashes here.

File details

Details for the file image_enhancer_ai_upload-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for image_enhancer_ai_upload-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9389fe1b88d1591771c117aa2d128c4ffc1b6c77f0454dfcd1a44fcd61ce7bb3
MD5 b897b77ed70d03f346cf6007f6d31b0f
BLAKE2b-256 6199e0ccccbc40bf8649334fd8a7e76d4ecd14501f372e331d9aae1896f63a08

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.1

2 files

This release

1.0.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page