Line Detection in Images–
Recent Developments and Applications
NANDEDKAR PARTH SHIRISH
1
Department of
Intelligent Media,
Yagi Laboratory
今日の流れーTopics
1.Goal of Line Detection, difference with Edge Detection
2.Successive Approximation Method
3.Hough Transform Method
4.RANSAC(Random Sample Consensus) Method
5.Vanishing Point Detection using Hough Transform
6.Applications-Rectangle Detection
2
Department of
Intelligent Media,
Yagi Laboratory
1. Goal of Line Detection
Line detection is an algorithm that takes a collection of
n edge points and finds all the lines on which these edge
points lie.
Most popular line detectors are Hough
transform and convolution-based techniques.
Convolution-based Line Detection:
Same process as Edge Detection.
3
1. Difference with Edge Detection
An edge is a transition from one phase/object/thing to
another. On one side you have one color, on the other side
you have another color.
A line is a 1D structure. It has the same phase/object/thing
on either side. On one side you have background, on the
other side you have background also.
→Better techniques can better differentiate between these.
4
2.Successive Approximation Method
• Transforming from a curve-contour to a simpler
representation (to Piecewise-linear polyline or B-spline cur
• Algorithm: Mark the first and last point. Find the farthest
inlier from this line and join First and this point. Now remov
the farthest inlier to this line.
• If contour is a line we can simplify it to that line.
5
3.Hough Transform Basics
A line-to-point transform, that transforms the data from
x,y space to m,h space, where each line is transformed
to a point.
Problem: neither m or h are bounded
Line k to x axis ⇒ h not defined
Line k to y axis ⇒ m → ∞ 6
3.Polar Hough Transform
Now both variables are bounded!
→ Polar Hough Transform:
Value for an arbitrary line (r – xcosθ – ysinθ = 0) in (r, θ)
Where f(x,y) is the 2D image
→ Unit Sphere & Cubemap Mappings possible(pg. 253)
7
3.Polar Hough Transform – Theoretical Example
Output in the case of perfectly continuous lines.
8
3.Hough Transform for Line Detection
→ Goal: To identify straight lines
• Process: For each pixel at (x,y) the Polar Hough transform
algorithm determines if there is enough evidence of a
straight line at that pixel, using votes from sample points.
→ Strengths:
• Gives equations of lines(but not “end-points” of segments).
• Works well with simple images that contain good straight
lines. (Good for Robot Vision)
• Deals with broken lines very well (in next slide).
• Reasonably efficient if there are “few” edge points.
9
3.Polar Hough Transform – Broken Line/
Sampling Example
10
3.Polar Hough Transform – Discrete case
Same as before, but discrete. Number in Accumulator cell
proportional to number of points on the line.
11
3.Polar Hough Transform – Voting Algorithm
12
3.Hough Transform for Line Detection
→ Problems:
• Very slow of there are many edge points.
• Hough Space is non-linear, different edge sensitivities in
different directions.
• Poor for short lines.
→ Recent Extensions of Hough Method:
• Circle and Ellipse detection by Double Hough Method.
• Image transform plus Hough for general 2D shape
detection.
• Vanishing Points Detection(section 4.3.3, part 5 of slides)13
4.RANSAC (Random Sample Consensus)
Method – (For Feature Detection)
• Determines the best transformation that includes the
most number of match features (inliers) from the previous
step.
• RANSAC loop for planar pattern detection:
1. Select four feature pairs (at random) in the two angles.
2. Compute homography H (see next slide).
3. Compute inliers where SSD(pi’, Hpi) < a certain value,ε.
4. Keep largest set of inliers.
5. Re-compute least-squares estimate on all of the inliers.
14
4.RANSAC Method – What are Homographies?
• Example of Homography
• Definition: Projective–mapping between any two
projection planes with the same center of
projection
15
4.RANSAC Method – What are Homographies?
• Definition: Projective–mapping between any two
projection planes with the same center of
projection
16
4.RANSAC Method – (For Line Detection)
→ Simple example: Let us fit a line
• Use biggest set of inliers
• Do least-square fit => SD is low, Very likely it is a line
17
4.RANSAC Method – Video: Fitting a Line
→ Strengths:
• Robust estimation
• Relatively high
accuracy
→ Weaknesses:
• Randomness.
• Number of
Iterations required
for p% success
18
→ Goal: To collect lost 3D information from perspective in a
2D image detecting Vanishing points of Parallel lines.
19
5.Vanishing Points Detection – using Hough Transform
5.Vanishing Points Detection – using Hough Transform
→ Textbook method using Cross Product:
Step 1) Calculate Vanishing Point Hypothesis (weight)
= Cross product of any two line vectors =
 Near-Collinear segments downweighted
