Pattern Recognition Letters 23 (2002) 1705–1710 www.elsevier.com/locate/patrec
Point-to-line mappings as Hough transforms Prabir Bhattacharya a, Azriel Rosenfeld b
b,*
, Isaac Weiss
b
a Panasonic Information and Networking Technologies Lab, Princeton, NJ 08540, USA Computer Vision Laboratory, Center for Automation Research, University of Maryland, College Park, MD 20742-3275, USA
Received 24 October 2001; received in revised form 15 January 2002
Abstract In 1962 [US Patent 3069654], Hough used a linear point-to-line mapping (PTLM) to detect large sets of collinear points in an image, by mapping the points into concurrent lines and detecting peaks where many lines intersect. In 1972, Duda and Hart [Commun. ACM 15 (1972) 11] pointed out that Hough’s method is not practical, because the peaks need not lie in a bounded region. They (and others after them) therefore developed methods of detecting sets of collinear points using nonlinear point-to-curve mappings that map collinear points into concurrent curves whose intersections do lie in a bounded range. In this paper we show that any PTLM that maps collinear points into concurrent lines must be linear, and that no such PTLM can map all the sets of collinear points in an image into peaks that lie in a bounded region; thus Duda and Hart’s objection applies to any PTLM-based Hough transform. Ó 2002 Elsevier Science B.V. All rights reserved. Keywords: Hough transform; Point-to-line mapping; Collinearity
1. Introduction A point-to-line mapping (PTLM) on the plane maps the points of the plane into the lines on the plane; in other words, it maps any point (u; v) into a line ax þ by þ c ¼ 0, where the coefficients a, b, c are functions of u and v. A PTLM is called linear if these functions are linear. It is not hard to show that a linear PTLM must map collinear points (points that all lie on the same line) into concur-
*
Corresponding author. Tel.: +1-301-405-4526; fax: +1-301314-9115. E-mail address:
[email protected] (A. Rosenfeld).
rent lines (lines that all pass through the same point). To avoid situations in which many points all map into the same line, we will deal primarily with one-to-one PTLMs in this paper. Hough (1962) patented a method of using a linear PTLM to detect collinear sets of points in an image. Suppose the image I has value 1 at a set of points (ui ; vi ), and let the PTLM take (ui ; vi ) into the line ai x þ bi y þ ci ¼ 0. For each i, we create a new image Ji that has value 1 at the points of this line, and construct a final image J by summing the Ji ’s. If n of the points are collinear, the corresponding n lines are concurrent; hence J has a peak of height n at the point where the n lines intersect. We can thus detect large sets of collinear points in I by searching for high peaks in J.
0167-8655/02/$ - see front matter Ó 2002 Elsevier Science B.V. All rights reserved. PII: S 0 1 6 7 - 8 6 5 5 ( 0 2 ) 0 0 1 3 3 - 2
1706
P. Bhattacharya et al. / Pattern Recognition Letters 23 (2002) 1705–1710
Hough used the PTLM that maps the point (u; v) into the line x ¼ vy þ u. Evidently, if a set of points all have the same v coordinate (i.e., they lie on a horizontal line), this PTLM maps them into lines that all have the same slope. These lines are parallel rather than concurrent, so that there is no peak at their ‘‘intersection’’. Even if the lines are not exactly parallel, their intersection may be arbitrarily far from the origin, so that it may be impractical to search for the peak. This problem with Hough’s PTLM was pointed out by Duda and Hart (1972). They therefore used a nonlinear mapping, which they called a ‘‘Hough transform’’ (HT), to detect collinear sets of points. This mapping took points into sinusoids rather than lines, but it took collinear points into concurrent sinusoids, so that large collinear sets of points still gave rise to peaks. Moreover, the positions of the peaks were confined to a bounded range, so that it was practical to search for the peaks. The HTs that have been used since 1972 to detect collinear sets of points (Illingworth and Kittler, 1988; Leavers, 1993; Picton, 1987) have been based on nonlinear point-to-curve mappings. Since PTLMs can be nonlinear, it is conceivable that practical PTLM-based HTs could exist. In this paper we will show that Duda and Hart’s objection applies to any possible PTLM-based HT. To avoid the need to consider special cases involving parallel lines, we will develop our results in the real projective plane, which is obtained by adding ‘‘points at infinity’’ to the Euclidean plane. We will begin (Sections 2.1 and 2.2) by reviewing basic facts about points and lines in the projective plane. We will then show (Section 2.3) that any one-to-one point-to-line correspondence (in brief: 1–1 PTLM) that takes collinear points into concurrent lines, and can therefore be used to define an HT, must be linear. Finally, we will show (Section 2.4) that because of its linearity, no such PTLM can map all the sets of collinear points that lie in a bounded region (such as an image) into sets of concurrent lines whose intersections all lie in a bounded region; hence if such a PTLM is used to define an HT, it cannot be practical to search for all the peaks in this HT.
2. PTLMs as HTs Our first goal is to prove that if a 1–1 PTLM takes collinear points into concurrent lines, so that it can be used to define an HT, then it must be linear. To make the discussion self-contained, in Section 2.1 we present a brief, informal introduction to the real projective plane. In Section 2.2 we introduce linear mappings of the projective plane into itself that take points into points (‘‘collineations’’) or points into lines (‘‘correlations’’). It is known that if a one-to-one point-to-point correspondence preserves collinearity it must be linear. In Section 2.3 we use this result to prove that if a 1–1 PTLM takes collinear points into concurrent lines it must be linear. We then show in Section 2.4 that no such PTLM can map all the sets of collinear points that lie in an image into sets of concurrent lines whose intersections lie in a bounded region; hence if such a PTLM is used to define an HT, it is not practical to search for all the peaks in that HT. 2.1. Points and lines; the projective plane; homogeneous coordinates In the Euclidean plane a point can be specified by a pair of real-number coordinates (x, y), and a line can be specified as a set of points that satisfy a linear equation ax þ by þ c ¼ 0 where the coefficients a, b, c are real numbers and a, b are not both zero. Any two distinct points are contained in a unique line; specifically, the line containing the points (r; s) and (u; v) has the equation ðv sÞx ðu rÞy þ ðus vrÞ ¼ 0. Any two distinct lines intersect in at most one point, but parallel lines (i.e., lines ax þ by þ c ¼ 0 and dx þ ey þ f ¼ 0 for which the coefficients a and d, b and e are proportional) do not intersect. The relationship between points and lines can be made symmetric by adjoining ‘‘points at infinity’’ to the plane and specifying that any two parallel lines intersect at such a point. This can be done without introducing infinite values for the coordinates of points. Instead, we introduce a homogeneous coordinate system in which a point is specified by a set of proportional triples of real numbers (i.e., if (r; s; t) and (u; v; w) are propor-
P. Bhattacharya et al. / Pattern Recognition Letters 23 (2002) 1705–1710
tional we say that they specify the same point) and we require that the elements of a triple not all be zero. In this coordinate system, if t 6¼ 0 the triple (r; s; t) represents the ‘‘finite’’ point ðx; yÞ ¼ ðr=t; s=tÞ; if t ¼ 0, (r; s; t) represents a ‘‘point at infinity’’. The set of points defined by triples in this way is called the real projective plane. When we use homogeneous coordinates lines are still specified by linear equations; a line is a set of triples (x, y, z), not all zero, that satisfy an equation of the form ax þ by þ cz ¼ 0 where a, b, c are not all zero. Note that if (r; s; t) satisfies this equation so does any triple proportional to (r; s; t); thus a line is still a set of points. Moreover, if two triples of coefficients (a; b; c) and (d; e; f ) are proportional they evidently define the same line; thus lines too are defined by triples of homogeneous ‘‘coordinates’’ (their coefficients). It is not hard to see that any two distinct (non-proportional) points are contained in a unique line and any two distinct lines (¼ lines whose coefficients are not proportional) contain (i.e., intersect in) a unique point. To summarize: In homogeneous coordinates both points and lines are defined by triples of real numbers (coordinates or coefficients) not all of which are zero, where proportional triples are regarded as defining the same point or line. Because of this symmetric relationship between points and lines the projective plane can be regarded as either a set of points or a set of lines, and if a statement about points is true (e.g., that the union of any two distinct points is contained in a unique line), then the ‘‘dual’’ statement about lines (e.g., that the intersection of any two distinct lines contains a unique point) is also true. 2.2. Collineations and correlations A linear mapping of the projective plane into itself is called a collineation. Because of the symmetric relationship between points and lines such a mapping can be regarded as either taking points into points or lines into lines. The symmetry between points and lines also allows us to define linear mappings that take points into lines or vice versa; such a mapping is called a correlation. The terms ‘‘collineation’’ and ‘‘correlation’’ were introduced by M€ obius in 1827. (Note that in signal
1707
processing and statistics the word ‘‘correlation’’ has rather different meanings.) Our main interest in this paper is in correlations, but we will also make use of some basic facts about collineations. Note that statements about correlations are not the ‘‘duals’’ of statements about collineations. In any given homogeneous coordinate system a correlation f : x ! u can be written in vectormatrix notation as u ¼ Ax where A is a 3 3 matrix and x and u are 3 1 matrices (‘‘column vectors’’) representing the coordinates of x and the coefficients of u respectively. Evidently two matrices define the same correlation f (with respect to a given coordinate system) iff one is a nonzero scalar multiple of the other. If A defines f we should call it ‘‘a’’ matrix of f, but we will refer to it as ‘‘the’’ matrix of f if this will not cause confusion. Evidently a collineation or correlation is a oneto-one correspondence (i.e., is invertible) iff its matrix (more precisely: any of its matrices) is nonsingular. The invertible collineations evidently form a group under composition of functions. The invertible correlations cannot form a group since they are not closed under composition of functions, but together with the invertible collineations they do form a group. As an example, we saw in Section 1 that the PTLM used by Hough (1962) mapped the point (u; v) into the line x ¼ vy þ u. In homogeneous coordinates this mapping takes the point (u; v; 1) into the line (1; v; u). Evidently this mapping is a correlation and has matrix 0 1 0 0 1 @ 0 1 0 A: ð1Þ 1 0 0 Note that this matrix has determinant 1, so the mapping is invertible. (The mapping is given in (Rosenfeld and Kak, 1982, p. 123) in a slightly different form, as taking (u; v) into the line y ¼ ux þ v.) Collineations and correlations are treated in detail in books on (projective) geometry (such as Ayers, 1967; Coxeter, 1957; Coxeter, 1961, 1964; Graustein, 1930; Hodge and Pedoe, 1953; Hopkins and Hails, 1953; Levy, 1964; Maxwell, 1960; Semple and Kneebone, 1952; Springer, 1964;
1708
P. Bhattacharya et al. / Pattern Recognition Letters 23 (2002) 1705–1710
Todd, 1947; Veblen and Young, 1910); treatments of the subject intended for use by computer vision researchers can be found in (Hartley and Zisserman, 2000; Kanatani, 1991, 1993; Mundy and Zisserman, 1992). Correlations, in particular, are treated in (Ayers, 1967, pp. 186–187; Coxeter, 1957, pp. 51–53; Coxeter, 1961, 1964, pp. 165–171, pp. 49, 57, 98; Graustein, 1930, pp. 168, 326–334; Hartley and Zisserman, 2000, p. 39; Hodge and Pedoe, 1953, Ch. 9, pp. 362–429; Kanatani, 1993, p. 28; see also Kanatani, 1991; Levy, 1964, pp. 229-235; Mundy and Zisserman, 1992, p. 483; Semple and Kneebone, 1952, pp. 224–230; Springer, 1964, p. 171; Todd, 1947, p. 24; Veblen and Young, 1910, pp. 262–267, 278–280). 2.3. A 1–1 PTLM that takes collinear points into concurrent lines must be linear Let f be a (not necessarily linear) PTLM defined on the real projective plane. Even if f is invertible, it need not be linear. For example, if f takes the point (u; v; w) into the line whose coefficients are ðvw; wu; uv) (see Ayers, 1967, p. 43; Hopkins and Hails, 1953, pp. 41–42; Maxwell, 1960, p. 10; Springer, 1964, p. 111; and Todd, 1947, pp. 74–76, where this mapping is called a polarity with respect to a triangle) it is invertible but not linear; this is the simplest nontrivial example of an invertible Cremona transformation (see Semple and Kneebone, 1952, p. 231). The same is true if f takes (u; v; w) into (u3 ; v3 ; w3 ), since on the real projective plane this mapping too is invertible. However, as we shall now show, if f is a 1–1 PTLM that takes collinear points into concurrent lines it must be linear. It is known that a one-to-one point-to-point correspondence preserves collinearity iff it is linear; dually, the same is true for a one-to-one line-toline correspondence that preserves concurrence. Proofs of this theorem can be found in many books on projective geometry; e.g., see Artin (1988, p. 88) (where it is called the Fundamental Theorem of Projective Geometry), Graustein (1930, p. 109), and Levy (1964, p. 152). Interestingly, none of these books mentions the corresponding result about point-to-line correspondences (which is NOT the dual of the point-
to-point or line-to-line result); we therefore prove it here using an argument based on (Coxeter, 1957, p. 85). Note first that if f is a 1–1 PTLM, f1 is a oneto-one line-to-point correspondence, and if f and g are 1–1 PTLMs, f 1 g is a one-to-one point-topoint correspondence, where denotes composition of functions. Let f0 be any specific linear 1–1 PTLM––for example, the ‘‘identity’’ mapping that takes the point (u; v; w) into the line whose coefficients are (u; v; w); note that this particular f0 is defined by the 3 3 identity matrix. Then for any 1–1 PTLM f we have f ¼ f0 ðf01 f Þ, where f01 f is a one-to-one point-to-point correspondence. Evidently a linear PTLM maps collinear points into concurrent lines and vice versa; hence if f maps collinear points into concurrent lines f01 f preserves collinearity. Hence by the theorem stated in the preceding paragraph f01 f is linear. Since f0 is linear f ¼ f0 ðf01 f Þ must also be linear. We have thus proved. Theorem 1. A 1–1 PTLM takes collinear points into concurrent lines iff it is linear.
2.4. Such a PTLM cannot define a practical HT We will now show that no such PTLM can be used to define a practical HT. Specifically, we will show that no such PTLM can take all the sets of collinear points that lie in a bounded region (such as an image) into sets of concurrent lines whose intersections lie in a bounded region. To see this, let O be an interior point of the image; thus every line Li through O intersects the image in an interval, so the image contains many collinear points that lie on Li . These collinear points map into concurrent lines, say all through the point Pi . Since the Li ’s are concurrent lines, and the PTLM is linear, the points Pi must be collinear, say lying on the line M. (The coefficients of the Li ’s are linearly dependent; hence the coordinates of the Li ’s are linearly dependent.) Moreover, since the PTLM is a one-to-one correspondence, every point of M arises in this way from some line through O. In other words, any point Pi of M is a possible location of a peak (the
P. Bhattacharya et al. / Pattern Recognition Letters 23 (2002) 1705–1710
intersection of the concurrent lines that correspond to collinear points that lie on Li ). Thus the peaks arising from all the possible sets of collinear points in the image can be anywhere on the line M, so they cannot all lie in a bounded region. We have thus proved. Theorem 2. A 1–1 PTLM cannot map all the sets of collinear points that lie in a bounded region into sets of concurrent lines whose intersections lie in a bounded region. This completes our argument that no 1–1 PTLM can define a practical HT.
1709
are mapped into its sides by a 1–1 PTLM whose matrix is symmetric, the sides must be the images of three mutually orthogonal lines in space. 1–1 PTLMs also have other interesting uses. In (Rosenfeld, 1995; Bhattacharya and Rosenfeld, 1998), ‘‘geometric’’ properties of sets of lines are defined using conventional geometric properties of the sets of points that correspond to those lines under a 1–1 PTLM. In a forthcoming paper we will show how PTLMs can be used to define binary operations on points, and how algebraic properties of these operation are related to geometric properties of the PTLMs.
References 3. Concluding remarks A single PTLM cannot define a practical HT, but it is easy to define practical HTs by using two PTLMs. For example, Hough’s PTLM maps points that lie on a horizontal line into parallel lines, so it cannot be used to detect sets of collinear points that lie on a line that is close to horizontal. Similarly, the PTLM that maps the point (u; v) into the line y ¼ ux þ v maps points that lie on a vertical line into parallel lines, so it cannot be used to detect sets of collinear points that lie on a line that is close to vertical. But a practical HT can be constructed by using both of these PTLMs; the first one will produce peaks that lie in a bounded region for sets of collinear points that lie on lines whose slopes are sufficiently far from horizontal (e.g., at least 45°), and the second one will do the same for points that lie on lines whose slopes are sufficiently far from vertical (e.g., at most 45°). This was suggested by one of the authors as early as 1969 (see Rosenfeld, 1969, pp. 151–152; see also the first edition of Rosenfeld and Kak (1982, p. 379)). It was pointed out by two of the referees, one of whom referred to its use in HT detection of line segments (see da Fontoura Costa and Sandler (1993) and several earlier conference papers). Although they may not be useful for defining practical HTs, 1–1 PTLMs have other useful geometric properties. For example, it is known (Kanatani, 1991) that if the vertices of a triangle
Artin, E., 1988. Geometric Algebra. Wiley/Interscience, New York. Ayers Jr., F., 1967. Theory and Problems of Projective Geometry. Mc-Graw Hill, New York. Bhattacharya, P., Rosenfeld, A., 1998. ‘‘Convexity’’ of sets of lines. Pattern Recognition Letters 19, 1199–1205. Coxeter, H.S.M., 1957. Non-Euclidean Geometry. University of Toronto Press, Toronto. Coxeter, H.S.M., 1961. The Real Projective Plane. Cambridge University Press, Cambridge, UK. Coxeter, H.S.M., 1964. Projective Geometry. Blaisdell, New York. da Fontoura Costa, L., Sandler, M.B., 1993. Effective detection of digital bar segments with Hough transform. CVGIP: Graphical Models and Image Processing 55, 180–191. Duda, R.O., Hart, P.E., 1972. Use of the Hough transformation to detect lines and curves in pictures. Communications of the ACM 15, 11–15. Graustein, W.C., 1930. Introduction to Higher Geometry. Macmillan, New York. Hartley, R., Zisserman, A., 2000. Multiple View Geometry in Computer Vision. Cambridge University Press, Cambridge, UK. Hodge, W.V.D., Pedoe, D. (Eds.), 1953. Methods of Algebraic Geometry, vol. 1. Cambridge University Press, Cambridge, UK. Hopkins, E.J., Hails, J.S., 1953. An Introduction to Plane Projective Geometry. Clarendon Press, Oxford. Hough, P.V.C., 1962. Method and means for recognizing complex patterns, US Patent 3069654, December 18. Illingworth, J., Kittler, J., 1988. A survey of the Hough transform. Computer Vision Graphics and Image Processing 44, 87–116. Kanatani, K., 1991. Computational projective geometry. CVGIP: Image Understanding 54, 333–348. Kanatani, K., 1993. Geometric Computation for Machine Vision. Clarendon Press, Oxford.
1710
P. Bhattacharya et al. / Pattern Recognition Letters 23 (2002) 1705–1710
Leavers, V.F., 1993. Which Hough transform? CVGIP: Image Understanding 58, 250–264. Levy, H., 1964. Projective and Related Geometries. Macmillan, New York. Maxwell, E.A., 1960. The Methods of Plane Projective Geometry Based on the Use of General Homogeneous Coordinates. Cambridge University Press, Cambridge, UK. Mundy, J.L., Zisserman, A., 1992. In: Projective geometry for machine vision. Appendix to Geometric Invariance in Computer Vision. MIT Press, Cambridge, MA, pp. 463– 520. Picton, P.D., 1987. Hough transform references. International Journal of Pattern Recognition and Artificial Intelligence. 1, 413–425.
Rosenfeld, A., 1969. Picture Processing by Computer. Academic Press, New York. Rosenfeld, A., 1995. Geometric properties of sets of lines. Pattern Recognition Letters 16, 549–556. Rosenfeld, A., Kak, A.C., 1982. Digital Picture Processing, second ed. Academic Press, New York. Semple, J.G., Kneebone, G.T., 1952. Algebraic Projective Geometry. Clarendon Press, Oxford. Springer, C.E., 1964. Geometry and Analysis of Projective Spaces. Freeman, San Francisco. Todd, J.A., 1947. Projective and Analytic Geometry. Pitman, London. Veblen, O., Young, J.W., 1910. Projective Geometry. Ginn and Company, Boston.