# Intelligent Analysis of Core Identification Based on Intelligent Algorithm of Core Identification

Authors: Xiaolin Zhu; Wei Lv
Journal: Discrete Dynamics in Nature and Society
 (2021)

---

## Abstract

The communication recognition of mobile phone core is a test of the development of machine vision. The size of mobile phone core is very small, so it is difficult to identify small defects. Based on the in-depth study of the algorithm, combined with the actual needs of core identification, this paper improves the algorithm and proposes an intelligent algorithm suitable for core identification. In addition, according to the actual needs of core wire recognition, this paper makes an intelligent analysis of the core wire recognition process. In addition, this paper improves the traditional communication image recognition algorithm and analyzes the data of the recognition algorithm according to the shape and image characteristics of the mobile phone core. Finally, after constructing the functional structure of the system model constructed in this paper, the system model is verified and analyzed, and on this basis, the performance of the improved core recognition algorithm proposed in this paper is verified and analyzed. From the results of online monitoring and recognition, the statistical accuracy of mobile phone core video recognition is about 90%, which has higher accuracy in mobile phone core image recognition than traditional recognition algorithms. The core line recognition algorithm based on deep learning and machine vision is effective and has a good practical effect.


---

## Body

## 1. Introduction

In recent years, with the advent of the era of smart mobility, smartphone applications have become more and more widespread, the frequency of use has become higher and higher, and the overall power consumption has been increasing. Limited by battery capacity, smartphones need to be charged frequently, the demand for mobile phone charging data lines per capita is more than 3, and the sales of data line products continue to increase. As of 2020, there are more than 2,000 data cable manufacturers with an annual output value of more than 60 billion yuan. The industrial scale accounts for more than 90% of the global data cable production. Therefore, China is a global data cable manufacturing base. As of the end of 2018, 70% of the members of the US USB-IF Association came from Chinese companies [1]. USB-IF is the American USB Standardization Organization, and its full name is USB Implementers Forum.At present, the production process of mobile phone core lines in China is mainly completed by semiautomatic equipment. In the production process, it is necessary to use an industrial camera to continuously collect images to determine the position of several wires and to assist in the branching work. However, there are chromatic aberrations in different batches of mobile phone core wires, and in different time periods, different illuminations will also produce chromatic aberrations. Meanwhile, a lot of white dust is attached to the surface of several wires, which will cause a great interference to color recognition. Therefore, the current misjudgment rate of the position of several wires of this type of equipment is very high, resulting in a large number of defective products in the production process. Moreover, in the current production process, whether there is any leakage of copper wires when several wires are riveted to the terminal inserts needs to be manually detected. After a long time of work, the human eyes are prone to fatigue, which causes false detection and low manual operation efficiency. Mobile phone core wire manufacturers are actively introducing or developing efficient machine vision technology to improve the recognition rate of the positions of several wires and realize automatic detection of copper wire riveting. However, there has been no substantial progress. The main reason why the recognition rate of the positions of several wires cannot be improved is mainly due to color difference and white dust interference [2]. The main reason why the automatic detection of copper wire riveting cannot be realized is that the copper wire and the riveting piece are made of metal, and the colors are similar, which cannot be clearly distinguished in the image. In summary, the color difference of the core wire of the mobile phone, the white dust on the surface, the copper wire of the same material, and the riveting piece of similar color all interfere with the automatic production and detection of the core wire of the mobile phone [3].In the welding process of data line terminal and core wire communication, the quality of the solder joint is an important factor affecting the final qualification of data line. In addition, the position correspondence between the data line core and the internal solder joint of the terminal is also an important factor in determining whether the data line is qualified or not. If the position relationship between the data cable core and the internal solder joint of the terminal is not accurate during the welding process, the data cable will inevitably fail to achieve its due function and meet the quality standard and will eventually be treated as waste. If it continues to be misused, the electronic equipment connected to it will be at risk of damage. More importantly, it may cause fire and explosion, which will seriously damage the user’s life and property. Therefore, in the production process of communication data cable, the realization of fast, accurate, and effective welding between data cable core and terminal is not only related to the production efficiency of data cable but also related to the safety of people’s life and property. However, the production equipment technology of most data line production enterprises in China is relatively backward, and the degree of automation is low, resulting in overcapacity of low-end products, fierce competition in the data line market, more general-purpose products, and less high-tech and high value-added products [4]. Therefore, in view of this situation, it is necessary to solve the problem of core line sequencing in the production process of USB data line and realize its automation, improve production efficiency, and further improve the competitiveness of China’s data line industry. In the era of rapid development of robot technology, some modern forms of intelligent factories and unmanned workshops emerge one after another. In addition, automated products are also widely used in all walks of life, and more and more forms of automation appear in our surrounding companies. With the rapid development of China’s economy and the rising labor cost, a large number of labor-intensive industries are gradually transferred overseas. Therefore, among data line manufacturers, increasing production demand and pursuing low production costs have begun to become the company’s inventory model [5].With the support of in-depth learning algorithm, this paper constructs a communication core line recognition system suitable for automatic recognition, which can be used in the manufacturing industry.


## 2. Related Work

In a visual image, the edge of the image contains most of the information, such as the location, angle, and shape of the target product. By using different edge detection algorithms, edge information with different accuracy can be obtained. After the research of and scholars, there are many methods that can be used for image edge detection. In order to improve the speed of edge detection, literature [6] proposed a method of approximate calculation of image difference using Krawtchouk polynomial to achieve edge detection. Literature [7] designed an automatic fingerprint recognition algorithm based on edge detection, which has high accuracy and good detection effect. Literature [8] proposed an edge detection algorithm applied to noncontact workpiece detection, which is described as a median filter algorithm that collects two images, applies a one-dimensional filter in the horizontal and vertical directions, and then takes the average value. Literature [9] proposed a character recognition algorithm and shadow removal technology based on edge detection, which are applied to license plate recognition in intelligent transportation systems. Literature [10] designed a vision system for detecting whether materials are assembled on an automatic assembly line, used the Canny operator to detect the edges of assembly materials, and proposed a method to measure the geometric characteristics of a circular target using the Hough transform method. In order to solve the existing problems of Gaussian filtering parameters that are difficult to set, false edges are prone to appear, and local noise is difficult to eliminate when the traditional Canny operator detects edges. Literature [11] proposed an improved algorithm. The algorithm uses wavelet transform to remove noise interference and uses extreme median filter instead of Gaussian filter for edge detection.Image segmentation is to separate the target from the background. The method proposed in the literature [12] is to detect the local minimum based on the Euclidean distance transform of the binary image of the grain. Then, it uses the morphological expansion operator to merge the local minimum points to obtain the internal area of each grain. Finally, it connects the boundary of the region into an initial curve, which is trained by the active contour model and evolves into the boundary curve of the grain so as to achieve the effect of dividing each rice grain. From a visual point of view, image classification is to preprocess the image, such as improving contrast and morphological noise reduction, and then accurately interpret and interpret the target type according to the characteristics of image brightness, hue, and location [13]. Literature [14] used the Fisher discriminant method to project the multidimensional feature vector into one-dimensional space and then used the K-means clustering algorithm for recognition. From the experimental results, it is known that the accuracy of its purity recognition is higher than 94%. Target positioning is followed by image classification, and it is mainly to further determine and identify the pixel coordinate position and size of the specific centroid of the part of interest in the image. The main principle of the method proposed in literature [15] is to threshold the image first, calculate the shape description parameters of the binary image contour, and find all the bright strip objects in the image. After that, it uses the HSV color space to find the region of interest and then compares whether the target is within the approximate range of the HSV and RGB parameters that meet the required pixels. The method proposed in literature [16] uses the image color feature to segment the image, determine the contour moment, determine the centroid coordinates according to the contour moment, and then segment the image according to the high image color characteristics.


### 2.1. Extraction of Image Regions of Interest

