Open Access
27 July 2017 Operator-based homogeneous coordinates: application in camera document scanning
Author Affiliations +
An operator-based approach for the study of homogeneous coordinates and projective geometry is proposed. First, some basic geometrical concepts and properties of the operators are investigated in the one- and two-dimensional cases. Then, the pinhole camera model is derived, and a simple method for homography estimation and camera calibration is explained. The usefulness of the analyzed theoretical framework is exemplified by addressing the perspective correction problem for a camera document scanning application. Several experimental results are provided for illustrative purposes. The proposed approach is expected to provide practical insights for inexperienced students on camera calibration, computer vision, and optical metrology among others.



Projective geometry is an important topic in computer vision because it provides a useful camera imaging model and its fundamental properties.1 Some applications of this topic are found in camera motion,2 camera calibration,3,4 pose estimation for augmented reality,5 perspective correction,6 and three-dimensional (3-D) surface imaging7 among others.

Theoretical concepts of projective geometry are analyzed simply and elegantly using homogeneous coordinates.8,9 However, projective geometry is commonly presented in abstract form, leaving a gap in how to apply it in computer vision problems.10 Moreover, homogeneous coordinates are used with a notation that masks basic geometrical aspects and may confuse the inexperienced readers.11

In this paper, a simple and intuitive approach to expose some useful concepts of projective geometry is addressed. For this, an alternative notation for homogeneous coordinates based on operators is suggested. To highlight the relevance of this topic in computer vision, the presentation is motivated by a specific problem, namely the perspective correction for a “camera scanner” application.

First, the proposed operators for homogeneous coordinates are defined in Sec. 2. Next, some basic concepts of projective geometry in the one- (1-D) and two-dimensional (2-D) cases are presented in Secs. 3 and 4, respectively. Then, the pinhole camera model is derived in Sec. 5. A perspective correction method, useful for camera document scanning, is described in Sec. 6. Finally, the conclusions of this work are given in Sec. 7. The paper is complemented with two appendices. Appendix A presents the direct linear transformation method for homography matrix estimation. Finally, a simple method to obtain the camera parameters from homographies is explained in Appendix B.


Definition of Operators


Operators H and S

A point in an n-dimensional space will be represented by a vector of the form

Eq. (1)

where [·]T denotes the transpose. The homogeneous coordinates of the point are obtained by adding an extra entry to x with a value equal to the unity. The result is the (n+1)-dimensional vector

Eq. (2)

where H will be referred to as the homogeneous operator.

The last entry of a homogeneous vector is known as the scale and will be recovered by the scale operator S. This operator returns the last entry of any given vector. For instance, for the vectors in Eqs. (1) and (2), we have

Eq. (3)


The operator H sets the scale to unity. Another operator that sets the scale to zero is needed. For this, we define the operator

Eq. (4)

Note that the operator H0 does not affect neither the direction nor the norm of x. In projective geometry, the points represented by homogeneous coordinates of the form

Eq. (5)

are known as ideal points, where 0n=[0,,0]T is the n-dimensional zero vector.

The operators H and H0 can be considered as two particular cases of a more general operator defined as

Eq. (6)

where s is any scalar.

The procedure of adding an extra entry to vectors is reverted by returning the given vector except its last entry. For this, we define the inverse operator H01 as follows. For any (n+1)-dimensional vector

Eq. (7)

the operator H01 is defined as

Eq. (8)

Based on the operator H01, the inverse of the operator Hs for s0 is defined as

Eq. (9)

In particular, the operator H11 (written simply as H1) will be referred to as the inverse homogeneous operator.

The inverse H01 is a linear operator. That is, for any two scalars λ1 and λ2, we have

Eq. (10)

On the other hand, the operator Hs1 is invariant to nonzero scalar multiplication of its argument. That is,

Eq. (11)

The operators Hs and Hs1 can be expressed in terms of the homogeneous operator and its inverse, namely

Eq. (12)


Eq. (13)

and In being the n×n identity matrix.


Projection Operator P

In general terms, the homogeneous operator carries the representation of a point from n- to (n+1)-dimensional vectors while the inverse homogeneous operator returns the representation from (n+1)- to n-dimensional vectors. An important transformation emerges when, in the (n+1)-dimensional space, a linear mapping is applied. Mathematically, we describe this transformation by the projection operator defined as

Eq. (14)

where M is an (n+1)×(n+1) matrix. A generalized version of the projection operator is obtained using Hs and its inverse as

Eq. (15)

From Eq. (11), it follows that, for s0, the operator PM,s is invariant to nonzero scalar multiplication of the matrix M; that is

Eq. (16)

Let b=PM,s[a] with M being a nonsingular matrix. From Eq. (15), we have that a=Hs1[M1Hs[b]]. Therefore, the inverse operator PM,s1 is given by

Eq. (17)

where detM denotes the determinant of M.

Using the equations in Eq. (12), the operator PM,s can be expressed in terms of the projection operator, namely

Eq. (18)

