computer and machine visionecee.colorado.edu/~siewerts/extra/ecen5763/ecen... · 2/26/2014  ·...

16
February 26, 2014 Sam Siewert Computer and Machine Vision Lecture Week 7 Part-1 (Convolution Transform Speed-up and Hough Linear Transform)

Upload: others

Post on 25-Aug-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer and Machine Visionecee.colorado.edu/~siewerts/extra/ecen5763/ecen... · 2/26/2014  · –CV pp. 185 – 191 –Used to Stitch Together Images in a Mosaic –Used for 3D

February 26, 2014 Sam Siewert

Computer and Machine

Vision

Lecture Week 7

Part-1

(Convolution Transform Speed-up

and Hough Linear Transform)

Page 2: Computer and Machine Visionecee.colorado.edu/~siewerts/extra/ecen5763/ecen... · 2/26/2014  · –CV pp. 185 – 191 –Used to Stitch Together Images in a Mosaic –Used for 3D

Outline of Week 7 Basic Convolution Transform Speed-Up Concepts for Computer Vision

Hough Linear Transform

Review for Exam #1

Exam #1 – Next Week Friday/Saturday

– Friday In Person 9am to 12noon

– Or Via E-mail Between 9am Friday and 9pm Saturday

Sam Siewert 2

Page 3: Computer and Machine Visionecee.colorado.edu/~siewerts/extra/ecen5763/ecen... · 2/26/2014  · –CV pp. 185 – 191 –Used to Stitch Together Images in a Mosaic –Used for 3D

Methods to Speed-Up

Convolution Transform

Multi-Core Speed-up

Sam Siewert

3

Page 4: Computer and Machine Visionecee.colorado.edu/~siewerts/extra/ecen5763/ecen... · 2/26/2014  · –CV pp. 185 – 191 –Used to Stitch Together Images in a Mosaic –Used for 3D

Threading Review

Recall Threads from Operating Systems (Review if you Need to)

CPU Core Methods – POSIX Threads

GPU Co-Processor Methods – CUDA (Not Required Here – Covered in Digital Media, Tricky) – If Interested, See Udacity Intro to Parallel Programming –

https://www.udacity.com/course/cs344

– http://developer.nvidia.com/object/cuda_training.html

SIMD – Generate Vector Instructions on x86 with SSE (-mssse3 switch for gcc), See Paper

Sam Siewert 4

Page 5: Computer and Machine Visionecee.colorado.edu/~siewerts/extra/ecen5763/ecen... · 2/26/2014  · –CV pp. 185 – 191 –Used to Stitch Together Images in a Mosaic –Used for 3D

Transform Thread Grids Recall Flynn’s Taxonomy of Architectures for Processing

Linux POSIX Threading

– Map Threads to Frame Grid

– Divide Up Frame

– Or Map Thread to Each Frame in Sequence

– # Threads is at Least 2x # of CPU Cores or Co-processor cores

– POSIX thread creation, parameters, join

– Thread safety Stack variables only

Thread indexed global data

Mutual Exclusion Semaphore protection of shared global data

SIMD Vector Instructions

Sam Siewert 5

Page 6: Computer and Machine Visionecee.colorado.edu/~siewerts/extra/ecen5763/ecen... · 2/26/2014  · –CV pp. 185 – 191 –Used to Stitch Together Images in a Mosaic –Used for 3D

Multi-Core Speedup Recall Speed-up Limited by Amdahl’s Law (MS Excel Example) – P = Parallel Portion

– (1-P) = Sequential Portion

– S = # of Cores to Provide Speedup

– # Threads on Multi-Core Should be at Least 2 x S, Up to 4 x S (To Account of I/O blocking)

Sam Siewert 6

Page 7: Computer and Machine Visionecee.colorado.edu/~siewerts/extra/ecen5763/ecen... · 2/26/2014  · –CV pp. 185 – 191 –Used to Stitch Together Images in a Mosaic –Used for 3D

Hough Linear Transform

Introduction to Shape

Recognition

Sam Siewert

7

Page 8: Computer and Machine Visionecee.colorado.edu/~siewerts/extra/ecen5763/ecen... · 2/26/2014  · –CV pp. 185 – 191 –Used to Stitch Together Images in a Mosaic –Used for 3D

Line Recognition

Patent by P.V.C. Hough in 1962

Further Refined by Richard Duda and Peter Hart working at SRI on Shakey Robot

– Use of the Hough Transformation to Detect Lines and Curves in Pictures, Richard Duda & Peter Hart

– How the Hough Transform was Invented, P.E. Hart

– Both Available on Blackboard