The image region of interest (ROI) refers to the target area in a picture, which plays a role in reducing the interference of background information to improve the efficiency and accuracy of image processing and detection. When the core wire of the data cable is used as the research object, there will be effects of chromatic aberration, vibration, and noise on the image acquisition process. This paper chooses to use image graying, morphological opening and closing operations, and threshold segmentation to obtain high-quality pictures of interest as the research goals.The color value of each pixel on the grayscale image is also called grayscale, which refers to the color depth of the midpoint of the black-and-white image, generally ranging from 0 to 255, 255 for white and 0 for black. The so-called gray value refers to the intensity of color, and the gray histogram refers to the number of pixels with the gray value corresponding to each gray value in a digital image. Image degradation is the process of transforming an image from an ideal image to an actual defective image for some reason. Image restoration is the process of improving the degraded image and making the restored image close to the ideal image as much as possible.The color image (shown in Figure1) is stored in a multichannel array. Among them, the element in each channel can take a value from 0 to 255. Then, for the RGB channels of a color image, a three-channel histogram can be used to describe the proportions of different colors in the image. The color image (shown in Figure 1) is stored in a multichannel array. Among them, the element in each channel can take a value from 0 to 255. Then, for the RGB channels of a color image, the three-channel histogram can describe the proportion of its different colors in the image. As shown in Figure 2, the horizontal is the gray value of the image, its value range is 0–255, and the vertical is the number of occurrences of different gray values [17].Figure 1
RGB color image.Figure 2
RGB color histogram.Since each channel element is arranged in the matrix row and column order, the morphological characteristics of the image cannot be reflected, and it needs to be converted into a grayscale image. The grayscale image can reflect the characteristics and distribution of the overall and partial brightness and chromaticity levels of the image and can reduce the calculation time and calculation amount of color space conversion. For grayscale images, the 256-level transformation of grayscale ranges from 0 to 255, which does not contain any color information. At this time, the grayscale histogram is shown in Figure3, the horizontal is the gray value of the image, its value range is 0–255, and the vertical is the number of occurrences of different gray values [18].Figure 3
Grayscale histogram.Then, when performing grayscale processing on a color image, the three components are generally weighted and averaged according to different weights. Its reasonable distribution is shown in the following formula:(1)fi,j=0.3Ri,j+0.59Gi,j+0.11Bi,j.According to the above distribution method, the grayscale processing result of the color image obtained is shown in Figure4 [19].Figure 4
Grayscale image.In image processing, threshold segmentation is to achieve the separation of target and background. The main principle is to use the difference in grayscale to divide the pixel level of the core area into several parts, which is convenient for converting the grayscale image into a binary image. That is, it is judged whether the characteristic attribute of each pixel in the image is within the target threshold range so as to determine the target area and the background area.We assume a threshold and set its threshold to be T. In order to find the threshold value of the background and target feature, the gray value of all the pixel points set greater than the threshold is called the target feature, and the gray value of all the pixel points set less than the threshold is called the background feature. Then, its mathematical expression is shown in the following formula [20]:(2)Fx,y=h1;Hi,j≥T,h2;Hi,j≤T.Among them, the gray value of each point of the original image isHi,j, and the gray value after threshold judgment is Fx,y. Its advantage is that it is simple to calculate, it can use connected boundaries to define nonoverlapping and closed regions, and it can better segment the target and background with strong contrast.In addition, for binary images, it is necessary to mark the regions composed of pixels that meet the four-neighborhood connectivity criterion or the eight-neighborhood connectivity criterion with different unique labels. Therefore, the labeling method of connected regions is introduced. It is to assign unique label numbers to multiple target areas in a binary image. Moreover, it mainly prepares for the next step of positioning and matching by making relevant numerical analysis and parameter statistics on the characteristics of the connected area corresponding to each label number. According to the same criterion, in order to make the result error relatively small and closer to the perception of the human eye, the eight-neighborhood connectivity criterion is selected to label the image. The range of interest found according to the threshold is surrounded by a purple line as shown in Figure5.Figure 5
The purple rectangle representation of the area to be inspected on the data line.Mathematical morphology operation is to use the properties of point sets, integral geometric sets, and topology theory to transform object pixel sets. The most basic operations of morphology are dilation and erosion (Dilation and Erosion), which are often used for noise reduction, segmentation, maximum or minimum value regions, and image gradients. From a mathematical definition, the operation of convolving an image (or a part of the image, denoted by A) and the kernel (denoted by B) is a morphological operation. Among them, kernel B can have any shape and size, and the anchor point is a separately defined reference point. Similarly, the kernel can also be called a template or mask [21].The local maximum operation of convolution between kernel B and graphics is called dilation; that is, the maximum pixel value of the area covered by kernel B is found and used as the pixel designated by the reference point. This increases the area around the core wire, as shown in Figure6. For a multichannel image, the mathematical expression of the maximum value in the sliding window area is shown in equation (3). The corrosion operation is the inverse operation, which reduces the original area, so the corrosion is the operation to find the local minimum, as shown in Figure 7. The multichannel data is separated and processed, and the mathematical expression of the minimum value in the sliding window area is shown in formula (4):Figure 6
Expansion.Figure 7
Corrosion.(3)dstx,y=maxx′,y′:elementx′,y′≠0srcx+x′,y+y′,(4)dstx,y=minx′,y′:elementx′,y′≠0srcx+x′,y+y′.According to the basic operations of expansion and corrosion, the superposition of two basic operations is introduced, namely, the operations of morphological opening and closing. The open operation in morphology can remove noise and smooth the target boundary, as shown in formula (5). The closing operation can fill the discrete small holes and scattered parts in the target area, as shown in formula (6) [22]:(5)A∘B=AΘB⊕B,(6)A·B=A⊕BΘB.Corrosion is mainly used to remove some parts of the image in morphology. The etching operation is to take the central position of the structural element (assuming that the element participating in the logical calculation corresponds to the point with element 1 in the two-dimensional matrix, that is, the hole on the grid plate). When moving on the image, if the lower image can be seen through all holes, the image at the central point will be retained; otherwise, it will be removed.The opening operation is to perform the first corrosion operation and then the expansion operation on the image, which is mainly to eliminate the details of the image that are smaller than the structural elements when the local shape of the object remains unchanged. Under normal circumstances, when the background is brighter, it can exclude small-area objects, eliminate isolated points higher than the near point, denoise and smooth the contour of the object, and break the narrow neck. The closing operation is to expand the image first and then corrode. Its function is to be able to sort small black holes (black areas) and eliminate isolated points below the collar near point. Moreover, it can also denoise and smooth the contours of objects, bridge narrow discontinuities and slender gullies, eliminate small holes, and fill in the breaks of contour lines [23].Based on the above opening and closing operations, this paper gives an effect diagram of a core wire. Figure8 shows the opening and closing operation diagram of the green core wire.Figure 8
Morphological operation.In the case that the color of the image has been recognized, the target positioning of different colors still needs to be improved. According to the existing sorting system, the positioning is divided into three parts, including pixel distance calculation, azimuth angle calculation, and actual distance calculation. The system takes the position information of the target in the figure as input and the actual position of the target as output. The process is shown in Figure9.Figure 9
Target positioning process.Target positioning is to determine the pixel coordinates of the core line in the image. Usually, it is chosen to use the centroid positioning. Judging from the external characteristics of the core wire, the axisymmetric image has higher accuracy when using this method [24]. If Ii,j is assumed to be the pixel coordinates of the binary image, at this time, Sx0,y0 is the centroid coordinate of the target, and the expression is as follows:(7)G=Gx2+Gy2,x0=∑i,j∈siIj.j∑i,j∈sIj.j=∑i,j∈siN,y0=∑i,j∈sjIj.j∑i,j∈sIj.j=∑i,j∈sjN.Since the appearance of the core wire to be inspected is a cylinder, the orientation of the core wire can be calculated using the spindle positioning method.The main axis of the target graph is set, and the main calculation formula is as shown in the following formula:(8)χ2=∑i,j∈srij2.Among them, S is the boundary information of the core line andBi,j is the pixel gray value of the core line in the binary image. Then, the sum of the squares of the distances from this straight line to all points on the boundary of the core line of the data line is the smallest so that the straight line can be in a plumb state to avoid numerical ill-conditioned problems [25]. The straight line is expressed in a certain polar coordinate form, as shown in the following formula:(9)ρ=xsinθ+ycosθ.In the formula, θ is the angle formed by the normal line and the x-axis, and ρ is the distance from the straight line to the origin.That is, the conversion is as follows, which can be expressed as(10)χ2=∑i,j∈sxijcosθ+yijsinθ−ρ.After the overall calculation, the following formula can be used to express the minimization problem:(11)χ2=acos2θ+bsinθcosθ+csin2θ.Among them,(12)a=∑i,j∈sxij−x¯2,b=∑i,j∈sxij−x¯yij−y¯,c=∑i,j∈syij−y¯2.Moreover,(13)x¯=∑i,j∈sxijN,y¯=∑i,j∈syijN.When the differential result is equal to 0, we obtain(14)θ=12tan−1ba−c.For the existing formula, the process is shown in Figure10.Figure 10
The minimum matrix interception process.After the program is executed, the actual interception and positioning effect diagram is shown in Figure11.Figure 11
Centroid positioning.For digital images stored in the computer, each of them exists as anM∗N array, and the brightness (or grayscale) of the image points in the array is the value of each element (called pixel) in the array. When defining the x- and y-axes of the rectangular coordinate system, the coordinate of each pixel is x,y; that is, the image coordinate system is established by the pixel as the unit, and the distance between the point and the point is called the pixel distance. After that, the distance between the clamp and the core in the image needs to be required [26]. The color recognition positioning system of the core wire is input to the pixel coordinates of the information fixture. Then, the centroid coordinates of the core wire are identified. According to the distance relationship between the two points in the coordinate system, the distance between the different color coordinates of the core line and the pixel point of the fixture is equal to the result obtained after the square sum of the difference of the abscissa and ordinate of two points is squared. The mathematical expression is as follows:(15)distance=x0−x12+y0−y12.From the point of view of the establishment of the image coordinate system, after obtaining the centroid coordinates of the fixture and the core line, the azimuth angle of the core line can be judged through the trigonometric function relationship conversion. When the camera is taken as the center point and the horizontal right direction is0∘, the orientation of the core line can be calculated, as shown in the following formula:(16)sinθ=y1−y0diatancecosθ=x1−x0diatancetanθ=y1−y0x1−x0,(17)θ=−arctanθsinθ>0,cosθ>0,θ=−180+arctanθsinθ>0,cosθ<0,θ=arctanθ+90sinθ<0,cosθ<0,θ=−arctanθsinθ<0,cosθ>0.