Note that M and Ξs1MΞs are similar matrices. Some useful equalities of the defined operators are summarized in Table 1. For a more comprehensible reading of this paper, the reader is encouraged to demonstrate all the equalities in Table 1.

Table 1

Some useful equalities of the operators S, Hs, and PM,s. In all cases, we consider λ≠0, γ1 and γ2 are any scalars, x is a n-dimensional vector as given in Eq. (1), Ξs is the matrix defined in Eq. (13), y=λHs[x], M is a matrix of size (n+1)×(n+1), and W is a matrix of size m×(n+1).


In the following sections, the defined operators are studied from an intuitive geometrical approach for the 1-D and 2-D cases. Then, the usefulness of this theoretical framework is illustrated by addressing the perspective correction problem for camera document scanning.


One-Dimensional Space

The 1-D real space can be represented as a line as shown in Fig. 1(a). In this space, a point at a finite distance from the origin is represented by a real number x; otherwise, the point is represented by the symbol .

Fig. 1

(a) The real line as the 1-D Euclidean space. (b) The 1-D space represented by the projective line (y=1) in a 2-D Euclidean space.


Alternatively, the 1-D space can be represented by the projective line y=1 in the xy-plane as shown in Fig. 1(b). Thus, the coordinate x of a point in the line becomes the vector

Eq. (19)

The coordinate x can be recovered from its homogeneous version y as the intersection between the line y=1 and the line with direction H[x] passing through the origin as shown in Fig. 1(b). This is described mathematically as

Eq. (20)

Note that the result is invariant to the scalar multiplication of y by a nonzero scalar [e.g., λ and γ as shown in Fig. 1(b)] because the intersection between lines is unaltered. In other words, H1[λy]=H1[γy]=H1[y] as stated by Eq. (11).


Ideal Point

Homogeneous coordinates provide a different form to identify points of the real line. Consider the unit vector

Eq. (21)

Thus, the homogeneous representation of x given by Eq. (19) becomes

Eq. (22)

where λ2=1+x2 and tanθ=x. From Eq. (22), we obtain

Eq. (23)

Since a vector u and its opposite u represent the same point (i.e., H1[u]=H1[u]), all points of the real line at a finite distance from the origin are associated to a unique angle θ in the open interval (π/2,π/2); i.e., the vectors u different to [1, 0] and [1,0] in the quadrants I and II, as shown in Fig. 2.

Fig. 2

Representation of points of the real line using homogeneous coordinates. Opposite homogeneous vectors represent the same point; thus, there is a single point at infinity, given by u(π/2)=[1,0]T.


Intuitively, the real line in Euclidean representation has two points at infinity, namely and +. However, in projective geometry, the real line has only a single point at infinity given by the homogeneous coordinates

Eq. (24)

which is associated to u(π/2), as shown in Fig. 2. It could be argued that π/2 corresponds to + while π/2 to . However, note that u(π/2)=ψ is the opposite of ψ. Hence, they represent the same point.

Note that H1[ψ]=1/0 is consistent with the notion that ψ represents a point at infinity distance from the origin. According to the concepts of projective geometry, the vector ψ represents an ideal point, see Eq. (5).


One-Dimensional Projection

The line y=0 can be transformed to any other line by applying a rotation Q=[q1,q2] and a translation s. Thus, a point in the line y=0, represented by the scalar x, becomes a point in the xy-plane given by the vector

Eq. (25)

where the matrix Π1 will be referred to as the reference line parameters and has the explicit form

Eq. (26)

The first column of Π1 and the determinant detΠ1 provide the direction of the reference line and its distance from the origin, respectively.

If the matrix Π1 is singular, the vectors q1 and s are collinear. In this case, the origin is a point of the transformed line (the distance of the line from the origin is zero). The matrix Π1 is nonsingular when q1 and s are linearly independent. In this case, the origin is not a point of the transformed line.

Let p in Eq. (25) be the homogeneous coordinates of a point α in the line. Thus, we obtain the 1-D projection

Eq. (27)

The transformations by PΠ1[x] and its inverse PΠ11[α] are shown in Fig. 3.

Fig. 3

The 1-D projection.



Two-Dimensional Space


Points and Lines in the Plane

Any point in the 2-D space can be represented as the vector

Eq. (28)

Moreover, the point x can be represented by its homogeneous coordinates

Eq. (29)

as shown in Fig. 4(a). Note that H takes the 2-D vector x (in the plane z=0) and converts it to the 3-D vector H[x], where x is unaltered but now it lies in the projective plane z=1. It is worth mentioning that the vector x can be recovered from λH[x] as the point of intersection of the line with points 03 and λH[x], see Eq. (11). That is,

Eq. (30)

A line in the plane xy-plane can be written as the homogeneous equation

Eq. (31)

where l1, l2, and l3 are coefficients. Using homogeneous coordinates, Eq. (31) becomes

Eq. (32)

where x=[x1,x2]T is a point of the line and l=[l1,l2,l3]T is the vector that defines the line. Equation (32) exhibits that l and H[x] are orthogonal vectors. Note that the vector l is unique up to scale, i.e., the vectors l and λl, with λ0, represent the same line.

