CSSE463: Image Recognition Day 25
description
Transcript of CSSE463: Image Recognition Day 25
CSSE463: Image Recognition CSSE463: Image Recognition Day 25Day 25
This weekThis week Today: Finding lines and circles using the Hough Today: Finding lines and circles using the Hough
transform (Sonka 6.26)transform (Sonka 6.26) Please fill out Angel evaluation of Sunset partner if Please fill out Angel evaluation of Sunset partner if
you had one. Use "Term Project Partner Evaluation" you had one. Use "Term Project Partner Evaluation" Tomorrow: Applications of PCATomorrow: Applications of PCA Weds: k-means lab due.Weds: k-means lab due. Sunday night: project plans and preliminary work dueSunday night: project plans and preliminary work due
Questions?Questions?
Finding lines in real imagesFinding lines in real images
Input: set of edge pointsInput: set of edge points Output: the equation of Output: the equation of
a line containing thema line containing them Methods:Methods:
Least-squares (if you Least-squares (if you know which points know which points belong to the line…)belong to the line…)
Hough transform (today)Hough transform (today)
Hough transformHough transform
Idea Idea (Sonka 6.2.6; Forsyth and Ponce, ch 15)(Sonka 6.2.6; Forsyth and Ponce, ch 15)::Represent a line using parametersRepresent a line using parametersEach edge point in the image casts a vote for Each edge point in the image casts a vote for
all lines of which it could be part.all lines of which it could be part.Only the true line receives lots of votesOnly the true line receives lots of votes
Parametric Equation of a LineParametric Equation of a Line
Represent a line using 2 parametersRepresent a line using 2 parameters y = mx + b?y = mx + b?
Problem?Problem? Ax + By + C = 0?Ax + By + C = 0?
3 parameters; but A, B, and C are related…we only 3 parameters; but A, B, and C are related…we only need 2need 2
and and is distance from line to originis distance from line to origin is the angle the distance segment makes with x-is the angle the distance segment makes with x-
axisaxis x cosx cos + y sin + y sin = =
Q1
VotingVoting
Each point in image votes for all lines of Each point in image votes for all lines of which it could be part.which it could be part.
Only “true” line receives lots of votes.Only “true” line receives lots of votes.
Quiz question: show (4,4), (2,2), and (0,0) Quiz question: show (4,4), (2,2), and (0,0) voting for a line in y = mx+b space (for voting for a line in y = mx+b space (for simplicity)simplicity)
Q2-3
Perfect linePerfect line Notice sharp peak in voting spaceNotice sharp peak in voting space (next 3 images from Forsyth and Ponce, ch 15)(next 3 images from Forsyth and Ponce, ch 15)
Q4
Approximate lineApproximate line
Notice the broader peak. Can we detect it?Notice the broader peak. Can we detect it? Could smooth or use a coarser quantization?Could smooth or use a coarser quantization? Accumulator array: bin size? Range?Accumulator array: bin size? Range?
Q5
Random noiseRandom noiseVotes spead all over the place: no lineVotes spead all over the place: no lineToo much noise creates “phantom lines”Too much noise creates “phantom lines”
Smoothing can sometimes helpSmoothing can sometimes help
Q6
LimitationsLimitations
Finding the right grid size in parameter Finding the right grid size in parameter space may be trickyspace may be trickyTrial and errorTrial and error
MatlabMatlab
Run an edge detector first to find points that are voting
[H, theta, rho] = hough(edgeImg); peaks = houghpeaks(H,nPeaks); This works for lines only
Another demoAnother demo
http://www.rob.cs.tu-bs.de/content/04-teaching/06-interactive/HNF.html
GeneralizationsGeneralizations
Finding circles with fixed radius…Finding circles with fixed radius…Finding circles with arbitrary radius…Finding circles with arbitrary radius…Finding line segmentsFinding line segmentsFinding arbitrary shapes…Finding arbitrary shapes…
Ballard, Dana. 1981. Generalizing the Hough Ballard, Dana. 1981. Generalizing the Hough transform to detect arbitrary shapes. transform to detect arbitrary shapes. Pattern Pattern RecognitionRecognition, 13(2):111-122., 13(2):111-122.
Dana was a long-time member of Rochester’s Dana was a long-time member of Rochester’s computer vision group.computer vision group.
Q7-8
My Circle FinderMy Circle Finder
DemoDemo
Wouldn’t this be a great lab?Wouldn’t this be a great lab? Like Matlab’s hough and houghpeaks (for lines), but Like Matlab’s hough and houghpeaks (for lines), but
from scratchfrom scratch Easier would be to find circles of fixed radiusEasier would be to find circles of fixed radius
Reducing the number of votesReducing the number of votes
Use the edge gradient information as wellUse the edge gradient information as wellOnly need to cast votes for centers along the Only need to cast votes for centers along the
gradientgradient I’ve done this; it works really wellI’ve done this; it works really well
Use partial curves. If you had a way of Use partial curves. If you had a way of grouping relating points, you could use grouping relating points, you could use curvature.curvature.Haven’t done yet. Haven’t done yet.