### 2.2. Core Line Recognition Based on Deep Learning and Machine Vision

This paper uses deep learning to realize the intelligent recognition of the core wire of the mobile phone and improves the traditional algorithm. According to the actual demand of the core wire recognition, this paper conducts an intelligent analysis of the core wire recognition process. After constructing the functional structure of the system in this paper, the system model of this paper is verified and analyzed. On this basis, the performance verification and analysis of the improved core wire recognition algorithm proposed in this paper are carried out. This paper obtains multiple sets of core wire pictures from a certain manufacturer and conducts real-time video surveillance during the manufacturing process of mobile phone core wires. The picture has been marked by the quality inspector, so the image recognition result can be compared with the image marking result so that the accuracy of the algorithm constructed in this paper can be analyzed. The results of video monitoring can be compared with the results of the on-site quality inspector, and the accuracy rate can be calculated. Therefore, the main quantitative parameter of this paper is the accuracy rate of core wire recognition, and the corresponding table and the corresponding statistical diagram are drawn.The image recognition and analysis of the core wire of the mobile phone are carried out in the form of system simulation, and the results are shown in Table1 and Figure 12.Table 1
Statistical table of the accuracy of image recognition of mobile phone core wires.
NumAccuracy(%)NumAccuracy(%)NumAccuracy(%)198.2453495.2366798.019298.8103595.4426895.873397.9853698.3646996.246495.1443798.2167096.483596.5203896.7277195.590697.1363997.0467296.256798.7404097.6857396.481895.1224197.0557498.916997.0544298.6257595.8091096.0874397.7197696.8231195.0384498.5627796.1451296.6954598.7327896.8661398.4804698.3067998.5451495.3054797.8428095.5271598.3534898.2728195.5421698.3124998.1198298.7981797.4455098.5748395.5761897.3025195.0518497.4781995.9935297.5108597.7022097.3425396.5938697.1482196.2315495.2458798.5262296.9375597.5318898.7812398.6105696.1728995.2252497.4495796.9359098.5372596.5955898.8149196.4672695.6765997.7629296.0962798.4236098.0369397.8872898.3706196.3999495.4852997.3566298.0219595.3923098.4126397.0869695.5343196.5846496.8889798.6263298.3326597.2089898.4823398.2896696.5489996.237Figure 12
Statistical diagram of the accuracy of image recognition of mobile phone core wires.According to Table1, statistical table of image recognition accuracy of mobile phone core, the image recognition accuracy coefficient is always controlled at 95%. Figure 12, statistical chart of image recognition accuracy of mobile phone core line visually, shows this result. It can be seen from the above experimental statistical results that the core line recognition algorithm proposed in this paper has a high accuracy rate in the image recognition of mobile phone core wires, and the accuracy rate is above 95%. After that, this paper uses the system constructed in this paper to conduct real-time video monitoring on the production line, and the statistical recognition accuracy rate is shown in Table 2 and Figure 13.Table 2
Statistical table of the accuracy rate of video recognition of mobile phone core wires.
NumAccuracy (%)NumAccuracy (%)NumAccuracy (%)189.8183488.4096787.792291.6243592.2496891.329388.7923692.4156986.912484.6453789.4577087.729584.9393889.8087191.430685.6083993.6697294.868791.3314085.8787388.231887.8224191.1807486.106991.0074285.6827589.3121085.9944385.6217684.6341190.5074492.5487787.1511286.7914591.6727893.5151388.5874689.2767992.9371486.7034784.6198089.3601591.3634887.2268194.9871691.9754986.1938285.1611785.0485092.5268391.1251890.1255190.6328490.1891986.2175292.8538587.6872085.3325385.3488689.8232186.6775494.3378794.4702291.8415590.6078889.0242384.0785688.5088994.0142490.5325784.2119091.5982589.4925893.8069191.8562692.4945989.5719292.2152794.6536087.1819385.8492885.1596185.5539485.5892989.4446289.7309585.1193085.8116384.4659688.8753184.8966491.6049789.4393293.2076584.8539887.4573385.1876690.3429988.458Figure 13
Statistical diagram of the accuracy rate of video recognition of mobile phone core wires.From the results of online monitoring and recognition, the statistical results of mobile phone core video recognition accuracy fluctuate around 90%, and the core recognition algorithm has high accuracy in mobile phone core image recognition. The core line recognition algorithm based on deep learning and machine vision is effective, and the actual effect is very good.


