Skip to main content

SPECTACLE camera calibration module

Project description

SPECTACLE

SPECTACLE (Standardised Photographic Equipment Calibration Technique And CataLoguE) is a standardised methodology for the spectral and radiometric calibration of consumer camera data. More information on the SPECTACLE methodology, including results from applying it to several cameras, can be found in our paper: https://doi.org/10.1364/OE.27.019075

The camera calibration data described in the paper are available from this link.

This repository contains the associated spectacle Python module. This module can be used to calibrate data using previously obtained calibration data (measured by the user or retrieved from the SPECTACLE database). It also includes functions and pre-made scripts for processing calibration data, as described in the paper linked above.

Installation

Currently, the easiest way to install the spectacle module is using pip: simply run pip install pyspectacle in your terminal to fetch the package from PyPI and install it.

You may have to specify a user-specific installation (pip install pyspectacle --user) if a permission error occurs. Please note that while the module is identified as pyspectacle on PyPI and in pip, in Python itself it is imported and used as simply spectacle.

An alternative way to install the spectacle module is to clone this repository (git clone git@github.com:monocle-h2020/camera_calibration.git) and then install it using pip, by navigating into the repository folder and running pip install . (mind the .).

Usage

There are three main use cases for the spectacle module, each of which will be explained further in the relevant subsection. They are as follows:

  1. Application: applying camera calibrations to new data.
  2. Analysis: analysing camera properties and performance based on calibration data.
  3. Calibration: generating calibration data for use in the two other use cases.

Application

Calibrations are applied to existing data using the spectacle.Camera interface. In short, a Python object is created that represents a camera (for example the iPhone SE or Nikon D5300) and holds all the relevant information. This object has methods (functions, subroutines) corresponding to the different calibrations that can be done. When called, these methods automatically retrieve the appropriate calibration data. Each method comes with detailed documentation on its usage, which can be found in the individual scripts or from within Python (using Python's help function or iPython's ? and ?? shortcuts).

A camera information file is generated using the generate_camera.py script. This camera information file can be loaded in any script using the spectacle.load_camera function, which takes one argument, namely the root folder that contains all calibration data for a certain camera.

For example, if your calibration data for an iPhone SE are stored in the folder /home/spectacle_data/iPhone_SE/, then that folder is the root folder and the camera information file should be located in that folder (i.e. at /home/spectacle_data/iPhone_SE/metadata.json). Then the Camera object can be initialised from that file and used in the future.

Calibrations are applied using the Camera object's methods, such as Camera.correct_bias for correcting for camera bias. The Camera object will automatically load the required calibration data from the same folder it was initialised from.

Using the example of the iPhone SE, one might run the following piece of code:

from spectacle import load_camera, io

camera = load_camera("/home/spectacle_data/iPhone_SE/")
raw_data = io.load_raw_image("/home/img_0001.dng")

data_corrected = camera.correct_bias(raw_data)

This code snippet loads the iPhone SE camera data and a RAW image file (/home/img_0001.dng), then corrects the RAW image data for the iPhone SE camera bias.

Analysis

A large number of pre-made scripts for the analysis of camera data, calibration data, and metadata are provided in the analysis subfolder. These are sorted by the parameter they probe, such as linearity or dark current. Please refer to the README in the analysis subfolder and documentation in the scripts themselves for further information. A number of common methods for analysing these data have also been bundled into the spectacle.analyse submodule.

Calibration

Finally, pre-made scripts for generating calibration data based on data gathered by the user are provided in the calibration subfolder. These are sorted by the parameter they probe, such as bias or flat-field response. Furthermore, a script is provided that combines calibration data generated this way into a format that can be uploaded to the SPECTACLE database. Please refer to the README in the calibration subfolder and documentation in the scripts themselves for further information.

Further information

The SPECTACLE method itself has been fully developed and applied, as shown in our paper. The SPECTACLE database and spectacle Python module are still in active development. Contributions from the community are highly welcome and we invite everyone to contribute.

Further information will be added to this repository with time. If anything is missing, please raise an issue or contact the authors directly.

This project has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreement No 776480 (MONOCLE).

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

pyspectacle-3.1.2.tar.gz (54.0 kB view details)

Uploaded Source

Built Distribution

pyspectacle-3.1.2-py3-none-any.whl (64.4 kB view details)

Uploaded Python 3

File details

Details for the file pyspectacle-3.1.2.tar.gz.

File metadata

  • Download URL: pyspectacle-3.1.2.tar.gz
  • Upload date:
  • Size: 54.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/58.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for pyspectacle-3.1.2.tar.gz
Algorithm Hash digest
SHA256 2f59ff5812c31aaa9f3302b2cf807355b76d85ce06c050f4ad0327f800245468
MD5 f9ebafc42285d96c4ff3e10a7412d79d
BLAKE2b-256 e10ca88f61810612b81e5cd67654537532fe3d42cb44014802ae719d3d3cdf89

See more details on using hashes here.

File details

Details for the file pyspectacle-3.1.2-py3-none-any.whl.

File metadata

  • Download URL: pyspectacle-3.1.2-py3-none-any.whl
  • Upload date:
  • Size: 64.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/58.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for pyspectacle-3.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 955dc5c688722b31f7044b26dd47e7b285b19fc0f09af7fd3368b9ef2dafacd7
MD5 7fe94f14b956b76012cfd4ba243fbeb2
BLAKE2b-256 0b3b43e3b41337d578db313cc0490865fd2ca40f0d5a59f16cd00eeb7d0614e9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page