Fig. 4

(a) The 2-D space represented by the projective plane (z=1). (b) Parallel lines in the plane.


Let x1 and x2 be two different points in the xy-plane. The vector l of the line passing through x1 and x2 can be obtained by the cross product as

Eq. (33)

By definition of the cross product, the vector l is orthogonal to H[x1] and H[x2]. Therefore, these vectors satisfy Eq. (32).

Consider two lines defined by the vectors l1 and l2. If x is the intersection point of these lines, then H[x] is orthogonal to l1 and l2. That is

Eq. (34)

where λ=S[l1×l2]. Therefore, the intersection point of the lines l1 and l2 is

Eq. (35)



Parallel Lines

Two different lines are parallel if its defining vectors are of the form

Eq. (36)

where λ, δ0. This can be verified as follows. Consider two parallel lines in the plane with points α and β given, respectively, by

Eq. (37)

where γ is a parameter, δ0 is a constant, a is a reference point, d is a unit vector with direction of the line, and t is a unit vector orthogonal to d, i.e.,

Eq. (38)

as shown in Fig. 4(b). Two points of each line are
Thus, the vector of the line with points α is

Eq. (39)

or, since the line is unaffected by scaling of its vector

Eq. (40)

Similarly, the vector of the line with points β is

Eq. (41)

where λ=γ¯2γ¯1. Therefore, the vectors l and l¯ given in Eq. (36) represent parallel lines.

It is worth mentioning that, if l is the vector of a line with direction d [see Eq. (40)], then the vector H01[l] is orthogonal to d, namely

Eq. (42)



Ideal Points and the Line at Infinity

In the Euclidean geometry, two parallel lines in the plane do not intersect. However, in the projective geometry, two different lines always intersect at a point. Consider the parallel lines given by the vectors in Eq. (36). Using Eq. (35), the intersection point is

Eq. (43)


Eq. (44)

is the point of intersection in homogeneous coordinates. Note that H1[ψ]=[l2/0,l1/0] provides the insight that parallel lines intersecting at a point at infinity. As in the 1-D case, the vector ψ represents ideal points, see Eq. (5).

The vector ψ is associated with the direction d of the line l. This is verified by taking into account that H01[l] is orthogonal to d [Eq. (42)] as well as to H01[ψ] (H01[ψ]TH01[l]=0), then

Eq. (45)

where λ is some nonzero scalar.

All ideal points given by Eq. (44) are collinear. The vector of such a line, known as the line at infinity, is

Eq. (46)

This can be easily verified by lTψ=0 as required by Eq. (32).

The ideal point ψ in Eq. (44) was obtained as the intersection of two parallel lines l and l¯. However, the intuition suggests that the same result could be obtained by computing the intersection of the line l and the line at infinity l. In fact, we have that

Eq. (47)

Thus, using Eq. (45), the direction d of any line l is given by

Eq. (48)

where λ is a nonzero scale factor. For this reason, the line l is interpreted as the set of directions of lines in the plane.

Similar to the 1-D case, homogeneous coordinates provide a different form to identify points of the plane. Consider the unit vector

Eq. (49)

where θ and ϕ are polar and azimuth angles, respectively. Thus, the homogeneous coordinates for each point x=[x1,x2]T on the plane are given by

Eq. (50)

where λ2=1+x12+x22. From Eq. (50), the following relation holds

Eq. (51)


The points of the plane at a finite distance from the origin are given by v(θ,ϕ) with θ[0,π/2) and ϕ[π,π), i.e., the upper hemisphere of the unit sphere, see Fig. 5. The points of the plane at infinity distance from the origin are parameterized by θ=π/2 and ϕ(π/2,π/2]. These points have the homogeneous coordinates

Eq. (52)

see Eq. (44). That is, the ideal points are represented by the half equator of the unit sphere, see yellow line in Fig. 5.

Fig. 5

Representation of points of the plane using homogeneous coordinates v. The upper hemisphere represents points of the plane at a finite distance from the origin, and the half of the equator (yellow semicircle) represents points at infinity.



Two-Dimensional Projection

Any plane in the 3-D space can be obtained as the plane z=0 after a rotation Q=[q1,q2,q3] and a translation s. Thus, the points represented by x=[x1,x2]T, becomes

Eq. (53)

where the matrix Π2 will be referred to as the reference plane parameters and has the explicit form

Eq. (54)

The cross product of the first two columns of Π2 and detΠ2 provides the normal to the reference plane and its distance from the origin, respectively.

The matrix Π2 is singular when r1, r2, and t are coplanar. In this case, the origin 03 is a point of the transformed plane (the distance of the reference plane from the origin is zero). Otherwise, Π2 is a nonsingular.

Let p in Eq. (53) be the homogeneous coordinates of a point α in the projective plane. Thus, the relation between the points α and x is given by the 2-D projection PΠ2, namely

Eq. (55)

The projection PΠ2[x] and its inverse PΠ21[α] are shown in Fig. 6.

