Metadata-Version: 2.4
Name: Doc-Qual
Version: 0.1.0
Summary: Image quality scoring for OCR readiness
Project-URL: Homepage, https://github.com/PradeepMadhavankutty/doc-qual
Project-URL: Repository, https://github.com/PradeepMadhavankutty/doc-qual
Project-URL: Issues, https://github.com/PradeepMadhavankutty/doc-qual/issues
Author-email: Pradeep Madhavankutty <pradeep.madhavankutty@gmail.com>
License: MIT License
        
        Copyright (c) 2026 Pradeep Madhavankutty
        
        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.
License-File: LICENSE
Keywords: computer-vision,document,image-quality,ocr,preprocessing
Classifier: Development Status :: 3 - Alpha
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.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Image Recognition
Requires-Python: >=3.9
Requires-Dist: numpy>=1.21
Requires-Dist: opencv-python>=4.5
Provides-Extra: dev
Requires-Dist: black; extra == 'dev'
Requires-Dist: build; extra == 'dev'
Requires-Dist: isort; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs; extra == 'docs'
Requires-Dist: mkdocstrings[python]; extra == 'docs'
Provides-Extra: validation
Requires-Dist: matplotlib; extra == 'validation'
Provides-Extra: validation-easyocr
Requires-Dist: easyocr; extra == 'validation-easyocr'
Provides-Extra: validation-tesseract
Requires-Dist: pytesseract; extra == 'validation-tesseract'
Provides-Extra: viz
Requires-Dist: matplotlib; extra == 'viz'
Description-Content-Type: text/markdown

# Doc-Qual

`Doc-Qual` is a lightweight Python package for estimating whether a document image is ready for OCR before you spend time and money running OCR.

It computes a 0-100 OCR readiness score from interpretable image features:

| Feature | What it measures |
| --- | --- |
| Sharpness | Laplacian variance for blur detection |
| Noise | Gaussian residual noise estimate |
| Edges | Canny edge density for text-like structure |
| Skew | Hough-line based rotation estimate |
| Brightness | Exposure and contrast balance |
| Ridges | Hessian response for stroke-like structures |

## Installation

Install directly from GitHub (PyPI release coming soon):

```bash
pip install git+https://github.com/PradeepMadhavankutty/doc-qual.git
```

For development:

```bash
git clone https://github.com/PradeepMadhavankutty/doc-qual.git
cd doc-qual
pip install -e ".[dev]"
```

## Python Usage

```python
from doc_qual import compute_doc_qual_score

result = compute_doc_qual_score("scan.jpg", verbose=False)

print(result.ocr_score)
print(result.passed)
print(result.recommendations)
```

## CLI Usage

```bash
doc-qual path/to/image.jpg
doc-qual path/to/image.jpg --format json
doc-qual path/to/image.jpg --threshold 60
```

When `--threshold` is provided, the CLI exits with code `1` if the image score is below the threshold. This makes it useful in CI and batch document-processing pipelines.

## Current Status

This is an alpha implementation with expert-calibrated default weights. The long-term research direction is to calibrate feature weights empirically against OCR character error rate across datasets and engines.

## Development

```bash
pytest
ruff check .
python -m build
```

## License

MIT
