Research on Dimensional Inspection System of Thin Sheet Part Based on Machine Vision

Key technologies of dimensional inspection system of thin sheet part based on machine vision are investigated, and an entire machine vision inspection system is developed. A cad information-based line scanning step adaptive optimization method used for image grabbing of inspected part is proposed. A rectangle lens subpixel edge detection method based on cubic spline interpolation used for edge detection is advanced. A planar contour primitive recognition method based on curvature and HOUGH transform used for image recognition is raised. The inspection accuracy of the inspection system can reach to 1μm, and the inspection time can satisfy the requirements of on-line real-time inspection, so the inspection system is feasible.


Introduction
In the mass production of thin sheet part, in order to ensure the quality and enhance the production efficiency of the thin sheet part, the dimension of the finished thin sheet part must be inspected 100 percent and online, and the inspection system must be real-time, and it can obtain dimension information of the inspected part as much as possible in the shortest possible time on the condition that the inspection accuracy is guaranteed to meet the requirements, so as to satisfy the requirements of the tact time.Since the thin sheet part is very thin, a big measurement error will be produced due to the deformation of the thin sheet part under the loading of contact force, so the thin sheet part must be inspected with non-contact inspection method.The shapes of the thin sheet part are irregular and the dimensional accuracy requirements of the pitches of holes and apertures are high, so the inspection system must have the ability to inspect the pitches of holes and apertures with high accuracy.The traditional inspection technologies and instruments cannot satisfy the inspection requirements of thin sheet part with high accuracy, efficiency, automation and so on.The Machine Vision inspection technology can be used to satisfy the inspection requirements of thin sheet part with the advantages of non-contact, good flexibility, high accuracy, high inspection speed, high automation and intelligence, easy to integration with the information of design and control, and so on.The development of dimensional inspection system of thin sheet part based on machine vision with independent intellectual property rights has significant value both in theory and application.

Introduction of inspection system
The schematic diagram of hardware composition of the inspection system is shown in figure 1, and the inspection system is made up of inspection instrument and a computer and involves camera motion control subsystem, image sampling subsystem, illumination subsystem, inspection bench and bracket.The camera motion control subsystem is consist of motion control card, motor driver, servo motor, slider, guide rail and limit switch.The image sampling subsystem is consisted of image sampling card, line type CCD industrial camera, lens, grating ruler and frequency divider.The illumination subsystem is made up of LED backlight and backlight control.The software of the inspection system is programmed with modularization design idea and Visual C++ programming language based on Windows operating system platform.The structure schematic diagram of software module of the inspection system is shown in figure 2, and involves parameter setting, image sampling, image preprocessing, image edge detection, the recognition and dimension calculation of planar contour primitive, the comparison inspection of planar contour primitive dimension, the display and save of inspection result.The image sampling parameter and camera motion parameter are set at the parameter setting link.The image sampling parameter setting involves the setting of work pattern of the image sampling card and camera, trigger, exposure time, and so on.The camera motion parameter setting involves the setting of motion speed and motion acceleration.The line scanning step is optimized adaptively and the inspected part image is obtained by line scanning with optimized step at image sampling link.The calibration, binarization and denoising of the line scanning image is done at the image preprocessing link.The pixel level and subpixel level edge detection is realized at image edge detection link.The planar contour which obtained after subpixel edge detection is recognized and each primitive dimension are calculated at the recognition and dimension calculation of planar contour primitive link.At the comparison inspection of planar contour primitive dimension link, the difference value is gained by comparing the calculated dimension value with the design dimension value, and then the difference value is compared with the tolerance, so as to decide the part dimension is qualified or not.At the display and save of inspection result link, the inspected result is displayed and saved as TXT file, in order to easy to look around and do statistical process control analysis, thereby to ensure the part is produced with optimal parameters by improving the manufacturing process or adjusting the process parameters.

