ARTag
description
Transcript of ARTag
LOGO
ARTag ApplicationARTag Application
Kathy
Sep 24, 2008
Contents
Prepare for ARTag1
Files Required to Build C++ ARTag Projects2
ARTag Applications3
Design Your Own AR Game4
Prepare for ARTag
Files download from FTP
ftp://cgip.kyungwon.ac.kr
ID : arPassword : ar
Augmented Reality.pdfARTag SDKARTag DemoARTag Code
Files Required to Build C++ ARTag Projects
AR SDK Setup
OpenGL
OpenCV
AR AR DevelopmentDevelopment
AR Development Setup
Download the ARTag library and header files. You can use Visual Studio 2005, Visual Studio 2003, Visual
Studio 6 The ARTag SDK includes two versions of the ARTag library: artag_rev2_vs6.lib artag_rev2_vs2005.lib VS6.0 > Tools > Options > Directories
• Include– artag_rev2k_sdk_windows_1208\include
• Lib– artag_rev2k_sdk_windows_1208\lib
OpenGL
Building an OpenGL/GLUT program (VC6.0) Installing glut glut32.dll to %WinDir%\System, glut32.lib to $(MSDevDir)\..\..\VC98\lib, and glut.h to $(MSDevDir)\..\..\VC98\include\GL
Linking libraries Project->Settings. Select “Link” tab. In the Object\libraries field,
type: opengl32.lib glu32.lib glut32.lib Tool -> options -> directory $(MSDevDir)\..\..\VC98\include\GL
OpenCV
Assuming you have installed OpenCV 1.0 into C:/Program Files/OpenCV,
the settings you require are:
In ARTag project: VS6.0 > Tools > Options > Directories
• Include
– artag_rev2k_sdk_windows_1208\OpenCV
• Lib
– artag_rev2k_sdk_windows_1208\OpenCV
Make your own ARTag Marker
Tool: code\GetARRunning\artag_create_marker_compiled
directory, you will find the artag_create_marker.exe
created artag_marker1.pgm shown in Photoshop
ARTag Applications
ARTag Functions
Using ARTag Functions
These are the functions for initialization and cleanup: 1. First call init_artag(). 2. Load an array (.cf) file with load_array_file() if you want to use
arrays. 3. Associate arrays or single markers with handles (aka objects) by
using artag_associate_array() or artag_associate_marker(), respectively.
Use the returned artag_object_id for future calls.
Using ARTag Functions
These functions are called for every frame: 1. artag_find_objects(). This function searches an image for objects. 2. For all objects associated in step 3 of the initialization, call
artag_is_object_found(obj#) if the result is true (1), and then perform the following steps:
3. Call artag_set_object_opengl_matrix(), which sets the modelview
matrix for you to start rendering. 4. Other calls you could make instead of, or as well as, setting the
matrix are artag_project_point() and artag_project_between_objects().
These functions transfer object coordinates to image coordinates or transfer object coordinates between arrays.
ARTag Applications
Camera Input in ARTag Project The demos use the CVcam video capture program from the
OpenCV library, which provides imagery from USB webcams and other video cameras that have the necessary drivers—such as a camcorder plugged into a frame grabber.
Otherwise, we can delve into DirectShow or Video for Windows (VFW) programming,
ARTag Applications
Basic OpenGL Program Running with ARTag The basic_artag_opengl program demonstrates the following: 1. Initializing ARTag. 2. Loading an array file. 3. Associating an individual array from this file. An array file can
contain many arrays, starting and ending with the coordframe and \coordframe keywords.
4. Calling the main artag_find_objects() function. 5. Calling artag_is_object_found() to see whether an object is
loaded. 6. Using the artag_get_object_opengl_matrix() function to set the
OpenGL modelview matrix. This allows rendering relative to the array.
7. Using either OpenCV’s CVcam for camera capture with USB and USB 2 webcams or pgrflycapture for Point Grey Research’s
Dragonfly FireWire camera.
Detecting Markers
ARTag_Find_Objects function is the workhorse of ARTag.
This function uses many stages, including finding outlines,hypothesizing marker locations, and reading the embedded digital code.
Only used for grayscale image detection
Setting Virtual Camera Viewpoint
char artag_is_object_found(int artag_object_num); void artag_set_object_opengl_matrix(int object_num, char mirror_on);
artag_is_object_found()
Location of Arrays
artag_set_object_opengl_matrix
True
Call
Finding Marker Array Size
The scale of objects rendered will depend on the relative size between the virtual object and the array definition—the augmentation will be drawn in the same units.
Ex. one marker is 100 units wide in the .cf file, then a virtual 3D object will need to be 100 units wide so that it appears as wide as the marker
Mapping Between Objects
The artag_project_between_objects() function is provided for interactions between virtual objects attached to different array patterns. This function maps from a location (x, y, z) in the coordinate system (attached to one array) to a location (x, y, z) in a second array.
Mapping from Objects to the Image
artag_project_point(): an (x, y, z) location in object space is mapped to a pixel position (u, v) in the original camera image.
Creating Marker Patterns
Texture Mapping and Rendering
3D Model+ Image Texture
+ =
Programming
Camera Setting
Loading .cf file
Loading 3d model
.mtl file for texturemapping
Programming
Return object num
Marker detection
Scale for rendering
Design Your Own AR Game
Design Your Own AR Game
Design Your Own AR Game
LOGO