Accelerometers to Augmented Reality

Uploaded on

iOSDevCampDC 2011 talk by Jonathan Blocksom

iOSDevCampDC 2011 talk by Jonathan Blocksom

More in: Technology , Business
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. From Accelerometersto Augmented Reality Jonathan Blocksom @jblocksom iOSDevCamp 2011 August 13, 2011 Jonathan Saggau (@jonmarimba) present in spirit
  • 2. The Theme• Mobile devices are not just for viewing information on a screen; they can be a gateway to interacting with the world around us.• What can we do with them and how do we do it?
  • 3. iOS and the World Around Us Purpose Sensor SDKDevice Movement Accelerometer, Gyros Core Motion Geolocation GPS, Magnetometer Core Location Video Camera AVFoundation AVFoundation, Audio Microphone Core Jose
  • 4. Core Motion• High level interface to orientation and movement data• iOS 4+• Accelerometer and Gyroscope• Sensor Fusion and Data Filtering
  • 5. Motion Sensors: Accelerometer• Accelerometer • From iPhone 1 • Noisy Gravity Detector !"#$#%&%()*+,%-#,.#/% "012334445+67+$58#93:;+,<3=9)><39<$)3=!?@A1BCDEE@4E&>% • 100Hz, +/- 2.3G
  • 6. Motion Sensors: Gyroscopes• Gyroscope • iPhone 4, iPad 2 • Rotation Rate • 200/500/2500 dps
  • 7. Demo: Vibration• Visualize Accelerometer Data• App Store, $4.99 http:// app/vibration/ id301097580
  • 8. Demo 1:Core Motion Teapot
  • 9. Using Core Motion• Poll for data or block handlers for updates• Data as Yaw, Pitch, Roll Quaternion 4x4 Transform• Timestamps included
  • 10. Demo: Core Motion Viewer• coremotionviewer
  • 11. Core Motion Resources• Core Motion Framework Reference• Event Handling Guide for iPhone OS • “Core Motion” under “Motion Events”• WWDC ’10: CoreMotionTeapot• J. R. Powers Talk from VTM November ’10• O’Reilly Basic Sensors in iOS
  • 12. Computer Vision
  • 13. Computer Vision: OpenCV• The SDK I love to hate
  • 14. Building OpenCV on iOS• Follow this 20 step recipe: 2010/12/building-opencv-for-ios/• Or go here: OpenCV-iOS
  • 15. Face Detection• Use Haar Wavelet classification• Built in classifiers in OpenCV to find front and side facing faces• Not perfect, not too fast, but not bad• Video:
  • 16. Haar classification• “Cascade of boosted classifiers working with haar- like features”
  • 17. Loading the Classifier • Just call cvLoad        NSString  *path  =  [[NSBundle  mainBundle]                        pathForResource:@"haarcascade_frontalface_default"          ofType:@"xml"]; CvHaarClassifierCascade  *cascade  =                  (CvHaarClassifierCascade  *)cvLoad(                                [path  cStringUsingEncoding:NSASCIIStringEncoding],     NULL,  NULL,  NULL);
  • 18. Running the classifier  CvSeq*  faces  =  cvHaarDetectObjects(small_image,  cascade, storage,  1.2f,  2,                  CV_HAAR_DO_CANNY_PRUNING, cvSize(20,  20)); • Image, Haar cascades, spare storage • 1.2f: Size inc. for features per stage • 2: Minimum rectangle neighbors • Canny Pruning: Throw out areas with too few / too many edges
  • 19. What it’s Doing• Windows show where wavelets being checked• Overlapping rectangles are a detection
  • 20. Defeating Face Detection• cvDazzle project• Can also just turn to the side
  • 21. Demo: Face Detection• OpenCV based
  • 22. Feature Matching• Feature Matching is the workhorse of modern computer vision • Panoramas • Image stabilization • Superresolution • 3D reconstruction
  • 23. Feature Matching • SIFT, SURF, FLANN: Salient points in an image (a) (b) ... Scale (next octave) (c) (d) Figure 5: This figure shows the stages of keypoint selection. (a) The 233x189 pixel original image. (b) The initial 832 keypoints locations at maxima and minima of the difference-of-Gaussian function. Keypoints are displayed as vectors indicating scale, orientation, and location. (c) After applying a threshold on minimum contrast, 729 keypoints remain. (d) The final 536 keypoints that remain following an additional threshold on ratio of principal curvatures. Scale (first octave) As suggested by Brown, the Hessian and derivative of D are approximated by using dif- ferences of neighboring sample points. The resulting 3x3 linear system can be solved with minimal cost. If the offset x is larger than 0.5 in any dimension, then it means that the ex- ˆ tremum lies closer to a different sample point. In this case, the sample point is changed and Difference of the interpolation performed instead about that point. The final offset x is added to the location ˆ Gaussian Gaussian (DOG) of its sample point to get the interpolated estimate for the location of the extremum. The function value at the extremum, D(ˆ), is useful for rejecting unstable extrema with xFigure 1: For each octave of scale space, the initial image is repeatedly convolved with Gaussians toproduce the set of scale space images shown on the left. Adjacent Gaussian images are subtracted low contrast. This can be obtained by substituting equation (3) into (2), givingto produce the difference-of-Gaussian images on the right. After each octave, the Gaussian image isdown-sampled by a factor of 2, and the process repeated. Image gradients 1 ∂D T Keypoint descriptor D(ˆ) = D + x x. ˆ 2 ∂x Figure 7: A keypoint descriptor is created by first computing the gradient magnitude and orientation In addition, the difference-of-Gaussian function provides a close approximation to the at each image sample point in a region around the keypoint location,value of |D(ˆ)| less than 0.03 were For the experiments in this paper, all extrema with a as shown onx left. These are thescale-normalized Laplacian of Gaussian, σ 2 2 G, as studied by Lindeberg (1994). Lindeberg weighted bydiscarded (as before,indicated by the overlaid circle. These samples are then accumulated a Gaussian window, we assume image pixel values in the range [0,1]).showed that the normalization of the Laplacian with the factor σ 2 is required for true scale into orientation histograms summarizing the contents over 4x4 subregions, as shown on the right, with too Figure 5 shows the effects of keypoint selection on a natural image. In order to avoid
  • 24. Application: Automatic Panoramas• Application: Panoramas
  • 25. Tracking• Feature finding and matching is slow• Lower quality features can match faster with same results
  • 26. Demo: FAST Tracking
  • 27. Augmented Reality
  • 28. Augmented Reality• Fuse live video with generated pixels based on device sensors• Geolocated• Marker Based• Commercial SDKs available
  • 29. Geolocated AR• AR Based on GPS Location• Fuse rendered objects with real world locations
  • 30. 3DAR Toolkit•• Drop in replacement for MKMapView• Shows AR view based on phone orientation• Free if branded• $5K for unbranded
  • 31. Demos:LAYAR, 3DAR
  • 32. Marker Based AR• Find a marker• Figure out camera transform to it• Render something on top of it• String SDK• Qualcomm AR SDK
  • 33. Demo: Marker Based AR SDK License Notes NYAR GPL Old String Commercial $ Qualcomm Commercial, No cost Still in beta augmented-reality
  • 34. Qualcomm SDK• FLANN to find initial features• FAST to update after marker is found
  • 35. That’s It!• Qualcomm AR SDK: augmented-reality• String SDK:• Me: