SlideShare a Scribd company logo
1 of 35
Download to read offline
From Accelerometers
to Augmented Reality
     Jonathan Blocksom
        @jblocksom

      iOSDevCamp 2011
       August 13, 2011

      Jonathan Saggau
       (@jonmarimba)
      present in spirit
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?
iOS and the World
         Around Us

   Purpose              Sensor               SDK


Device Movement   Accelerometer, Gyros    Core Motion


  Geolocation     GPS, Magnetometer      Core Location


     Video              Camera           AVFoundation

                                         AVFoundation,
    Audio             Microphone
                                           Core Jose
Core Motion
• High level interface
  to orientation and
  movement data

• iOS 4+

• Accelerometer and
  Gyroscope

• Sensor Fusion and
  Data Filtering
Motion Sensors:
      Accelerometer

• Accelerometer

 • From iPhone 1

 • Noisy Gravity
   Detector          !"#$#%&'%()*+,%-#,.#/%
                     "012334445+67+$58#93:;+,<3=9)><39<$)3=!?@A1BCDEE@4E&>%


 • 100Hz, +/- 2.3G
Motion Sensors:
       Gyroscopes


• Gyroscope
 • iPhone 4, iPad 2
 • Rotation Rate
 • 200/500/2500
   dps
Demo:
            Vibration

• Visualize
  Accelerometer Data

• App Store, $4.99
  http://
  itunes.apple.com/
  app/vibration/
  id301097580
Demo 1:
Core Motion Teapot
Using Core Motion
• Poll for data or
  block handlers for
  updates

• Data as
  Yaw, Pitch, Roll
  Quaternion
  4x4 Transform

• Timestamps
  included
Demo:
   Core Motion Viewer
• https://bitbucket.org/jblocksom/
  coremotionviewer
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
Computer Vision
Computer Vision:
         OpenCV
• The SDK I love to hate
Building OpenCV on iOS
• Follow this 20 step recipe:
  http://computer-vision-talks.com/
  2010/12/building-opencv-for-ios/


• Or go here:
  https://github.com/jonmarimba/
  OpenCV-iOS
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: http://vimeo.com/12774628
Haar classification



• “Cascade of
  boosted classifiers
  working with haar-
  like features”
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);
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
What it’s Doing
• Windows
  show where
  wavelets being
  checked
• Overlapping
  rectangles are
  a detection
Defeating Face
         Detection
• cvDazzle project
• Can also just turn to
  the side
Demo:
      Face Detection
• OpenCV based
Feature Matching
• Feature Matching is the
  workhorse of modern
  computer vision
 • Panoramas
 • Image stabilization
 • Superresolution
 • 3D reconstruction
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
                                                                                                                                                                  x
Figure 1: For each octave of scale space, the initial image is repeatedly convolved with Gaussians to
produce 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), giving
to produce the difference-of-Gaussian images on the right. After each octave, the Gaussian image is
down-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
                                                                                                                                                                                           the
scale-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
Application:
 Automatic Panoramas
• Application: Panoramas
Tracking
• Feature finding and
  matching is slow
• Lower quality
  features can match
  faster with same
  results
Demo: FAST Tracking
Augmented Reality
Augmented Reality
• Fuse live video with generated pixels
  based on device sensors
• Geolocated
• Marker Based


• Commercial SDKs available
Geolocated AR
• AR Based on GPS Location
• Fuse rendered objects with real world
  locations
3DAR Toolkit
• http://spotmetrix.com/
• Drop in replacement for MKMapView
• Shows AR view based on phone
  orientation
• Free if branded
• $5K for unbranded
Demos:
LAYAR, 3DAR
Marker Based AR
• Find a marker
• Figure out camera transform to it
• Render something on top of it


• String SDK
• Qualcomm AR SDK
Demo:
              Marker Based AR
            SDK                           License            Notes



          NYAR                              GPL                Old



          String                        Commercial              $
  http://poweredbystring.com




     Qualcomm
http://developer.qualcomm.com/dev/   Commercial, No cost   Still in beta
          augmented-reality
Qualcomm SDK
• FLANN to find initial features
• FAST to update after marker is found
That’s It!
• Qualcomm AR SDK:
  http://developer.qualcomm.com/dev/
  augmented-reality
• String SDK:
  http://poweredbystring.com
• Me:
  http://twitter.com/jblocksom/

More Related Content

What's hot

565 Alpha Chun-Fu Chao
565 Alpha Chun-Fu Chao565 Alpha Chun-Fu Chao
565 Alpha Chun-Fu Chao
Frank Chao
 
Practical and Robust Stenciled Shadow Volumes for Hardware-Accelerated Rendering
Practical and Robust Stenciled Shadow Volumes for Hardware-Accelerated RenderingPractical and Robust Stenciled Shadow Volumes for Hardware-Accelerated Rendering
Practical and Robust Stenciled Shadow Volumes for Hardware-Accelerated Rendering
Mark Kilgard
 
Deferred shading
Deferred shadingDeferred shading
Deferred shading
Frank Chao
 
CARR’13 - Semantically-Enhanced Pre-Filtering for CARS
CARR’13 - Semantically-Enhanced Pre-Filtering for CARSCARR’13 - Semantically-Enhanced Pre-Filtering for CARS
CARR’13 - Semantically-Enhanced Pre-Filtering for CARS
Victor Codina
 
Epic_GDC2011_Samaritan
Epic_GDC2011_SamaritanEpic_GDC2011_Samaritan
Epic_GDC2011_Samaritan
MinGeun Park
 
Estimating Human Pose from Occluded Images (ACCV 2009)
Estimating Human Pose from Occluded Images (ACCV 2009)Estimating Human Pose from Occluded Images (ACCV 2009)
Estimating Human Pose from Occluded Images (ACCV 2009)
Jia-Bin Huang
 
A Knapsack Approach to Sensor-Mission Assignment with Uncertain Demands
A Knapsack Approach to Sensor-Mission Assignment with Uncertain DemandsA Knapsack Approach to Sensor-Mission Assignment with Uncertain Demands
A Knapsack Approach to Sensor-Mission Assignment with Uncertain Demands
Diego Pizzocaro
 
03 conditional random field
03 conditional random field03 conditional random field
03 conditional random field
zukun
 
Biao Hou--SAR IMAGE DESPECKLING BASED ON IMPROVED DIRECTIONLET DOMAIN GAUSSIA...
Biao Hou--SAR IMAGE DESPECKLING BASED ON IMPROVED DIRECTIONLET DOMAIN GAUSSIA...Biao Hou--SAR IMAGE DESPECKLING BASED ON IMPROVED DIRECTIONLET DOMAIN GAUSSIA...
Biao Hou--SAR IMAGE DESPECKLING BASED ON IMPROVED DIRECTIONLET DOMAIN GAUSSIA...
grssieee
 

What's hot (19)

565 Alpha Chun-Fu Chao
565 Alpha Chun-Fu Chao565 Alpha Chun-Fu Chao
565 Alpha Chun-Fu Chao
 
Secrets of CryENGINE 3 Graphics Technology
Secrets of CryENGINE 3 Graphics TechnologySecrets of CryENGINE 3 Graphics Technology
Secrets of CryENGINE 3 Graphics Technology
 
CS 354 Lighting
CS 354 LightingCS 354 Lighting
CS 354 Lighting
 
Practical and Robust Stenciled Shadow Volumes for Hardware-Accelerated Rendering
Practical and Robust Stenciled Shadow Volumes for Hardware-Accelerated RenderingPractical and Robust Stenciled Shadow Volumes for Hardware-Accelerated Rendering
Practical and Robust Stenciled Shadow Volumes for Hardware-Accelerated Rendering
 
Deferred shading
Deferred shadingDeferred shading
Deferred shading
 
Around the World in 80 Shaders
Around the World in 80 ShadersAround the World in 80 Shaders
Around the World in 80 Shaders
 
SPU Assisted Rendering
SPU Assisted RenderingSPU Assisted Rendering
SPU Assisted Rendering
 
CARR’13 - Semantically-Enhanced Pre-Filtering for CARS
CARR’13 - Semantically-Enhanced Pre-Filtering for CARSCARR’13 - Semantically-Enhanced Pre-Filtering for CARS
CARR’13 - Semantically-Enhanced Pre-Filtering for CARS
 
DirectX 11 Rendering in Battlefield 3
DirectX 11 Rendering in Battlefield 3DirectX 11 Rendering in Battlefield 3
DirectX 11 Rendering in Battlefield 3
 
Epic_GDC2011_Samaritan
Epic_GDC2011_SamaritanEpic_GDC2011_Samaritan
Epic_GDC2011_Samaritan
 
Estimating Human Pose from Occluded Images (ACCV 2009)
Estimating Human Pose from Occluded Images (ACCV 2009)Estimating Human Pose from Occluded Images (ACCV 2009)
Estimating Human Pose from Occluded Images (ACCV 2009)
 
Paris Master Class 2011 - 04 Shadow Maps
Paris Master Class 2011 - 04 Shadow MapsParis Master Class 2011 - 04 Shadow Maps
Paris Master Class 2011 - 04 Shadow Maps
 
Kernel Recipes 2016 - Video and Colorspaces
Kernel Recipes 2016 - Video and ColorspacesKernel Recipes 2016 - Video and Colorspaces
Kernel Recipes 2016 - Video and Colorspaces
 
Nodebox for Data Visualization
Nodebox for Data VisualizationNodebox for Data Visualization
Nodebox for Data Visualization
 
A Knapsack Approach to Sensor-Mission Assignment with Uncertain Demands
A Knapsack Approach to Sensor-Mission Assignment with Uncertain DemandsA Knapsack Approach to Sensor-Mission Assignment with Uncertain Demands
A Knapsack Approach to Sensor-Mission Assignment with Uncertain Demands
 
03 conditional random field
03 conditional random field03 conditional random field
03 conditional random field
 
Random Valued Impulse Noise Removal in Colour Images using Adaptive Threshold...
Random Valued Impulse Noise Removal in Colour Images using Adaptive Threshold...Random Valued Impulse Noise Removal in Colour Images using Adaptive Threshold...
Random Valued Impulse Noise Removal in Colour Images using Adaptive Threshold...
 
A White Paper The Red Color Workflow
A White Paper The Red Color WorkflowA White Paper The Red Color Workflow
A White Paper The Red Color Workflow
 
Biao Hou--SAR IMAGE DESPECKLING BASED ON IMPROVED DIRECTIONLET DOMAIN GAUSSIA...
Biao Hou--SAR IMAGE DESPECKLING BASED ON IMPROVED DIRECTIONLET DOMAIN GAUSSIA...Biao Hou--SAR IMAGE DESPECKLING BASED ON IMPROVED DIRECTIONLET DOMAIN GAUSSIA...
Biao Hou--SAR IMAGE DESPECKLING BASED ON IMPROVED DIRECTIONLET DOMAIN GAUSSIA...
 

Similar to Accelerometers to Augmented Reality

Machine learning for high-speed corner detection
Machine learning for high-speed corner detectionMachine learning for high-speed corner detection
Machine learning for high-speed corner detection
butest
 

Similar to Accelerometers to Augmented Reality (20)

Svm map reduce_slides
Svm map reduce_slidesSvm map reduce_slides
Svm map reduce_slides
 
Sift detector boosted by adaptive contrast threshold to improve matching robu...
Sift detector boosted by adaptive contrast threshold to improve matching robu...Sift detector boosted by adaptive contrast threshold to improve matching robu...
Sift detector boosted by adaptive contrast threshold to improve matching robu...
 
Sift detector boosted by adaptive contrast threshold to improve matching robu...
Sift detector boosted by adaptive contrast threshold to improve matching robu...Sift detector boosted by adaptive contrast threshold to improve matching robu...
Sift detector boosted by adaptive contrast threshold to improve matching robu...
 
Scale Invariant Feature Tranform
Scale Invariant Feature TranformScale Invariant Feature Tranform
Scale Invariant Feature Tranform
 
Michal Erel's SIFT presentation
Michal Erel's SIFT presentationMichal Erel's SIFT presentation
Michal Erel's SIFT presentation
 
Practical Digital Image Processing 4
Practical Digital Image Processing 4Practical Digital Image Processing 4
Practical Digital Image Processing 4
 
Isvc08
Isvc08Isvc08
Isvc08
 
06 image features
06 image features06 image features
06 image features
 
Midterm II Review
Midterm II ReviewMidterm II Review
Midterm II Review
 
Augmented reality session 4
Augmented reality session 4Augmented reality session 4
Augmented reality session 4
 
06 mlp
06 mlp06 mlp
06 mlp
 
Preemptive RANSAC by David Nister.
Preemptive RANSAC by David Nister.Preemptive RANSAC by David Nister.
Preemptive RANSAC by David Nister.
 
SPATIAL POINT PATTERNS
SPATIAL POINT PATTERNSSPATIAL POINT PATTERNS
SPATIAL POINT PATTERNS
 
Machine learning for high-speed corner detection
Machine learning for high-speed corner detectionMachine learning for high-speed corner detection
Machine learning for high-speed corner detection
 
Machine Learning Algorithms (Part 1)
Machine Learning Algorithms (Part 1)Machine Learning Algorithms (Part 1)
Machine Learning Algorithms (Part 1)
 
CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9
 
Edge detection iOS application
Edge detection iOS applicationEdge detection iOS application
Edge detection iOS application
 
The Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerThe Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math Primer
 
MIT 6.870 - Template Matching and Histograms (Nicolas Pinto, MIT)
MIT 6.870 - Template Matching and Histograms (Nicolas Pinto, MIT)MIT 6.870 - Template Matching and Histograms (Nicolas Pinto, MIT)
MIT 6.870 - Template Matching and Histograms (Nicolas Pinto, MIT)
 
SIFT
SIFTSIFT
SIFT
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Accelerometers to Augmented Reality

  • 1. From Accelerometers to 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 SDK Device 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:// itunes.apple.com/ app/vibration/ id301097580
  • 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 • https://bitbucket.org/jblocksom/ 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
  • 13. Computer Vision: OpenCV • The SDK I love to hate
  • 14. Building OpenCV on iOS • Follow this 20 step recipe: http://computer-vision-talks.com/ 2010/12/building-opencv-for-ios/ • Or go here: https://github.com/jonmarimba/ 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: http://vimeo.com/12774628
  • 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 x Figure 1: For each octave of scale space, the initial image is repeatedly convolved with Gaussians to produce 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), giving to produce the difference-of-Gaussian images on the right. After each octave, the Gaussian image is down-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 the scale-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
  • 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 • http://spotmetrix.com/ • Drop in replacement for MKMapView • Shows AR view based on phone orientation • Free if branded • $5K for unbranded
  • 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 $ http://poweredbystring.com Qualcomm http://developer.qualcomm.com/dev/ 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: http://developer.qualcomm.com/dev/ augmented-reality • String SDK: http://poweredbystring.com • Me: http://twitter.com/jblocksom/