Multiple-view model-based inspection of quadric objects

Multiple-view model-based inspection of quadric objects

Pattern Recognition Letters 10 (1989) 33-38 North-Holland July 1989 Multiple-view model-based inspection of quadric objects Itzhak WILF Eatultr of E...

274KB Sizes 3 Downloads 21 Views

Pattern Recognition Letters 10 (1989) 33-38 North-Holland

July 1989

Multiple-view model-based inspection of quadric objects Itzhak WILF Eatultr of Engineering . Tel-Aviv University, Tel-Aviv, Israel

Yehuda MANOR Math, and Comput . Science Dept ., Bar-Ilan University, Rarnat-Gut, Israel

Received 27 September 1988 Revised 2 January 1989 Abstract A method is presented for measuring 3D properties of a quadric object using multiple, partially overlapping views . : The method is based on quadric model construction from its silhouette curves . Its application to fruit sorting is described . Ker words : Quadric model, perspective projection, 3D inspection .

1 . Introduction Automated visual inspection of 3D objects is frequently performed by taking multiple pictures of such objects from different viewpoints . Range sensing [I] yields accurate 3D information but is rather slow and expensive . Considering TV sensing, we address two fundamental problems : First, the pictures obtained are 2D while the properties used for inspection are generally 3D . Second, using a sufficient number of cameras to view the complete surface of the object introduces overlap between the various views . These problems are solved by constructing an appropriate 3D model of the object from its perspective projections . The model is used to relate 2D measurements to 3D properties as well as to match features between different views, thus solving the overlap problem . The constructed 3D model tends to he geometrically and computationally simpleThe only requirement is that it should match the allowed inspection errors, usually being comparable to those of a human observer . This approach is suggested and studied in the context of a fruit sorter using visual inspection to

classify apples . We consider the specific task of estimating the ratio between the red area of the apple to its surface area (red plus green) . It was found that for the estimation task as well as for others (such as size measurement), apples can be approximated by ellipsoids and covered effectively by a four-camera tetrahedral arrangement with the apple located near the center of the tetrahedron . We start by introducing quadrics and their perspective projections . Then we describe a robust model-construction algorithm for non-singular quadrics from their silhouette curves . Based on that model, a method is presented for identifying surface features already considered in previous projections . Our method is based on sound geometrical elements as opposed to both `shape from contour' [2] and conventional stereo vision relying on feature matching [3] . We conclude with the possible extension of our approach to objects having more complex shapes .

2 . Quadrics and their perspective projections The general algebraic form of a quadric surface

0167-8655189,1$3.50 © 1989, Elsevier Science Publishers B .V . (North-Holland)

33



Volume 10 . Number I

in 3D cartesian coordinate system

PATTERN RECOGNITION LETTERS (X, Y, Z)

is

+ 2BXY + 2CXZ + 2DX + EY 2 + 2F YZ + 2 G Y + HZ2 + 21Z + J = 0 (2 .1)

q(X, Y, Z) = AX2

where A,B,C . . . are arbitrary real constants [4] . This equation can be represented in matrix form V[Q]V' = 0

(2 .2)

July 1989

called a view space . We adopt the convention of (X,Z) being parallel to the image plane axes and Y being oriented along the optical axis of the camera . The focal point is described by the vector F = [0 0 0 11' .

(2 .9)

The image plane coordinates (x, z), of the perspective projection of the point V are given by

where V is a row vector representation of a point V = [X Y Z I ]

(2 .3)

and [Q] . a four by four symmetric discriminant matrix :

[Q] =

A B C D B E F G C F H I D G I J

A quadric surface is singular if and only if the determinant of its discriminant vanishes . Similarly, we define a planar surface by the equation KX + L Y+ MZ + N = 0 and its matrix form VP = 0

(2 .5)

with P'= [K L M Al . Let V be the position vector of a point in one cartesian coordinate system, then it may be transformed, by a sequence of rotations and translations, into another system where it is represented by V = [X' 1^ Z' I] . The transformation is described by means of the matrix multiplication :

x= -

f~ z=-1Y

provided that Y > 0 .J is the focal length of the camera . The normal vector to a quadric q(x,y,z) at a point on q is given by the vector of partial derivatives :

N =- [Nx h r Nz]'

oq g eq = _ox 8Y 8Z

(2 .7) (2 .8)

(see [5, 6]) . A camera-centered cartesian coordinate system is 34

(2-12)

(2 .6)

where T is a non-singular 4*4 Point Transformation Matrix (PTM) . [S], the Surface Transformation Matrix (STM), being the inverse of [T], can be used to transform the matrix representation of planes and quadrics into the corresponding representation in the new system as follows : P' _ [S] P, [Q'] = [S][Q][S]'

(2 .11)

Consider the lines drawn from a point V, not on the quadric [Q], which are tangent to [Q] . These lines touch [Q] in points lying on the polar plane of V with respect to [Q] . The vector representation of that plane is given by the product [Q]V', [7, p . 167] . The points of tangency lie on a conic section, defined by the quadric and its polar plane . The assemblage of all the tangent lines is a quadric cone, with vertex V . called the tangent cone . The matrix form of the cone is given by [6] : [R] = [Q]V t V[Q] - V[QV'[Q] .

V- VT

(2 .10)

Taking the focal point, F, to be the vertex of a tangent cone, the image plane projection of the conic section mentioned above, is known as the limb or silhouette curve [6] . Figure 1 depicts a quadric, its tangent cone through the focal point, and the projected silhouette curve.

3. Quadric model construction Consider a set of cameras viewing a non-singular quadric q, and let the algebraic form of the limb



PATTERN RECOGNITION LETTERS

Volume 10, Number I

July 1989

known quadric coefficients, we describe the model construction algorithm . We relate all equations to the quadric coefficients in the c = 0 view space, normalized such that A in (2 .1) is I . Thus, we have a vector of nine unknown variables Q 0 ,, U -

[ Q001

Q002 Q003 Qoll Qo12 Qo13 (3 .5)

Q022 Q023 Q033] .

Figure I . A tangent cone, R, to a quadric Q, through the focal point, b . P . the polar plane of F. intersects the quadric and the cone in the conic C. The projection of C on the image plane . forms the silhouette curve S. x,z are the image plane axes .

curve conic section in camera number c be given by a, I X 2 + a, 2 z 2

+ a c3 x2

+ a,4 x + a, s z

+ 0 th =

0 . (3 .11

Choosing an appropriate set of nine equations of the form (3 .4) from the different view spaces, a Newton-Raphson iterative algorithm is used for solving the unknown coefficients :

Ukil=Uk - i[J] - 'E

(3.6)

where [J] is the jacobian matrixCE(e) (3 .7) IU(u)

The curve may be hack-projected through the focal point F, of camera number c, substituting x,z from (2 .10) into (3 .1) to obtain the cone described by the discriminant : all

1-2

-

4'

- 2a 5J 0

4f

- 4`a '4fa,6 [re] =