Fig. 6

The 2-D projection.



Properties of the Two-Dimensional Projection

As shown in Fig. 6, the 2-D projection PΠ2 excludes several geometrical properties; e.g., shape, angles, lengths, and ratio of lengths. Fortunately, there are some geometrical properties that are preserved. Particularly, we are interested in three of them that are very useful in practice: namely straightness, line–line intersection, and parallelism of the normal and line at infinity vectors.


Straightness property

This property states that a 2-D projection transforms lines to lines.12 This can be shown as follows. Consider a line with vector l and points x, that is

Eq. (56)

Next, the points x are transformed to α by Eq. (55). Solving Eq. (55) for x and substituting in Eq. (56), we obtain

Eq. (57)


Eq. (58)


Eq. (59)

with Π2T being the abbreviation of (Π21)T or (Π2T)1. In summary, the points x of a line l are transformed by PΠ2 to points α of a new line m.


Line–line intersection

Preservation of the line–line intersection by a 2-D projection refers to the following. If

Eq. (60)

is the point where the lines l1 and l2 intersect, then

Eq. (61)

is the point where intersect the lines

Eq. (62)

In fact, the lines m1 and m2 intersect at the point

Eq. (63)

where the identity of the cross product

Eq. (64)

was applied. By solving Eq. (60) for l1×l2 and substituting in Eq. (63), we obtain

Eq. (65)



Parallelism of the normal and line at infinity vectors

The normal of the xy-plane and the vector l of the line at infinity are parallel. When the projection PΠ2 is applied, the normal q3 of the reference plane (with parameters Π2) and the new line at infinity m still remain parallel; i.e., m=λq3, λ0. Actually, the reference plane has the normal

Eq. (66)

see Eq. (54), whereas the vector of the new line at infinity is

Eq. (67)

where λ=1/detΠ2, and cof(·) denotes the cofactor matrix.

In the following section, the developed theoretical framework is applied in a real problem.


Pinhole Camera Model

In practice, the imaging process is performed by a camera lens device as shown in Fig. 7(a). This device produces high quality images because of a complicated system of lenses that minimizes aberration and distortion. However, the imaging process can be modeled using a single thin lens as shown in Fig. 7(b). Moreover, the imaging model can be easily derived using the equivalent pinhole camera as shown in Fig. 7(c).

Fig. 7

(a) Illustration of a camera lens. (b) The imaging process modeled using a single thin lens. (c) A pinhole camera. The planes z=f and z=f are the actual and conjugate image planes, respectively.


In the pinhole camera, the origin of a coordinate system is fixed at the pinhole and the z-axis is parallel to the optical axis. The plane z=f, where f is the focal length, is the actual image plane. Note that the image is inverted; therefore, the x and y axes are reverted to describe the image as a magnified version of the object. The inversion of the axes is avoided using the conjugate image plane z=f as shown in Fig. 7(c).


Centered Pinhole Camera

A typical representation of a pinhole camera is shown in Fig. 8. The coordinate system Ocxcyczc is known as the camera reference frame. Let

Eq. (68)

be the coordinates of a point in the camera reference frame. The point pc will be imaged in the plane zc=f at the point

Eq. (69)

where β will be referred to as the physical image coordinates. The pinhole projection model relates the vectors pc and β by

Eq. (70)

Using homogeneous coordinates for the image point β, Eq. (70) can be rewritten as

Eq. (71)

The image formed in the sensor of the camera is sampled as an array of pixels. Then, the physical coordinates β will be transformed to the pixel coordinates

Eq. (72)

which depend on the size of the pixel and skew (diagonal distortion) as shown in Fig. 8. The sampling can be described as

Eq. (73)

where sx and sy (with units of length) are the width and height of the pixel, respectively, τ=[τx,τy]T is known as the principal point and represents the point (from the uv-reference frame) where the optical axis crosses the image plane, and σ is the skew factor (σ=0 for most camera sensors). Equation (73) can be written as

Eq. (74)

or using a compact notation

Eq. (75)

where S is the sampling matrix given as

Eq. (76)

Substituting Eq. (71) into Eq. (75), we obtain the image μ (in pixel coordinates) of the point pc as

Eq. (77)

where K=SΞf1 is known as the matrix of intrinsic camera parameters having the explicit form

Eq. (78)

Since detK=(sxsyf)1, the matrix K is nonsingular for any experimental case.

Fig. 8

The centered pinhole camera and sampling of the image plane.


Given a point μ (in pixel coordinates), the actual coordinates Hf[β] of an image point (physical coordinates on the image plane z=f) can be obtained from Eq. (75) as

Eq. (79)

where the equality S[S1H[μ]]=1 was used.


Noncentered Pinhole Camera

Let us consider that the pinhole camera is at an arbitrary position and orientation with respect to a world coordinate system Oxyz as shown in Fig. 9. The position and orientation of the camera are defined by the vector t and the rotation matrix R, respectively. Let

Eq. (80)

be a point in the world coordinate system. Then, the point p is seen from the camera reference frame as

