Skip to main content

A basic library to handle camera raw files for use in machine learning. Built on rawpy and cv2.

Project description

RawHandler

PyPI version License: MIT Python version

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:

  1. Open and convert most camera raw files into numpy arrays.

  2. Apply black and white point correction automatically.

  3. Provide multiple representations of the underlying sensor data:

    • Mono Bayer representation
    • 3-channel sparse representation
    • 4-channel RGGB representation
  4. Demosaic Bayer data using colour-demosaicing, supporting:

    • Bilinear interpolation
    • Malvar–He–Cutler (2004)
    • DDFAPD – Menon et al. (2007)
  5. 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.

  6. Crop, resize, and generate thumbnails while preserving Bayer pattern alignment.

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

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

rawhandler-0.2.2.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rawhandler-0.2.2-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file rawhandler-0.2.2.tar.gz.

File metadata

  • Download URL: rawhandler-0.2.2.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for rawhandler-0.2.2.tar.gz
Algorithm Hash digest
SHA256 b91b5e24b1f82588ab96efcab70131f7b355f7df4d8eca0744ed6de80be29a32
MD5 83db7059d4caef8759e2dd009d7108d0
BLAKE2b-256 d63ffc3e5446cbf4e047408415c943360dc6eaadeb83ed7fd6a3b0d30b4aba0b

See more details on using hashes here.

File details

Details for the file rawhandler-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: rawhandler-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for rawhandler-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 888b817669394ad190c5e2b9bc6905006b76e28423a3f5d987bb9e1f470a4e27
MD5 360e677375314104b15b4b61bbefb3cc
BLAKE2b-256 ae43a9a1698fa53a9f199826b315316a5a253ef4eeec0aef5d797bb44bb0637f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page