Planar Contour Primitive Recognition of Thin Sheet Part Dimensional Inspection System

According to the two indices of inspection accuracy and inspection speed, a planar contour primitive recognition method of thin sheet part dimensional inspection system based on curvature and HOUGH transform is proposed. A contour point classification algorithm based on neighborhood values is developed, and a curvature threshold method is selected to filter the contour points, and a projection height method is selected to distinguish the property of the primitive and classify the contour points, and the straight line primitive and arc primitive segmentation and merging algorithms are constructed respectively by HOUGH transform. The inspection accuracy and inspection speed of the proposed method are compared and analyzed by contrast experiments between the proposed method and four dominant point detection methods such as Chung & Tsai method and so on. The dominant point detection ability of the proposed method is tested by a simulation planar contour which includes all kinds of dominant points. The experimental results indicate that the proposed method can recognize primitives exactly, the inspection speed is fast and the universality is good.


Introduction
The thin sheet part dimensional inspection system based on machine vision is a high-accuracy, on-line real time inspection system. The pixel set which is single-pixel width and connected is obtained after the edge detection of the inspected part image, and the primitives such as line, arc and circle are made up of the single-pixel width and connected pixels which belong to the same primitives, and the planar contour is made up of those primitives. The planar contour primitive recognition is the key and essential step of the thin sheet part dimensional inspection system, the recognition precision will affect the veracity of the subsequent dimension inspection directly, and the recognition efficiency will affect the real-time of the inspection system directly. The intersection point between primitives is called dominant point, so the dominant point detection of the planar contour is the key of the planar contour primitive recognition. The dominant point detection of the planar contour is investigated widely and deeply by many domestic and overseas scholars, and much dominant point detection methods are proposed. The existing dominant point detection methods can be classified into three categories, dominant point detection method based on gray character of image, dominant point detection method based on mathematical morphology, dominant point detection method based on edge information of image. The existing dominant point detection methods have the disadvantages such as large calculated amount, low inspection accuracy, bad compatibility, and so on, and it is hard to be used in high precision and real-time situation. A planar contour primitive recognition method of thin sheet part dimensional inspection system based on curvature and HOUGH transform is proposed based on intensive study of existing dominant detection methods.

Planar contour primitive recognition based on curvature and HOUGH transform
The procedures are as follows. (1) The contour points are classified according the neighborhood values, the contour points which may be corner are picked out, and these contour points are called candidate contour points. (2) The discrete curvature values of all candidate contour points are calculated with 11 point k-curvature method, the discrete curvature threshold value is calculated according to the discrete curvature values of all candidate contour points, the candidate contour points which discrete curvature value is greater than threshold value are picked out, and these candidate contour points are called first filter candidate contour points. (3) The first filter candidate contour points are classified with projection height method. (4) The false dominant points of the arc primitives are rejected and the inflection points of the arc primitives are added with arc primitive segmentation and merging algorithms based on HOUGH transform, the candidate contour points after this step processing are called secondary filter candidate contour points.  figure 1 (a), the pixel P has two horizontal neighboring pixels and two vertical neighboring pixels (identified with t), and has four diagonal neighboring pixels (identified with s), all the neighboring pixels and diagonal neighboring pixels are called as eight neighbourhood of the pixel P. In order to distinguish them, each pixels of eight neighbourhood are marked, as shown in figure 1 (b). It is specified that the eight neighbourhood value of the 0 neighbourhood pixel is 0, the eight neighbourhood value of the 1 neighbourhood pixel is 1, and the rest may be deduced by analogy. s t s 5 6 7 t P t 4 P 0 s t s 3 2 1 (a) (b) Fig. 1 Eight neighborhood of pixel P The planar contour which obtained after edge detection is saved independently and consecutively at the order of the connected sequence. It is supposed that there is a contour point

464
Mechatronics and Information Technology the contour points can be classified according the eight neighborhood value, the contour point that cannot be corner is marked, the curvature of the marked contour point will not be calculated at later curvature calculation of contour points, thus calculation amount is reduced and real-time of the system is improved. Filter of candidate contour point by curvature threshold method. The discrete curvature values of all candidate contour points are calculated with 11 point k-curvature method. It is supposed that the contour C has N contour points where, After the curvatures of candidate contour points are calculated, the candidate contour points are filter with curvature threshold, the candidate contour points which cannot be corner are rejected. The selection of the curvature threshold is the key of the dominant point detection method based on curvature, oversize curvature threshold will miss some valid contour points, and undersized curvature threshold will generate false dominant points. The proposed method has the segmentation and merging of straight line primitive and arc primitive in subsequent, the missed valid contour points will be added and false dominant points will be rejected, so the selection of the curvature threshold value is not key. After several experiments of many contours, it is indicated that when the curvature threshold is set as the average of the curvatures of all candidate contour points in the contour, neither the corners are missed nor much false dominant points are added. So the curvature threshold of the contour is set as the average of the curvatures of all candidate contour points in the contour automatically, therefore the curvature threshold does not need to be set by man-machine interaction method manually, thereby the intelligence and compatibility of the inspection system is improved. Discrimination of primitive property and classification of contour points by projection height method. If the primitive is wanted to be recognized, the property of the primitive between two dominant points must be known. The property of the primitive between two dominant points is discriminated and dominant points are classified with projection height method based on projection height form dot to straight line. As shown in figure 2, P i-1 , P i , P i+1 are supposed as three adjacent candidate contour points, C is supposed as a part of a closed contour. P i is supposed as the current candidate contour point, a straight line P i P i-1 is draw from P i to P i-1 , the projection height H j of all contour points CP j between P i and P i-1 to straight line P i P i-1 are calculated. The threshold T is set as 0.5, two accumulators are defined, one is the line accumulator LineAccu the other is the arc accumulator ArcAccu, if H j >T, then ArcAccu=ArcAccu+1, otherwise H j ≤ T, then LineAccu=LineAccu+1. After all contour points CP j between P i and P i-1 are calculated, if ArcAccu>LineAccu, then the primitive between P i and P i-1 is arc, otherwise ArcAccu ≤ LineAccu, then the primitive between P i and P i-1 is straight line. In the similar way, the primitive between P i and P i+1 can be discriminated. The type of P i can be discriminated and classified according to the property of the primitive between P i and P i-1 and the property of the primitive between P i and P i+1 . The type of candidate contour point and dominant point is defined as follows according to the combination of straight line and arc. Type 1, straight line to straight line, type 2 arc to straight line, type 3 straight line to arc, type 4 arc to arc. After all candidate contour points of each contour are calculated, then all candidate contour points can be classified.