Eq. (81)

where L is known as the matrix of extrinsic camera parameters having the explicit form

Eq. (82)

By substituting Eq. (81) into Eq. (77), the complete imaging process by a noncentered pinhole camera is given as

Eq. (83)

where C=KL is the matrix of the camera.

Fig. 9

The noncentered pinhole camera.



Homography Matrix

In general terms, Eq. (83) describes a transformation of points p of the 3-D space to points of the 2-D one. A very useful transformation is obtained when p represents points of a plane in the 3-D space. In this case, Eq. (83) is reduced to a transformation from the 2-D space to itself.

Consider that p represents the points of a plane in the 3-D space; mathematically, see Eq. (53)

Eq. (84)

where ρ=[ρx,ρy]T parameterizes the plane, Π=[q1,q2,s] is the matrix of the plane, q1 and q2 are columns of the rotation matrix Q=[q1,q2,q3]T, and s is a translation vector. Next, the points p are transformed to μ by Eq. (83) as

Eq. (85)

where G is known as the homography matrix and has the explicit form

Eq. (86)


Eq. (87)

From Eqs. (79) and (85), a point ρ is imaged at the point with actual image coordinates

Eq. (88)

where λ=S[GH[ρ]].

The homography matrix is singular when the pinhole is at a point of the reference plane. For any other case, detG=q3T(st)/(sxsyf) and Eq. (85) can be inverted as

Eq. (89)

The homography matrix is very useful for many computer vision tasks. In Appendix A, the direct linear transformation method for homography estimation is described.


Perspective Correction for Document Scanning

A camera document scanning application performs several image processing tasks, such as quadrilateral detection, perspective correction, resampling, and image enhancement. In this section, the perspective correction task is addressed to illustrate the application of the proposed approach.



In Appendix A, we show that the perspective of a flat object can be easily corrected using the associated homography. For this, at least four correspondences (μk,ρk) must be provided. However, for practical document scanning, the coordinates ρk are unknown. Instead, it is assumed that the document to be digitized is rectangular and the orthogonality and parallelism properties of its edges are exploited.

The estimation of the homography is greatly simplified by assuming a centered pinhole camera with known intrinsic parameters; e.g., by a previous camera calibration, see Appendix B. Thus, we only require to estimate the reference plane parameters Π, i.e., the rotation matrix Q and the translation vector s, see Eq. (84).


Estimation of the Reference Plane Parameters

Consider a coordinate system in the reference plane with origin at the center of the document to be scanned as shown in Fig. 10(a). The x- and y-axes of this coordinate system are parallel with the upper/lower and left/right sides of the paper, respectively. The corners of the document to be digitized have coordinates given by the vectors

Eq. (90)

In this configuration, the vectors ρk are symmetric about the y-axis; that is

Eq. (91)


Eq. (92)

When the document is imaged by the camera, the original rectangle is transformed to a quadrilateral because of the perspective distortion. The corners of the imaged document have coordinates given by the vectors

Eq. (93)

as shown in Fig. 10(b). The vectors μk and ρk are related by Eqs. (85) and (89); however, the vectors ρk and the homography G are unavailable. Only the vectors μk are available, which are easily obtained from the image by pointing the vertexes of the imaged document.

Fig. 10

(a) Depict of the rectangular paper to be digitized. (b) The quadrilateral obtained by pinhole imaging of a rectangular paper. (c) The remaining rotation after perspective correction of the quadrilateral shown in (b).


The points μk are used to compute the following lines, see Fig. 10(b),

Eq. (94)

Next, with the lines mk, the following three intersection points are computed

Eq. (95)

Since the intrinsic camera parameters are assumed to be known, the actual image coordinates of the points μi can be obtained by Eq. (79) as

Eq. (96)

with i=a,b,0,1,2,3,4.


Normal vector

Note that the points μa and μb are the projections of the ideal points

Eq. (97)

respectively. Thus, the line m (in physical coordinates on the image plane z=f) is parallel to the normal q3, see Eq. (67). That is,

Eq. (98)

for some λ. Thus, the normal of the reference plane is obtained as the normalization of the vector n, namely

Eq. (99)



Translation vector

The translation vector s is obtained by taking into account that PG preserves the line–line intersection. Thus, from Eq. (65) we have μ0=PG[ρ0] with ρ0=02. Therefore, from Eq. (88) we have

Eq. (100)

where ξ is a scalar to be determined. For this, note that the vectors

Eq. (101)

are points of the reference for values ζk and ξ such that the equation of the plane q3(pks)=0 is satisfied. This leads to

Eq. (102)

Since the points ρk are on the unit circumference, see Fig. 10(a), then ρk=pks=1, which leads to

Eq. (103)

where the subindex k in ξ emphasizes the fact that a different value could be obtained for each Hf[βk] due to inaccuracies of μk. Therefore, the value ξ is computed as

Eq. (104)

The result is used in Eq. (100), and the translation of the reference plane is now available.


Euler angles

