Skip to main content

Python bindings for apriltags v3

Project description

pupil-apriltags: Python bindings for the apriltags3 library

Build Status

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:

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 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(searchpath=['apriltags'],
                       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
searchpath ['apriltags'] Where to look for the Apriltag 3 library, must be a list
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.

Custom layouts

If you want to use a custom layout, you need to create the C source and header files for it and then build the library again. Then use the new libapriltag.so library. You can find more information on the original Apriltags repository.

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.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-cp37-cp37m-win_amd64.whl (3.7 MB view details)

Uploaded CPython 3.7mWindows x86-64

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

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64

pupil_apriltags-1-cp37-cp37m-macosx_10_12_x86_64.whl (8.1 MB view details)

Uploaded CPython 3.7mmacOS 10.12+ x86-64

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

Uploaded CPython 3.6mWindows x86-64

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

Uploaded CPython 3.6mmanylinux: glibc 2.12+ x86-64

pupil_apriltags-1-cp36-cp36m-macosx_10_12_x86_64.whl (8.1 MB view details)

Uploaded CPython 3.6mmacOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pupil-apriltags-1.tar.gz
Algorithm Hash digest
SHA256 106fe1862fb61f5eea2ef9d462f8b50bdeb5a491cdb73c666e87279353786a96
MD5 4f1f7c27d3af89d853e6ddd9d59c32db
BLAKE2b-256 751d592037acdb0b09f005e6063b02843cfcc1802f5c2042c5c88daeea2f7c4e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pupil_apriltags-1-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/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for pupil_apriltags-1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 f4a5145dfe27388873e7a0486ddd140c5eb7e35b228b866fb2a32ef501d8edd3
MD5 5d8641b8b6ad1df2948c3b220863d8fd
BLAKE2b-256 264744a0541fa92ba93f9fad533b6ec67f9bb187d4dea909ac0a19f8913cf84c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pupil_apriltags-1-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/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for pupil_apriltags-1-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 7bfb799fed59c09be818578badc4ac7fb7553c1cc492f7060299a86a35024f16
MD5 95d19addca973b2bf96146ba993150e3
BLAKE2b-256 ec9482b5c1a705caa34deef848912f02848d5c06918a77de211de15c611a34fc

See more details on using hashes here.

File details

Details for the file pupil_apriltags-1-cp37-cp37m-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: pupil_apriltags-1-cp37-cp37m-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 8.1 MB
  • Tags: CPython 3.7m, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for pupil_apriltags-1-cp37-cp37m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d0d1850cfe1e0edb7a2573ed82c05d95d69630800188a85847f2b48cdf378ba5
MD5 29e3b69f00b3d737905ebbd8399d6a92
BLAKE2b-256 d6fc3a2925f05be860e57be58449159f0b73523e44b9d715bb75c68d3b727fcf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pupil_apriltags-1-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/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for pupil_apriltags-1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 50ed47d3e2fa7424a6bdf0df1ee39a708d59d1611436887151b3eae83eef17f0
MD5 3a1af844aea09d26a63082f94b8450f7
BLAKE2b-256 533aa2ba96f52cece5f11541d2f6a92b2494052552563b37c91025eb0b4b6f6e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pupil_apriltags-1-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/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for pupil_apriltags-1-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 b8eda86bb481f0f37214a9d9afbbf8bfbeeb08291c76bac626968ba7fc8f6110
MD5 9c7cb630781293df9cd386ef0a2f171f
BLAKE2b-256 270aca5690d500a258acd1644a232b9eeefcafb9caedd2e521e29878a0bd1ef2

See more details on using hashes here.

File details

Details for the file pupil_apriltags-1-cp36-cp36m-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: pupil_apriltags-1-cp36-cp36m-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 8.1 MB
  • Tags: CPython 3.6m, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for pupil_apriltags-1-cp36-cp36m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d059380c2a91213b797f5f208af36ac863cc08576b4663411f89d357a753583e
MD5 69c6b9f8a55848070a7cde66715796d0
BLAKE2b-256 c32f0d12931de91f604bccff761b235a629adf8716804ef43b7aa6e0367342dd

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