Difference between revisions of "Using the AprilTags Glyph Recognition System"

From Lofaro Lab Wiki
Jump to: navigation, search
(Print tags)
(Running the demo)
 
(9 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
The following tutorial will help users recognize AprilTag glyphs.
 
The following tutorial will help users recognize AprilTag glyphs.
  
The demo system for AprilTags will allow you to recognize multiple markers and obtain their x, y, and z position as well ass their roll, pitch, and yaw.
+
The demo system for AprilTags will allow you to recognize multiple markers and obtain their x, y, and z position as well as their roll, pitch, and yaw.
<html><iframe width="560" height="315" src="https://www.youtube.com/embed/zP6j9a0dwqo" frameborder="0" allowfullscreen></iframe></html>
+
  
  
 +
== Prerequisites: Ubuntu ==
 +
Our tutorials were made using Ubuntu 12.04 LTS.
  
 +
== Getting the AprilTag Recognition Code ==
  
 +
Source: http://people.csail.mit.edu/kaess/apriltags/
  
 +
Run the following commands to get the AprilTag Recognition code:
  
 +
    sudo apt-get install subversion cmake libopencv-dev libeigen3-dev libv4l-dev
  
 +
    sudo port install pkgconfig opencv eigen3
  
 +
    svn co https://svn.csail.mit.edu/apriltags
  
 +
    cd apriltags
 +
    make
  
 +
== Printing Tags ==
  
 +
In order to recognize the tags, you must first print them. We will be using the tag36h11 family. You can download the png files for this family [http://april.eecs.umich.edu/software/tag36h11.tgz here].
  
  
 +
Now to print a tag, do the following:
  
  
 +
1. Untar the tag36h11.tgz file you downloaded
  
 +
2. Run gimp on one of the png files, e.g., "gimp tag36_11_00000.png"
  
== Prerequisites: Ubuntu ==
+
3. From the pulldown menu, select Image > Scale Image
Our tutorials were made using Ubuntu 12.04 LTS.
+
  
== Get AprilTag Recognition Code ==
+
4. Set the units to inches and the size to your desired tagsize (this tagsize is the length of a side of the tag you wish to print). 3 to 5 inches is a reasonable tagsize.
  
The code you will use to recognize AprilTags is on Github. First clone the package from Github onto your local machine:
+
5. Set the Interpolation mode to None
  
  <nowiki>$ git clone https://github.com/SD-Robot-Vision/apriltags.git</nowiki>
+
6. Click on the Scale button
  
== Printing Tags ==
+
7. From the pulldown menu, select File > Save As
TODO
+
  
== Run the Demo ==
+
8. Save the image as a PostScript file, e.g., /tmp/tag0.ps
TODO
+
 
 +
9. Send the PostScript file to your printer
 +
 
 +
 
 +
Source: http://wiki.tekkotsu.org/index.php/AprilTags#Printing_Your_Own_AprilTags
 +
 
 +
== Running the demo ==
 +
Make sure you have a camera connected before running the demo.
 +
 
 +
You can run the demo with several options:
 +
 
 +
  * -h  -?          Show help options
 +
  * -a              Arduino (send tag ids over serial port)
 +
  * -d              Disable graphics
 +
  * -t              Timing of tag extraction
 +
  * -C <bbxhh>      Tag family (default 36h11)
 +
  * -D <id>        Video device ID (if multiple cameras present)
 +
  * -F <fx>        Focal length in pixels
 +
  * -W <width>      Image width (default 640, availability depends on camera)
 +
  * -H <height>    Image height (default 480, availability depends on camera)
 +
  * -S <size>      Tag size (square black frame) in meters
 +
  * -E <exposure>  Manually set camera exposure (default auto; range 0-10000)
 +
  * -G <gain>      Manually set camera gain (default auto; range 0-255)
 +
  * -B <brightness> Manually set the camera brightness (default 128; range 0-255)
 +
 
 +
By default the tag family that the program recognizes is 36h11, so we will not need to specify that through the options.
 +
 
 +
If you have multiple cameras connected, you must specify the camera's ID using the -D option.
 +
 
 +
It is very important that you specify the focal length in pixels of your camera using the -F option. Generally the focal length fx and fy are the same. If they are not, you must edit default fx and fy in the code of the demo program to specify this. It is very important that you have the correct focal length specified in order to obtain accurate pose information of the tag.
 +
 
 +
-W and -H are used to specify the image resolution that will be input for recognition.
 +
 
 +
-S is used to specify the tag size in meters, so whatever the length of the side of the tag is in meters is the value you plug in here. It is very important that you have the correct tagsize specified in order to obtain accurate pose information of the tag.
 +
 
 +
Those are the more important parameters, most of the other parameters are used for faster more optimized recognition.
 +
 
 +
Here is an example of running the demo for a camera with focal length in pixels of 600, tagsize of 0.2032 meters, image resolution of 640x480, first cd into apriltags then run the following command in the terminal:
 +
    ./build/bin/apriltags_demo -F 600 -S 0.2032 -H 480 -W 640
 +
 
 +
== The AprilTags Demo in Action ==
 +
The following videos show that the system is capable of single and multi-tag recognition.
 +
 
 +
<html><iframe width="560" height="315" src="https://www.youtube.com/embed/zP6j9a0dwqo" frameborder="0" allowfullscreen></iframe></html>
  
== XXX ==
+
<html><iframe width="560" height="315" src="https://www.youtube.com/embed/R0wI8mjDuOM" frameborder="0" allowfullscreen></iframe></html>

Latest revision as of 14:54, 4 March 2015

Aprildemo.jpg

The Apriltags system is capable of multi-marker recognition.

The following tutorial will help users recognize AprilTag glyphs.

The demo system for AprilTags will allow you to recognize multiple markers and obtain their x, y, and z position as well as their roll, pitch, and yaw.


Prerequisites: Ubuntu

Our tutorials were made using Ubuntu 12.04 LTS.

Getting the AprilTag Recognition Code

Source: http://people.csail.mit.edu/kaess/apriltags/

Run the following commands to get the AprilTag Recognition code:

   sudo apt-get install subversion cmake libopencv-dev libeigen3-dev libv4l-dev
   sudo port install pkgconfig opencv eigen3
   svn co https://svn.csail.mit.edu/apriltags
   cd apriltags
   make

Printing Tags

In order to recognize the tags, you must first print them. We will be using the tag36h11 family. You can download the png files for this family here.


Now to print a tag, do the following:


1. Untar the tag36h11.tgz file you downloaded

2. Run gimp on one of the png files, e.g., "gimp tag36_11_00000.png"

3. From the pulldown menu, select Image > Scale Image

4. Set the units to inches and the size to your desired tagsize (this tagsize is the length of a side of the tag you wish to print). 3 to 5 inches is a reasonable tagsize.

5. Set the Interpolation mode to None

6. Click on the Scale button

7. From the pulldown menu, select File > Save As

8. Save the image as a PostScript file, e.g., /tmp/tag0.ps

9. Send the PostScript file to your printer


Source: http://wiki.tekkotsu.org/index.php/AprilTags#Printing_Your_Own_AprilTags

Running the demo

Make sure you have a camera connected before running the demo.

You can run the demo with several options:

 * -h  -?          Show help options
 * -a              Arduino (send tag ids over serial port)
 * -d              Disable graphics
 * -t              Timing of tag extraction
 * -C <bbxhh>      Tag family (default 36h11)
 * -D <id>         Video device ID (if multiple cameras present)
 * -F <fx>         Focal length in pixels
 * -W <width>      Image width (default 640, availability depends on camera)
 * -H <height>     Image height (default 480, availability depends on camera)
 * -S <size>       Tag size (square black frame) in meters
 * -E <exposure>   Manually set camera exposure (default auto; range 0-10000)
 * -G <gain>       Manually set camera gain (default auto; range 0-255)
 * -B <brightness> Manually set the camera brightness (default 128; range 0-255)

By default the tag family that the program recognizes is 36h11, so we will not need to specify that through the options.

If you have multiple cameras connected, you must specify the camera's ID using the -D option.

It is very important that you specify the focal length in pixels of your camera using the -F option. Generally the focal length fx and fy are the same. If they are not, you must edit default fx and fy in the code of the demo program to specify this. It is very important that you have the correct focal length specified in order to obtain accurate pose information of the tag.

-W and -H are used to specify the image resolution that will be input for recognition.

-S is used to specify the tag size in meters, so whatever the length of the side of the tag is in meters is the value you plug in here. It is very important that you have the correct tagsize specified in order to obtain accurate pose information of the tag.

Those are the more important parameters, most of the other parameters are used for faster more optimized recognition.

Here is an example of running the demo for a camera with focal length in pixels of 600, tagsize of 0.2032 meters, image resolution of 640x480, first cd into apriltags then run the following command in the terminal:

   ./build/bin/apriltags_demo -F 600 -S 0.2032 -H 480 -W 640

The AprilTags Demo in Action

The following videos show that the system is capable of single and multi-tag recognition.