## 2.1. Extraction of Image Regions of Interest

The image region of interest (ROI) refers to the target area in a picture, which plays a role in reducing the interference of background information to improve the efficiency and accuracy of image processing and detection. When the core wire of the data cable is used as the research object, there will be effects of chromatic aberration, vibration, and noise on the image acquisition process. This paper chooses to use image graying, morphological opening and closing operations, and threshold segmentation to obtain high-quality pictures of interest as the research goals.The color value of each pixel on the grayscale image is also called grayscale, which refers to the color depth of the midpoint of the black-and-white image, generally ranging from 0 to 255, 255 for white and 0 for black. The so-called gray value refers to the intensity of color, and the gray histogram refers to the number of pixels with the gray value corresponding to each gray value in a digital image. Image degradation is the process of transforming an image from an ideal image to an actual defective image for some reason. Image restoration is the process of improving the degraded image and making the restored image close to the ideal image as much as possible.The color image (shown in Figure1) is stored in a multichannel array. Among them, the element in each channel can take a value from 0 to 255. Then, for the RGB channels of a color image, a three-channel histogram can be used to describe the proportions of different colors in the image. The color image (shown in Figure 1) is stored in a multichannel array. Among them, the element in each channel can take a value from 0 to 255. Then, for the RGB channels of a color image, the three-channel histogram can describe the proportion of its different colors in the image. As shown in Figure 2, the horizontal is the gray value of the image, its value range is 0–255, and the vertical is the number of occurrences of different gray values [17].Figure 1
RGB color image.Figure 2
RGB color histogram.Since each channel element is arranged in the matrix row and column order, the morphological characteristics of the image cannot be reflected, and it needs to be converted into a grayscale image. The grayscale image can reflect the characteristics and distribution of the overall and partial brightness and chromaticity levels of the image and can reduce the calculation time and calculation amount of color space conversion. For grayscale images, the 256-level transformation of grayscale ranges from 0 to 255, which does not contain any color information. At this time, the grayscale histogram is shown in Figure3, the horizontal is the gray value of the image, its value range is 0–255, and the vertical is the number of occurrences of different gray values [18].Figure 3
Grayscale histogram.Then, when performing grayscale processing on a color image, the three components are generally weighted and averaged according to different weights. Its reasonable distribution is shown in the following formula:(1)fi,j=0.3Ri,j+0.59Gi,j+0.11Bi,j.According to the above distribution method, the grayscale processing result of the color image obtained is shown in Figure4 [19].Figure 4
Grayscale image.In image processing, threshold segmentation is to achieve the separation of target and background. The main principle is to use the difference in grayscale to divide the pixel level of the core area into several parts, which is convenient for converting the grayscale image into a binary image. That is, it is judged whether the characteristic attribute of each pixel in the image is within the target threshold range so as to determine the target area and the background area.We assume a threshold and set its threshold to be T. In order to find the threshold value of the background and target feature, the gray value of all the pixel points set greater than the threshold is called the target feature, and the gray value of all the pixel points set less than the threshold is called the background feature. Then, its mathematical expression is shown in the following formula [20]:(2)Fx,y=h1;Hi,j≥T,h2;Hi,j≤T.Among them, the gray value of each point of the original image isHi,j, and the gray value after threshold judgment is Fx,y. Its advantage is that it is simple to calculate, it can use connected boundaries to define nonoverlapping and closed regions, and it can better segment the target and background with strong contrast.In addition, for binary images, it is necessary to mark the regions composed of pixels that meet the four-neighborhood connectivity criterion or the eight-neighborhood connectivity criterion with different unique labels. Therefore, the labeling method of connected regions is introduced. It is to assign unique label numbers to multiple target areas in a binary image. Moreover, it mainly prepares for the next step of positioning and matching by making relevant numerical analysis and parameter statistics on the characteristics of the connected area corresponding to each label number. According to the same criterion, in order to make the result error relatively small and closer to the perception of the human eye, the eight-neighborhood connectivity criterion is selected to label the image. The range of interest found according to the threshold is surrounded by a purple line as shown in Figure5.Figure 5
The purple rectangle representation of the area to be inspected on the data line.Mathematical morphology operation is to use the properties of point sets, integral geometric sets, and topology theory to transform object pixel sets. The most basic operations of morphology are dilation and erosion (Dilation and Erosion), which are often used for noise reduction, segmentation, maximum or minimum value regions, and image gradients. From a mathematical definition, the operation of convolving an image (or a part of the image, denoted by A) and the kernel (denoted by B) is a morphological operation. Among them, kernel B can have any shape and size, and the anchor point is a separately defined reference point. Similarly, the kernel can also be called a template or mask [21].The local maximum operation of convolution between kernel B and graphics is called dilation; that is, the maximum pixel value of the area covered by kernel B is found and used as the pixel designated by the reference point. This increases the area around the core wire, as shown in Figure6. For a multichannel image, the mathematical expression of the maximum value in the sliding window area is shown in equation (3). The corrosion operation is the inverse operation, which reduces the original area, so the corrosion is the operation to find the local minimum, as shown in Figure 7. The multichannel data is separated and processed, and the mathematical expression of the minimum value in the sliding window area is shown in formula (4):Figure 6
Expansion.Figure 7
Corrosion.(3)dstx,y=maxx′,y′:elementx′,y′≠0srcx+x′,y+y′,(4)dstx,y=minx′,y′:elementx′,y′≠0srcx+x′,y+y′.According to the basic operations of expansion and corrosion, the superposition of two basic operations is introduced, namely, the operations of morphological opening and closing. The open operation in morphology can remove noise and smooth the target boundary, as shown in formula (5). The closing operation can fill the discrete small holes and scattered parts in the target area, as shown in formula (6) [22]:(5)A∘B=AΘB⊕B,(6)A·B=A⊕BΘB.Corrosion is mainly used to remove some parts of the image in morphology. The etching operation is to take the central position of the structural element (assuming that the element participating in the logical calculation corresponds to the point with element 1 in the two-dimensional matrix, that is, the hole on the grid plate). When moving on the image, if the lower image can be seen through all holes, the image at the central point will be retained; otherwise, it will be removed.The opening operation is to perform the first corrosion operation and then the expansion operation on the image, which is mainly to eliminate the details of the image that are smaller than the structural elements when the local shape of the object remains unchanged. Under normal circumstances, when the background is brighter, it can exclude small-area objects, eliminate isolated points higher than the near point, denoise and smooth the contour of the object, and break the narrow neck. The closing operation is to expand the image first and then corrode. Its function is to be able to sort small black holes (black areas) and eliminate isolated points below the collar near point. Moreover, it can also denoise and smooth the contours of objects, bridge narrow discontinuities and slender gullies, eliminate small holes, and fill in the breaks of contour lines [23].Based on the above opening and closing operations, this paper gives an effect diagram of a core wire. Figure8 shows the opening and closing operation diagram of the green core wire.Figure 8
Morphological operation.In the case that the color of the image has been recognized, the target positioning of different colors still needs to be improved. According to the existing sorting system, the positioning is divided into three parts, including pixel distance calculation, azimuth angle calculation, and actual distance calculation. The system takes the position information of the target in the figure as input and the actual position of the target as output. The process is shown in Figure9.Figure 9
Target positioning process.Target positioning is to determine the pixel coordinates of the core line in the image. Usually, it is chosen to use the centroid positioning. Judging from the external characteristics of the core wire, the axisymmetric image has higher accuracy when using this method [24]. If Ii,j is assumed to be the pixel coordinates of the binary image, at this time, Sx0,y0 is the centroid coordinate of the target, and the expression is as follows:(7)G=Gx2+Gy2,x0=∑i,j∈siIj.j∑i,j∈sIj.j=∑i,j∈siN,y0=∑i,j∈sjIj.j∑i,j∈sIj.j=∑i,j∈sjN.Since the appearance of the core wire to be inspected is a cylinder, the orientation of the core wire can be calculated using the spindle positioning method.The main axis of the target graph is set, and the main calculation formula is as shown in the following formula:(8)χ2=∑i,j∈srij2.Among them, S is the boundary information of the core line andBi,j is the pixel gray value of the core line in the binary image. Then, the sum of the squares of the distances from this straight line to all points on the boundary of the core line of the data line is the smallest so that the straight line can be in a plumb state to avoid numerical ill-conditioned problems [25]. The straight line is expressed in a certain polar coordinate form, as shown in the following formula:(9)ρ=xsinθ+ycosθ.In the formula, θ is the angle formed by the normal line and the x-axis, and ρ is the distance from the straight line to the origin.That is, the conversion is as follows, which can be expressed as(10)χ2=∑i,j∈sxijcosθ+yijsinθ−ρ.After the overall calculation, the following formula can be used to express the minimization problem:(11)χ2=acos2θ+bsinθcosθ+csin2θ.Among them,(12)a=∑i,j∈sxij−x¯2,b=∑i,j∈sxij−x¯yij−y¯,c=∑i,j∈syij−y¯2.Moreover,(13)x¯=∑i,j∈sxijN,y¯=∑i,j∈syijN.When the differential result is equal to 0, we obtain(14)θ=12tan−1ba−c.For the existing formula, the process is shown in Figure10.Figure 10
The minimum matrix interception process.After the program is executed, the actual interception and positioning effect diagram is shown in Figure11.Figure 11
Centroid positioning.For digital images stored in the computer, each of them exists as anM∗N array, and the brightness (or grayscale) of the image points in the array is the value of each element (called pixel) in the array. When defining the x- and y-axes of the rectangular coordinate system, the coordinate of each pixel is x,y; that is, the image coordinate system is established by the pixel as the unit, and the distance between the point and the point is called the pixel distance. After that, the distance between the clamp and the core in the image needs to be required [26]. The color recognition positioning system of the core wire is input to the pixel coordinates of the information fixture. Then, the centroid coordinates of the core wire are identified. According to the distance relationship between the two points in the coordinate system, the distance between the different color coordinates of the core line and the pixel point of the fixture is equal to the result obtained after the square sum of the difference of the abscissa and ordinate of two points is squared. The mathematical expression is as follows:(15)distance=x0−x12+y0−y12.From the point of view of the establishment of the image coordinate system, after obtaining the centroid coordinates of the fixture and the core line, the azimuth angle of the core line can be judged through the trigonometric function relationship conversion. When the camera is taken as the center point and the horizontal right direction is0∘, the orientation of the core line can be calculated, as shown in the following formula:(16)sinθ=y1−y0diatancecosθ=x1−x0diatancetanθ=y1−y0x1−x0,(17)θ=−arctanθsinθ>0,cosθ>0,θ=−180+arctanθsinθ>0,cosθ<0,θ=arctanθ+90sinθ<0,cosθ<0,θ=−arctanθsinθ<0,cosθ>0.