Step 2) Populate Hough space(accumulator) with weights
and find peaks for Vanishing point votes from the lines.
Step 3) Calculate Least Squares Estimate for all Vanishing
points with respect to lines that voted for it.
20
where = Green Triangle area
Rule: The lower the sum of all areas subtended to segment
endpoints, the more appropriate the vanishing point.
21
5.Vanishing Points Detection – using Hough Transform
6.Applications
Rectangle Detection:
Step 1) First, detect all vanishing points
Step 2) Detect the Edge points/Lines that are aligned along
vanishing lines.
We then efficiently recover the inter-sections of pairs of
lines corresponding to different vanishing points. (論文[8])22
6.Applications
Rectangle Detection:
Using only Hough
Detection is an 8D
vector-space problem
(論文[8]).
Major Quadrilaterals in
image can be detected
using only Vanishing
Point and Line Detection
(論文[8]).
23
References
[1] Polar Hough:
https://www.wikiwand.com/en/Hough_transform
[2] Hough Accumulator:
https://chmodux.wordpress.com/2012/04/16/target-
acquisition/
[3] Ransac:
https://www.slideshare.net/allynjoycalcaben/computer-
vision-feature-matching-with-ransac-algorithm
[4] Homographies:
https://docs.opencv.org/master/d9/dab/tutorial_homog
raphy.html
24
References
[5] Ransac animation:
https://kapernikov.com/cable-detection-in-lidar-data/
[6] Various:
Computer Vision: Algorithms and Applications by Richard
Szeliski
[7] Vanishing Points Examples:
http://teresabernardart.com/the-rules-of-
perspective/#:~:text=There%20are%20three%20basic%20
types,illusion%20of%20depth%20and%20space.
[8] Rectangle Detection Algorithm:
https://www.researchgate.net/publication/228697341_Pe
rspective_rectangle_detection 25

