Abstract:
Two-dimensional image data of an object is processed to inspect a circular arc configuration of the object. Initially, the two-dimensional image data is subjected to a data extraction process in which image edge points of the circular arc configuration of the object are extracted from the two-dimensional image data. The image edge points are then applied to a process to approximate the circular arc configuration of the object by defining a circle which minimizes a mean value of a fourth power error of the image edge points relative to the circle, the thus defined circle being used to approximate the circular arc configuration of the object.

Description:
BACKGROUND OF THE INVENTION 
     The present invention relates to a method and apparatus for measuring or inspecting a circular arc configuration of a product or part such as the circular arc configuration of a thread hole, and more particularly to a method for approximating the center position and radius of the circular arc configuration based on image information. 
     With reference to the drawings, two examples of conventional method for approximating a circular are configuration are is described below. 
     The conventional method includes the following three processes (A), (B) and (C). 
     Process (A): 
     A sequence of edge points is extracted from a two-dimensional image. 
     Process (B): 
     A point sequence is formed based on the edge points. 
     Process (C): 
     A circular-arc is approximated based on the point sequence. The circular-arc configuration of the product is detected according to the approximated circular arc. 
     The two examples 1 and 2 of conventional method which will be described below each include the above-described processes (A) and (B), but are different from each other with respect to process (C). 
     First, the process (A) for extracting edge points from the two-dimensional image is described. Normally, in measuring or inspecting the configuration of a specified portion of a product or part, there are abrupt changes in the density of the image thereof. The image density suddenly changes at the edge point. Therefore, the absolute value of the differentiated value of the image density is large at the edge point. Thus, the image is filtered by a differential filter so that a point at which the absolute value of the output is large is set as the edge point. A Laplacian filter is an example of a differential filter. FIG. 2 shows an example of an output, obtained by the use of the Laplacian filter, in which a center point having a value &#34;8&#34; is an edge point. In extracting ridges shown in FIG. 3 from a two-dimensional image, a result obtained by using the Laplacian filter is shown in FIG. 4. An edge point is required to satisfy two of the following four conditions. 
     X≧X 0  and X&gt;X 4   
     X≧X 1  and X&gt;X 5   
     X≧X 2  and X&gt;X 6   
     X≧X 3  and X&gt;X 7   
     The process (B) for forming a point sequence based on edge point is now described. In order to obtain a point sequence from the aggregation of edge points obtained in the process (A), adjacent edge points are connected with each other. In this case, short lines branching from the point sequence are deleted. Of long lines branching from the point sequence, only a point sequence consisting of a branch having a minimum curvature is selected and other branches are cut off to obtain a single point sequence having no branches. The curvature (C) is calculated as follows: A branch point shown in FIG. 5 is assumed as (P). Points spaced at a length (L) from the point (P) are supposed as Q 1  and Q 2 . When the difference in the directional angle between a vector Q 1  P and a vector PQ 2  is supposed as θ, the curvature (C) is found as follows: 
     
         C=θ/L                                                (1) 
    
     The value of (L) is set to be smaller than the radius of a circumference which must be detected so that noise does not have a large inappropriate influence on calculations used for finding the curvature (C) because it is sensitive that the value is set to be too small. The resulting point sequence is expressed as follows: 
     
         {P.sub.i |i=1, . . . N}                           (2) 
    
     The process (C) for approximating a circular arc from the point sequence of the process (B) and detecting the circular arc configuration based on the approximated circular arc will now be described. Since the two examples 1 and 2 differ with respect to process (C), the example 1 is first described below. FIG. 6 is an illustration showing the method for calculating a partial curvature C i+1  of the first example 1. 
     The partial curvature C i+1  of a curve formed by three points P i , P i+1  and P i+2  is expressed as follows: 
     
         C.sub.i+1 =θ.sub.i+1 /d.sub.i+1                      ( 3) 
    
     where θ i+1  is the difference in the directional angle between a vector (P i  P i+1 ) and a vector (P i+1  P i+2 ), and d i+1  is the average of the length P i  P i+1  and the length P i+1  P i+2 . 
     The curvature C 1  of the entire point sequence is expressed as follows: ##EQU1## 
     A decision is made according to the value of the variance of the partial curvature C i+1  with respect to the curvature C 1  of the entire point sequence. If the variance value is smaller than a predetermined value, it is decided that the point sequence is a part of a circular arc and consequently, detected as the circular arc. 
     The process (C) of example 2 for approximating a circular arc from the point sequence of the process (B) and detecting the circular arc configuration based on the approximated circular arc will now be described. FIG. 7 is an illustration showing the method for calculating a partial curvature C i+s  of the example 2. 
     According to the example 2, instead of calculating the partial curvature of a curve configured by the three continuous points as in the example 1, the partial curvature C i+s  between two points spaced at (s) pieces of points apart is calculated. If the variance of the partial curvature C i+s  with respect to the curvature C 2  of the entire point sequence is smaller than a predetermined value, it is decided that the point sequence is a part of a circular arc and accordingly detected as the circular arc. 
     The partial curvature C i+s  of the circular arc formed by three points P i , P i+s , and P i+2s  of the point sequence is expressed by the following equation (5): 
     
         C.sub.i+1 =θ.sub.i+1 /d.sub.i+1                      ( 5) 
    
     where θ i+s  is the difference in the directional angle between a vector [P i  P i+s  ] and a vector [P i+s  P i+2s  ] and d i+s  is the average of the length P i  P i+s  and the length P i+s  P i+2s . 
     The curvature C 2  of the entire point sequence is expressed by the following equation (6). ##EQU2## 
     A decision is made according to the value of the variance of the partial curvature C i+s  with respect to the curvature C 2  of the entire point sequence. If the value of the variance is smaller than a predetermined value, it is decided that the point sequence is a part of a circular arc and consequently is detected as the circular arc. 
     However, the above-described conventional method have the following disadvantages: 
     The disadvantage common to the examples 1 and 2 is that in the processes (A) and (B), in forming a point sequence from edge points extracted from the two-dimensional image, false edge points are generated as a result of, for example, dirt adhering to the product or part roughness of the product surface, and electric signal noise. Such false edge points do not coincide with the required true edge points of the actual configuration of the product or parts to be measured or inspected. If extraction of edge points is repeated to remove the false edge points, some of the true edge points will disappear together with the false edge points. As a result, the required edge points decrease and the point sequence becomes short. Consequently, it becomes difficult to make a correct approximation of the circular arc. In addition, edge points serving as the information source of the approximation of a circular arc decrease, and thus, the position and radius of the circular are cannot be accurately calculated. 
     Further, it takes a long time for the methods of examples 1 and 2 to perform the necessary calculations because a large number of angle calculations is required. 
     As described previously, according to the example 1, the curvature C 1  of the entire point sequence is expressed by the equation (4). But supposing that d 0  is the length of the entire point sequence and θ 01  is the variation from the directional angle of a vector P 1  P 2  connecting one edge point of the point sequence and a point adjacent thereto with each other to the directional angle of a vector P N-1  P N  connecting the other edge point of the point sequence and a point adjacent thereto with each other, the curvature C 1  is expressed as follows: ##EQU3## 
     Usually the actual outline image of a product or part is not necessarily thin, but thick. According to the above-described method for extracting edge points which uses filtering, large errors are made in determining the coordinates of edge points. In addition, since the average value d i+1  of the equation (3) is small, a large error is made in the directional angle, between the vector P 1  P 2  and the vector P N-1  P N , which determines the variation θ 01 . Thus, a large error occurs in the calculation of the variation θ 01 , namely, in the calculation of the curvature C 1  of the entire point sequence. 
     According to the example 2, since the average value d i+s  of the equation (5) is (s) times as great as the average value d i+1  of the equation (3) of the example 1, errors in determining the coordinates of edge points are not large and consequently, the error of the curvature C 2  of the entire point sequence is smaller than that of the example 1. But if the number of point sequences is small, the curvature cannot be calculated depending on the value of (s). Further, according to the example 2, there is no reference value on which an appropriate value of (s) is determined. 
     Furthermore, according to the examples, the center of the circular arc is not found. 
     SUMMARY OF THE INVENTION 
     Accordingly, an essential object of the present invention is to provide a method for approximating a circular are in the processing of a two-dimensional image without forming a point sequence based on edge points and any inappropriate influence caused by errors, and capable of performing an approximation with a high accuracy. 
     In accomplishing these and other objects, according to one aspect of the present invention, there is provided a method for approximating the center position and radius of a circular arc detected in the processing a two-dimensional image, comprising the steps of: 
     extracting an aggregation of edge points from data of the two-dimensional image of a product or part having the circular arc to be detected, a configuration of which is measured or inspected; 
     finding the square of the distance between the center of a circular arc and a given edge point of an aggregation of the edge points; 
     finding the square of the radius of the circular arc used in the first finding step; 
     finding the square of the difference between the two squares; 
     taking a mean value of a fourth power error obtained by the square of the difference of the two squares; and 
     minimizing the mean value of the fourth power error to perform an approximation so as to estimate a circular arc having the minimum mean value as an approximated circular arc of the circular arc to be detected in the aggregation of the edge points.. 
     According to the above construction, since it is unnecessary to perform processing for forming a point sequence based on edge points, a great number of edge points can be provided as the information source for approximating the center position and radius of a circular arc. In addition, even though errors occur in determining the coordinates of edge points, they do not cause calculations to be inappropriately performed. Further, it is unnecessary to perform angle calculations, the center and radius of the circular arc can be approximated with a high accuracy by easy calculations. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     These and other objects and features of the present invention will become clear from the following description taken in conjunction with the preferred embodiments thereof with reference to the accompanying drawings, in which: 
     FIG. 1 is a flowchart according to an embodiment of the present invention; 
     FIG. 2 is an example of an output of a Laplacian filter to be used in the extraction of edge points in the embodiment of the present invention and the conventional method; 
     FIG. 3 is an illustration showing the conventional method of extracting edge points; 
     FIG. 4 is an illustration showing the conventional method of extracting edge points; 
     FIG. 5 is an illustration showing the conventional method of composing a point sequence; 
     FIG. 6 is an illustration showing a first example of the conventional method for calculating a radius of curvature; and 
     FIG. 7 is an illustration showing a second example of the conventional method for calculating a radius of curvature. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     Before the description of the present invention proceeds, it is to be noted that like parts are designated by like reference numerals throughout the accompanying drawings. 
     Referring now to accompanied drawings, the method for approximating the center position and radius of a circular arc in the processing of a two-dimensional image according to an embodiment of the present invention will be described below. 
     FIG. 1 is a flowchart according to an embodiment of the present invention. In this embodiment, a circular arc configuration of a product or part is approximated using an apparatus including an image pick-up device, an image storing/processing device, and a calculating device. 
     At step #1, the image of a product or part to be detected having a circular arc configuration is picked up and the density of a two-dimensional image is differentiated based on the data thereof. The image is filtered by a digital differential filter such as ! a Laplacian filter and consequently, the output distribution of the filtering as shown in FIG. 2 is obtained. 
     At step #2, the aggregation of edge points is extracted from the two-dimensional image. 
     At the edge point, an image density abruptly changes. The edge point corresponds to an outline at which the image brightness suddenly changes on the product or part to be measured or inspected. The absolute value of the differentiated value of an image density is great at the edge point. Therefore, in the output distribution in FIG. 2 obtained at step #1, points of a great absolute value are extracted as edge points and the aggregation of the edge points is obtained. Although this method generates a few false edge points due to, for example, dirt adhered to of the product or the part, roughness of the product surface, or electric signal noise, the number of required true edge points is high. Therefore, according to this method, inappropriate influence is hardly given in detecting the center position and radius of a circular arc. 
     At step #3, the center position and radius of a circular arc is approximated and detected by the present method for minimizing a mean fourth power error based on the aggregation of the edge points obtained at step #2. 
     This method is described below. 
     
         (x-a).sup.2 +(y-b).sup.2 =r.sup.2                          (8) 
    
     The equation (8) indicates a circle having the radius (r) and the center at a point (a, b). The equation (8) can be expressed as follows: 
     
         x.sup.2 -Ax+y.sup.2 -By+C=0                                (9) 
    
     The square of the distance between the center (a, b) of the circular arc to be detected and a given edge point (x i , y i ) is equal to the left side portion {(x-a) 2  +(y-b) 2  } of the equation (8). 
     Supposing that (r) is the radius between the edge point to be detected and the point (a, b), the following equation (10) is established: 
     
         (x.sub.i -a).sup.2 +(y.sub.i -b).sup.2 =r.sup.2 +e.sub.i   (10) 
    
     (e i ) of the equation (10) is the difference between the square of the distance between the center (a, b) of the circular arc and the edge point (x i , y i ) and the square of the radius (r) of the circular arc. Thus, the equation (10) can be expressed as follows: ##EQU4## 
     Finding the average value (E) of the sum of the square of the equation (11) with respect to (N) edge points, the following equation (12) is obtained: ##EQU5## 
     The center (a, b) of the circular arc and the radius (r) thereof which are approximated by the equations (8) and (9) are obtained by (A), (B), and (C) which minimize the average value (E) of the equation (12). The equation (12) represents the method for minimizing the mean fourth power error according to the embodiment of the present invention. 
     Supposing that f (x i , y i ) is the differentiated value of the image density at the given edge point (x i , y i ), the equation (12) can be expressed as follows: ##EQU6## 
     The equation (13) may be used instead of the equation (12) by giving the differentiated value of the image density at each edge point as a load to the mean fourth power error at each edge point. In this case, the load may be expressed in the form of a given function of the differentiated value f (x i , y i ) of the image density, for example, a square root, a logarithmic function, and an exponential function. Since the change in an image brightness can be appropriately reflected in an approximative calculation, approximative calculations can be appropriately performed. 
     The method for finding (A), (B) and (C) which minimize the average value (E) of the equation (13) is described below. To this end, the equation (13) is partially differentiated by (A), (B) and (C). Then, the following simultaneous equation (14) is solved. ##EQU7## 
     The simultaneous equations of the equation (14) is solved as follows: ##EQU8## 
     Supposing Z i  =x i   2  +y i   2 , these equations (14-1), (14-2), and (14-3)are expressed as follows: 
     From the equation (14-1), ##EQU9## 
     From the equation (14-2), ##EQU10## 
     From the equation (14-3), ##EQU11## 
     Supposing ##EQU12## and α is an any value such as x, y, x 2 , or x·y, these equations are as follows: 
     From the equation (14-41), 
     
         Z·x-Ax.sup.2 -Bx·y+Cx=θ            (14-4&#39;) 
    
     From the equation (14-5) 
     
         Z·y-Ax·y-By.sup.2 +Cy=θ            (14-5&#39;) 
    
     From the equation (14-6) 
     ti Z-Ax-By+C=θ                                       (14-6&#39;) 
     Here,(the left side of the equation (14-4&#39;)) -x×(the left side of the equation (14-6&#39;))=θ, 
     
         Z·x-Z·x-A(x.sup.2 -x.sup.2)-B(x·y-x·y)=θ            (14-7) 
    
     Here, (the left side of the equation (14-5&#39;)) -y×(the left side of the equation (14-6))=θ, 
     
         Z·y-Z·y-A(x·y-x·y)-B(y.sup.2 -y.sup.2)=θ                                         (14-8) 
    
     From the equation (22), ##EQU13## 
     Similarly, from the equation (23), the following equation is obtained: 
     
         V(y)=y.sup.2 -y.sup.2                                      (14-10) 
    
     From the equation (24), ##EQU14## 
     Similarly, from the equations (25) and (26), 
     
         C(x, z)=x·z-x·z                          (14-12) 
    
     
         C(y, z)=y·z-y·z                          (14-13) 
    
     Substituting the equations (14-12) , (14-9), and (14-11) in the equation (14-7), 
     
         C(x, z)-A·V(x)-B·C(x, y)=θ         (14-7&#39;) 
    
     Substituting the equations (14-13), (14-10), and (14-11) in the equation (14-8), 
     
         C(y, z)-A·C(x, y)-B·V(y)=θ         (14-8&#39;) 
    
     The simultaneous equations (14-7&#39;) and (14-8&#39;) are solved to obtain the equations (15) and (16). ##EQU15## 
     The following equation (17) is obtained from the equation (14-6&#39;). 
     
         C=A·x+b·y-z                              (17) 
    
     where 
     
         z=x.sup.2 +y.sup.2                                         (18) 
    
     In the above equations, &#34;V()&#34; indicates variance, &#34;C()&#34; indicates covariance and upper bar affixed above x, y, and z indicates average. ##EQU16## 
     The coorrdinate (a, b) of the center and the radius (r) of the circular arc to be detected are calculated as follows from (A), (B) and (C) and the equations (8) and (9): ##EQU17## 
     Thus, the center position and radius of the circular arc to be detected from the data of the two-dimensional image can be approximated. 
     It is decided based on the value of (E) of the equation (13) with respect to (a) of the equation (27), (b) of the equation (28), and (r) of the equation (29) whether or not the aggregation of the edge points forms a circular are. 
     That is, if the value of (E) is smaller than a predetermined value, it is decided that the aggregation of the edge points forms the circular arc. Thus, a circle of radius (r) with the point (a, b) at the center thereof is detected. 
     According to the above construction, since it is unnecessary to perform processing for forming a point sequence based on edge points, a great number of edge points can be provided as the information source for approximating the center position and radius of a circular arc. In addition, even though errors occur in determining the coordinates of edge points, they do not cause calculations to be inappropriately performed. Further, it is unnecessary to perform angle calculations, and the center and radius of the circular arc can be approximated with a high accuracy using simple easy calculations. Furthermore, since the differentiated value of the image density at each edge point is given as a load to the mean fourth power error at each edge point, the center position and radius of the circular arc can be accurately found. 
     Although the present invention has been fully described in connection with the preferred embodiments thereof with reference to the accompanying drawings, it is to be noted that various changes and modifications are apparent to those skilled in the art. Such changes and modifications are to be understood as included within the scope of the present invention as defined by the appended claims unless they depart therefrom.