## 2.2. Core Line Recognition Based on Deep Learning and Machine Vision

This paper uses deep learning to realize the intelligent recognition of the core wire of the mobile phone and improves the traditional algorithm. According to the actual demand of the core wire recognition, this paper conducts an intelligent analysis of the core wire recognition process. After constructing the functional structure of the system in this paper, the system model of this paper is verified and analyzed. On this basis, the performance verification and analysis of the improved core wire recognition algorithm proposed in this paper are carried out. This paper obtains multiple sets of core wire pictures from a certain manufacturer and conducts real-time video surveillance during the manufacturing process of mobile phone core wires. The picture has been marked by the quality inspector, so the image recognition result can be compared with the image marking result so that the accuracy of the algorithm constructed in this paper can be analyzed. The results of video monitoring can be compared with the results of the on-site quality inspector, and the accuracy rate can be calculated. Therefore, the main quantitative parameter of this paper is the accuracy rate of core wire recognition, and the corresponding table and the corresponding statistical diagram are drawn.The image recognition and analysis of the core wire of the mobile phone are carried out in the form of system simulation, and the results are shown in Table1 and Figure 12.Table 1
Statistical table of the accuracy of image recognition of mobile phone core wires.
NumAccuracy(%)NumAccuracy(%)NumAccuracy(%)198.2453495.2366798.019298.8103595.4426895.873397.9853698.3646996.246495.1443798.2167096.483596.5203896.7277195.590697.1363997.0467296.256798.7404097.6857396.481895.1224197.0557498.916997.0544298.6257595.8091096.0874397.7197696.8231195.0384498.5627796.1451296.6954598.7327896.8661398.4804698.3067998.5451495.3054797.8428095.5271598.3534898.2728195.5421698.3124998.1198298.7981797.4455098.5748395.5761897.3025195.0518497.4781995.9935297.5108597.7022097.3425396.5938697.1482196.2315495.2458798.5262296.9375597.5318898.7812398.6105696.1728995.2252497.4495796.9359098.5372596.5955898.8149196.4672695.6765997.7629296.0962798.4236098.0369397.8872898.3706196.3999495.4852997.3566298.0219595.3923098.4126397.0869695.5343196.5846496.8889798.6263298.3326597.2089898.4823398.2896696.5489996.237Figure 12
Statistical diagram of the accuracy of image recognition of mobile phone core wires.According to Table1, statistical table of image recognition accuracy of mobile phone core, the image recognition accuracy coefficient is always controlled at 95%. Figure 12, statistical chart of image recognition accuracy of mobile phone core line visually, shows this result. It can be seen from the above experimental statistical results that the core line recognition algorithm proposed in this paper has a high accuracy rate in the image recognition of mobile phone core wires, and the accuracy rate is above 95%. After that, this paper uses the system constructed in this paper to conduct real-time video monitoring on the production line, and the statistical recognition accuracy rate is shown in Table 2 and Figure 13.Table 2
Statistical table of the accuracy rate of video recognition of mobile phone core wires.
NumAccuracy (%)NumAccuracy (%)NumAccuracy (%)189.8183488.4096787.792291.6243592.2496891.329388.7923692.4156986.912484.6453789.4577087.729584.9393889.8087191.430685.6083993.6697294.868791.3314085.8787388.231887.8224191.1807486.106991.0074285.6827589.3121085.9944385.6217684.6341190.5074492.5487787.1511286.7914591.6727893.5151388.5874689.2767992.9371486.7034784.6198089.3601591.3634887.2268194.9871691.9754986.1938285.1611785.0485092.5268391.1251890.1255190.6328490.1891986.2175292.8538587.6872085.3325385.3488689.8232186.6775494.3378794.4702291.8415590.6078889.0242384.0785688.5088994.0142490.5325784.2119091.5982589.4925893.8069191.8562692.4945989.5719292.2152794.6536087.1819385.8492885.1596185.5539485.5892989.4446289.7309585.1193085.8116384.4659688.8753184.8966491.6049789.4393293.2076584.8539887.4573385.1876690.3429988.458Figure 13
Statistical diagram of the accuracy rate of video recognition of mobile phone core wires.From the results of online monitoring and recognition, the statistical results of mobile phone core video recognition accuracy fluctuate around 90%, and the core recognition algorithm has high accuracy in mobile phone core image recognition. The core line recognition algorithm based on deep learning and machine vision is effective, and the actual effect is very good.


## 3. Conclusion

The recognition of the core wire of the mobile phone is a test of the development of machine vision. Generally speaking, the size of the core wire of the mobile phone is very small, so it is difficult to identify the small flaws in it. Based on the deep learning algorithm, this paper combines the actual requirements of core wire recognition to improve the algorithm and proposes an intelligent system suitable for core wire recognition. In the actual research, the system framework is constructed through two methods of image recognition and video recognition. Meanwhile, in the experimental design, the experimental research is also carried out through the two pattern recognition of image recognition and video recognition. Through experimental research and analysis, it can be concluded that the core wire recognition method based on deep learning and machine vision constructed in this paper has a certain effect on core wire image and core wire video recognition and can exert a certain quality control effect on actual core wire manufacturing and production.



---

*Source: 5242930-2021-11-28.xml*