The reference plane is fully characterized by six degrees of freedom (DOF), namely position (three coordinates) and orientation (three angles). The vectors q3 and s provide five DOFs. Specifically, the vector s provides three DOFs that fix the position while q3 provides two DOFs defining the orientation by the azimuth and polar angles given, respectively, by

Eq. (105)

where [q13,q23,q33]T=q3 is the third column of the rotation matrix Q. The remaining angle γ (the angle around the normal q3) can be obtained as follows.

From Eqs. (84) and (53), we have

Eq. (106)

where the matrix Q is defined as the Euler sequence

Eq. (107)

with Qz and Qy being the rotation matrices around the z- and y-axes, respectively. Thus, using Eq. (101), the estimated vector s, and the angles θ and ϕ, we compute the (perspective corrected) points

Eq. (108)

with k=1,,4, see Fig. 10(c). The vectors δk and ρk are related by

Eq. (109)


Eq. (110)

The vectors ρk are unavailable, but we use their symmetry properties given in Eq. (91) to obtain

Eq. (111)

The product Q¯zT(γ)δk can be written as

Eq. (112)

where Γ=[sinγ,cosγ]T and

Eq. (113)

Thus, Eq. (111) can be rewritten as

Eq. (114)


Eq. (115)

The nontrivial solution of Eq. (114) for Γ is obtained as the right-singular vector corresponding to the smallest singular value of B. Finally, the angle γ is obtained from Γ by

Eq. (116)

The estimated parameters are used to create the matrix Π. Then, the required homography G is obtained by Eq. (86) (with t=03 and R=I because of the centered pinhole camera configuration). Finally, the perspective distortion of the image is corrected by displaying the intensity of each pixel of the image at the point ρ computed by Eq. (89).


Illustrative Example

The functionality of the presented algorithm is illustrated by the following example. The camera described in Appendix B and the estimated intrinsic parameters K given in Eq. (156) are used here.

Figure 11(a) shows the image of a rectangular object acquired by the camera. Then, the four corners of the quadrilateral are marked from the image as shown by the yellow circles in Fig. 11(b). The points μ0, μa, and μb are indicated by the red circles in Fig. 11(b). It is worth mentioning that μa, or μb, or both could be points at infinity. Even in these cases, the presented methodology is valid.

Fig. 11

(a) An input image with a rectangular object in scene. (b) The corners of the rectangle are marked by yellow circles. (c) Corrected image. (d) Zoom of (c) highlighting the region of interest.


The information estimated with the four corners are

Eq. (117)

With these parameters, the matrix of the reference plane is

Eq. (118)

Thus, the resulting homography is

Eq. (119)

All points μ of the image are transformed to points ρ of the reference plane by Eq. (89). Next, the pixels of the image are displayed at the points ρ as shown in Fig. 11(c).

With the correction of perspective, the yellow circles in Fig. 11(b) become the green ones in Fig. 11(c). The region of interest is the rectangle with corners marked by green circles in Fig. 11(c). Finally, a zoom of the region of interest is shown in Fig. 11(d).



An operator-based approach for homogeneous coordinates was proposed. Several basic geometrical concepts and properties of the operators were investigated. With the proposed approach, the pinhole camera model and a simple camera calibration method were described. The study of this work was motivated by developing a perspective correction method useful for a camera document scanning application. Several experimental results illustrate the analyzed theoretical aspects. The proposed approach could be a good starting point to introduce inexperienced students in the scientific discipline of computer vision.


Appendix A:

Estimation of the Homography Matrix

In this appendix, we illustrate the method known as direct linear transformation for homography matrix estimation. This method is very useful for illustration purposes because of its simplicity. However, the highest accuracy and robustness are reached with other advanced methods available in the literature.9,13

Let G be the homography matrix defined in Eq. (86). Consider that the matrix G is row partitioned as follows:

Eq. (120)


Eq. (121)


Equation (85), which relates points of the reference and image planes, can be rewritten as

Eq. (122)


Eq. (123)


Furthermore, Eq. (123) can be written in matrix form as

Eq. (124)


Eq. (125)


Equation (124) relates a single point ρ on the reference plane with the corresponding point μ on the image plane. If n pairs (ρk,μk), with k=1,2,n, are available, the n corresponding equations of the form Eq. (124) can be written as

Eq. (126)


Eq. (127)


The nontrivial solution g¯ of Eq. (126) can be obtained using the constraint g¯=1. Thus, by using the singular value decomposition of A, the solution for g¯ is the right-singular vector corresponding to the smallest singular value of A, see Appendix C of Ref. 14.

The application of this method is illustrated as follows. Consider the image shown in Fig. 12(a). A letter size paper printed with the Melencolia I by Albrecht Dürer is in the scene. Using the aspect ratio 11.2941 of the letter paper, the coordinates of the corners are fixed to

Eq. (128)


The coordinates of the imaged corners are

Eq. (129)

see yellow circles in Fig. 12(a). With these four pairs (ρk,μk), we obtain the homography

Eq. (130)


