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.

Filename, size & hash SHA256 hash help File type Python version Upload date
pibayer-0.6.0.tar.gz (5.6 kB) Copy SHA256 hash SHA256 Source None Aug 21, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page