Method for generating surface data to be added to three dimensional shape data

- MINOLTA CO., LTD.

An object of the present invention is to automatically determine the orientation of a newly generated surface, etc. when performing such processing as filling a dropout portion of three dimensional shape data, and to generate more natural three dimensional shape data. The present invention provides a method for generating a grid-patterned surface in three dimensional shape data, and comprises a first step (#11) for detecting the orientation of a polygon in the three dimensional shape data that is located at a periphery of a surface to be fitted, a second step (#12) for determining the orientation of the surface so that a grid orientation of the surface matches the orientation of the detected polygon, and a third step (#13) for fitting the surface onto the three dimensional shape data while maintaining the thus determined orientation.

Skip to: Description  ·  Claims  · Patent History  ·  Patent History
Description
RELATED APPLICATION

[0001] This application is based on application No. H11-369025 filed in Japan, the entire content of which is hereby incorporated by reference.

BACKGROUND OF THE INVENTION

[0002] 1. Field of the Invention

[0003] The present invention relates to a method for generating surface data to be added to three dimensional shape data.

[0004] 2. Description of the Related Art

[0005] It is known in the art to generate three dimensional shape data by using a three dimensional measuring apparatus utilizing the light section method or the like. The three dimensional measuring apparatus optically scans an object to be measured, by projecting, for example, a slit ray and deflecting it, and obtains three dimensional shape data by calculation based on the principle of triangulation. By measuring around the circumference of the object and joining together the acquired three dimensional shape data, the three dimensional shape data of the entire object is obtained.

[0006] However, depending on the shape and orientation of the object or the illumination condition, three dimensional shape data may not be obtained fully, and may contain data dropouts.

[0007] In that case, such data dropout portions must be filled. One way to achieve this is to generate a grid-patterned surface and join the generated surface and the data dropout portion together along the contour thereof.

[0008] The problem here is what surface is to be generated and how the generated surface is arranged with respect to the original three dimensional shape data. In this case, if the user has to determine or make such settings to generate three dimensional data, the user would have to go through extremely time and labor consuming procedures.

SUMMARY OF THE INVENTION

[0009] An object of the present invention is to solve the above problem. Another object of the invention is to accomplish proper surface fitting to three dimensional shape data. Still another object of the invention is to generate natural three dimensional shape data when surface fitting is applied to the three dimensional data. Yet another object of the invention is to automatically determine the orientation or grid density of a newly generated surface.

[0010] These and other objects are attained by a method for generating a grid-patterned surface in three dimensional shape data, the method comprising a first step for detecting the orientation of a polygon in the three dimensional shape data that is located at a periphery of a surface to be fitted, a second step for determining the orientation of the surface so that a grid orientation of the surface matches the orientation of the detected polygon, and a third step for fitting the surface onto the three dimensional shape data while maintaining the thus determined orientation.

[0011] The above objects of the invention are also attained by detecting in the first step a vector whose starting point is at a vertex of the polygon located at the periphery of the surface to be fitted, and whose end point is at a vertex connected to the vertex taken as the starting point, and by determining the orientation of the surface in the second step so that the grid orientation of the surface aligns with a coordinate space whose X or Y axis is taken along a direction in which the vector is pointed.

[0012] In another preferred mode, the above objects of the invention are attained by a method comprising a first step for detecting in three dimensional shape data a surface shape around a periphery of a surface to be fitted, a second step for determining the orientation of the surface so that the grid orientation of the surface matches the detected shape, and a third step for fitting the surface onto the three dimensional shape data while maintaining the thus determined orientation.

[0013] The above objects of the invention are also attained by generating in the first step a rectangular bounding box that fits around the periphery of the surface to be fitted, setting a grid inside and outside the bounding box, and obtaining a Z value of a vertex of the grid as a boundary value, and by rotating the bounding box in the second step so that an evaluation value based on the boundary value is minimized or maximized, and determining the orientation of the surface so that the grid orientation of the surface aligns with a coordinate space whose X or Y axis is taken along a direction in which the grid of the bounding box is oriented.

[0014] In still another preferred mode, the above objects of the invention are attained by a method comprising a first step for detecting the density of polygons in the three dimensional shape data that are located around a periphery of a surface to be fitted, a second step for determining a grid density of the surface so that the grid density of the surface matches the detected density, and a third step for generating a surface with the thus determined density and fitting the generated surface onto the three dimensional shape data.

[0015] The above objects of the invention are also attained by taking, in the first step, the periphery of the surface to be fitted as forming a polygon, detecting vectors each consisting of two adjacent vertices in the vertices forming the polygon, and detecting the density in X direction on the basis of an average value of the x components of the vectors near the X-axis direction and the density in Y direction on the basis of an average value of the y components of the vectors near the Y-axis direction.

[0016] The invention itself, together with further objects and attendant advantages, will best be understood by reference to the following detailed description taken in conjunction with the accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

[0017] FIG. 1 is a block diagram showing schematically the configuration of a three dimensional processing apparatus embodying the present invention;

[0018] FIG. 2 is a diagram for explaining a first mode for generating a surface for three dimensional data;

[0019] FIG. 3 is a flow chart illustrating a surface generation process according to the first mode;

[0020] FIG. 4 is a diagram for explaining a second mode for generating a surface for three dimensional data;

[0021] FIG. 5 is a flow chart illustrating a surface generation process according to the second mode;

[0022] FIG. 6 is a diagram for explaining a third mode for generating a surface for three dimensional data;

[0023] FIG. 7 is a flow chart illustrating a surface generation process according to the third mode;

[0024] FIG. 8 is a diagram showing vectors around the periphery of a dropout portion in three dimensional data;

[0025] FIG. 9 is a diagram showing the relationship between X and Y axes and X′ and Y axes;

[0026] FIG. 10 is a diagram showing the arrangement of a bounding box in a first embodiment of the second mode;

[0027] FIG. 11 is a diagram showing X lines and Y lines set in the bounding box;

[0028] FIG. 12 is a diagram for explaining a method of obtaining an evaluation value from a gradient difference;

[0029] FIG. 13 is a diagram for explaining a method of obtaining the evaluation value from the variances of boundary values;

[0030] FIG. 14 is a diagram for explaining a method of obtaining the evaluation value from the variances of boundary values;

[0031] FIG. 15 is a diagram showing the arrangement of a bounding box in a second embodiment of the second mode;

[0032] FIG. 16 is a diagram showing the arrangement of vertices in three dimensional data in accordance with a first embodiment of the third mode; and

[0033] FIG. 17 is a diagram showing the arrangement of three dimensional data in a second embodiment of the third mode.

[0034] In the following description, like parts are designated by like reference numerals throughout the several drawings.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0035] The preferred modes of the present invention will become apparent from the following description given with reference to the accompanying drawings.