Fig. 2. Principle of projection height method
Segmentation and merging of arc based on HOUGH transform. As shown in figure 3 (a), it is supposed that contour Q j Q j+1 is formed by a convex arc and a concave arc which connected fair, after the candidate contour points are filtered by curvature threshold method, all candidate contour points are false dominant points, at the same time the inflection point between two arc is missed, after all the candidate contour points are classified by projection height method, the type of P 1 , P 2 , …, P N-1 , P N are type 4, the type of Q j , Q j+1 is type 3 and type 2 respectively.
It is supposed that Q j is the present processing candidate contour point which is abbreviated to the current point, the candidate contour point P 1 next Q j is abbreviated to the next candidate contour point, the candidate contour point P 2 which is after Q j two candidate contour point is abbreviated to the next to next candidate contour point. All contour points (including two candidate contour points) from current point Q j to next candidate contour point P 1 are fitted with least square arc, the centre and radius 1 r of arc are Q j P 1 calculated and obtained. According to the principle of HOUGH transform arc detection, if next to next candidate contour point P 2 belongs to circle which contain the arc Q j P 1 , then the three-dimensional erect taper surface corresponding with next to next candidate contour point P 2 and that corresponding with arc Q j P 1 are intersected at point 1  , it is indicated that arc Q j P 1 and arc P 1 P 2 belong to the same arc, and should be merged, the candidate contour property of the next candidate contour point P 1 is clear, the next to next candidate contour point P 2 is set as next candidate contour point and the calculation is continued and recycled. If 1 > T ε , it is indicated that arc Q j P 1 and arc P 1 P 2 do not belong to the same arc, namely a dominant point is missed between next candidate contour point P 1 and the next to next candidate contour point P 2 . The mid-value point P (if the mount of the contour point between P 1 and P 2 is a even number, there are two mid-value point, one of the two mid-value point is selected discretionarily) of next candidate contour point P 1 and the next to next candidate contour point P 2 is selected and set as candidate contour point, the parameter space coordinates 1 1 3 ( , , ) a b r of candidate contour point P is calculated and obtained according to , the absolute value of the difference between 1 r and 3 r namely 2 3 1 r r ε = − is calculated, and 2 ε is compared with threshold T=0.001. If 2 > T ε , then P is set as new next to next candidate contour point, if 2 ≤ T ε , then P is set as new next candidate contour point. Then the calculation and compare is continued and recycled, until the interval between new next candidate contour point and new next to next candidate contour point is less than 1, the candidate contour property of the next candidate contour point P 1 is clear, and the candidate contour property of new next candidate contour point is set. The segmentation and merging result of arc Q j Q j+1 is shown in figure 3 (b), it is shown in figure 3 (b) that all false dominant points in the arc Q j Q j+1 have rejected, and the inflection point Q* has added. Since circle is a special arc, it is specified that one of the candidate contour points is reserved and its type is set as type 4 after the segmentation and merging of circle.  figure 4 (a), contour Q j Q j+1 is formed by a straight line and a concave arc which connected fair, after the candidate contour points are filtered by curvature threshold method, all candidate contour points are false dominant points, at the same time the tangent point between the straight line and the arc is missed, after all the candidate contour points are classified by projection height method, the type of P 1 , P 2 , P 3 , P 4 are type 1, the type of P N is type 3, the type of Q j , Q j+1 is type 1 and type 2 respectively. The procedure of the segmentation and merging of straight line based on HOUGH transform is basically the same as that of the segmentation and merging of arc based on HOUGH transform, merely here the principle of the segmentation and merging of straight line is HOUGH transform straight line detection, therefore the algorithm of the segmentation and merging of straight line is unnecessary to go into details. The segmentation and merging result of straight line is shown in figure 4 (b), it is shown in figure 4 (b) that all false dominant points have rejected, and the tangent point between the straight line and the arc Q* has added.

Conclusion
A planar contour primitive recognition method of thin sheet part dimensional inspection system based on curvature and HOUGH transform is proposed in this paper. The procedures and realization of the method are discussed in detail, the inspection accuracy and inspection speed of the proposed method are compared and analyzed by contrast experiments between the proposed method and four dominant point detection methods such as Chung & Tsai method and so on, the dominant point detection ability of the proposed method is tested by a simulation planar contour which includes all kinds of dominant points. The experimental results indicate that the proposed method can recognize primitives exactly, the inspection speed is fast and the universality is good.