Skip to main content

No project description provided

Project description

dt-apriltags: Python bindings for the Apriltags library

These are Python bindings for the Apriltags library developed by AprilRobotics. Inspired by the Apriltags2 bindings by Matt Zucker.

The original library is published with a BSD 2-Clause license.

Installation

The easy way

You can install using pip:

pip install dt-apriltags

Build it yourself

Clone this repository and navigate in it. Then initialize the Apriltags submodule:

$ git submodule init
$ git submodule update

Build the Apriltags C library. Keep in mind you need to have OpenCV installed beforehand.

$ cd apriltags
$ cmake .
$ make

If building Apriltags was successful, you should be able to run the demo.

Usage

Some examples of usage can be seen in the test.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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

dt_apriltags-0.10.0-cp27-cp27mu-linux_armv7l.whl (2.0 MB view details)

Uploaded CPython 2.7mu

File details

Details for the file dt_apriltags-0.10.0-cp27-cp27mu-linux_armv7l.whl.

File metadata

  • Download URL: dt_apriltags-0.10.0-cp27-cp27mu-linux_armv7l.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 2.7mu
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.8

File hashes

Hashes for dt_apriltags-0.10.0-cp27-cp27mu-linux_armv7l.whl
Algorithm Hash digest
SHA256 b082bf14e7d8ba1121c0a4990605f6d11a326574bf45a2555cc4b1048db53e5d
MD5 92de845d3802bfc089e759acbed65290
BLAKE2b-256 4794ec320fc3e7a317a5441272f2e38152de92528e73fd9a6699c4fdee3198a9

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