The homography G fully defines a pinhole imaging process. Thus, it can be inversed to obtain an undistorted view of the reference plane from its perspective distorted image. Specifically, using Eq. (89) all points μ of the image are transformed to points ρ of the reference plane. Then, the pixels of the image are displayed at the points ρ as shown in Fig. 12(b). Note that corners of the paper in the corrected image are at the coordinates specified by Eq. (128).

The least number of point correspondences for two-dimensional homography estimation is four. However, the accuracy of the estimation is improved when more than four point correspondences are provided. For this reason, checkerboard patterns15 and gratings16,17 are useful target objects. In this appendix, the corner points of the imaged rectangle where obtained manually from the image. However, the corner points can be obtained automatically using checkerboard patterns or gratings along with grid detection18 or phase demodulation,19 respectively.

Appendix B:

Camera Parameters from Homographies

The homography matrix involves both intrinsic K and extrinsic L camera parameters as well as the reference plane parameters Π. In this appendix, we show how to obtain the intrinsic and extrinsic camera parameters from several homographies.


Intrinsic Camera Parameters

Consider that the reference plane is the xy-plane of the world coordinate system; i.e., s=03 and

Eq. (131)


In this case, the homography G, defined in Eq. (86), is reduced to

Eq. (132)

where r¯1T and r¯2T are the first and second rows of the rotation matrix R, respectively. Consider that the matrix G is column partitioned as follows:

Eq. (133)


Eq. (134)


Thus, Eq. (132) can be written as

Eq. (135)


Since r¯1 and r¯2 are orthonormal vectors (r¯1 and r¯2 are rows of a rotation matrix), we have the following two constraints r¯1Tr¯2=0 and r¯12=r¯22, which can be written as

Eq. (136)

where the symmetric matrix W is defined as

Eq. (137)


The bilinear form giTWgj can be rewritten as

Eq. (138)


Eq. (139)


Eq. (140)


Then, the constraints given by Eq. (136) become

Eq. (141)

where V[G] is the following 2×6 matrix:

Eq. (142)


A nontrivial solution of Eq. (141) for w can be obtained using several homographies Gk, k=1,2,,m. For this, we compute the homographies of different images where the position and orientation of the reference plane (or the camera, or both) are varying (in an unknown manner) while the intrinsic camera parameters remain constant. Thus, we solve the new matrix equation

Eq. (143)


Eq. (144)


In general, at least three homographies (m=3) are required. However, two homographies are sufficient assuming zero-skew.

Equation (143) can be solved for w using the singular value decomposition method, see Appendix C of Ref. 14. Since the obtained solution, labeled as w˜, is unique up to scale, the associated matrix W˜ is related to W by

Eq. (145)

where λ0 is an unknown constant. With the estimated matrix W˜, the unknown scalar λ and the entries kij of the intrinsic parameter matrix

Eq. (146)

are given in closed form as

Eq. (147)

where d=w˜11w˜22w˜122.

It is worth mentioning that the intrinsic camera parameters (f, sx, sy, τx, τy, and σ) cannot be obtained using only the matrix K. Fortunately, the matrix K is sufficient for many computer vision tasks. For the case where the intrinsic camera parameters are required explicitly, we can assume that the skew and size of the pixel are known (e.g., sx, sy, and σ are consulted in the datasheet of the camera sensor). Thus, the estimation of the remaining intrinsic parameters is a linear problem with the least-squares solution

Eq. (148)


Eq. (149)


Eq. (150)



Extrinsic Camera Parameters

Once the matrix K is available, the rotation matrix R and the translation vector t can be estimated for each provided homography as follows. First, we compute the estimate R˜T of the matrix RT as

Eq. (151)

where using Eq. (135), the vectors h1 and h2 are given as

Eq. (152)


Then, the rotation matrix R is obtained from R˜ ensuring the orthogonality condition of rotation matrices. For this, the singular value decomposition R˜=UΣVT is obtained and the required rotation matrix is determined as

Eq. (153)


Finally, the translation vector t is computed as

Eq. (154)



Illustrative Example

As an example, we describe a simple experiment to obtain the intrinsic parameters of a camera. A camera with a pixel size of 6  μm (square pixel), resolution of 752×480  pixel, and imaging lens with focal length of 6 mm was used. The 3×3 checkerboard pattern shown in Fig. 13(a) was printed on a letter paper. Then, 15 images of the printed pattern lying on the reference plane were captured from different unknown viewpoints, see Figs. 13(b)13(i).

We use the coordinates of the corners shown in Fig. 13(a) as the known points ρk on the reference plane. The corresponding points μk in the image plane were obtained by marking the corners of the checkerboard pattern in the image. Then, with the pairs (ρk,μk), an homography matrix Gk was computed for each acquired image. With these homographies, the matrix V defined in Eq. (144) was created. Then, Eq. (143) was solved for w, the resulting matrix W˜ is

Eq. (155)


From this, the intrinsic parameter matrix K was recovered as

Eq. (156)


For validation purposes, we estimate the focal length using the known information sx=sy=6  μm, and σ=0. The reader should note that the quantities sx and sy are defined in this experiment as

