Skip to content

Library for extracting raw bayer data from a Raspberry Pi JPEG+RAW file

License

Notifications You must be signed in to change notification settings

OsmoSystems/picamraw

Repository files navigation

picamraw

Library for extracting raw bayer data from a Raspberry Pi JPEG+RAW file.

Installable from PyPI; usable without camera hardware present.

Usage example

Extract raw bayer array

from picamraw import PiRawBayer, PiCameraVersion

raw_bayer = PiRawBayer(
    filepath='path/to/image.jpeg',  # A JPEG+RAW file, e.g. an image captured using raspistill with the "--raw" flag
    camera_version=PiCameraVersion.V2,
    sensor_mode=0
)
raw_bayer.bayer_array   # A 16-bit 2D numpy array of the bayer data
raw_bayer.bayer_order   # A `BayerOrder` enum that describes the arrangement of the R,G,G,B pixels in the bayer_array
raw_bayer.to_rgb()      # A 16-bit 3D numpy array of bayer data collapsed into RGB channels (see docstring for details).
raw_bayer.to_3d()       # A 16-bit 3D numpy array of bayer data split into RGB channels (see docstring for details).

Testing

This package is tested using tox. To run tests, simply pip install tox and then run tox.

Note: this code is only expected to work with images captured with camera version V2 and sensor_mode 0 (e.g. raspistill --raw -o myimage.jpg). Raspbberry Pi Camera V1.x hardware is unsupported (see #8).

Attribution

This library was forked from the PiCamera package and heavily modified.

About

Library for extracting raw bayer data from a Raspberry Pi JPEG+RAW file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages