48
Jason Rebello | Waterloo Autonomous Vehicles Lab Review of Computer Vision Techniques Jason Rebello 16/05/2017

Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

  • Upload
    vantu

  • View
    215

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Jason Rebello | Waterloo Autonomous Vehicles Lab

Review ofComputer Vision

Techniques

Jason Rebello16/05/2017

Page 2: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Outline |

Jason Rebello | Waterloo Autonomous Vehicles Lab

Part I : What is Computer Vision and how is an image formed

Part || : Feature Detection and Feature Matching

Part ||| : Feature Tracking and Prediction

Part IV : Applications (Bag Of Words)

Page 3: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Part I |

Jason Rebello | Waterloo Autonomous Vehicles Lab

What is Computer Vision and How is an Image Formed

Page 4: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Introduction |

Jason Rebello | Waterloo Autonomous Vehicles Lab

Image Processing: Image Manipulation (Motion compensation, Filtering)

Computer Vision: Scene Interpretation

Noise Removal Image Sharpening

Semantic Segmentation 3D Reconstruction

Page 5: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Introduction | Computer Vision systems

Jason Rebello | Waterloo Autonomous Vehicles Lab

Autonomous driving Source: Tesla Optical Character Recognition

Structure from Motion Source: DrCalleOlsson Surveillance Source: Ben Benfold & Ian Reid

Page 6: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Introduction | Computer Vision is hard

Jason Rebello | Waterloo Autonomous Vehicles Lab

Motion from shadowsSource: Dan Kersten

Shadow Effects

Page 7: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Introduction | Image Representations

Jason Rebello | Waterloo Autonomous Vehicles Lab

Colour ImageGray Scale

Salt and Pepper Noise

- Images are thought of Functions

- Images:Sample 2D spaceQuantize Intensity

- Noise is another function combined with

original function

Page 8: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Image Formation | Cameras and Lenses

Jason Rebello | Waterloo Autonomous Vehicles Lab

No ApertureSingle Ray: Dim Image, Diffraction

Lens: Multiple Light Rays

Source: Scaramuzza, AMRx

Thin Lens Diagram

Thin Lens Equation

Page 9: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Image Formation | Distortions

Jason Rebello | Waterloo Autonomous Vehicles Lab

Radial DistortionSource: Scaramuzza

Tangential Distortion Source: MathWorks

Nikon Lens SystemSource: Aaron Bobik

Page 10: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Image Formation | Projection pipeline

Jason Rebello | Waterloo Autonomous Vehicles Lab

Forward Projection

Source: Robert Collins, CSE486

(a) (b) (c)

Image to Pixel Coordinates

Page 11: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Image Formation | Camera Parameters

Jason Rebello | Waterloo Autonomous Vehicles Lab

(a) Extrinsic Transformation (Rotation + Translation)

- Transforms points from World to Camera coordinate Frame

- Homogeneous coordinates allow for easy matrix multiplication

(b),(c) Perspective Projection

Camera Coordinates Pixel CoordinatesSource: Robert Collins, CSE486

Page 12: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

End of Part I |

Jason Rebello | Waterloo Autonomous Vehicles Lab

Page 13: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Part II |

Jason Rebello | Waterloo Autonomous Vehicles Lab

Feature Detection andFeature Matching

Page 14: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Feature Detectors |

Jason Rebello | Waterloo Autonomous Vehicles Lab

Need to find reliably detectable and discriminable locations in images- Repeatability ( Across images )- Precise ( Location )- Saliency ( Distinctive description )- Compactness ( Few features )- Locality ( Size of descriptor region)

Source: Mubarak Shah

Page 15: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Feature Detectors | FAST corner detector

Jason Rebello | Waterloo Autonomous Vehicles Lab

- Let ‘P’ be point of interest

- Select threshold ‘t’

- Consider 16 pixels around Point ‘P’

- ‘P’ is a corner if ‘n’ consecutive pixels with corresponding intensity greater or less than intensity of ‘P’ exist

- Shi-Tomasi, GFTT, BRIEF, SURF, SIFT

Source: OpenCV

Features from Accelerated Segment Test

Page 16: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Feature Detectors | Harris Corner Detector

Jason Rebello | Waterloo Autonomous Vehicles Lab

- Consider a grayscale image I. Calculate the variation in the gradient by sweeping a window in x and y direction

- Approximation in matrix form

- Determine Score for each window

- Score using Eigen values

- Image Convolution using Sobel Operator

Page 17: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Feature Detectors | Harris Score Value

Jason Rebello | Waterloo Autonomous Vehicles Lab

Page 18: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Feature Detectors | Harris Corner Properties

Jason Rebello | Waterloo Autonomous Vehicles Lab

Rotation Invariant

Uniform Intensity Invariance

Not Scale Invariant

Scale Invariant Detection

Page 19: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Feature Detectors | SIFT Detector

Jason Rebello | Waterloo Autonomous Vehicles Lab

Laplacian of Gaussian vs Difference of Gaussian

Scale Space Generation

Page 20: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Feature Detectors | SIFT Detector

Jason Rebello | Waterloo Autonomous Vehicles LabSource: Aaron Bobik

Extrema at different scales

Page 21: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Feature Detectors | SIFT Detector

Jason Rebello | Waterloo Autonomous Vehicles Lab

Find Maxima in Scale Space SIFT Feature Points

Source: Aaron Bobik

Page 22: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Feature Descriptors | SIFT Descriptor

Jason Rebello | Waterloo Autonomous Vehicles Lab

- Find Gradients of image patch

- Get Dominant Orientation using 36 bins and applying gaussian weighting.

- Highest Peak is dominant orientation

- Take 16x16 region around Keypoint and rotate to dominant orientation

- Divide into 16 sub-blocks of 4x4 and create orientation histogram with 8 bins

- Stack histogram to get 128 Dimensional Descriptor

Dominant Orientation 128 Dimensional Descriptor

Histogram Orientation

Page 23: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Feature Descriptors | Descriptor Comparison

Jason Rebello | Waterloo Autonomous Vehicles LabSource: Gil

(i) BRIEF(ii) BRISK(iii) FREAK

Page 24: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Questions |

Jason Rebello | Waterloo Autonomous Vehicles Lab

Page 25: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Part III |

Jason Rebello | Waterloo Autonomous Vehicles Lab

Feature Tracking and Prediction

Page 26: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Stereo Vision |

Jason Rebello | Waterloo Autonomous Vehicles LabSource: Aaron Bobik

Xl - Xr = disparity

Page 27: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Feature Matching | SSD

Jason Rebello | Waterloo Autonomous Vehicles Lab

- Sum of Square differences between two descriptors f1 and f2- What value of threshold to use ?

- How to resolve ambiguous matches ? Ratio distance = SSD(f1,f2) / SSD(f1,f’2)

- Ambiguous matches will have ratio close to 1

Page 28: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Feature Tracking | Optical Flow

Jason Rebello | Waterloo Autonomous Vehicles Lab

- Determine apparent motion of object in consecutive frames

- Given pixel in I(x,y,t), find nearby pixels of same intensity in I(x,y,t+1)

Brightness Constancy Constraint:

Small Motion Constraint:

Source: Aaron Bobik

Page 29: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Feature Tracking | KLT

Jason Rebello | Waterloo Autonomous Vehicles Lab

Optical Flow Equation

- Ix Iy are space image derivatives

- It is time image derivative

- u v are unknowns

- 5x5 window gives 25 equations per pixel.

Solution: d = (ATA)-1ATb

Source: Aaron Bobik

Page 30: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Feature Prediction | Parallel image planes

Jason Rebello | Waterloo Autonomous Vehicles Lab

What if the image planes weren’t parallel ?

Sum of Squared Differences :

Page 31: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Feature Prediction | Epipolar Geometry

Jason Rebello | Waterloo Autonomous Vehicles Lab

- Lines project to lines in the image

- All epipolar lines intersect at epipole

- One dimensional search for correspondence

- Parallel image planes have epipole at infinity

Page 32: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Epipolar Geometry | Essential Matrix

Jason Rebello | Waterloo Autonomous Vehicles LabSource: Aaron Bobik

Page 33: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Epipolar Geometry | Fundamental matrix

Jason Rebello | Waterloo Autonomous Vehicles Lab

Calculate F from minimum 8 correspondences

Source: Aaron Bobik

Page 34: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Epipolar Geometry | Fundamental Matrix

Jason Rebello | Waterloo Autonomous Vehicles LabSource: Aaron Bobik

Page 35: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Correspondence Problem | Why is it hard

Jason Rebello | Waterloo Autonomous Vehicles Lab

Window Size Occlusion

Narrow occluding surface ( Ordering problems)

Source: Aaron Bobik

Page 36: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Questions |

Jason Rebello | Waterloo Autonomous Vehicles Lab

Page 37: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Part IV |

Jason Rebello | Waterloo Autonomous Vehicles Lab

Bag of Words

Page 38: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Place Recognition | Overview

Jason Rebello | Waterloo Autonomous Vehicles LabSource: Margarita Chli

Page 39: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Place Recognition | Creating feature space

Jason Rebello | Waterloo Autonomous Vehicles Lab

Extract Features using SIFT descriptor

Hierarchical Clustering to get Visual Words

Source: Margarita Chli

Page 40: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Place Recognition | Training Images

Jason Rebello | Waterloo Autonomous Vehicles Lab

- Pass each image through Vocabulary Tree

- Get Visual words based on features of image

- Use inverted file index (Visual word to image mapping) for quick test time

Source: Margarita Chli

Page 41: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Place Recognition | Test Image

Jason Rebello | Waterloo Autonomous Vehicles Lab

- Extract Features from Test Image

- Find corresponding Visual Words

- Determine closest match

Source: Margarita Chli

Page 42: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Questions |

Jason Rebello | Waterloo Autonomous Vehicles Lab

Page 43: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

Homework |

Jason Rebello | Waterloo Autonomous Vehicles Lab

Read and Summarize:

1) SURF Detector and Descriptor

2) ORB Detector and Descriptor

Page 44: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

SURF Detector | Integral Image

Jason Rebello | Waterloo Autonomous Vehicles Lab

Create: 16 + 12 - 7 + 3 = 24Create: 16 + 23 - 13 + 6 = 32

Query: 64 + 16 - 32 - 32 = 16 same as 6+5+3+2 = 16

Page 45: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

SURF Detector | Speeded Up Robust Features

Jason Rebello | Waterloo Autonomous Vehicles Lab

Gaussian Partial Derivatives

Box Filter Approximations Hessian Matrix and Determinant

Scale space analysis

Lyy Lxy Dyy Dxy

Page 46: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

SURF Descriptor |

Jason Rebello | Waterloo Autonomous Vehicles Lab

Haar Wavelets

Dominant Orientation

SURF Descriptor

- Each patch is 4 dimensional vector

- 16 Patches give 64

Dimensional Vector

- Sign of Hessian Matrix for black vs white blobs

Black vs White blobs

Page 47: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

ORB Detector | Oriented fast and Robust Brief

Jason Rebello | Waterloo Autonomous Vehicles Lab

- FAST corner Detector

- Harris Corner Measure

- FAST detected at multiple levels in the Pyramid for Scale Invariance

BRIEF: Binary Robust Independent Elementary Features

- Random Selection of pairs of Intensity Values

- Fixed sampling Pattern of 128, 256 or 512 pairs

- Hamming Distance to compare descriptors (XOR)

Page 48: Review of Computer Vision Techniques - University of Waterloowavelab.uwaterloo.ca/slam/2017-SLAM/Lecture4-computer_vision... · Shadow Effects. Introduction ... Feature Detectors

ORB Descriptor |

Jason Rebello | Waterloo Autonomous Vehicles Lab

Patch moments

Center of Mass

OrientationAngle Calculation

Learning the paris

- 300K Keypoints- 205590 Possible Tests- 256 dimensional descriptor