- `a,sf 0

zac3.f 0 a,f 0

:a,3f'' 0

0

(3 .2)

0

Let [Q,] denote the discriminant of the quadric in the view space of camera number c, then for the discriminant [re ] of the enveloping cone through the focal point F, we substitute (2 .9) into (2_12) . It may be verified that R

_

JQ,3IQc3J -

Q,33Qcii

0

if i,j < 2, otherwise .

(3 .3)

Clearly, both cones are equivalent . Since for an ellipsoid R,00 does not vanish, we may write the equation E(e) = R, ;j r'. oo - R,uur,,j = 0

Since some equations E(c, i,j) are stated in c # 0 view spaces, the surface transformation matrix [S e] from view space c to 0 is used . From (2 .8) . (3 .4) and (3 .5) it may be verified that

for all

i, j <- 2

(3 .4)

where e is an equation index defining some (e .i,j) triplet . Having defined the second-order equations relating the measured limb curve coefficients to the un-

d F(e . i, j) = Q 1- 3 ;tpd(e,3,j,in,n) c U(m, it) + Q,, J tpd(c, 3, i, nt, n ) - Q, 33 tpd(c,i,,j,in,n) Q , i tpd(c, 3, 3, in, n)

(3 .8)

where the transformation partial derivative function is defined by t pd(c, i j, in, n) = S d „ „S t.j

+

S,i .Sc„„ .

The following vector of (c,i .j) triples defines a set of nine equations for which the algorithm exhibits good convergence properties : [(0, 0, 1), (0, 0, 2), (0, l , 1), (0, 1, 2) . (0, 2, 2), (1,0,I),(1 .0,2),(l,I,I),(2,0,1)] .

(3 .9)

The convergence is determined also by the initial solution U 0 . For the apple inspection system we currently use a spherical guess computed as follows : Taking two elliptic limb curves we solve for the point in space corresponding to the centers of the ellipses, using a standard LSE technique [8] . That 35



July 1989

Volume t0. Nut

Figure 2 . Three views of an apple following contrast stretching .

Figure 3 . Synthetically generated views of the inspected apple, rendered using its quadric model . 36



Volume 10, Number I

PATTERN RECOGNITION LETTERS

July 1989

point is taken to he the sphere's center . Its radius is computed by taking the geometric mean of the geometric means of the semi-axes of the ellipses, multiplied by the appropriate magnification factors . Figure 2 depicts three views of an apple taken with B/W cameras equipped with a special color filter . The pictures have been enhanced using local contrast stretching [9] . The computed quadric, synthetically rendered using standard computer graphics techniques, is shown in Figure 3 with the segmented red spots mapped onto the surface . 'The convergence rate has been tested in numerous simulations . Let a perfect ellipsoid have its center at (X 1 , Y„ Z,) and let the geometric mean of its semi-axes be R, . Similarly, define (X2 ,Y2 ,Z,) and R 2 for the computed ellipsoid . Then we define the normalized geometric error (NGE) by

Define the algebraic error at iteration k . AE(k), by 8 E2 (e) where e is an equation index, defining a Y e -n (e,i,j) triplet in the vector (3 .9) . The NGE and NAE = AE(k)/AE(0) are shown in Figure 4 . It may be seen that about 12 iterations yield an error of five percent . This 'numerical' error is related to the speed of convergence of the iterative process . It should be combined in a r .m .s . manner with the 'geometric' error resulting from approximating the apple by a quadric. We have found the total size error to be of the order of 10 percent which is within the proposed specifications of the system .

NGE _ (R1- R2) 2 +

Having computed the quadric model, various image properties are converted into 3D properties via that model . For the specific task of color ratio estimation we divide the 3D red area, integrated from all views, by that of the ellipsoid's surface . From each red pixel which has not been considered in the integration of a previous view, we cast a ray through the focal point . Let W = [X Y Z]c be the ray-quadric intersection closest to the camera and N the normal to the quadric at W, computed using (2 .11) . Let da be the image plane area corresponding to a single pixel, cp the normalized cross product between W and N, and M the magnification factor M = Y// Then the pixel's contribution to the . integrated red area is given by da M'/cp We now describe the procedure for identifying surface elements which have been considered in previous views . Let P,, be the colomn vector representing the polar plane of F r , the focal point in view space c . Let also F,P, be greater than zero . P, defines the visible portion of the quadric w .r .t . camera number c . Use (2 .7) and the appropriate STM to transform Pr to view space number v, where it is described by P 1 , . Suppose we are integrating view v and considering the surface point V . If for some previous view c, VP,„ > 0, V has already been considered and should not contribute to the colored area . Computational efficiency is increased by transforming that constraint into aa conic image plane inequality, avoiding unnecessary casting of rays .

( X1 -

X2)2 + ( Y, - Y2 ) 2 + ( Z, R2

Zz)2

n

w NGE 0 .4-

0,05L 2

4

6

10

12

14 n

Figure 4 . Normalized algebraic (NAE) and geometric errors (NGE) vs . number of iterations (n) in model construction (scales are linear) .

4. Multiple-view surface feature integration

37



Volume 10, Number I

PATTERN RECOGNITION LETTERS

5 . Summary An algorithm for the reconstruction of a non-singular quadric from its silhouette curves has been developed as a part of a method for surface property measurements from multiple perspective projections . The method has been applied to certain tasks of visual inspection in a fruit sorter . The algorithms are robust, the inspection accuracy obtained is very good and the complexity is such that a practical system can be based on a few modern floating-point processing chips . The methods are adapted from some of the numerical modules of a logic-based computer vision system built by the authors which handles objects bounded by multiple quadric and planar faces . Such object models, combined with structured-light sensing, can be used for the identification of shape defects in apples and for the inspection of other objects which cannot be described by a single-quadric model .

38

July 1989

References [1] Faugeras, O .D . and M . Hebert (1986) . The representation, recognition and positioning of 3D shapes from range data . In : A . Rosenfeld, Ed ., Techniques for 3-D Machine Perception . North-Holland, Amsterdam . [21 Barrow, H .G . and J .M . Tenenbaum (1981) . Interpreting line drawings as three-dimensional surfaces . Artificial Intelligence 17, 75-116 . [3] Grimson . W .E .L . (1986). Computing stereopsis using feature point contour matching . In : A . Rosenfeld, Ed ., Techniques for 3-D Machine Perception, North-Holland, Amsterdam . [4] Levin, I .Z . (1976) . A parametric algorithm for drawing pictures of solid objects composed of quadric surfaces . Comm . AC,M 19(10) . 555-563 . [5] Newmann, W .M . and R.F . Sproull (1979) . Principles of Interactive Computer Graphics . McGraw-Hill, New York . [6] Blinn, J . F . (1984) . The algebraic properties of homogeneous second order surfaces . ACM SIGGRAPH Advanced Image Synthesis, 1-23 . [7] Dresden, A . (1964) . Solid Analytical Geometry and Determinants . Dover. New York . [8] Ro_eers, D .R . and J .A . Adams (1976) . Mathematical ElementsforComputer Graphics . McGraw-Hill, New York . [9] Wallis, R . (1977), An approach to the space-variant restoration and enhancement of images . In : C .O . Wilde and E . Barrett, Eds ., Image Science Mathematics. Western Periodicals, North Holywood .