Skip to main content

Python bindings for apriltags v3

Project description

pupil-apriltags: Python bindings for the apriltags3 library

Build Status PyPI PyPI - Python Version PyPI - Format

These are Python bindings for the Apriltags3 library developed by AprilRobotics, specifically adjusted to work with the pupil-labs software. The original bindings were provided by duckietown and were inspired by the Apriltags2 bindings by Matt Zucker.

How to get started:

Requirements

Note that pupil-apriltags currently only runs on Python 3.6 or higher.

Also we are using a newer python build system, which can fail for older versions of pip with potentially misleading errors. Please make sure you are using pip > 19 or consider upgrading pip to the latest version to be on the safe side:

python -m pip install --upgrade pip

Install from PyPI

This is the recommended and easiest way to install pupil-apriltags.

pip install pupil-apriltags

We offer pre-built binary wheels for common operating systems. In case your system does not match, the installation might take some time, since the native library (apriltags-source) will be compiled first.

Manual installation from source (for development)

You can of course clone the repository and build from there. For development you should install the development requirements as well. This project uses the new python build system configuration from PEP 517 and PEP 518.

# clone the repository
git clone --recursive https://github.com/pupil-labs/apriltags.git
cd apriltags

# install apriltags in editable mode with development requirements
pip install -e .[dev]

# run tests
tox

Usage

Some examples of usage can be seen in the src/pupil_apriltags/bindings.py file.

The Detector class is a wrapper around the Apriltags functionality. You can initialize it as following:

from pupil_apriltags import Detector

at_detector = Detector(families='tag36h11',
                       nthreads=1,
                       quad_decimate=1.0,
                       quad_sigma=0.0,
                       refine_edges=1,
                       decode_sharpening=0.25,
                       debug=0)

The options are:

Option Default Explanation
families 'tag36h11' Tag families, separated with a space
nthreads 1 Number of threads
quad_decimate 2.0 Detection of quads can be done on a lower-resolution image, improving speed at a cost of pose accuracy and a slight decrease in detection rate. Decoding the binary payload is still done at full resolution. Set this to 1.0 to use the full resolution.
quad_sigma 0.0 What Gaussian blur should be applied to the segmented image. Parameter is the standard deviation in pixels. Very noisy images benefit from non-zero values (e.g. 0.8)
refine_edges 1 When non-zero, the edges of the each quad are adjusted to "snap to" strong gradients nearby. This is useful when decimation is employed, as it can increase the quality of the initial quad estimate substantially. Generally recommended to be on (1). Very computationally inexpensive. Option is ignored if quad_decimate = 1
decode_sharpening 0.25 How much sharpening should be done to decoded images? This can help decode small tags but may or may not help in odd lighting conditions or low light conditions
debug 0 If 1, will save debug images. Runs very slow

Detection of tags in images is done by running the detect method of the detector:

tags = at_detector.detect(img, estimate_tag_pose=False, camera_params=None, tag_size=None)

If you also want to extract the tag pose, estimate_tag_pose should be set to True and camera_params ([fx, fy, cx, cy]) and tag_size (in meters) should be supplied. The detect method returns a list of Detection objects each having the following attributes (note that the ones with an asterisks are computed only if estimate_tag_pose=True):

Attribute Explanation
tag_family The family of the tag.
tag_id The decoded ID of the tag.
hamming How many error bits were corrected? Note: accepting large numbers of corrected errors leads to greatly increased false positive rates. NOTE: As of this implementation, the detector cannot detect tags with a Hamming distance greater than 2.
decision_margin A measure of the quality of the binary decoding process: the average difference between the intensity of a data bit versus the decision threshold. Higher numbers roughly indicate better decodes. This is a reasonable measure of detection accuracy only for very small tags-- not effective for larger tags (where we could have sampled anywhere within a bit cell and still gotten a good detection.)
homography The 3x3 homography matrix describing the projection from an "ideal" tag (with corners at (-1,1), (1,1), (1,-1), and (-1, -1)) to pixels in the image.
center The center of the detection in image pixel coordinates.
corners The corners of the tag in image pixel coordinates. These always wrap counter-clock wise around the tag.
pose_R* Rotation matrix of the pose estimate.
pose_t* Translation of the pose estimate.
pose_err* Object-space error of the estimation.

Changelog

1.0.3 (2020-04-07)

Changed

  • Python wheels for macOS will be built on 10.13 due to 10.12 being deprecated.

1.0.2 (2020-04-06)

Changed

  • Added CHANGELOG.md to MANIFEST.in - #27

1.0.1 (2020-01-07)

Changed

  • Switched to semantic versioning format.

Documentation

  • Added changelog.
  • Cleaned up and corrected docs in README.

1 (2019-09-24)

  • Initial release.

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

