Metadata-Version: 2.4
Name: lide
Version: 1.0.0
Summary: Local Intensity Distribution Equalization – Python port of github.com/peune/lide
License-Expression: Apache-2.0
Keywords: image,enhancement,histogram,equalization,lide
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Scientific/Engineering :: Image Processing
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: numpy>=1.24
Requires-Dist: opencv-python>=4.7
Requires-Dist: scipy>=1.10

# lide-python — Image Enhancement Library

Python port of [peune/lide](https://github.com/peune/lide) (C++), which accompanies the paper:

> *Image enhancement using local intensity distribution equalization*
> https://jivp-eurasipjournals.springeropen.com/articles/10.1186/s13640-015-0085-2

Also includes Pixel Sorting (PS1/PS2) from:

> *Image enhancement by pixels sorting*
> Sanparith Marukatat and Pichid Kittisuwan
> https://ieeexplore.ieee.org/document/8619964

## Install

```bash
pip install lide
```

Or directly from GitHub:

```bash
pip install git+https://github.com/peune/lide-python.git
```

## Methods

| ID | Name | Description |
|----|------|-------------|
| 0  | HE      | Standard Histogram Equalization |
| 1  | AHE     | Adaptive Histogram Equalization (CLAHE-style clipping) |
| 2  | DHE     | Dynamic Histogram Equalization |
| 3  | MHE     | Multi-interval Histogram Equalization |
| 4  | ESIHE   | Exposure-based Sub-Image HE |
| 5  | BPHEME  | Brightness-Preserving HE using Mean |
| 6  | FHSABP  | Flattest Histogram Spec. with Adaptive Brightness Preservation |
| 7  | HEGMM   | HE using Gaussian Mixture Model |
| 8  | LIDEG   | LIDE simple – Gaussian model |
| 9  | LIDEL   | LIDE simple – Laplacian model |
| 10 | LIDEGMM | LIDE mixture – Gaussian model |
| 11 | LIDELMM | LIDE mixture – Laplacian model |
| 12 | PS1     | Pixel Sorting variant 1 |
| 13 | PS2     | Pixel Sorting variant 2 |

## Python API

```python
import cv2
from lide import color_enhance, EnhanceParam, ENHANCE_LIDEG, ENHANCE_HE

img = cv2.imread("input.jpg")   # BGR uint8

# Standard histogram equalization
param = EnhanceParam(method=ENHANCE_HE)
out = color_enhance(img, param)
cv2.imwrite("out_he.jpg", out)

# LIDE (Gaussian, local window 100px)
param = EnhanceParam(method=ENHANCE_LIDEG, d=100, lide_sigma_min=30.0)
out = color_enhance(img, param)
cv2.imwrite("out_lide.jpg", out)
```

### Grayscale only

```python
import cv2
from lide import enhance, EnhanceParam, ENHANCE_MHE

gray = cv2.imread("input.jpg", cv2.IMREAD_GRAYSCALE)
param = EnhanceParam(method=ENHANCE_MHE, mhe_mmin=5, mhe_mmax=10)
out = enhance(gray, param)
cv2.imwrite("out_mhe.jpg", out)
```

## Command-line

```bash
lide -in input.jpg -out output.jpg -method 8
lide -in input.jpg -out output.jpg -method 1 -AHE:clipping 0.03 -ALL:d 50
lide -in input.jpg -out output.jpg -method 13 -PS:wei 5.0
```

Run `lide --help` for all options.

## Dependencies

- numpy >= 1.24
- opencv-python >= 4.7
- scipy >= 1.10