[0036] FIG. 1 is a block diagram showing schematically the configuration of a three dimensional processing apparatus 1 embodying the present invention.

[0037] In FIG. 1, the three dimensional processing apparatus 1 comprises a CPU (processor) 11, a memory 12, an auxiliary storage device 13, an input/output interface 14, a keyboard 15, a mouse 16, and a display 17, each connected to a bus 10.

[0038] The CPU 11 carries out various kinds of processing including processing for the surface generation method of the present invention. The memory 12 includes a ROM 12a which stores a control program describing procedures that the CPU 11 carries out, a RAM 12b which provides a data storage area and work area necessary for the CPU 11 to carry out the various kinds of processing, and a driver 18 for reading out data stored on a portable storage medium such as a CD-ROM. The auxiliary storage device 13 is used to store data to be processed, such as three dimensional data (three dimensional shape data) and two dimensional color image data. The input/output interface 14 is used to input data to be processed from an external device or to output generated data to an external device.

[0039] The keyboard 15 and mouse 16 are used to input various kinds of data, instructions, or settings. The display 17 is used to display three dimensional data and generated surface images, and also display processing state, processing results, and the progression of processing. The display 17 is capable of displaying a plurality of windows using a multi-window system.

[0040] Using the three dimensional processing apparatus 1, processing such as data filling, generation of a new surface, etc. can be applied to data dropout portions of the input three dimensional data. More specifically, the CPU 11 performs the processing by loading a program for carrying out such processing from the ROM 12a. A portable storage medium holding thereon a program for carrying out such processing may be inserted into the driver 18; in this case also, the CPU can perform the processing by loading the program stored on the portable storage medium.

[0041] Further, by using the driver 18, a processing program stored on a portable storage medium can be installed on the three dimensional processing apparatus 1.

[0042] Three modes of operation for surface generation and shape, i.e., the first to third modes of the invention, will be described below.

[0043] [Mode 1]

[0044] FIG. 2 is a diagram for explaining the first mode for generating a surface for three dimensional data TD1, and FIG. 3 is a flow chart illustrating a surface generation process according to the first mode.

[0045] A portion of the three dimensional data TD1 is shown in FIG. 2. The three dimensional data TD1 includes a data dropout portion KR1. A new surface ME1 is generated and fitted onto the dropout portion KR1.

[0046] When generating or fitting the surface ME1, the orientation of the surface ME1 is determined so as to match the orientation of the polygons in the three dimensional data TD1, as shown at the lower right of FIG. 2. In the case of the surface MEK1 shown at the upper right of FIG. 2, its grid orientation does not match the orientation of the polygons in the three dimensional data TD1.

