ARTag

26
LOGO ARTag Application Kathy Sep 24, 2008

description

AR develop document

Transcript of ARTag

Page 1: ARTag

LOGO

ARTag ApplicationARTag Application

Kathy

Sep 24, 2008

Page 2: ARTag

Contents

Prepare for ARTag1

Files Required to Build C++ ARTag Projects2

ARTag Applications3

Design Your Own AR Game4

Page 3: ARTag

Prepare for ARTag

Files download from FTP

ftp://cgip.kyungwon.ac.kr

ID : arPassword : ar

Augmented Reality.pdfARTag SDKARTag DemoARTag Code

Page 4: ARTag

Files Required to Build C++ ARTag Projects

AR SDK Setup

OpenGL

OpenCV

AR AR DevelopmentDevelopment

Page 5: ARTag

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

Page 6: ARTag

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

Page 7: ARTag

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

Page 8: ARTag

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

Page 9: ARTag

ARTag Applications

ARTag Functions

Page 10: ARTag

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.

Page 11: ARTag

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.

Page 12: ARTag

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,

Page 13: ARTag

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.

Page 14: ARTag

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

Page 15: ARTag

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

Page 16: ARTag

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

Page 17: ARTag

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.

Page 18: ARTag

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.

Page 19: ARTag

Creating Marker Patterns

Page 20: ARTag

Texture Mapping and Rendering

3D Model+ Image Texture

+ =

Page 21: ARTag

Programming

Camera Setting

Loading .cf file

Loading 3d model

.mtl file for texturemapping

Page 22: ARTag

Programming

Return object num

Marker detection

Scale for rendering

Page 23: ARTag

Design Your Own AR Game

Page 24: ARTag

Design Your Own AR Game

Page 25: ARTag

Design Your Own AR Game

Page 26: ARTag

LOGO