Apress Pro iOS 5 Augmented Reality (2011).pdf

(38387 KB) Pobierz
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Enhance your virtual world with the
power of iOS augmented reality
Pro
iOS 5 Augmented
Reality
Kyle Roche
870505791.031.png 870505791.042.png 870505791.052.png 870505791.058.png 870505791.001.png 870505791.002.png
 
 
 
 
 
 
 
 
870505791.003.png 870505791.004.png 870505791.005.png 870505791.006.png 870505791.007.png 870505791.008.png 870505791.009.png 870505791.010.png
 
 
 
 
 
 
 
870505791.011.png 870505791.012.png 870505791.013.png 870505791.014.png 870505791.015.png 870505791.016.png 870505791.017.png 870505791.018.png 870505791.019.png 870505791.020.png 870505791.021.png 870505791.022.png 870505791.023.png
 
 
 
 
870505791.024.png 870505791.025.png 870505791.026.png 870505791.027.png 870505791.028.png 870505791.029.png 870505791.030.png 870505791.032.png 870505791.033.png 870505791.034.png 870505791.035.png 870505791.036.png 870505791.037.png 870505791.038.png 870505791.039.png 870505791.040.png 870505791.041.png 870505791.043.png 870505791.044.png
 
For your convenience Apress has placed some of the front
matter material after the index. Please use the Bookmarks
and Contents at a Glance links to access them.
870505791.045.png 870505791.046.png
Contents at a Glance
Contents .............................................................................................................. v
About the Author................................................................................................ ix
About the Technical Reviewers .......................................................................... x
Acknowledgments ............................................................................................. xi
Preface ............................................................................................................. xii
Chapter 1: Introduction ................................................................................... 1
Chapter 2: Hardware Comparison ................................................................. 15
Chapter 3: Using Location Services............................................................... 31
Chapter 4: iOS Sensors .................................................................................. 63
Chapter 5: Sound and User Feedback............................................................ 87
Chapter 6: Camera and Video Capture ........................................................ 101
Chapter 7: Using cocos2D for AR................................................................. 123
Chapter 8: Building a cocos2D AR Game ..................................................... 141
Chapter 9: Third-Party Augmented Reality Toolkits.................................... 181
Chapter 10: Building a Marker-Based AR Application with OpenGL ES ...... 211
Chapter 11: Building a Social AR Application.............................................. 225
Chapter 12: Facial-Recognition Techniques ................................................ 263
Chapter 13: Building a Facial Recognition AR App...................................... 297
Index ............................................................................................................... 333
iii
870505791.047.png 870505791.048.png 870505791.049.png 870505791.050.png 870505791.051.png
1
Chapter
Introduction
Welcome to Pro iOS 5 Augmented Reality . Augmented reality (AR) has existed in sci-fi
movies for decades, is used in the military for head-up displays (HUDs) , and until
recently, has been a thing of the future. With the upswing in mobile applications since
the introduction of the iPhone and the Android operating system, applications such as
Layar ( www.layar.com ), M etaio’s Junaio ( www.junaio.com ), an d Wikitude
( www.wikitude.com ) ha ve put augmented reality in the hands of the everyday consumer.
In this book, I’ll walk you through how to create your own augmented reality applications
for iOS.
Time magazine named augmented reality among the top-ten technology trends for
2010. Time barely scratched the surface on the potential applications of AR. They
selected a few vendor application platforms, such as Layar, and also discussed some
more day-to-day applications, such as that employed by the United States Postal
Service (USPS).
Augmented Reality in the Real and Cyber World
The USPS introduced an augmented reality application to its web site in 2010. If you’ve
ever mailed something from the post office, you can attest to the fact that quickly
selecting a box that fits your needs without holding up the line is a near impossible task.
Either you’re stuck wasting a lot of space with a bigger box or you’re holding up the 20
people behind you while you jam all your items into the box that almost fits everything.
The USPS took a shot at making this easier, without requiring you to leave your home or
office. Basically, you go to the USPS web site ( www.prioritymail.com ) an d use the
Virtual Box Simulator and your webcam to try out different box sizes before you head
out for the post office. It works like this:
Print out a special icon (the USPS eagle) so the simulator knows where to put the
hologram of the virtual box. See Figure 1–1 .
1.
Make sure your webcam is enabled.
1
870505791.053.png 870505791.054.png 870505791.055.png
2
CHAPTER 1: Introduction
2.
Launch the Virtual Box Simulator. Put the printed image in the view of
the webcam and the simulator puts a hologram of different options for
shipping containers around the image. See Figure 1–2.
Figure 1–1. This eagle icon is printed and used by the USPS to augment your camera’s view with a simulated
shipping container.
There are a few basic principles to follow when creating icons or markers for
recognition. For traditional markers, you want high-contrast objects that carry a certain
uniqueness and aren’t found in common scenarios. In fact, random images are often
more effective. Also, you want to use images that have a certain rotation and aren’t
symmetrical either horizontally or vertically. This helps the AR program recognize
orientation and adjust accordingly. The USPS marker is a good example of these
principles.
Figure 1–2. The hologram is overlaying the printed icon.
870505791.056.png 870505791.057.png
Zgłoś jeśli naruszono regulamin