Transformation to R, Theta Space for All Points in Image on Edges in PBM

Sam Siewert 8

Page 9: Computer and Machine Visionecee.colorado.edu/~siewerts/extra/ecen5763/ecen... · 2/26/2014  · –CV pp. 185 – 191 –Used to Stitch Together Images in a Mosaic –Used for 3D

Hough Transform

Every Point on an Edge in the Image Has a Range of Lines it Can Lie On, Each with Unique Perpendicular Distance R to Origin and Angle Theta Off X axis

Center in Image: -R to R and Theta=0 … Pi

R, Theta Intersections in Transformed Space are Co-linear

Sam Siewert 9

http://en.wikipedia.org/wiki/File:Hough_transform_diagram.png

From “How the Hough Transform Was Invented”, Peter E. Hart,

IEEE Signal and Processing Magazine, November 2009.

Page 10: Computer and Machine Visionecee.colorado.edu/~siewerts/extra/ecen5763/ecen... · 2/26/2014  · –CV pp. 185 – 191 –Used to Stitch Together Images in a Mosaic –Used for 3D

From Duda and Hart Paper

Example of 120x120 PGM Converted to PBM with Thresholiding

R, Theta at 20 degree increments

Counts for Image FG Pixels with R, Theta Intersection Accumulated

Counts > 35 Considered a Significant Edge Line in Shape of Interest

Sam Siewert 10

From “Use of Hough

Transformation to Detect

Lines and Curves in

Pictures”, Richard Duda and

Peter Hart, Communications

of the ACM, January 1972,

Volume 15, Number 1.

Page 11: Computer and Machine Visionecee.colorado.edu/~siewerts/extra/ecen5763/ecen... · 2/26/2014  · –CV pp. 185 – 191 –Used to Stitch Together Images in a Mosaic –Used for 3D

Hough Transform General

Recognition

Similar Approach in Parametric Space

Used to Find Edge Pixels on a Circle or

Ellipse in Parametric Transform

Generalized Based on Parametric

Transform for a Pattern Model

Sam Siewert 11

Page 12: Computer and Machine Visionecee.colorado.edu/~siewerts/extra/ecen5763/ecen... · 2/26/2014  · –CV pp. 185 – 191 –Used to Stitch Together Images in a Mosaic –Used for 3D

RANSAC Alternative Start with Any 2 Edge Points to Form Line Hypothesis – Find Number of Additional Edge

Points that Are Co-linear Within Tolerance to Support Hypothesis

– Final Line has Greatest Support

Disadvantage is Run-time Compared to Hough Transform

Hough is Based on R and Theta Resolution and Number of Edge Points – O(n x R x Theta)

RANSAC Can Test all Edge Pairs Potentially – O(n3)

Sam Siewert 12

http://en.wikipedia.org/wiki/File:Fitted_line.svg

From Computer and Machine Vision,

E.R. Davies, page 292.

Page 14: Computer and Machine Visionecee.colorado.edu/~siewerts/extra/ecen5763/ecen... · 2/26/2014  · –CV pp. 185 – 191 –Used to Stitch Together Images in a Mosaic –Used for 3D

Feature Detectors

Keypoint features

Edges

Correspondences

– CV pp. 185 – 191

– Used to Stitch Together Images in a Mosaic

– Used for 3D Image Stereopsis (Registration

Points for Right and Left Eye for Similar

Triangles)

– Used for Image Stabilization (Without Gimbal)

Sam Siewert 14

Page 15: Computer and Machine Visionecee.colorado.edu/~siewerts/extra/ecen5763/ecen... · 2/26/2014  · –CV pp. 185 – 191 –Used to Stitch Together Images in a Mosaic –Used for 3D

Feature Correspondence 1. Correlation (Least Squares) and Track with

Localized Search – Track Identified Feature Frame to Frame

– Similar to Lab #3, but More Complex than Simple Center of Mass for Threshold

2. Detect all Features and Match – Find Locations That Will Match Well

– Compact Invariant Descriptor

– Search New Images for Matching Candidates

David Lowe – SIFT

Sam Siewert 15

Page 16: Computer and Machine Visionecee.colorado.edu/~siewerts/extra/ecen5763/ecen... · 2/26/2014  · –CV pp. 185 – 191 –Used to Stitch Together Images in a Mosaic –Used for 3D

Summary

Segmenting Shapes in an Image is More Powerful Than Edge Finding

Step toward Recognition Beyond Segmentation

Step toward Feature Registration (Common Feature Seen in Two Images of Same Scene)

More on SIFT – Scale Invariant Feature Transform, After Exam #1

Sam Siewert 16