The Research on the Measurement System of Target Dimension Based on Digital Image

Targets dimension measurement technology based on digital image processing has the advantages of non-contact, low cost and wide environmental adaptability. It has been widely used in chip manufacturing, biomedicine, aerospace, military and other fields. In the traditional image acquisition and edge detection, it is inevitable to be affected by noise such as illumination, shadow and edge defect, which makes the measurement accuracy vulnerable to environmental impact. In this paper, on the basis of gray scale transformation and Gaussian filtering of the image, Canny operator was used to detect the target’s edge, and morphological algorithms such as hole filling and small object removal were used for post-processing, so as to finally achieve the dimension measurement and display of the target. This system eliminates the influence of light and Gaussian noise, and realizes the extraction of the edge while carrying out meticulous and de-noising, which makes the system realize the extraction of the edge fine, wide applicability and high precision.


Introduction
With the rapid development of optical, electronic, computer and other industries, the processing accuracy of industrial products is always improved with the improvement of the level of measurement technology. Measurement technology characterized by non-contact, high precision and high speed has become the main development direction of dimensional measurement technology [1]. Non-contact measurement has the advantages of high speed, no contact, no scratch on the surface of the measured object, and is suitable for the measurement of soft objects. It has been widely used in chip manufacturing, biomedical, aerospace, military and other fields [2]. The image target dimension measurement based on digital image can meet the requirements of high efficiency, automation, non-contact measurement and so on, and has a strong advantage in engineering detection, especially in the measurement of small dimension.
There are many reports about digital images processing, including image gray histogram and its transformation, sharpening, smoothing, filtering, false color, contour extraction and enhancement, image format conversion and its file structure [3]. Since the beginning of this century, various technologies at home and abroad have been relatively perfect, especially in fingerprint recognition, face recognition, dimension measurement, etc., there have been very mature developments [4]. However, current image acquisition systems are easily affected by noise such as illumination, shadows, and edge flaws, resulting in poor image imaging quality, affecting the accuracy of target information acquisition, and further affecting the accuracy of target dimension measurement. Therefore, how to measure the target stably and accurately in a complex environment is still a difficult problem we face. This article aims to create an image target dimension measurement system with wide applicability, strong reliability and high accuracy based on digital images processing. First, perform grayscale conversion and Gaussian filtering on the input original image to eliminate the effects of light and noise, then use the canny operator to perform edge detection, then use morphological algorithms to refine the edges and retain the outermost edges, and finally got the answer. To a certain extent, it overcomes the problems of shadows and small object interference, while ensuring high accuracy, which can make the measurement error within 3%. The image processing flow of the target dimension measurement system is shown in Figure 1, which can be divided into four steps: image acquisition, image preprocessing, edge detection and dimension measurement. First, use CCD to obtain the original image under different lighting conditions; then preprocess the image. This article uses grayscale conversion and Gaussian filtering algorithms for preprocessing, so that the original image is displayed more clearly while eliminating noise; then the preprocessing Edge extraction of the resulting image specifically includes four steps: edge detection, internal texture removal, edge extraction, and non-target object removal. Finally, mark the edges of the reference object and the object to be measured, and obtain the measured dimension of the target object according to the principle of dimension measurement.

Image acquisition
We choose a one-yuan coin in daily use as a reference, with a diameter of 25.000mm. In the experiment, the camera of a mobile phone (iPhone 8Plus) was used as the CCD, and each image had 12 million pixels. In the shooting process, coins and objects to be measured are placed on the black sample table, and a special bracket is used to fix the CCD directly above the object, so that the camera is perpendicular to the object to be measured. In this way, the influence of shadows can be reduced and the precision of edge detection can be guaranteed. This is shown in Figure 2.

Image preprocessing
Grayscale conversion is to perform grayscale transformation operations on each pixel in the original image to convert the RBG image into a grayscale image. It can eliminate the color saturation of the source image while retaining its brightness, and it can enhance the edge of the image. Highlight the contours of the image, make the image clear, delicate, and easy to recognize, and at the same time, it can suppress a large amount of image noise and information we don't need, so as to improve image vision and facilitate image digital processing.
Since there is a large amount of Gaussian noise in the image, after the grayscale conversion is completed, the entire image can be reconstructed by Gaussian filtering to reduce the influence of noise. For each pixel, the Gaussian filter value will use the pixel value of itself and its neighboring points to perform a weighted average to smooth the gray value.

Image edge information extraction
In Figure 4, (a) is the edge detection image obtained after the Canny operator. It can be seen that there are many small irrelevant edges inside the card. This requires hole filling operations on the image to further remove extraneous edges inside the image. When performing hole filling operations, we must first judge the eight connected areas around each pixel, and record the number of gray values 0 of 255 among the nine points covered by each pixel and its eight connected areas, which is recorded as N; then determine the value of N, if N>=5, that is, at least five pixels in this pixel and its eight connected areas are 255, this pixel is the target, otherwise it is judged as the background; finally Morphological processing is performed on the image to obtain the image after the hole is filled. Figure 4 (b) is the result of completing the hole filling. Figure 4(c) is the result of edge information extraction. It can be seen from the figure that in addition to the edge information of the reference object and the object to be tested, there are some irrelevant edge information in the upper left corner of the picture. Morphology can be used the algorithm filters out small objects. This article filters out objects with an area less than 100 pixels to get a noise-free edge image. The result is shown in Figure 4(d).

Image labelling and measurement results
After obtaining the outermost edge image of the target and the reference, the reference and the target can be marked, and the pixel information of the reference and the test object can be counted. From the formula: The actual dimension of the test object can be obtained, where L is the dimension of the test object, and P o and P R are the pixel points occupied by the test object and the reference object.
Through the above operations, inputting images of different light intensity (such as taking the light intensity of noon, evening, night or 40W incandescent lamp: 1000lx, 800lx, 500lx), we can get the actual dimension of the image target under different light intensities. As shown in Table 1. It can be found from Table 1 that under the illumination of 500lx and 800lx non-strong light sources, the results of the object dimension measurement are almost the same, indicating that in the daily nonstrong light source (the daily average illuminance is 300lx-800lx) this system overcomes the impact of light on the dimension measurement When using 1000lx strong light, the measurement result of the object dimension has a small error with the weak light source, indicating that the image calculation may be distorted with the change of the light source, but the overall errors are small and within 3%.

Conclusion
In this paper, on the basis of gray scale transformation and Gaussian filtering of the image, Canny operator was used to detect the target's edge, and morphological algorithms such as hole filling and small object removal were used for post-processing, so as to finally achieve the dimension measurement and display of the target. Compared with the standard parameters, the measurement error of this system is within 3%, and this measurement system has strong portability and reliability, and can provide a powerful technical guarantee for plane non-contact dimension measurement.