Line Detection
Line Detection
- The masks shown below can be used to detect lines at various orientations
horizontal line
0 1 0 1 0 0 1 0 0 1 0
convolved image
6 6 -
mask
0 -1 2 -1 -1 2 -1 -1 2 -1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 -
-2- In practice, we run every mask over the image and we combine the responses: R(x, y) = max(|R1 (x, y)|, |R2 (x, y)|, |R3 (x, y)|, |R4 (x, y)|) If R(x, y) > T , then discontinuity
R1
-1 2 -1 -1 2 -1 -1 2 -1 -1 -1 2
R2
-1 2 -1 2 -1 -1 -1 -1 -1
R3
2 2 2 -1 -1 -1 2 -1 -1
R4
-1 2 -1 -1 -1 2
Original Image
MAX .
(x,y)
-3-
- Consider the slope-intercept equation of line y = ax + b, (a, b are constants, x is a variable, y is a function of x) - Rewrite the equation as follows: b = xa + y (now, x, y are constants, a is a variable, b is a function of a)
- The following properties are true: Each point (x i , y i ) denes a line in the a b space (parameter space) Points lying on the same line in the x y space, dene lines in the parameter space which all intersect at the same point The coordinates of the point of intersection dene the parameters of the line in the x y space
-4Algorithm 1. Quantize the parameter space P[amin , . . . , amax ][bmin , . . . , bmax ] (accumulator array)
2. For each edge point (x, y) For(a = amin ; a amax ; a++) { b = xa + y; /* round off if needed * (P[a][b])++; /* voting */ } 3. Find local maxima in P[a][b] (If P[a j ][b k ]=M, then M points lie on the line y = a j x + b k )
-5-
Effects of quantization
- The parameters of a line can be estimated more accurately using a ner quantization of the parameter space - Finer quantization increases space and time requirements - For noise tolerance, however, a coarser quantization is better
b y y=ax+b
.. .. .. . .
(it is very likely that every point will cast a vote in the (a, b) cell)
-6-
xcos + ysin =
space (parameter
Points lying on the same line in the x y space, dene curves in the parameter space which all intersect at the same point The coordinates of the point of intersection dene the parameters of the line in the x y space
-7Algorithm 1. Quantize the parameter space P[ min , . . . , max ][ min , . . . , max ] (accumulator array)
For( =
min ;
max ;
++) {
-8-
-9-