Skip to main content

Python bindings for apriltags v3

Project description

pupil-apriltags: Python bindings for the apriltags3 library

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.

Install from source via current master branch from GitHub

$ pip install git+https://github.com/pupil-labs/apriltags

Manual installation from source

You can of course manually clone the repository and build from there. We use scikit-build instead of the normal python setuptools, since skbuild makes working with native libraries a lot easier. Building is still controlled via standard python setup.py [options] commands, but skbuild takes care of platform-independently compiling apriltags-source in the background.

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:

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

Uploaded CPython 3.7mWindows x86-64

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

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64

pupil_apriltags-1.dev0-cp37-cp37m-macosx_10_10_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.7mmacOS 10.10+ x86-64

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

Uploaded CPython 3.6mWindows x86-64

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

Uploaded CPython 3.6mmanylinux: glibc 2.12+ x86-64

pupil_apriltags-1.dev0-cp36-cp36m-macosx_10_10_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.6mmacOS 10.10+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pupil-apriltags-1.dev0.tar.gz
Algorithm Hash digest
SHA256 4ef092bd95adff63af89de0412278f82bf6385a68698c5af04f0e1a4db0e7962
MD5 3b6f6173d7278bdf0020a8ad6bf90e5f
BLAKE2b-256 10b9d3c3a1a871a3047109c429a718f12b33c695346e2ac7f7cf6792381eaadf

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pupil_apriltags-1.dev0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 79d3417438aaa2bdc7923f94c3d9034be42c5a8b467b8227d2dbc146860e734e
MD5 c68dad27b7b5ecd3a9f2fa6fb0d9098a
BLAKE2b-256 db15b19f3ed142ed60fc3e762c52b1f7d5786b2de87de80af2d1776d122ea72d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pupil_apriltags-1.dev0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 85887f792f2c26e74ab1cee24d9e91e3d0820cbb213c2ec204800c7f67e84b7f
MD5 dbf5d468ee3e6cb160edee0619b47cee
BLAKE2b-256 20618a6bca78059a1a980e74994a9b90f65b189246796887e3a5e664c0da3e13

See more details on using hashes here.

File details

Details for the file pupil_apriltags-1.dev0-cp37-cp37m-macosx_10_10_x86_64.whl.

File metadata

  • Download URL: pupil_apriltags-1.dev0-cp37-cp37m-macosx_10_10_x86_64.whl
  • Upload date:
  • Size: 8.2 MB
  • Tags: CPython 3.7m, macOS 10.10+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.4

File hashes

Hashes for pupil_apriltags-1.dev0-cp37-cp37m-macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 4df4258e7530ccaed530fc6506162cdd935609ff9c47a8541406dd9811c15fd6
MD5 52349e4ae7aaf35ddc787f940b285e87
BLAKE2b-256 458508c0cd892de1ebab5a30b93a4be78ee7dd58edca5dff767e7e1f123d365d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pupil_apriltags-1.dev0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 749128a0d0511867dc63c8654c4b09d4b2c5c5f9385b64706bfa7b9576624a3a
MD5 0b5a248650f9c1bd410dd8e2ec0cf13e
BLAKE2b-256 3ee37a7e1f23d1a421013c4f40cf54be1e5d2bbde8467b90fffb1d8da3ab8eba

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pupil_apriltags-1.dev0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6ac30e168d5029f21aed53889bde7d340ae8799b2810ec651256d29bfc8b82f3
MD5 a23eaa155053137661d0a31e3613f070
BLAKE2b-256 8763890013fb5866c773fa194c762a4db7c7c91531a2751d56c14fb25101e6ce

See more details on using hashes here.

File details

Details for the file pupil_apriltags-1.dev0-cp36-cp36m-macosx_10_10_x86_64.whl.

File metadata

  • Download URL: pupil_apriltags-1.dev0-cp36-cp36m-macosx_10_10_x86_64.whl
  • Upload date:
  • Size: 8.2 MB
  • Tags: CPython 3.6m, macOS 10.10+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.8

File hashes

Hashes for pupil_apriltags-1.dev0-cp36-cp36m-macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 d25ae7b2ad078031f535c403bc6a61c006472e86841485fa0ae85a047e1ba074
MD5 caa3b84b96901762b0e124304dab9d83
BLAKE2b-256 159da37da6fbf006fb6c7bd87ff98cdb537dd22f295ad6140f93d2e6131a48b0

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