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.1.tar.gz (17.8 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.1-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for rawhandler-0.2.1.tar.gz
Algorithm Hash digest
SHA256 62de6bbcd9e303bf122c5f623c1f135234993c1c0a629a469955952f1c5be1c3
MD5 a6e243780f08cde3e32c2c602ef4ebf9
BLAKE2b-256 09b564376d56ff93a38f67aa2b4d29031d31b781adda88f484dbe1c4a3dedcec

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for rawhandler-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba7fbf01f92dcbce6158f7dd1ad195960377d12a8de21948f227d992280de9be
MD5 70cc1a9ab66c60fb6b55f6d818c4ff73
BLAKE2b-256 ff1b78e1eba7e20a82015c95cabffd501fcc47b31fda7b3e80a8526749ae5b32

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