Skip to main content

Calibration and mapping between stage and camera coordinates in a microscope

Project description

Camera Stage Mapping calibration

This Python module allows you to calibrate a microscope's stage against the camera. By moving the sample a known number of steps, and tracking how far the image translates, it is possible to recover the number of steps per pixel. This code goes a step further, and recovers a 2x2 affine transformation matrix, so it will cope with rotation, flipping, and non-uniform scaling of the X and Y axes. The calibration routines are designed to be relatively robust and minimally parameterised, so they start by determining a sensible step size automatically.

As part of the calibration, you can use either FFT-based or directly calculated cross correlation to track motion of the sample. This code is probably useful on its own, and is found in the fft_image_tracking and correlation_image_tracking submodules. The underlying mechanism of tracking stage and camera coordinates simultaneously is handled by the CameraStageTracker class, in camera_stage_tracker. The main calibration function is camera_stage_calibration_1d.calibrate_backlash_1d. For 2D calibration, I recommend running this once for X and once for Y, then using camera_stage_calibration_1d.image_to_stage_displacement_from_1d to combine the two calibrations. This is more robust than the 2D grid calibration method.

Hardware interface

Rather than tie these functions to a specific class interface, as found in many lab control frameworks, the calibration routines simply require functions to be passed in as arguments. This is done for maximum flexibility, and to impose the fewest necessary constraints on the hardware we are controlling. In the future, we may define a class interface to use, and would welcome input on how to do this without forcing a particular taxonomy of laboratory instruments upon everyone using the library.

Installing

pip install camera-stage-mapping

This package is published on PyPI and can be installed using pip. It's managed using poetry and can be installed by cloning the repository and running poetry install. For details of how to set up a development environment, please see CONTRIBUTING.

Documentation

The functions all have fairly extensive docstrings and the module is documented on readthedocs.

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

camera_stage_mapping-0.1.6.tar.gz (40.7 kB view details)

Uploaded Source

Built Distribution

camera_stage_mapping-0.1.6-py3-none-any.whl (46.2 kB view details)

Uploaded Python 3

File details

Details for the file camera_stage_mapping-0.1.6.tar.gz.

File metadata

  • Download URL: camera_stage_mapping-0.1.6.tar.gz
  • Upload date:
  • Size: 40.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/5.4.109+

File hashes

Hashes for camera_stage_mapping-0.1.6.tar.gz
Algorithm Hash digest
SHA256 800f8f19fffec159294456342e4cb20edf8cb4fca0288a382a9b357fadc314a7
MD5 13d20e92a8e2536c205b46635c747b84
BLAKE2b-256 311b0689703546cb384fb8daee19c4fd8db70b479649ee6f01a97337e95a8cec

See more details on using hashes here.

File details

Details for the file camera_stage_mapping-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for camera_stage_mapping-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6bb47281a46527eb5eb7132157a56fc71a447d4eef13b3e7d4cb03644a6fc08c
MD5 4074c660ecc22478f51906d8e2346fca
BLAKE2b-256 a35854f285d800d235215d729e3c869197cd59ea5f308b28918a0da83a548a87

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