Skip to main content

Acquire raw Bayer-masked image from Raspberry Pi camera and write image stack to HDF5 or TIFF.

Project description

[![Build Status](](
[![PyPi version](](
[![PyPi formats](](
[![PyPi Download stats](](

# Raspicam raw Bayer mask pixels

Acquire RAW Bayer-masked images with Raspberry Pi camera (before demosaicking).
Writes HDF5, NetCDF or TIFF compressed image stacks.

## Install

To be installed directly on the Raspberry Pi, using Python ≥ 3.5:
apt install python3-numpy

python3 -m pip install -e .

Running the self-test must be done on a Raspberry Pi with camera module:
python3 -m pip install -e .[tests]

python3 -m pytest

To install advanced (HDF5, NetCDF4) image writing libraries:
apt install python3-netcdf4 python3-h5py

### Tips
* Avoid MMAL errors: `raspi-config` → Advanced Options → Memory Split should be 128 MB, not 64 MB.
* Fix error "ImportError: cannot open shared object file: No such file or directory" by:
apt install libatlas-dev

## Examples

Setting of exposure time manually (seconds) is mandatory to avoid mistakes in experiments.

### RAW live video display
./ 0.01 -a

### Dump image stack to disk

* NetCDF: `./ 0.01`
* HDF5: `./ 0.01 output.h5`
* TIFF: `./ 0.01 output.tif`

## Command-Line Options

* `-a` GPU-based preview, for aiming camera (fast)
* `-p` use Matplotlib for slow, live (10 seconds per frame) display
* `-e` exp_sec manually set exposure time, up to one second (there are still some auto-set gains)
* `-8` output 8-bit array instead of default 10-bit array

## Notes

[Constraints on exposure time](


> ValueError: cannot save to a group with the backend

is fixed by:
apt install libnetcdf-dev

pip install netcdf4

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

pibayer-0.6.0.tar.gz (5.6 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page