Eq. (157)

sx=sy=75226×103  mm
because the points μ were obtained in a coordinate system with a unit of length equal to a half of the image width, see Figs. 13(b)13(i). From the matrix K in Eq. (156), the focal length was estimated using Eq. (148). The result is f=6.0032  mm, which is very close to the nominal focal length (6 mm) of the employed camera lens.

Fig. 12

(a) Image of 1168×2080  pixel capturing a scene with the Melencolia I printed on a letter size paper. (b) Perspective corrected Image.


Fig. 13

(a) A 3×3 checkerboard pattern and the coordinates of the corners. (b)–(i) 8 of 15 images of the reference plane acquired by a camera from different unknown viewpoints.



This work was supported by CONACyT México through the project Cátedras/880.



O. Faugeras, Q.-T. Luong and T. Papadopoulo, The Geometry of Multiple Images: the Laws that Govern the Formation of Multiple Images of a Scene and Some of Their Applications, MIT Press, Cambridge (2004). Google Scholar


O. D. Faugeras and S. Maybank, “Motion from point matches: multiplicity of solutions,” Int. J. Comput. Vision, 4 (3), 225 –246 (1990). IJCVEQ 0920-5691 Google Scholar


Z. Zhang, “A flexible new technique for camera calibration,” IEEE Trans. Pattern Anal. Mach. Intell., 22 1330 –1334 (2000). ITPIDJ 0162-8828 Google Scholar


Y. Zhao and Y. Li, “Camera self-calibration from projection silhouettes of an object in double planar mirrors,” J. Opt. Soc. Am. A, 34 696 –707 (2017). JOAOD6 0740-3232 Google Scholar


T. Taketomi et al., “Camera pose estimation under dynamic intrinsic parameter change for augmented reality,” Comput. Graphics, 44 11 –19 (2014). Google Scholar


H. H. Ip and Y. Chen, “Planar rectification by solving the intersection of two circles under 2D homography,” Pattern Recognit., 38 (7), 1117 –1120 (2005). PTNRA8 0031-3203 Google Scholar


B. Cyganek and J. P. Siebert, An Introduction to 3D Computer Vision Techniques and Algorithms, John Wiley & Sons Ltd., Chichester, West Sussex (2009). Google Scholar


O. Faugeras, Three-Dimensional Computer Vision: a Geometric Viewpoint, MIT Press, Cambridge (1993). Google Scholar


R. Hartley and A. Zisserman, Multiple View Geometry in Computer Vision, Cambridge University Press, Cambridge (2003). Google Scholar


J. L. Mundy and A. Zisserman, Appendix—Projective Geometry for Machine Vision, 463 –519 MIT Press, Cambridge (1992). Google Scholar


W. Burger, “Zhang’s camera calibration algorithm: in-depth tutorial and implementation,” Hagenberg, Austria (2016). Google Scholar


F. Devernay and O. Faugeras, “Straight lines have to be straight,” Mach. Vision Appl., 13 (1), 14 –24 (2001). MVAPEO 0932-8092 Google Scholar


H. Zeng, X. Deng and Z. Hu, “A new normalized method on line-based homography estimation,” Pattern Recognit. Lett., 29 (9), 1236 –1244 (2008). PRLEDG 0167-8655 Google Scholar


Z. Zhang, “A flexible new technique for camera calibration,” (1998). Google Scholar


L. Kr, “Accurate chequerboard corner localisation for camera calibration,” Pattern Recognit. Lett., 32 (10), 1428 –1435 (2011). PRLEDG 0167-8655 Google Scholar


R. Juarez-Salazar et al., “Camera calibration by multiplexed phase encoding of coordinate information,” Appl. Opt., 54 4895 –4906 (2015). APOPAI 0003-6935 Google Scholar


R. Juarez-Salazar, L. N. Gaxiola and V. H. Diaz-Ramirez, “Single-shot camera position estimation by crossed grating imaging,” Opt. Commun., 382 585 –594 (2017). OPCOB8 0030-4018 Google Scholar


A. Herout, M. Dubská and J. Havel, Vanishing Points, Parallel Lines, Grids, 41 –54 Springer, London (2013). Google Scholar


R. Juarez-Salazar, F. Guerrero-Sanchez and C. Robledo-Sanchez, “Theory and algorithms of an efficient fringe analysis technology for automatic measurement applications,” Appl. Opt., 54 5364 –5374 (2015). APOPAI 0003-6935 Google Scholar

Biographies for the authors are not available.

© 2017 Society of Photo-Optical Instrumentation Engineers (SPIE)
Rigoberto Juarez-Salazar and Victor H. Díaz-Ramírez "Operator-based homogeneous coordinates: application in camera document scanning," Optical Engineering 56(7), 070801 (27 July 2017).
Received: 11 May 2017; Accepted: 7 July 2017; Published: 27 July 2017 Logo
Cited by 25 scholarly publications.
Get copyright permission  Get copyright permission on Copyright Marketplace
Back to Top