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](https://travis-ci.com/scivision/pibayer.svg?branch=master)](https://travis-ci.com/scivision/pibayer)
[![Maintainability](https://api.codeclimate.com/v1/badges/66560126d66fb438a9d4/maintainability)](https://codeclimate.com/github/scivision/raspicam-raw-bayer/maintainability)
[![PyPi version](https://img.shields.io/pypi/pyversions/pibayer.svg)](https://pypi.python.org/pypi/pibayer)
[![PyPi formats](https://img.shields.io/pypi/format/pibayer.svg)](https://pypi.python.org/pypi/pibayer)
[![PyPi Download stats](http://pepy.tech/badge/pibayer)](http://pepy.tech/project/pibayer)

# 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:
```sh
apt install python3-numpy

python3 -m pip install -e .
```

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

python3 -m pytest
```

To install advanced (HDF5, NetCDF4) image writing libraries:
```sh
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: libf77blas.so.3: cannot open shared object file: No such file or directory" by:
```sh
apt install libatlas-dev
```

## Examples

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

### RAW live video display
```sh
./getrawimage.py 0.01 -a
```

### Dump image stack to disk

* NetCDF: `./getrawimage.py 0.01 output.nc`
* HDF5: `./getrawimage.py 0.01 output.h5`
* TIFF: `./getrawimage.py 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](http://picamera.readthedocs.io/en/latest/fov.html#camera-modes)

---

> ValueError: cannot save to a group with the scipy.io.netcdf backend

is fixed by:
```sh
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

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 SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page