pupil-apriltags-1.0.3.tar.gz (1.9 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pupil_apriltags-1.0.3-cp37-cp37m-win_amd64.whl (3.7 MB view details)

Uploaded CPython 3.7mWindows x86-64

pupil_apriltags-1.0.3-cp37-cp37m-manylinux2010_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64

pupil_apriltags-1.0.3-cp37-cp37m-macosx_10_13_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.7mmacOS 10.13+ x86-64

pupil_apriltags-1.0.3-cp36-cp36m-win_amd64.whl (3.7 MB view details)

Uploaded CPython 3.6mWindows x86-64

pupil_apriltags-1.0.3-cp36-cp36m-manylinux2010_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.12+ x86-64

pupil_apriltags-1.0.3-cp36-cp36m-macosx_10_13_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.6mmacOS 10.13+ x86-64

File details

Details for the file pupil-apriltags-1.0.3.tar.gz.

File metadata

  • Download URL: pupil-apriltags-1.0.3.tar.gz
  • Upload date:
  • Size: 1.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.8

File hashes

Hashes for pupil-apriltags-1.0.3.tar.gz
Algorithm Hash digest
SHA256 5e3baac40433f0cba56880d9b42585eba9d15b45c383459b4c8418b216ea06d2
MD5 6cebee1083c0bee0558cc6a3eed626aa
BLAKE2b-256 3ecfef5c7e3b3cdde874e576fd8d63b75f0d8a65e62fad09a8f6430475c4d650

See more details on using hashes here.

File details

Details for the file pupil_apriltags-1.0.3-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pupil_apriltags-1.0.3-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 3.7 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for pupil_apriltags-1.0.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 e61a86098b86acf975ef69582c59605aa75120afb353767f90f9b8d85b2b15d2
MD5 81ae55c3e39ae45f12c7e6aa5e2ff6f8
BLAKE2b-256 034c1f8e21afeef7a0b70947a9acb4dcc6db5d7d2dce0620fdbb2e4c19b0b0b7

See more details on using hashes here.

File details

Details for the file pupil_apriltags-1.0.3-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: pupil_apriltags-1.0.3-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 7.0 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for pupil_apriltags-1.0.3-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 c7039fb526c3f0ed0309b2df727ee420f03f60cac0bcfa6a92dfbb3619735532
MD5 0b90bc765c2bee03448c1282f1688e63
BLAKE2b-256 ef3699900091aee3e972c7af16b67757fba8f0b22c6601711080bde2817d744e

See more details on using hashes here.

File details

Details for the file pupil_apriltags-1.0.3-cp37-cp37m-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: pupil_apriltags-1.0.3-cp37-cp37m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 8.2 MB
  • Tags: CPython 3.7m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for pupil_apriltags-1.0.3-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a3bd8ce0e3f7f1f5783deeb2435548a82b5ac54209a120ad466b31450c373dd7
MD5 05ae1423420fac129d87943c0af56cec
BLAKE2b-256 c16787922ec35a9284ee80490ef7a32c2795b03c86dbd3d8b9bd19961fb87c27

See more details on using hashes here.

File details

Details for the file pupil_apriltags-1.0.3-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: pupil_apriltags-1.0.3-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 3.7 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.8

File hashes

Hashes for pupil_apriltags-1.0.3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 0078264088a197a12c76a3cd63e1ed8f333baf3068a3104f6b7898922d279585
MD5 e810ae2f2fd2984489b58ee44748312d
BLAKE2b-256 2606de9c374d44a6ed74bf0204b7234287c69d25fe48dd151d24320c6429f335

See more details on using hashes here.

File details

Details for the file pupil_apriltags-1.0.3-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: pupil_apriltags-1.0.3-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 7.0 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.8

File hashes

Hashes for pupil_apriltags-1.0.3-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 a3188336181f01de341e80e93d63a4e4cc2de9966b537083317084c22bafcf2e
MD5 627e1a2b96fbfcc26713a16823b44200
BLAKE2b-256 68a301f4ab2c2ccbdf08ead219e69ffaa4f125f43b90361a020c1bb4066ebbc1

See more details on using hashes here.

File details

Details for the file pupil_apriltags-1.0.3-cp36-cp36m-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: pupil_apriltags-1.0.3-cp36-cp36m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 8.2 MB
  • Tags: CPython 3.6m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.8

File hashes

Hashes for pupil_apriltags-1.0.3-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 8f27e5d9fa23b6a7c6a8f81da5552d0bac99d5f461a0a509ddabdfe928c6ff9a
MD5 1afcedd03175d70ee1b4fa25ef0929af
BLAKE2b-256 eafdc141ec4c07a1ef60e7066ef5732c71a01f89046006d834c7bd3ec0526d0a

See more details on using hashes here.

Supported by

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