A basic library to handle camera raw files for use in machine learning. Built on rawpy and cv2.
Project description
RawHandler
RawHandler is a lightweight wrapper around rawpy that provides convenient tools for working with raw sensor data, particularly for training neural networks on raw images.
Features
RawHandler can:
-
Open and convert most camera raw files into numpy arrays.
-
Apply black and white point correction automatically.
-
Provide multiple representations of the underlying sensor data:
- Mono Bayer representation
- 3-channel sparse representation
- 4-channel RGGB representation
-
Demosaic Bayer data using colour-demosaicing, supporting:
- Bilinear interpolation
- Malvar–He–Cutler (2004)
- DDFAPD – Menon et al. (2007)
-
Convert color spaces from the camera’s native space to standard targets such as XYZ, sRGB, AdobeRGB, or linear Rec.2020 — all available for every representation.
-
Crop, resize, and generate thumbnails while preserving Bayer pattern alignment.
-
Read EXIF/metadata information (ISO, shutter speed, orientation, etc.) and return it as a convenient Python dictionary.
Currently supported: Bayer raw images In progress: Fujifilm X-Trans support
Installation
You can install RawHandler directly from PyPI:
pip install RawHandler
Or install locally from source:
# Clone the repository
git clone https://github.com/rymuelle/RawHandler.git
cd RawHandler
# Editable/development install
pip install -e .
# Standard local install
pip install .
Example
A simple demo notebook is available:
examples/simple_demosaicing.ipynb
This example downloads a raw image and demonstrates the basic functionality of RawHandler.
License
This project is released under the MIT License.
Acknowledgments
Special thanks to the authors of RawNIND:
Brummer, Benoit; De Vleeschouwer, Christophe, 2025. Raw Natural Image Noise Dataset. https://doi.org/10.14428/DVN/DEQCIM, Open Data @ UCLouvain, V1.
Updating
1. Update version in pyproject.toml
2. Clean old builds
rm -rf dist build *.egg-info
3. Build
python -m build
4. Check
twine check dist/*
5. Upload
twine upload --repository testpypi dist/*
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rawhandler-0.0.3.tar.gz.
File metadata
- Download URL: rawhandler-0.0.3.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4b1f2c65ec8a759336181bb4d84787b2b9c98b75b96bcdb2739665963596602
|
|
| MD5 |
7dca0d0551707563c5d6defc7ad31a8a
|
|
| BLAKE2b-256 |
9a2ba064e47fc812cc47b0a89cfecc2c7ad37ec177d168fa039528a4de374083
|
File details
Details for the file rawhandler-0.0.3-py3-none-any.whl.
File metadata
- Download URL: rawhandler-0.0.3-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3708f62b74950a51cc4513ff585f7d8d2cb22eb69571371e7b27a796de3ac006
|
|
| MD5 |
9191a62a0e7ec5276b4b3861fd521745
|
|
| BLAKE2b-256 |
e4cbd767a0953997a5b00b29d1690310d6caf555244edaf043c3bcf6481e35a6
|