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

Uploaded CPython 3.7mWindows x86-64

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

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.6mWindows x86-64

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

Uploaded CPython 3.6mmanylinux: glibc 2.12+ x86-64

pupil_apriltags-0.dev0-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-0.dev0.tar.gz.

File metadata

  • Download URL: pupil-apriltags-0.dev0.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-0.dev0.tar.gz
Algorithm Hash digest
SHA256 72688a8bcaa1c5ecf6597e9ed1ba420f9a0fe7a59b2105c45caaf3dd43bbfedc
MD5 15a3f3bde867e2b156d958628e542744
BLAKE2b-256 f94832e53abeb1744bec9f24aaac629001e77f0aed5ee9697f49c2799f2abd20

See more details on using hashes here.

File details

Details for the file pupil_apriltags-0.dev0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pupil_apriltags-0.dev0-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-0.dev0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 fcb2645b6f80ba87d15a836578419705f64bde0490c4f346b16868ec812ca9a8
MD5 0e1867643938268c8b17e3cfdc724691
BLAKE2b-256 a53767309f9bd23af73c8b7f10488e83bbc4a0e9bd9ab3788f7faf57fc0bed9d

See more details on using hashes here.

File details

Details for the file pupil_apriltags-0.dev0-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: pupil_apriltags-0.dev0-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-0.dev0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 9a1dbcf28183b3d7b296e78fc3ebd3571ff55ea74cbcd521358b8743bd30efb0
MD5 ae9060d3846822eb168ba400bc83c212
BLAKE2b-256 39d71483c579b835b5423cc6a4cfc2f9428bded677894a3d41a986f35ac36d32

See more details on using hashes here.

File details

Details for the file pupil_apriltags-0.dev0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: pupil_apriltags-0.dev0-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-0.dev0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 71d0500678e11162f8a7988d918bf0b2569547ae69f576e11d6d33a106e1da29
MD5 cbecd29c97b9ddccaadaa3b433c580ae
BLAKE2b-256 985696e9568fa07077feb7af2cdbd7d1c801309fd9af07935780846918399f37

See more details on using hashes here.

File details

Details for the file pupil_apriltags-0.dev0-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: pupil_apriltags-0.dev0-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-0.dev0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 7e81bb4da42d278595dab814dc930825dfe261bba30c2be5ffc1769a75bb13de
MD5 793a8c87da47f41d6c9175cf46520d5f
BLAKE2b-256 45788b03e08dd1075912871c3015684e652bc4e876de5cd6bd62a74f0df44871

See more details on using hashes here.

File details

Details for the file pupil_apriltags-0.dev0-cp36-cp36m-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: pupil_apriltags-0.dev0-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-0.dev0-cp36-cp36m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 76f78652178286e713169a3d3dd20b9dd812139812d292235357983c140df1ea
MD5 74b121543a10b118e1e1c9dd62bbd2ef
BLAKE2b-256 2b59b274b5a9f3555bf4e031da82d340f4152ffa91816f811cb56e9f2add76ea

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