[0047] In FIG. 3, the orientation of the polygons located around the periphery of the surface to be fitted, that is, the dropout portion KR1 of the three dimensional data TD1, is detected (#11). Next, the orientation of the surface ME1 is determined so that the grid orientation of the surface ME1 matches the orientation of the detected polygons (#12). The surface ME1 with the thus determined orientation is fitted onto the three dimensional data TD1 (#13). Three dimensional data TD1 free from dropout portions is thus generated.

[0048] Since this processing is performed automatically, the user is freed from troublesome procedures, and more natural three dimensional data TD1 can be generated.

[0049] The surface ME1 can also be fitted onto a portion for which it is desired to generate a new surface, instead of fitting it onto the dropout portion KR1.

[0050] [Mode 2]

[0051] FIG. 4 is a diagram for explaining the second mode for generating a surface for three dimensional data TD2, and FIG. 5 is a flow chart illustrating a surface generation process according to the second mode. The second mode corresponds to the invention described in claim 3.

[0052] The three dimensional data TD2 shown in FIG. 4 represents a cylindrically shaped object. The three dimensional data TD2 includes a data dropout portion KR2 in a portion of its circumferential surface. A new surface ME2 is generated and fitted onto the dropout portion KR2.

[0053] When generating or fitting the surface ME2, the orientation of the surface ME2 is determined so as to match the shape of the three dimensional data TD2, as shown at the lower right of FIG. 4. In the case of the surface MEK2 shown at the upper right of FIG. 4, its grid orientation does not match the shape of the three dimensional data TD2.

[0054] In FIG. 5, the shape of the peripheral portion of the surface to be fitted, that is, the dropout portion KR2 of the three dimensional data TD2, is detected (#21). Next, the orientation of the surface ME2 is determined so that the grid orientation of the surface ME2 matches the detected shape (#22). The surface ME2 with the thus determined orientation is fitted onto the three dimensional data TD2 (#23). Three dimensional data TD2 free from dropout portions is thus generated.

[0055] Since this processing is performed automatically, the user is freed from troublesome procedures, and more natural three dimensional data TD2 can be generated.

[0056] The surface ME2 can also be fitted onto a portion for which it is desired to generate a new surface, instead of fitting it onto the dropout portion KR2. The surface ME2 can be deformed in such a manner as to follow the shape of the three dimensional data TD2.

[0057] [Mode 3]

[0058] FIG. 6 is a diagram for explaining the third mode for generating a surface for three dimensional data TD3, and FIG. 7 is a flow chart illustrating a surface generation process according to the third mode. The third mode corresponds to the invention described in claim 5.

[0059] A portion of the three dimensional data TD3 is shown in FIG. 6. The three dimensional data TD3 includes a data dropout portion KR3. A new surface ME3 is generated and fitted onto the dropout portion KR3.

[0060] When generating or fitting the surface ME3, the grid density of the surface ME3 is determined so as to match the grid density of the polygons in the three dimensional data TD3, as shown at the center in the right side of FIG. 6. In the case of the surfaces MEK3 and MEK4 shown at the upper right and lower right of FIG. 6, the grid density is too low or too high and does not match the density of the polygons in the three dimensional data TD3.

[0061] In FIG. 7, the density of the polygons located around the periphery of the surface to be fitted, that is, the dropout portion KR3 of the three dimensional data TD3, is detected (#31). Next, the grid density of the surface ME3 is determined so that the grid density of the surface matches the detected density (#32). The surface ME3 with the thus determined grid density is fitted with its orientation matched to the orientation of the polygons in the three dimensional data TD3 (#33). Three dimensional data TD3 free from dropout portions is thus generated.

[0062] Since this processing is performed automatically, the user is freed from troublesome procedures, and more natural three dimensional data TD3 can be generated.

[0063] The surface ME3 can be fitted onto a portion for which it is desired to generate a new surface, instead of fitting it onto the dropout portion KR3.

[0064] The above three modes will be described in further detail below.

[0065] [Details of Mode 1]

[0066] As described above, in the first mode, a surface is generated for the data dropout portion KR so that the orientation of the surface matches the orientation of the polygons in the three dimensional data TD. When fitting the grid-patterned plane surface onto the dropout portion KR of the three dimensional data TD, the orientation of the plane surface, that is, the orientation of the XY coordinate axes of the plane, is set so as to match the orientation of the polygons located around the periphery of the dropout portion KR.

[0067] [Embodiment 1 of Mode 1]

[0068] FIG. 8 is a diagram showing vectors around the periphery of a dropout portion KR4 in three dimensional data TD4, and FIG. 9 is a diagram showing the relationship between X and Y axes and X′ and Y axes.

[0069] The following processing (a) to (d) is carried out for the dropout portion KR4 of the three dimensional data TD4.

[0070] (a) Regard the dropout portion KR4 of the three dimensional data TD4 as a polygon, and find a normal to it. Then, set the direction of the normal as the Z-axis direction of the plane surface (surface ME) to be generated. As a result, when the three dimensional data TD4 is viewed with its dropout portion KR4 facing the viewer, its depth direction is the Z-axis direction and the X and Y axes are set in a plane parallel to the dropout portion KR4.

[0071] Here, the X and Y axes are set in suitable directions (see FIG. 9). For example, the line of intersection between the plane surface to be fitted and the XY plane of the original coordinate system is set as the X axis. Then, the three dimensional data TD4 is converted to the newly set XYZ coordinate system. The following description considers the XY plane in this newly set coordinate system.

[0072] (b) Pick up vectors vi=(xi, yi), each having a starting point at one of the vertices forming the dropout portion KR4 and an end point at a vertex connected to the vertex taken as the starting point, as shown in FIG. 8. At this time, each vector vi is normalized to magnitude 1. Using the vectors vi, the X and Y axes of the plane surface to be generated are determined.

[0073] (c) Assume here that the X and Y axes are rotated through &thgr;(&thgr;≦&thgr;≦&pgr;/2) about the Z axis. The rotated axes are denoted by X′ axis and Y′ axis, respectively. In the coordinate system rotated through &thgr;, if the original vectors vi=(xi, yi) have become vectors vi′=(xi′, yi′) after rotation, the relationship between them is expressed by equation (1) below.

xi′=xi cons &thgr;+yi sin &thgr;

yi″=−xi sin &thgr;+yi cons &thgr;  (1)

[0074] (d) For the plane surface generated by the coordinate system rotated through &thgr; from the coordinate system set in the above processing (a) to match the polygons located around the periphery of the dropout portion KR4, in the X′Y′ coordinate system the vectors vi′=(xi′, yi′) should be made close to (1, 0), (0, 1), (−1, 0), and (0, −1). That is, the vectors vi′ should be set parallel to the X′ axis or Y′ axis.

[0075] Therefore, the value of 0 should be found that minimizes the sum of the squares of the products of the x and y components of the vectors vi. If this is expressed as evaluation function E, the following equation (2) is given. 1 E = ∑ i ⁢ ( x i ′ ⁢ y i ′ ) 2 ( 2 )

[0076] Substituting the equation (1) into the equation (2), the following equation (3) is obtained. 2 E = ∑ i ⁢ [ ( x i ⁢ cos ⁢   ⁢ θ + y i ⁢   ⁢ sin ⁢   ⁢ θ ) ⁢ ( - x i ⁢   ⁢ sin ⁢   ⁢ θ + y i ⁢ cos ⁢   ⁢ θ ) ] 2 ( 3 )

[0077] Setting a=cos &thgr; and b=sin &thgr;, the equation (3) is transformed to obtain the following equation (4). 3 E = ∑ i ⁢ [ ( x i ⁢ a + y i ⁢   ⁢ b ) ⁢ ( - x i ⁢ b + y i ⁢ a ) ] 2 = ∑ i ⁢ [ x i ⁢ y i ⁢   ⁢ a 2 - ( x i 2 - y i 2 ) ⁢ a ⁢   ⁢ b - x i ⁢ y i ⁢ b 2 ] 2 = ∑ i ⁢ [ A i ⁡ ( a 2 - b 2 ) - B i ⁢ ab ] 2 ⁢ ⁢   ⁢ ( A i = x i ⁢ y i , B i = x i 2 - y i 2 ) ⁢ ⁢   ⁢ a 2 - b 2 = cos 2 ⁢   ⁢ θ - sin 2 ⁢ θ = cos ⁢   ⁢ 2 ⁢ θ ⁢ ⁢   ⁢ ab = cos ⁢   ⁢ θsin ⁢   ⁢ θ = 1 2 ⁢ sin ⁢   ⁢ 2 ⁢ θ ⁢   ⁢ ⁢ ⁢ E = ∑ i ⁢ [ A i ⁢ cos ⁢   ⁢ 2 ⁢ θ - 1 2 ⁢ B i ⁢ sin ⁢   ⁢ 2 ⁢ θ ] 2 ( 4 )

[0078] For the value of &thgr; that minimizes the evaluation function E, the value of &thgr; for which dE/d&thgr;=0 should be found.

[0079] Differentiating the equation (4) by &thgr;, the following equation (5) is obtained. 4 ⅆ E ⅆ θ = ∑ i ⁢ 2 ⁢ ( A i ⁢ cos ⁢   ⁢ 2 ⁢ θ - 1 2 ⁢ B i ⁢ sin ⁢   ⁢ 2 ⁢ θ ) ⁢ ( 2 - A i ⁢ sin ⁢   ⁢ θ - B i ⁢ cos ⁢   ⁢ 2 ⁢ θ ) = 0 ⁢ ⁢ ∑ i ⁢ [ ( - 4 ⁢ A i 2 + B i 2 ) ⁢ sin ⁢   ⁢ 2 ⁢ θcos ⁢   ⁢ 2 ⁢ θ - 2 ⁢ A i ⁢ B i ⁡ ( cos 2 ⁢ 2 ⁢ θ - sin 2 ⁢ 2 ⁢ θ ) ] = 0 ⁢ ⁢ ∑ i ⁢ [ ( - 4 ⁢ A i 2 + B i 2 ) ⁢   ⁢ 1 2 ⁢ sin ⁢   ⁢ 4 ⁢ θ - 2 ⁢ A i ⁢ B i ⁢ cos ⁢   ⁢ 4 ⁢ θ ] = 0 ⁢ ⁢ C ⁢   ⁢ sin ⁢   ⁢ 4 ⁢   ⁢ θ - D ⁢   ⁢ cos ⁢   ⁢ 4 ⁢ θ = 0 ⁢ ⁢ ( C = ∑ i ⁢ ( - 4 ⁢ A i 2 + B i 2 ) , D = ∑ i ⁢ 4 ⁢ A i ⁢ B i ) ( 5 )

[0080] Hence, &thgr; is found as shown by equation (6) below. 5 θ = 1 4 ⁢ tan - 1 ⁢ D C ( 6 )

[0081] Two values are found for &thgr;. These are substituted into the equation (4), and the value of &thgr; for which the evaluation function E is the smaller is adopted.

[0082] Next, inverse coordinate transformation is applied to the three dimensional data TD4 to convert it back to the original coordinate system. Then, the X and Y axes set in the above processing (a) are rotated through &thgr; about the Z axis to determine the orientation (X and Y axes) of the plane surface (surface ME) to be generated.

[0083] [Embodiment 2 of Mode 1]

[0084] In the second embodiment, the X and Y axes are determined using a technique of principal component analysis. First, the processing (a) and (b) in the first embodiment is carried out. Then, the processing (c) described below is carried out.

[0085] (c) Perform principal component analysis with the vectors vi=(xi, yi), and determine the direction of the first principal component vector as the X-axis direction. However, since coordinate transformation has been applied to the three dimensional data TD4 in the above processing (a), inverse coordinate transformation must be performed.

[0086] Though principal component analysis is a known technique, an outline will be described below.

[0087] [Principal Component Analysis]

[0088] Conditions for principal component vectors and procedures

[0089] 1. The magnitude of each principal component vector is 1.

(Normality: ∥ui∥2=1, i=1, . . . , m)

[0090] Here, m represents the degree, which is 2 in the present embodiment since two axes, the X and Y axes, are involved.

[0091] 2. The first principal component vector u1 is determined so that the variance of its direction component k1 becomes the largest. 6 ( Variance ⁢   ⁢ maximization ⁢ : ⁢   ⁢ ⟨ k i 2 ⟩ = 1 n ⁢ ∑ i = 1 n ⁢   ⁢ k 1 ⁢ i 2 -> max )

[0092] 3. The second principal component vector u2 is determined so that the variance of its direction component k2 becomes the largest under the condition that the condition 1 is satisfied and that it is uncorrelated with k2. 7 ( Condition ⁢   ⁢ for ⁢   ⁢ uncorrelatedness ⁢ : ⁢   ⁢ ⟨ k i ⁢ k 2 ⟩ = 1 n ⁢ ∑ i = 1 n ⁢   ⁢ k 1 ⁢ i ⁢ k 2 ⁢ i = 0 )

[0093] 4. Likewise, the j-th principal component vector uj is determined so that the variance of its direction component kj becomes the largest under the condition that it is uncorrelated with kj.

[0094] Calculation of the First Principal Component Vector

[0095] Supposition and expression for samples

[0096] Number of samples: n 8 i ⁢ - ⁢ th ⁢   ⁢ sample ⁢ : ⁢   ⁢ X i = [ x i , 1 x i , 2 ]

[0097] Average is zero vector

[0098] First principal component of i-th sample is

ki=XiTui

[0099] Variance of first principal component over entire sample is 9 E = 1 n ⁢ ∑ i = 1 n ⁢ ( X i T ⁢ u i ) 2 ->   ⁢ min

[0100] Condition for normality is

∥u1∥2=1

[0101] Since this is a conditional minimization problem, Lagrange's method of undetermined coefficients is used. That is, introducing a parameter &lgr;, u1 and &lgr; that minimize equation (7) below are found. 10 E = 1 n ⁢ ∑ i = 1 n ⁢ ( X i T ⁢ u i ) 2 - λ ⁡ ( &LeftDoubleBracketingBar; u 1 &RightDoubleBracketingBar; 2 - 1 ) ( 7 )

[0102] For this purpose, the equation (7) is differentiated with respect to each element of u1, and solved by equating it to zero. To rearrange the expression, if we put

X=[X1, . . . , Xn]

[0103] then 11 X T ⁢ u 1 = [ X 1 T ⋮ X n T ] ⁢ u 1 = [ X 1 T ⁢ u 1 ⋮ X n T ⁢ u 1 ]

[0104] Hence, E1 is expressed as 12 E 1 = 1 n ⁢ ∑ i = 1 n ⁢ ( X i T ⁢ u 1 ) 2 = 1 n ⁡ [ X 1 T ⁢ u 1 ⋯ X n T ⁢ u 1 ] ⁡ [ X 1 T ⁢ u 1 ⋮ X n T ⁢ u 1 ] = 1 n ⁢ ( X T ⁢ u 1 ) T ⁢ X T ⁢ u 1 = 1 n ⁢ u 1 T ⁢ X ⁢   ⁢ X T ⁢ u 1 = u 1 T ⁢ C ⁢   ⁢ u 1

[0105] Using this expression, the objective function is expressed as

E=u1TCu1−&lgr;(∥u1∥2−1)

[0106] Differentiating the equation with respect to u1 and equating it to zero, we have 13 ∂ E ∂ u 1 = 2 ⁢   ⁢ Cu 1 - 2 ⁢   ⁢ λ ⁢   ⁢ u 1 = 0 ⁢ ∴ ( C - λ ⁢   ⁢ 1 ) ⁢ u 1 = 0

[0107] The above equation is equivalent to an eigenvalue problem. For the above equation to have a significant solution (u1≠0), the matrix=0, that is,

|C−&lgr;I|=0

[0108] must be satisfied. This matrix equation can be expanded to a polynomial in &lgr;,

a0a1&lgr;+a2&lgr;2+. . . +am&lgr;m=0

[0109] There are a number, m, of &lgr; values that satisfy this equation and, from the positive semidefinite nature of a covariance matrix, it is known that the values are all nonnegative.

[0110] Of the solutions of the equation in &lgr;, the largest one is found, and the eigenvector corresponding to it is the first principal component. The eigenvalue at this time provides the variance of the first principal component. Consider an eigenvector corresponding to the i-th solution &lgr;i. The variance Ei of this eigenvector's direction is shown as follows.

Ei=u1TCui=uiT&lgr;iui=&lgr;i∥ui∥2=&lgr;i

[0111] That is, the eigenvalue itself provides the variance of the eigenvector.

[0112] Therefore, of the eigenvalues, the largest one should be selected, and its corresponding eigenvector should be taken as the first principal component vector. Then, the eigenvector corresponding to the second largest one should be taken as the second principal component vector.

[0113] [Embodiment 3 of Mode 1]

[0114] The first and second embodiments described above have dealt with examples in which a plane surface is fitted onto a dropout portion; by contrast, the third embodiment described hereinafter deals with an example in which a plane surface is fitted onto a portion for which it is desired to form a new surface, regardless of the presence or absence of a dropout portion.

[0115] That is, in the third embodiment, a plane surface is generated for three dimensional data TD so as to match the orientation of the polygons in the three dimensional data TD. When fitting the grid-patterned plane surface onto the three dimensional data TD, the orientation of the plane surface is set so that the grid orientation of the plane surface (the orientation of the XY coordinate axes of the plane surface) matches the orientation of the polygons in the selected region.

[0116] The following processing (a) to (c) is performed.

[0117] (a) Select polygons in the region where it is desired to generate a plane surface in the three dimensional data TD. The user can select the polygons.

[0118] (b) Calculate the average value of the normal vectors of the selected polygons.

[0119] The average value is set as the Z-axis direction in the coordinate system of the plane surface to be generated. The X and Y axes are set in suitable directions. For example, the line of intersection between the plane to be fitted and the XY plane of the original coordinate system is set as the X axis. Then, the three dimensional data TD is converted to the newly set XYZ coordinate system. The following description considers the XY plane in this newly set coordinate system.

[0120] (c) Examine vertices defining the boundaries between the selected polygons and non-selected polygons. Pick up vectors vi=(xi, yi), each having a starting point at a vertex of a selected polygon and an end point at a vertex of the non-selected polygon connected to it, are picked up. At this time, each vector vi is normalized to magnitude 1. Using the vectors vi, the X and Y axes of the plane surface to be generated are determined.

[0121] The method of determining the axes is the same as that shown in the processing (c) and (d) in the first embodiment of the first mode and the processing (c) in the second embodiment of the first mode.

[0122] [Details of Mode 2]

[0123] In the second mode, a surface is generated for a dropout portion KR so as to match the shape of three dimensional data TD. When fitting the grid-patterned plane surface onto the dropout portion KR of the three dimensional data TD, by considering the shape around the dropout portion KR the plane surface (the coordinate axes of the plane surface) is oriented along a direction that follows the shape [Embodiment 1 of Mode 2]

[0124] FIG. 10 is a diagram showing the arrangement of a bounding box BB1 in the first embodiment of the second mode, and FIG. 11 is a diagram showing X lines and Y lines set in the bounding box BB1.

[0125] The following processing (a) to (f) is carried out for the dropout portion KR5 of the three dimensional data TD5.

[0126] (a) Regard the dropout portion KR5 of the three dimensional data TD5 as a polygon, and find a normal to it. Set the direction of the normal as the Z-axis direction of the plane surface (surface ME) to be generated. Set the X and Y axes in suitable directions. Then, convert the three dimensional data TD5 to the newly set XYZ coordinate system. The following description considers the XY plane in this newly set coordinate system.

[0127] (b) Take the thus set X axis as the horizontal direction, and the Y axis as the vertical direction. Generate the bounding box BB1 for the dropout portion KR5. Since the grid-patterned plane surface is supposed to be generated within the bounding box BB1, the purpose here is to correctly set the X axis and Y axis of the bounding box BB1.

[0128] (c) Set a grid inside and outside the bounding box BB1, as shown in FIG. 11. The grid consists of X lines horizontally and Y lines vertically. The grid line spacing is determined in advance. The X lines are extended in the horizontal direction (X-axis direction) of the bounding box BB1, and the Y lines are drawn at intervals of Hx.

[0129] The Z values of the points where the X lines intersect the boundary of the bounding box BB1 and the Z values of the points where the X lines intersect the Y lines in regions outside the bounding box BB1 provide boundary values. The boundary values are indicated by filled circles in FIG. 11. These boundary values can be obtained by projecting the grid points onto the polygons in the three dimensional data TD5.

[0130] (d) Calculate the evaluation value E from the boundary values. The method of calculating the evaluation value E will be described later.

[0131] (e) Apply inverse coordinate transformation to convert the three dimensional data TD5 back to the original coordinate system by rotating it through a predetermined angle &thgr; about the Z axis, and return to the above processing (b). Then, the processing from (b) to (e) is repeated until a 90-degree rotation is achieved.

[0132] (f) Find the value of angle &thgr; that minimizes (or maximizes) the obtained evaluation value E, and set it as the optimum angle. Rotate the X and Y axes, set in the processing (a), through the thus obtained optimum angle &thgr; about the Z axis, and generate a plane surface whose sides are located along the thus rotated X and Y axes.

[0133] That is, by rotating through the angle &thgr; that minimizes (or maximizes) the evaluation value E, the plane surface is oriented along the circumferential surface of the three dimensional data TD5. For example, in the case of the three dimensional data TD2 shown in FIG. 4, the surface ME2 is oriented in the direction such that the spacing between the surface ME2 and the circumferential surface of the circular cylinder is maintained constant. The plane surface thus arranged can be deformed in such a manner as to follow the curvature of the three dimensional data TD by using a suitable method.

[0134] Next, the method of calculating the evaluation value E will be described.

[0135] [Evaluation Value Calculation Method 1]

[0136] In this method, the evaluation value E is obtained from a gradient difference.

[0137] FIG. 12 is a diagram for explaining the method of obtaining the evaluation value E from a gradient difference.

[0138] Attention is paid to each X line (see FIG. 11). As shown in FIG. 12, gradients are obtained from the boundary values Lz0, Lz1, and Lz2 on the left side of the bounding box BB1 and the boundary values Rz0, Rz1, and Rz2 on the right side, and the average gradients gradL and gradr are respectively obtained. The evaluation value E is calculated based on the average gradients.

[0139] Attention is paid to the bounding values on the i-th X line. Using the following equation, average gradients gradLi and gradRi are respectively obtained from pairs of successive boundary values on the left and right sides of the bounding box BB1. On the left side, the leftward direction is taken as the positive direction, and on the right side, the rightward direction is taken as the positive direction. That is, the direction directed away from the bounding box BB1 is taken as the positive direction. In the equation, m indicates the number of boundary values. 14 gradL i = ∑ j = 0 m - 1 ⁢ ( Lz j + 1 - Lz j ) / H x ) m - 1 gradR i = ∑ j = 0 m - 1 ⁢ ( Rz j + 1 - Rz j ) / H x m - 1

[0140] Then, the square of the difference between gradLi and gradRi is calculated.

Ei=(gradli−gradri)2

[0141] When there are n X lines, the evaluation value E is calculated as follows. 15 E = ∑ n ⁢ E i n

[0142] That is, the average of the squares of the differences between left and right calculated on an X-line by X-line basis is taken as the evaluation value E. When the plane surface (surface ME) is inclined on the left and right sides by approximately the same amount, the evaluation value E becomes small. Accordingly, the plane should be rotated by the angle &thgr; that minimizes the evaluation value E.

[0143] [Evaluation Value Calculation Method 2]

[0144] This method also obtains the evaluation value E from a gradient difference.

[0145] The method of calculation is similar to the method 1 described above, except that the positive direction along the x axis is set the same between the left and right sides. That is, in FIG. 12, the rightward direction, which is taken as the positive direction on the right side, for example, is also taken as the positive direction of the gradient of the boundary values on the left side. In this case, the plane surface is arranged along the non-curving direction of the circumferential surface (along the axial direction of the circular cylinder).

[0146] [Evaluation Value Calculation Method 3]

[0147] In this method, the magnitudes of gradients are calculated.

[0148] Gradient is calculated from each pair of successive boundary values on each X line. The gradient is calculated for every pair on every line, and the average of the magnitudes (absolute values) of the gradients is taken as the evaluation value E. The average is determined so as to minimize the evaluation value E. The gradient is smaller as the evaluation value E decreases. The evaluation value E is given by the following equation. 16 E = ∑ &LeftBracketingBar; grad &RightBracketingBar; numgrad

[0149] Here, grad denotes the gradient. Further, numgrad indicates the number of obtained gradients, which is equal to n shown by the following equation.

n=(number of X lines)×(number of boundary values on one line−1)×2

[0150] [Evaluation Value Calculation Method 4]

[0151] In this method, the variances of boundary values are calculated.

[0152] FIG. 13 is a diagram for explaining the method of obtaining the evaluation value E from the variances of boundary values.

[0153] As shown circled by ellipses in FIG. 13, attention is paid to the boundary values on the lines parallel to the Y lines. In other words, attention is paid to each group of boundary values whose x coordinates are the same. The variance of the z value at the boundary values is calculated. Variances are calculated for the respective groups, and the average is taken as the evaluation value E.

[0154] In this method also, the average is determined so as to minimize the evaluation value E. Variation among the boundary values on each Y line becomes smaller as the evaluation value E decreases.

[0155] [Evaluation Value Calculation Method 5]

[0156] In this method, the variances of boundary values are calculated.

[0157] FIG. 14 is a diagram for explaining the method of obtaining the evaluation value E from the variances of boundary values.

[0158] As shown circled by ellipses in FIG. 14, attention is paid to the boundary values on each pair of adjacent lines parallel to the Y lines. Gradient is calculated from two adjacent boundary values lying on the same X line, and the variance is calculated from all the gradients. The variances of the gradients are calculated for the respective groups, and the average is taken as the evaluation value E.

[0159] In this method also, the average is determined so as to minimize the evaluation value E. Variation along the X direction on each Y line becomes smaller as the evaluation value E decreases.

[0160] [Embodiment 2 of Mode 2]

[0161] FIG. 15 is a diagram showing the arrangement of a bounding box BB2 in the second embodiment of the second mode.

[0162] The second embodiment deals with an example in which a plane surface is fitted onto a portion for which it is desired to form a new surface, regardless of the presence or absence of a dropout portion.

[0163] That is, in the second embodiment, when forming the grid-patterned plane surface for three dimensional data TD6, by considering the shape of the three dimensional data TD6 the plane surface (the coordinate axes of the plane surface) is oriented along a direction that follows the shape.

[0164] The following processing (a) to (c) is performed.

[0165] (a) Select polygons in the region where it is desired to generate a plane surface in the three dimensional data TD6.

[0166] (b) Calculate the average value of the normal vectors of the selected polygons.

[0167] The average value is set as the Z-axis direction in the coordinate system of the plane surface to be generated. The X and Y axes are set in suitable directions. For example, the line of intersection between the plane to be fitted and the XY plane of the original coordinate system is set as the X axis. Then, the three dimensional data TD6 is converted to the newly set XYZ coordinate system. The following description considers the XY plane in this newly set coordinate system.

[0168] (c) Take the thus set X axis as the horizontal direction, and the Y axis as the vertical direction. Generate the bounding box BB2 for the selected polygons. The purpose here is to obtain the X and Y axes of the bounding box BB2.

[0169] The method of determining the axes is the same as that shown in the processing (c) to (f) in the first embodiment of the second mode.

[0170] [Details of Mode 3]

[0171] In the third mode, as earlier described, the density of grid points on the surface to be generated, that is, the number of grid points and grid point spacing, for example, is determined automatically. It is assumed that the orientation (X-axis direction and Y-axis direction) of the plane surface to be generated is already determined in accordance with the method described, for example, in the first mode or the second mode.

[0172] [Embodiment 1 of Mode 3]

[0173] FIG. 16 is a diagram showing the arrangement of vertices in three dimensional data TD7 in accordance with the first embodiment of the third mode.

[0174] The following processing (a) to (d) is carried out for a dropout portion KR 7 of the three dimensional data TD7.

[0175] (a) Regard the dropout portion KR-7 of the three dimensional data TD7 as a polygon and, for vertices P0, P1, P2, forming the polygon, consider vectors each consisting of two adjacent vertices.

[0176] (b) Classify each vector by examining whether the direction of the vector is close to the x-axis direction or y-axis direction in the coordinate system determined for surface generation.

[0177] More specifically, the vector is normalized, and the absolute value of the x component is compared with the absolute value of the y component; if the x component is greater in magnitude, the vector is classified as a vector close to the x-axis direction, and if they component is greater in magnitude, the vector is classified as a vector close to the y-axis direction. This classification is performed on every vector.

[0178] (c) For the vectors classified as vectors close to the x-axis direction, the average value of the x components is taken. Likewise, for the vectors classified as vectors close to the y-axis direction, the average value of they components is taken. These two average values are taken as spacings in the X direction and Y direction in an ideal grid, and denoted by x space and y space, respectively.

[0179] (d) When the vertical and horizontal lengths of the bounding box BB for the dropout portion KR7 are denoted by H and W, respectively, the number of grid points, num x and num y, to be generated is given as

num x=W/x space

num y=H/y space

[0180] If num x or num y is not exactly divisible, the number is rounded to the nearest integer.

[0181] If num x or num y becomes 1, a grid-patterned surface cannot be generated; in that case, num x or num y is set to 2.

[0182] [Embodiment 2 of Mode 3]

[0183] FIG. 17 is a diagram showing the arrangement of three dimensional data TD8 in the second embodiment of the third mode.

[0184] The second embodiment deals with an example in which a plane surface is fitted onto a portion for which it is desired to form a new surface, regardless of the presence or absence of a dropout portion.

[0185] (a) In the three dimensional data TD8, select polygons in the region where it is desired to generate a plane surface.

[0186] (b) For vertices on the boundaries between the selected polygons and non-selected polygons, consider vectors each consisting of two adjacent vertices.

[0187] Using the vectors, the number of grid points is determined. The method of determining the number is the same as that described in (b) to (d) in the first embodiment of the third mode.

[0188] As described above, according to the three dimensional processing apparatus 1 of the present invention, when filling a dropout portion of three dimensional data or forming a desired surface, for example, the orientation of a newly generated surface, etc. are automatically determined, thereby achieving generation of more natural three dimensional data.

[0189] In the above-described modes, the configuration of the whole or part of the three dimensional processing apparatus 1, the details of processing, the order of processing, the shape of three dimensional data TD, etc. can be altered in accordance with the purpose of the invention.

[0190] Although the present invention has been fully described by way of examples with reference to the accompanying drawings, it is to be noted that various changes and modifications will be apparent to those skilled in the art. Therefore, unless such changes and modifications depart from the scope of the present invention, they should be construed as being included therein.

Claims

1. A method for fitting a grid-patterned surface data onto a portion of a three-dimensional shape data including a plurality of polygons, the method comprising:

a first step of detecting the conditions of a plurality of polygons in the three dimensional shape data that is located at a periphery of a surface to be fitted the surface data;
a second step of determining conditions of grid-pattern of the surface data on the basis of detected conditions of the plurality of polygons; and
a third step of fitting the surface data whose grid-pattern has been determined onto the three dimensional shape data.

2. The method according to claim 1,

wherein said condition of polygon includes an orientation thereof, and said condition of grid-pattern includes an orientation thereof for the three-dimensional shape data.

3. The method according to claim 2,

wherein the orientation of the polygon is detected in the first step by picking up a vector whose starting point is at a vertex of the polygon located at the periphery of the surface to be fitted, and whose end point is at a vertex connected to the vertex taken as the starting point, and the orientation of the grid-pattern is determined in the second step so as to take along direction of the picked up vector.

4. The method according to claim 1,

wherein said condition of polygon includes a position thereof in a three-dimensional space, and said condition of grid-pattern includes a orientation thereof for the three-dimensional shape data.

5. The method according to claim 4,

wherein said second step comprising sub-steps of:
generating a rectangular bounding box that includes the portion to be fitted the surface data;
setting a grid inside and outside the bounding box;
obtaining a Z value of a vertex of the grid as a boundary value;
rotating the bounding box so that an evaluation value based of the boundary value is minimized or maximized; and
determining the orientation of the surface so that the orientation of the grid-pattern aligns with a coordinate space whose X or Y axis is taken along a direction in which the grid of the bounding box is oriented by the rotation.

6. The method according to claim 1,

wherein said condition of polygon includes a density thereof, and said condition of grid-pattern includes a density thereof.

7. The method according to claim 6,

wherein the density of polygon is detected in the first step by picking up vectors each consisting of two adjacent vertices in the vertices forming the polygon, and in the second step, the density in X direction is detected on the basis of an average value of the x components of the vectors near the X-axis direction among the picked up vectors, the density in Y direction is detected on the basis of an average value of the Y components of the vectors near the Y-axis direction among the picked up vectors, and the density of the grid is determined on the basis of the detected densities.

8. The method according to claim 1,

wherein said portion is where three-dimensional data lacks.

9. The method according to claim 1,

wherein said portion is designated from within the three-dimensional data by a operator.

10. A method for fitting a grid-patterned surface data onto a portion of a three-dimensional shape data consisting of a plurality of polygons, the method comprising:

a first step of picking up a vector whose starting point is at a vertex of the polygon located at the periphery of the surface to be fitted the surface data;
a second step of determining a orientation of the surface data on the basis of the picked up vector; and
a third step of fitting the surface data to the three-dimensional shape data in the determined orientation.

11. The method according to claim 10,

wherein in the second step, X-Y coordinates is determined so as to minimize a sum of the squares of the products of the x and y components of the respective vectors, and the orientation of the surface data is determined according to the determined X-y coordinates.

12. The method according to claim 10,

wherein in the second step, X-Y coordinates is determined using a technique of principal component analysis, and the orientation of the surface data is determined according to the determined X-y coordinates.

13. A method for fitting a grid-patterned surface data onto a portion of a three-dimensional shape data consisting of a plurality of polygons, the method comprising steps of:

generating a rectangular bounding box that includes the portion to be fitted the surface data;
setting a grid inside and outside the bounding box;
obtaining a evaluation value based on Z value of a vertex of the grid;
determining the orientation of the surface according to orientation of the bounding box which making the evaluation value to minimize or maximize.

14. A method for fitting a grid-patterned surface data onto a portion of a three-dimensional shape data consisting of a plurality of polygons, the method comprising steps of:

picking up vectors each consisting of two adjacent vertices in the vertices forming the portion;
determining the density in X direction on the basis of an average value of the x components of the vectors near the X-axis direction among the picked up vectors;
determining the density in Y direction on the basis of an average value of the Y components of the vectors near the Y-axis direction among the picked up vectors; and
fitting the surface that the density of which grid is determined to the three-dimensional shape data.

15. An apparatus for fitting a grid-patterned surface data onto a portion of a three-dimensional shape data consisting of a plurality of polygons, the apparatus comprising:

a detector for detecting the conditions of a plurality of polygons in the three dimensional shape data that is located at a periphery of a surface to be fitted the surface data;
a determination portion for determining conditions of grid-pattern of the surface data on the basis of detected conditions of the plurality of polygons; and
a processor for fitting the surface data whose grid-pattern has been determined onto the three dimensional shape data.

16. A computer program for making a computer to execute processes of:

detecting the conditions of a plurality of polygons in the three dimensional shape data that is located at a periphery of a surface to be fitted the surface data;
determining conditions of grid-pattern of the surface data on the basis of detected conditions of the plurality of polygons; and
fitting the surface data whose grid-pattern has been determined onto the three dimensional shape data.
Patent History
Publication number: 20040212613
Type: Application
Filed: May 19, 2004
Publication Date: Oct 28, 2004
Patent Grant number: 7215336
Applicant: MINOLTA CO., LTD. (Osaka)
Inventors: Koichi Fujiwara (Otsu-Shi), Osamu Toyama (Kakogawa-Shi), Eiro Fujii (Osaka)
Application Number: 10847886
Classifications
Current U.S. Class: Three-dimension (345/419)
International Classification: G06T015/00;