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.0.tar.gz (17.7 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.0-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rawhandler-0.2.0.tar.gz
  • Upload date:
  • Size: 17.7 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.0.tar.gz
Algorithm Hash digest
SHA256 314f6e130f314c59ef33ebe9aa7fa8fe1e56ecc22ba2516aa6315eda8eac8caa
MD5 a9e3649469437720470d8003a99a4d9e
BLAKE2b-256 cc6a98fe8a4d3b4feaa7fd18b63bff0114da45cb106c36464a2c39e4b6cc6bee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rawhandler-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a21a4bb83dbad240de8dc7c49f72986bc1d9da2c21d919c435cf312fa430d0d
MD5 c32bdeefe7a2b62ad2feb9f960d7cd54
BLAKE2b-256 6dcfc4da80228a27746974554b14b25ec51f9f6055e072013e93d246f21ccd27

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