740 likes | 747 Views
Learn about edge detection techniques to convert a 2D image into curves, extracting important features of the scene in a more compact manner than pixels.
E N D
CS 440 / ECE 448Introduction to Artificial IntelligenceFall 2006 Instructor: Eyal Amir TAs: Deepak Ramachandran (head TA), Jaesik Choi CS440 / ECE 448 – Fall 2006 Lecture #2
Edge detection • Convert a 2D image into a set of curves • Extracts salient features of the scene • More compact than pixels CS440 / ECE 448 – Fall 2006 Lecture #2
Origin of Edges • Edges are caused by a variety of factors surface normal discontinuity depth discontinuity surface color discontinuity illumination discontinuity CS440 / ECE 448 – Fall 2006 Lecture #2
Last Time: Detecting Local Features • Convolution: Slide a window over the image, creating an image of dot products • Detect • Line • Edge / Edgel • Corners • Direction of the above CS440 / ECE 448 – Fall 2006 Lecture #2
Effect of (Gaussian kernel size) original Canny with Canny with • The choice of depends on desired behavior • large detects large scale edges • small detects fine features CS440 / ECE 448 – Fall 2006 Lecture #2
Edge detection by subtraction original CS440 / ECE 448 – Fall 2006 Lecture #2
Edge detection by subtraction smoothed (5x5 Gaussian) CS440 / ECE 448 – Fall 2006 Lecture #2
Edge detection by subtraction Why does this work? smoothed – original (scaled by 4, offset +128) CS440 / ECE 448 – Fall 2006 Lecture #2 filter demo
Gaussian - image filter Gaussian delta function CS440 / ECE 448 – Fall 2006 Lecture #2 Laplacian of Gaussian
An edge is not a line... • How can we detect lines ? CS440 / ECE 448 – Fall 2006 Lecture #2
Finding lines in an image • Option 1: • Search for the line at every possible position/orientation • What is the cost of this operation? • Option 2: • Use a voting scheme: Hough transform CS440 / ECE 448 – Fall 2006 Lecture #2
Finding lines in an image y b • Connection between image (x,y) and Hough (m,b) spaces • A line in the image corresponds to a point in Hough space • To go from image space to Hough space: • given a set of points (x,y), find all (m,b) such that y = mx + b b0 m0 x m image space Hough space CS440 / ECE 448 – Fall 2006 Lecture #2
A: the solutions of b = -x0m + y0 • this is a line in Hough space Finding lines in an image y b • Connection between image (x,y) and Hough (m,b) spaces • A line in the image corresponds to a point in Hough space • To go from image space to Hough space: • given a set of points (x,y), find all (m,b) such that y = mx + b • What does a point (x0, y0) in the image space map to? y0 x0 x m image space Hough space CS440 / ECE 448 – Fall 2006 Lecture #2
Hough transform algorithm • Typically use a different parameterization • d is the perpendicular distance from the line to the origin • is the angle this perpendicular makes with the x axis • Why? • Basic Hough transform algorithm • Initialize H[d, ]=0 • for each edge point I[x,y] in the image for = 0 to 180 H[d, ] += 1 • Find the value(s) of (d, ) where H[d, ] is maximum • The detected line in the image is given by • What’s the running time (measured in # votes)? CS440 / ECE 448 – Fall 2006 Lecture #2
Extensions • Extension 1: Use the image gradient • same • for each edge point I[x,y] in the image compute unique (d, ) based on image gradient at (x,y) H[d, ] += 1 • same • same • What’s the running time measured in votes? • Extension 2 • give more votes for stronger edges • Extension 3 • change the sampling of (d, ) to give more/less resolution • Extension 4 • The same procedure can be used with circles, squares, or any other shape CS440 / ECE 448 – Fall 2006 Lecture #2
Extensions • Extension 1: Use the image gradient • same • for each edge point I[x,y] in the image compute unique (d, ) based on image gradient at (x,y) H[d, ] += 1 • same • same • What’s the running time measured in votes? • Extension 2 • give more votes for stronger edges • Extension 3 • change the sampling of (d, ) to give more/less resolution • Extension 4 • The same procedure can be used with circles, squares, or any other shape CS440 / ECE 448 – Fall 2006 Lecture #2
Hough demos Line : http://www.dai.ed.ac.uk/HIPR2/houghdemo.html http://www.dis.uniroma1.it/~iocchi/slides/icra2001/java/hough.html Circle : http://www.markschulze.net/java/hough/ CS440 / ECE 448 – Fall 2006 Lecture #2
CS440 / ECE 448 – Fall 2006 Lecture #2
Edge detection • What real-world position does a pixel represent? CS440 / ECE 448 – Fall 2006 Lecture #2
Simple Segmentation: Subtraction Next: Positioning CS440 / ECE 448 – Fall 2006 Lecture #2
Processing an Image Image: array of pixels Localizing Transformation to real-world, 3D coordinates Features: lines, shapes, invariants, colors, positions, histograms matching against prototype/class Segmentation, aggregation CS440 / ECE 448 – Fall 2006 Lecture #2
Processing an Image Image: array of pixels Localizing Transformation to real-world, 3D coordinates Features: lines, shapes, invariants, colors, positions, histograms CS440 / ECE 448 – Fall 2006 Lecture #2
Rest of Today: Vision & Localization • 3-D EUCLIDEAN SPACE & RIGID-BODY MOTION • Coordinates and coordinate frames • Rigid-body motion and homogeneous • coordinates • GEOMETRIC MODELS OF IMAGE FORMATION • Pinhole camera model • CAMERA INTRINSIC PARAMETERS • From metric to pixel coordinates CS440 / ECE 448 – Fall 2006 Lecture #2
Frontal pinhole IMAGE FORMATION – Pinhole Camera Model Pinhole Z CS440 / ECE 448 – Fall 2006 Lecture #2
Coordinates of a point in space: Standard base vectors: 3-D EUCLIDEAN SPACE - Cartesian Coordinate Frame CS440 / ECE 448 – Fall 2006 Lecture #2
Coordinates of the vector : 3-D EUCLIDEAN SPACE - Vectors A “free” vector is defined by a pair of points : CS440 / ECE 448 – Fall 2006 Lecture #2
Cross product between two vectors: 3-D EUCLIDEAN SPACE – Inner Product and Cross Product Inner product between two vectors: CS440 / ECE 448 – Fall 2006 Lecture #2
Coordinates are related by: RIGID-BODY MOTION – Rotation Rotation matrix: R is Orthogonal: CS440 / ECE 448 – Fall 2006 Lecture #2
Coordinates are related by: Velocities are related by: RIGID-BODY MOTION – Rotation and Translation CS440 / ECE 448 – Fall 2006 Lecture #2
Homogeneous coordinates: Homogeneous coordinates/velocities are related by: RIGID-BODY MOTION – Homogeneous Coordinates 3-D coordinates are related by: CS440 / ECE 448 – Fall 2006 Lecture #2
Frontal pinhole IMAGE FORMATION – Pinhole Camera Model Pinhole Z CS440 / ECE 448 – Fall 2006 Lecture #2
Homogeneous coordinates IMAGE FORMATION – Pinhole Camera Model 2-D coordinates CS440 / ECE 448 – Fall 2006 Lecture #2
metric coordinates Linear transformation pixel coordinates CAMERA PARAMETERS – Pixel Coordinates CS440 / ECE 448 – Fall 2006 Lecture #2
Calibration matrix (intrinsic parameters) Projection matrix Camera model CAMERA PARAMETERS – Calibration Matrix and Camera Model Pinhole camera Pixel coordinates CS440 / ECE 448 – Fall 2006 Lecture #2
Projection of a 3-D point to an image plane IMAGE FORMATION – Image of a Point Homogeneous coordinates of a 3-D point Homogeneous coordinates of its 2-D image CS440 / ECE 448 – Fall 2006 Lecture #2
Homogeneous representation of its 2-D image Projection of a 3-D line to an image plane IMAGE FORMATION – Image of a Line Homogeneous representation of a 3-D line CS440 / ECE 448 – Fall 2006 Lecture #2
Multiple Images . . . • Images are all “incident” at the corresponding features in space; • Features in space have many types of incidence relationships; • Features in space have many types of metric relationships. CS440 / ECE 448 – Fall 2006 Lecture #2
CAMERA PARAMETERS – Radial Distortion Nonlinear transformation along the radial direction Distortion correction: make lines straight CS440 / ECE 448 – Fall 2006 Lecture #2
Next class: Probabilistic Knowledge CS440 / ECE 448 – Fall 2006 Lecture #2
CS440 / ECE 448 – Fall 2006 Lecture #2
Brooks and Binford, 1981 • Sullivan and Ponce, 1998 • Invariants (Weiss, 1988; Rothwell et al., 1992; etc.) • Murase and Nayar, 1992 • Schmid and Mohr, 1996 CS440 / ECE 448 – Fall 2006 Lecture #2
Human Bug ?? Face Camel CS440 / ECE 448 – Fall 2006 Lecture #2
EXTRA SLIDES(not included in class presentation) CS440 / ECE 448 – Fall 2006 Lecture #2
Hough Transform for Curves • The H.T. can be generalized to detect any curve that can be expressed in parametric form: • Y = f(x, a1,a2,…ap) • a1, a2, … ap are the parameters • The parameter space is p-dimensional • The accumulating array is LARGE! CS440 / ECE 448 – Fall 2006 Lecture #2
Corner detection Corners contain more edges than lines. • A point on a line is hard to match. CS440 / ECE 448 – Fall 2006 Lecture #2
Corners contain more edges than lines. • A corner is easier CS440 / ECE 448 – Fall 2006 Lecture #2
Edge Detectors Tend to Fail at Corners CS440 / ECE 448 – Fall 2006 Lecture #2
Finding Corners • Intuition: • Right at corner, gradient is ill defined. • Near corner, gradient has two different values. CS440 / ECE 448 – Fall 2006 Lecture #2
Formula for Finding Corners We look at matrix: Gradient with respect to x, times gradient with respect to y Sum over a small region, the hypothetical corner WHY THIS? CS440 / ECE 448 – Fall 2006 Lecture #2 Matrix is symmetric
First, consider case where: • This means all gradients in neighborhood are: • (k,0) or (0, c) or (0, 0) (or off-diagonals cancel). • What is region like if: • l1 = 0? • l2 = 0? • l1 = 0 and l2 = 0? • l1 > 0 and l2 > 0? CS440 / ECE 448 – Fall 2006 Lecture #2