Key algorithm of inspection system
Machine vision dimension inspection system takes the image of inspected object as the means and carrier of the inspection and transinformation, and gains the geometry dimension parameters of inspected object by processing the edge of the image of the inspected object, so how to obtain high quality image of the inspected object, how to get high-precision image edge, how to recognize the image edge and gain the geometry dimension parameters of inspected object, namely image sampling, image processing and image recognition are the key steps of the machine vision dimension inspection system.Image sampling.The inspection system obtains image by line scanning, and it requirements that the line scanning must be high accuracy so as to can gain high quality image which reflects the contour future of the inspected part, the scanning time of the line scanning must be decreased as much as possible so as to ensure the real-time of the inspection, the scanning data must be decreased as much as possible so as to decrease the time of subsequent processing.A CAD-based line scanning step adaptive optimization method is investigated and applied in the image sampling in order to realize above purposes.The procedures are as follows.At first, the AutoCAD DXF file is opened, and then the dimensions and tolerances of each primitive in the file are read and saved in the computer.Due to the primitives are stored at random sequence in AutoCAD DXF file, the read primitives should be sequenced based on the topological structure.An original scanning step is given, and the whole engineering drawing in the DXF file is scanned and sampled by equal scanning step with the original scanning step.The scanning step, the coordinates of scanning points and endpoints of each primitive are saved.The scanning step of each primitive is optimized respectively according to the type of the primitive.The optimized scanning step and the coordinates of scanning points each primitive are saved.The plan is divided as some region at the direction which is vertical to the direction of scanning motion direction according to the endpoints of each primitive.The line scanning step of the region is ascertained according to the region line scanning step selective criterion.Each region line scanning steps are saved in sequence.The inspected part is scanned by the real instrument with the optimized scanning step, and the image is gained and saved which is shown in Figure 3. Image processing.In order to advance the inspection accuracy and inspection speed of the inspection system, a rectangular lens subpixel edge detection based on cubic spline interpolation is proposed, which can make the edge orientate to the more precise position which in the interior of the pixel.The procedures are as follows.At first, the line scanning image is preprocessed, including image calibration, binarization and denoising.An image calibration method is investigated according to the imaging feature of the line scanning.The maximum between-class variance method is choose as the image binarization method of the inspection system.The pixel level edge detection was done with mathematical morphological edge detection method.The image of part to be inspected which has been denoised is dilated and eroded with binary mathematical morphology respectively, and then, the eroded image is subtracted with dilated image, and the edge of part to be inspected is gained.But the edge is not single pixel wide connected and need to be thinned.The edge is thinned with skeletonization thinning algorithm of binary mathematical morphology and single pixel wide connected edge is gained, which is called as contour.The subpixel level edge detection was completed and the subpixel level contour was obtained by 9×9 pixel rectangular lens algorithm based on cubic spline interpolation.The preprocessing result image of thin sheet part is shown in figure 4, the pixel level edge detection result image of thin sheet part is shown in figure 5.

Image recognition.
Pixel set which is single pixel wide connected is gained after the edge detection of thin sheet part image, the primitive such as straight line, arc, circle and so on is composed of the single pixel wide connected pixels which belong to the same primitive, and then those primitives are made up of planar contour.The geometric dimension and it's error, form error of the primitive, the position distance between primitives and it's error need to be inspected in the machine vision dimensional inspection system, so each primitives which be made up of the planar contour must be recognized, for this purpose a planar contour primitive recognition method based on curvature and HOUGH transform is proposed and applied to the image recognition.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 screen candidate contour points.

Experiments of dimensional inspection
The diameter D of the precision standardized parts which diameter measurement mean value is 25.0322 mm, measurement limit error is 0.0009 ± mm after precision measurement is inspected with dimensional inspection system of thin sheet part based on machine vision, and the inspection is repeated 10 times, the inspection results and it's analysis of diameter D are shown in table 1.The inspection result analysis indicates that the difference value between the diameter inspection mean values of the precision standardized parts and the diameter measurement mean values by other precision measurements method is at sub-micron level, this illustrates that the inspection accuracy of dimensional inspection system of thin sheet part based on machine vision can reach to micron level.The inspection time (exclusive of the line scanning time of the precision standardized parts) is shown in table 2, mean inspection time of the precision standardized parts is 0.156s, which can satisfy the requirements of on-line real-time inspection.

Conclusion
Key technologies of dimensional inspection system of thin sheet part based on machine vision are investigated in this paper, and an entire machine vision inspection system is developed.The 100% online high-accuracy real-time non-contact inspection of thin sheet part is realized by this inspection system, the inspection efficiency and accuracy are advanced, and the inspection has good application prospect.

Fig. 1 Fig. 2
Fig.1 Schematic diagram of hardware composition of the inspection system

Fig. 3
Fig. 3 Line scanning image of the inspected thin sheet part

Fig. 4 Fig. 5
Fig.4 Preprocessing result image of thin sheet part

( 3 )
The first screen 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 screen candidate contour points.(5) The secondary screen candidate contour points are classified with projection height method.(6) The false dominant points of the line primitives are rejected and the tangent points of the line primitives are added with line primitive 472 Mechatronics and Information Technology segmentation and merging algorithms based on HOUGH transform, so far all false dominant points are rejected and the inflection points and the tangent points are added, the candidate contour points after this step processing are dominant points.(7) The dominant points are classified and the property of the primitives on either hand of dominant point is distinguished with projection height method.(8) The dominant points are saved in sequence.The primitive recognition result image of thin sheet part planar contour is shown in figure 7, in which the position of the dominant point are identified with black point.

Fig. 7
Fig. 7 Primitive recognition result image of thin sheet part planar contourPrimitive recognition class CRecognitionEntity is structured, the object of this class is used to save the data of all recognition primitive.The data of all recognition primitive of whole image are saved with two level pointer, the pointers of the objects of the class CRecognitionEntity are saved to the first level pointer CPtrArray: *p_RecognitionEntities_Contour_PtrArray according to connected sequence of the recognition primitive in sequence, so the data of all recognition primitives of one contour are saved in one p_RecognitionEntities_ Contour_PtrArray.And then p_RecognitionEntities_Contour_PtrArra are saved to the second level point CPtrArray: *p_RecognitionEntities_Graph_PtrArray according to arrange sequence of the contour when the contour saved, so the data of all recognition primitives of whole image are saved in p_RecognitionEntities_Graph_PtrArray.

Fig. 8
Fig. 8 Dimensional data save format of recognition primitive

Advanced Engineering Forum Vols. 2-3
Tab.1 Inspection results and it's analysis of diameter D