Published on

AR develop document

Published in: Education
1 Comment
1 Like
  • The login information does not work anymore
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. ARTag Application Kathy Sep 24, 2008
  2. 2. Contents Prepare for ARTag 1 Files Required to Build C++ ARTag Projects 2 ARTag Applications 3 Design Your Own AR Game 4
  3. 3. Prepare for ARTag <ul><li>Files download from FTP </li></ul> ID : ar P assword : ar Augmented Reality.pdf ARTag SDK ARTag Demo ARTag Code
  4. 4. Files Required to Build C++ ARTag Projects AR SDK Setup OpenGL OpenCV AR Development
  5. 5. AR Development Setup <ul><ul><li>Download the ARTag library and header files. </li></ul></ul><ul><ul><li>Y ou can use Visual Studio 2005, Visual Studio 2003, Visual Studio 6 </li></ul></ul><ul><ul><li>The ARTag SDK includes two versions of the ARTag library: </li></ul></ul><ul><ul><li>artag_rev2_vs6.lib </li></ul></ul><ul><ul><li>artag_rev2_vs2005.lib </li></ul></ul><ul><ul><li>VS6.0 > Tools > Options > Directories </li></ul></ul><ul><ul><ul><li>Include </li></ul></ul></ul><ul><ul><ul><ul><li>artag_rev2k_sdk_windows_1208include </li></ul></ul></ul></ul><ul><ul><ul><li>Lib </li></ul></ul></ul><ul><ul><ul><ul><li>artag_rev2k_sdk_windows_1208lib </li></ul></ul></ul></ul>
  6. 6. OpenGL <ul><li>Building an OpenGL/GLUT program (VC6.0) </li></ul><ul><ul><li>Installing glut </li></ul></ul><ul><ul><li>glut32.dll to %WinDir%System, </li></ul></ul><ul><ul><li>glut32.lib to $(MSDevDir)....VC98lib, and </li></ul></ul><ul><ul><li>glut.h to $(MSDevDir)....VC98includeGL </li></ul></ul><ul><ul><li>Linking libraries </li></ul></ul><ul><ul><li>Project->Settings. Select “Link” tab.  In the Objectlibraries field, type:  opengl32.lib glu32.lib glut32.lib </li></ul></ul><ul><ul><li>Tool -> options -> directory $(MSDevDir)....VC98includeGL </li></ul></ul>
  7. 7. OpenCV <ul><li>Assuming you have installed OpenCV 1.0 into C:/Program Files/OpenCV, the settings you require are: </li></ul><ul><li>In ARTag project: </li></ul><ul><ul><li>VS6.0 > Tools > Options > Directories </li></ul></ul><ul><ul><ul><li>Include </li></ul></ul></ul><ul><ul><ul><ul><li>artag_rev2k_sdk_windows_1208OpenCV </li></ul></ul></ul></ul><ul><ul><ul><li>Lib </li></ul></ul></ul><ul><ul><ul><ul><li>artag_rev2k_sdk_windows_1208OpenCV </li></ul></ul></ul></ul>
  8. 8. Make your own ARTag Marker <ul><li>Tool: </li></ul><ul><li>codeGetARRunningartag_create_marker_compiled directory, you will find the artag_create_marker.exe </li></ul><ul><li>created artag_marker1.pgm shown in Photoshop </li></ul>
  9. 9. ARTag Applications <ul><li>ARTag Functions </li></ul>
  10. 10. Using ARTag Functions <ul><li>These are the functions for initialization and cleanup: </li></ul><ul><li>1. First call init_artag(). </li></ul><ul><li>2. Load an array (.cf) file with load_array_file() if you want to use arrays. </li></ul><ul><li>3. Associate arrays or single markers with handles (aka objects) by using artag_associate_array() or artag_associate_marker(), respectively. </li></ul><ul><li>Use the returned artag_object_id for future calls. </li></ul>
  11. 11. Using ARTag Functions <ul><ul><li>These functions are called for every frame: </li></ul></ul><ul><ul><li>1. artag_find_objects(). This function searches an image for objects. </li></ul></ul><ul><ul><li>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: </li></ul></ul><ul><ul><li>3. Call artag_set_object_opengl_matrix(), which sets the modelview </li></ul></ul><ul><li>matrix for you to start rendering. </li></ul><ul><ul><li>4. Other calls you could make instead of, or as well as, setting the </li></ul></ul><ul><li>matrix are artag_project_point() and artag_project_between_objects(). </li></ul><ul><li>These functions transfer object coordinates to image coordinates or transfer object coordinates between arrays. </li></ul>
  12. 12. ARTag Applications <ul><li>Camera Input in ARTag Project </li></ul><ul><li>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. </li></ul><ul><li>Otherwise, we can delve into DirectShow or Video for Windows (VFW) programming, </li></ul>
  13. 13. ARTag Applications <ul><li>Basic OpenGL Program Running with ARTag </li></ul><ul><li>The basic_artag_opengl program demonstrates the following: </li></ul><ul><li>1. Initializing ARTag. </li></ul><ul><li>2. Loading an array file. </li></ul><ul><li>3. Associating an individual array from this file. An array file can contain many arrays, starting and ending with the coordframe and coordframe keywords. </li></ul><ul><li>4. Calling the main artag_find_objects() function. </li></ul><ul><li>5. Calling artag_is_object_found() to see whether an object is loaded. </li></ul><ul><li>6. Using the artag_get_object_opengl_matrix() function to set the OpenGL modelview matrix. This allows rendering relative to the array. </li></ul><ul><li>7. Using either OpenCV’s CVcam for camera capture with USB and </li></ul><ul><li>USB 2 webcams or pgrflycapture for Point Grey Research’s Dragonfly FireWire camera. </li></ul>
  14. 14. Detecting Markers <ul><li>ARTag_Find_Objects function is the workhorse of ARTag. </li></ul><ul><li>This function uses many stages, including finding outlines,hypothesizing marker locations, and reading the embedded digital code. </li></ul><ul><li>Only used for grayscale image detection </li></ul>
  15. 15. Setting Virtual Camera Viewpoint <ul><li>char artag_is_object_found(int artag_object_num); </li></ul><ul><li>void artag_set_object_opengl_matrix(int object_num, char mirror_on); </li></ul>artag_is_object_found() Location of Arrays artag_set_object_ opengl_matrix True Call
  16. 16. Finding Marker Array Size <ul><li>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. </li></ul><ul><li>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 </li></ul>
  17. 17. Mapping Between Objects <ul><li>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. </li></ul>
  18. 18. Mapping from Objects to the Image <ul><li>artag_project_point(): an (x, y, z) location in object space is mapped to a pixel position (u, v) in the original camera image. </li></ul>
  19. 19. Creating Marker Patterns
  20. 20. Texture Mapping and Rendering <ul><li>3D Model+ Image Texture </li></ul>+ =
  21. 21. Programming Camera Setting Loading .cf file Loading 3d model .mtl file for texture mapping
  22. 22. Programming Return object num Marker detection Scale for rendering
  23. 23. Design Your Own AR Game
  24. 24. Design Your Own AR Game
  25. 25. Design Your Own AR Game
  26. 26. Thank You !
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.