Demo ArUco
Simple demo of ArUco augmented reality markers detection and decoding.
By Laurent Ittiitti@usc.eduhttp://jevois.orgGPL v3
Video Mapping:   NONE 0 0 0 YUYV 320 240 30.0 JeVois DemoArUco
Video Mapping:   YUYV 320 260 30.0 YUYV 320 240 30.0 JeVois DemoArUco
Video Mapping:   YUYV 640 500 20.0 YUYV 640 480 20.0 JeVois DemoArUco

Module Documentation

Detect and decode patterns known as ArUco markers, which are small 2D barcodes often used in augmented reality and robotics.

ArUco markers are small 2D barcodes. Each ArUco marker corresponds to a number, encoded into a small grid of black and white pixels. The ArUco decoding algorithm is capable of locating, decoding, and of estimating the pose (location and orientation in space) of any ArUco markers in the camera's field of view.

ArUcos are very useful as tags for many robotics and augmented reality applications. For example, one may place an ArUco next to a robot's charging station, an elevator button, or an object that a robot should manipulate.

For more information about ArUco, see https://www.uco.es/investiga/grupos/ava/node/26

The implementation of ArUco used by JeVois is the one of OpenCV-Contrib, documented here: http://docs.opencv.org/3.2.0/d5/dae/tutorial_aruco_detection.html

ArUco markers can be created with several standard dictionaries. Different disctionaries give rise to different numbers of pixels in the markers, and to different numbers of possible symbols that can be created using the dictionary. The default dictionary used by JeVois is 4x4 with 50 symbols. Other dictionaries are also supported by setting the appropriate parameter over serial port or in a config file, up to 7x7 with 1000 symbols.

Creating and printing markers

We have created the 50 markers available in the default dictionary (4x4_50) as PNG images that you can download and print, at http://jevois.org/data/ArUco.zip

To make your own, for example, using another dictionary, see the documentation of the ArUco component of JeVoisBase. Some utilities are provided with the component.

Serial Messages

This module can send the following messages over serial port (make sure you set the serout parameter to designate the serial port to which you want to send these messages, see the documentation for serout under the Command-line interface user guide).

  • When serstyle is 0:
      ArUco ID
    where
    • ID is the decoded ID of the ArUco that was detected
  • When serstyle is 1:
      ArUco ID X,Y
    where
    • ID is the decoded ID of the ArUco that was detected
    • X,Y are the coordinates of the marker's center
  • When serstyle is 2:
      ArUco ID X1,Y1 X2,Y2 X3,Y3 X4,Y4
    where
    • ID is the decoded ID of the ArUco that was detected
    • X1,Y1 are the coordinates of the first corner
    • X2,Y2 are the coordinates of the second corner
    • X3,Y3 are the coordinates of the third corner
    • X4,Y4 are the coordinates of the fourth corner

The coordinates are normalized so that the serial outputs are independent of camera resolution. x=0, y=0 is the center of the field of view, the left edge of the camera image is at x=-1000, the right edge at x=1000, the top edge at y=-750, and the bottom edge at y=750 (since the camera has a 4:3 aspect ratio). See Helper functions to convert coordinates from camera resolution to standardized for more information on standardized coordinates in JeVois.

One message is issued for every detected ArUco, on every video frame.

Things to try

  • First, use a video viewer software on a host computer and select one of the video modes with video output over USB. Point your JeVois camera towards one of the screenshots provided with this module, or towards some ArUco markers that you find on the web or that you have printed from the collection above (note: the default dictionary is 4x4_50, see parameter dictionary).
  • Then try it with no video output, as it would be used by a robot. Connect to the command-line interface of your JeVois camera through the serial-over-USB connection (see Command-line interface user guide; on Linux, you would use sudo screen /dev/ttyACM0 115200) and try:
      setpar serout USB
      setmapping2 YUYV 320 240 30.0 JeVois DemoArUco
      streamon
    and point the camera to some markers; the camera should issue messages about all the markers it identifies.

Showing the pose vectors

The OpenCV ArUco module can also compute normals to each marker, which allows you to recover the marker's orientation and distance. The requires that the camera be calibrated, see the documentation of the ArUco component in JeVois. A generic calibration that is for a JeVois camera with standard lens is included in file calibration.yaml in the module's directory (on the MicroSD, this is JEVOIS:/modules/JeVois/DemoArUco/calibration.yaml).

FIXME this crashes since the update to opencv 3.2, need to figure out what changed since 3.1.

ParameterTypeDescriptionDefaultValid Values
(DemoArUco) showposeboolShow pose vectors, requires a valid camera calibration matrixfalse-
(DemoArUco) markerlenfloatMarker side length (meters), used only for pose estimation0.1F-
(DemoArUco) serstyleintSerial output style for strings issued for each detected ArUco marker: 0: [ArUco ID] where ID is the decoded ArUco ID; 1: [ArUco ID X,Y] sends ID and standardized coordinates of the marker center;2: [ArUco ID X1,Y1 X2,Y2 X3,Y3 X4,Y4] sends ID and standardized coords of the 4 corners.0jevois::Range<int>(0, 2)
(ArUco) camparamsstd::stringFilename of camera parameters, or empty-
(ArUco) detparamsstd::stringFilename of detector parameters, or empty-
(ArUco) dictionaryDictSymbol dictionary to useDict::D4X4_50-
Detailed docs:DemoArUco, ArUco
Copyright:Copyright (C) 2016 by Laurent Itti, iLab and the University of Southern California
License:GPL v3
Distribution:Unrestricted
Restrictions:None
Support URL:http://jevois.org/doc
Other URL:http://iLab.usc.edu
Address:University of Southern California, HNB-07A, 3641 Watt Way, Los Angeles, CA 90089-2520, USA