Metadata-Version: 2.4
Name: image-enhancer-ai-upload
Version: 1.0.0
Summary: AI-powered image enhancement and document correction toolkit
Author: Image Enhancer AI Team
License: MIT License
        
        Copyright (c) 2026 Image Enhancer AI Team
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Keywords: image-processing,image-enhancement,computer-vision,opencv,document-processing,image-quality,rotation-correction,blur-detection,noise-removal
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Image Processing
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: <3.13,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy<2.0,>=1.24
Requires-Dist: opencv-python<5.0,>=4.8
Requires-Dist: tensorflow<2.20,>=2.15
Dynamic: license-file

# 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.


```text
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.