Line Detection in Computer Vision - Recent Developments and Applications

  • 1.
    Line Detection inImages– Recent Developments and Applications NANDEDKAR PARTH SHIRISH 1 Department of Intelligent Media, Yagi Laboratory
  • 2.
    今日の流れーTopics 1.Goal of LineDetection, difference with Edge Detection 2.Successive Approximation Method 3.Hough Transform Method 4.RANSAC(Random Sample Consensus) Method 5.Vanishing Point Detection using Hough Transform 6.Applications-Rectangle Detection 2 Department of Intelligent Media, Yagi Laboratory
  • 3.
    1. Goal ofLine Detection Line detection is an algorithm that takes a collection of n edge points and finds all the lines on which these edge points lie. Most popular line detectors are Hough transform and convolution-based techniques. Convolution-based Line Detection: Same process as Edge Detection. 3
  • 4.
    1. Difference withEdge Detection An edge is a transition from one phase/object/thing to another. On one side you have one color, on the other side you have another color. A line is a 1D structure. It has the same phase/object/thing on either side. On one side you have background, on the other side you have background also. →Better techniques can better differentiate between these. 4
  • 5.
    2.Successive Approximation Method •Transforming from a curve-contour to a simpler representation (to Piecewise-linear polyline or B-spline cur • Algorithm: Mark the first and last point. Find the farthest inlier from this line and join First and this point. Now remov the farthest inlier to this line. • If contour is a line we can simplify it to that line. 5
  • 6.
    3.Hough Transform Basics Aline-to-point transform, that transforms the data from x,y space to m,h space, where each line is transformed to a point. Problem: neither m or h are bounded Line k to x axis ⇒ h not defined Line k to y axis ⇒ m → ∞ 6
  • 7.
    3.Polar Hough Transform Nowboth variables are bounded! → Polar Hough Transform: Value for an arbitrary line (r – xcosθ – ysinθ = 0) in (r, θ) Where f(x,y) is the 2D image → Unit Sphere & Cubemap Mappings possible(pg. 253) 7
  • 8.
    3.Polar Hough Transform– Theoretical Example Output in the case of perfectly continuous lines. 8
  • 9.
    3.Hough Transform forLine Detection → Goal: To identify straight lines • Process: For each pixel at (x,y) the Polar Hough transform algorithm determines if there is enough evidence of a straight line at that pixel, using votes from sample points. → Strengths: • Gives equations of lines(but not “end-points” of segments). • Works well with simple images that contain good straight lines. (Good for Robot Vision) • Deals with broken lines very well (in next slide). • Reasonably efficient if there are “few” edge points. 9
  • 10.
    3.Polar Hough Transform– Broken Line/ Sampling Example 10
  • 11.
    3.Polar Hough Transform– Discrete case Same as before, but discrete. Number in Accumulator cell proportional to number of points on the line. 11
  • 12.
    3.Polar Hough Transform– Voting Algorithm 12
  • 13.
    3.Hough Transform forLine Detection → Problems: • Very slow of there are many edge points. • Hough Space is non-linear, different edge sensitivities in different directions. • Poor for short lines. → Recent Extensions of Hough Method: • Circle and Ellipse detection by Double Hough Method. • Image transform plus Hough for general 2D shape detection. • Vanishing Points Detection(section 4.3.3, part 5 of slides)13
  • 14.
    4.RANSAC (Random SampleConsensus) Method – (For Feature Detection) • Determines the best transformation that includes the most number of match features (inliers) from the previous step. • RANSAC loop for planar pattern detection: 1. Select four feature pairs (at random) in the two angles. 2. Compute homography H (see next slide). 3. Compute inliers where SSD(pi’, Hpi) < a certain value,ε. 4. Keep largest set of inliers. 5. Re-compute least-squares estimate on all of the inliers. 14
  • 15.
    4.RANSAC Method –What are Homographies? • Example of Homography • Definition: Projective–mapping between any two projection planes with the same center of projection 15
  • 16.
    4.RANSAC Method –What are Homographies? • Definition: Projective–mapping between any two projection planes with the same center of projection 16
  • 17.
    4.RANSAC Method –(For Line Detection) → Simple example: Let us fit a line • Use biggest set of inliers • Do least-square fit => SD is low, Very likely it is a line 17
  • 18.
    4.RANSAC Method –Video: Fitting a Line → Strengths: • Robust estimation • Relatively high accuracy → Weaknesses: • Randomness. • Number of Iterations required for p% success 18
  • 19.
    → Goal: Tocollect lost 3D information from perspective in a 2D image detecting Vanishing points of Parallel lines. 19 5.Vanishing Points Detection – using Hough Transform
  • 20.
    5.Vanishing Points Detection– using Hough Transform → Textbook method using Cross Product: Step 1) Calculate Vanishing Point Hypothesis (weight) = Cross product of any two line vectors =  Near-Collinear segments downweighted Step 2) Populate Hough space(accumulator) with weights and find peaks for Vanishing point votes from the lines. Step 3) Calculate Least Squares Estimate for all Vanishing points with respect to lines that voted for it. 20
  • 21.
    where = GreenTriangle area Rule: The lower the sum of all areas subtended to segment endpoints, the more appropriate the vanishing point. 21 5.Vanishing Points Detection – using Hough Transform
  • 22.
    6.Applications Rectangle Detection: Step 1)First, detect all vanishing points Step 2) Detect the Edge points/Lines that are aligned along vanishing lines. We then efficiently recover the inter-sections of pairs of lines corresponding to different vanishing points. (論文[8])22
  • 23.
    6.Applications Rectangle Detection: Using onlyHough Detection is an 8D vector-space problem (論文[8]). Major Quadrilaterals in image can be detected using only Vanishing Point and Line Detection (論文[8]). 23
  • 24.
    References [1] Polar Hough: https://www.wikiwand.com/en/Hough_transform [2]Hough Accumulator: https://chmodux.wordpress.com/2012/04/16/target- acquisition/ [3] Ransac: https://www.slideshare.net/allynjoycalcaben/computer- vision-feature-matching-with-ransac-algorithm [4] Homographies: https://docs.opencv.org/master/d9/dab/tutorial_homog raphy.html 24
  • 25.
    References [5] Ransac animation: https://kapernikov.com/cable-detection-in-lidar-data/ [6]Various: Computer Vision: Algorithms and Applications by Richard Szeliski [7] Vanishing Points Examples: http://teresabernardart.com/the-rules-of- perspective/#:~:text=There%20are%20three%20basic%20 types,illusion%20of%20depth%20and%20space. [8] Rectangle Detection Algorithm: https://www.researchgate.net/publication/228697341_Pe rspective_rectangle_detection 25