LibLLIE
is an open-source library for Low-Light Image Enhancement built on PyTorch.
This Python library provides a collection of traditional machine learning algorithms for low-light image enhancement. The library supports multiple color spaces and offers various methods for image enhancement. It is designed to be modular and easy to integrate into your existing projects.
The integration code for deep learning models is currently being developed and will be released soon !
Feel free to use this library in your research!
⭐ Star us on GitHub — your support means a lot!
-
-
HE series
-
Math series
-
Dark Channel Prior(DCP)
-
Multiple Color Spaces
-
Supported Algorithms for now :
HE Series: HE、CLAHE、RCLAHE
Math series: gamma correction、log transformation
Dark Channel Prior(DCP): implementation of paper : Single image haze removal using dark channel prior
Color Spaces: RGB、HLS、HSV、LAB、YUV...
More algorithms will be released soon !
There are two ways to install LibLLIE
.
conda create -n LlieLib python=3.8 -y
pip install -r requirements.txt
Method 1: Install from Source Code
git clone https://github.com/glory-wan/LLIE-Lib.git
pip install -e . # Editable mode, suitable for those who wish to modify the source code.
pip install . # Standard mode, suitable for installing the package without the need for further modification of the source code.
Method 2: Install Using a Compressed Package
With this method, you don't need to download the source code. Simply download a compressed package and execute the following command in your local Python environment.
The compressed package can be found at LLIE-Lib/dist
, or you can download it from the Releases section.
pip install LibLlie-1.0.tar.gz
To quickly start processing images using the command-line interface:
python example/commandTA.py --img path/to/img --method he --cs hsv --name he_hsv --display True
Supported algorithms and color spaces can be found in the LibLlie/troditionAlgorithm/config.py
file.
To use the library in a Python script:
from LibLlie.scriptTA import script_ta
img = script_ta(
img_path='path/to/img.jpg',
algorithm='he',
# following parameters are alternative
showimg=True,
saveimg=False,
# name='rgb_he',
# width=800,
# height=600,
# format='jpg',
# directory=results_path,
# clipLimit=2.0, # default = 2.0
# gridSize=8, # default = 8
# iteration=2, # default = 2
)
The configuration parameters for the algorithms can be set via the command line or within a script:
--img
: Path to the image file (URL or local path).--method
: Selected algorithm (e.g.,he
,clahe
,rclahe
).--cs
: Selected color space (e.g.,rgb
,hls
,hsv
,lab
,yuv
).
Optional parameters include clipLimit
, gridSize
, iteration
, name
, save
, format
, display
, width
, and height
.
More details can be found in the LibLlie/troditionAlgorithm/config.py
file.
Below are some examples demonstrating the enhancement effects achieved using LibLLIE
on low-light images.
Original vs Enhanced Images using HE series
the results of HE series
Original vs Enhanced Images using gamma correction
The input
The result with varying gamma values
for i in tqdm(np.arange(0.0, 30.0, 0.05)): # Gamma values from 0.0 to 30.0 with a step size of 0.05
gamma_img = gamma_correction(img, gamma=i)
gamma_correction.mp4
Original vs Enhanced Images using Dark Channel Prior
Original vs Enhanced Images using Single-Frame Multi-Enhancement Fusion
(This part of the code will be uploaded soon.)
Some parts of LLIELib
's code were completed with the assistance of Ln3214, BZ2116, zhlhlz, KyleTang-0711, Bainianzzz, purplers, Mystic2004, Humbleb11, 7dayu6 shazhou01.
We welcome contributions to improve this library. If you would like to contribute, please fork the repository, create a new branch, and submit a pull request.
If you have any question or suggestion, please feel free to contact us by raising an issue or sending an email to [email protected].
LibLLIE
is licensed under the MIT License. See the LICENSE file for more details.