Recent Changes - Search:

edit SideBar

aprilTags Module

Module to identify AprilTags in an image. An AprilTag is a pattern of dark and light squares similar to a QR code but easier for cameras to detect robustly and at a distance. AprilTags were created by Associate Professor Edwin Olson (ebolson@umich.edu), EECS, University of Michigan. See https://april.eecs.umich.edu/.

This module defines two functions, a filter() function that takes an image and some options and returns a modified image, and a tags() function that retrieves an array of tags identified in the most recent invocation of filter().

See also the auto-generated doc file for the current version of the Ptolemy II/Nashorn host implementation of this module.

Functions

The following functions are implemented by this module:

  • filter(image, options): Invoke the AprilTag detector on the specified image with the specified options and return the modified image. Any unrecognized options are ignored. Note that previously applied options for a given filter may still be used, even if they are not set in this call. The returned image has the center and outline of all detected AprilTags indicated on it. The image is an object containing the hosts native representation of images, whatever that is. For example, it can be an image returned by a camera object provided by the cameras module. The AprilTags detector has a large number of options that can be tuned. To set an option, provide an object with a field matching the option name. The options are described in the <a href="https://ptolemy.berkeley.edu/accessors/doc/jsdoc/accessor-AprilTags.html">detailed documentation</a>.
  • tags(): Return an array of tags detected by the most recent call to filter(). The returned value is null if there has been no call to filter() or if there are no detected AprilTags in the image. Otherwise, it is an array of objects with the following fields:
    • id: The ID of the detected tag.
    • center: An array with two doubles giving the center of the tag in pixel coordinates.
    • perimeter: An array with four arrays, each of which gives the x and y coordinates of a corner of the AprilTag.

Usage

To detect AprilTags in a single image from the default camera, you can do this:

   var cameras = require("cameras");
   var aprilTags = require("aprilTags");
   var camera = new cameras.Camera();
   camera.open();
   var image = camera.snapshot();
   camera.close();
   var modifiedImage = aprilTags.filter(image); // Use default options.
   var tags = aprilTags.tags();
   console.log(JSON.stringify(tags));


Back to Optional JavaScript Modules

Edit - History - Print - Recent Changes - Search
Page last modified on June 17, 2017, at 03:34 pm