Router shell production quality inspection method based on artificial intelligence
Through artificial intelligence-based detection methods, the aggregation and crack characteristics of the grayscale image of the router shell are analyzed, and the grayscale level is optimized, which solves the problem of difficulty in detecting fine cracks and heat dissipation holes in the existing technology, and improves the accuracy of router shell production quality detection Sex and reliability.
Patent Information
- Application Number
- CN202410009533.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-04
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2044-01-04
AI Technical Summary
In the prior art, the fine crack defects and heat dissipation holes of the router shell are difficult to detect effectively, resulting in poor detection accuracy and robustness, which affects the reliability of production quality inspection.
Using an artificial intelligence-based detection method, by obtaining the grayscale image of the router shell, dividing the original grayscale level, analyzing the degree of aggregation and cracking, combining the connection domain and the minimum external rectangle features, screening out regular shapes, and performing histogram equalization mapping. Optimize the grayscale level and improve the accuracy of crack detection.
Effectively remove the detection error of the heat dissipation hole, improve the accuracy and robustness of crack detection, and enhance the effectiveness and reliability of router shell production quality detection.
Smart Images

Figure CN118014935B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image analysis, and in particular to a production quality detection method for a router shell based on artificial intelligence. Background Art
[0002] The router shell needs to be inspected for quality after production. In the prior art, the global contrast is often enhanced by using histogram equalization, so as to analyze the cracks based on the inconsistency between the grayscale of the cracks in the enhanced image and the grayscale of the router shell surface.
[0003] In this way, larger crack defects contained in the router shell body can be easily detected, while fine crack defects on the surface of the router shell and the influence of regularly arranged heat dissipation holes often cause detail loss due to the effect of histogram equalization, and the heat dissipation hole area is easily identified as a crack area, making it impossible to effectively detect crack defects through conventional defect detection methods, and the accuracy and robustness of crack detection on the router shell are poor, which in turn leads to insufficient detection effect and detection reliability of the production quality of the router shell. Summary of the invention
[0004] In order to solve the technical problem that conventional defect detection methods in the related art cannot effectively detect crack defects, the accuracy and robustness of crack detection of router shells are poor, and thus the detection effect and detection reliability of the production quality of router shells are insufficient, the present invention provides a router shell production quality detection method based on artificial intelligence, and the technical scheme adopted is as follows:
[0005] The present invention proposes a router shell production quality detection method based on artificial intelligence, the method comprising:
[0006] Acquire a grayscale image of a router shell, divide pixel points in the grayscale image of the router shell into a preset first number of original grayscale levels, and determine the aggregation degree of each original grayscale level according to the grayscale distribution of the pixel points of each original grayscale level in a surrounding preset neighborhood range;
[0007] Connected domain analysis and minimum circumscribed rectangle analysis are performed on the pixels of each original gray level respectively, and the rectangle to be analyzed corresponding to each connected domain of each original gray level is obtained. According to the shapes of all the rectangles to be analyzed at each original gray level, the rectangles to be analyzed with regular shapes are deleted to determine the crack degree of each original gray level;
[0008] Determining a defect index of each original gray level according to the aggregation degree and the crack degree; performing histogram equalization mapping on each original gray level according to the defect index and the number of pixels corresponding to the original gray level to obtain an enhanced gray level;
[0009] The grayscale of the pixel points in the grayscale image of the router housing is updated according to the enhanced grayscales respectively corresponding to all the original grayscales to obtain an enhanced image, and crack detection is performed on the enhanced image to obtain a detection result.
[0010] Furthermore, the step of determining the aggregation degree of each original grayscale level according to the grayscale distribution of the pixel points of each original grayscale level in a surrounding preset neighborhood range includes:
[0011] An original grayscale is selected as the grayscale to be measured, and any pixel point whose grayscale in the grayscale image of the router housing belongs to the grayscale to be measured is selected as the pixel point to be analyzed;
[0012] Counting the number of other pixel points whose grayscale is the grayscale to be measured within a preset neighborhood of the pixel point to be analyzed as the number of clusters;
[0013] The average normalized value of the number of clusters of all pixels corresponding to the gray level to be measured is calculated to obtain the degree of clustering of the gray level to be measured, and the gray level to be measured is adjusted to obtain the degree of clustering of each original gray level.
[0014] Furthermore, the connected domain analysis and the minimum bounding rectangle analysis are performed on the pixel points of each original gray level to obtain the rectangle to be analyzed corresponding to each connected domain of each original gray level, including:
[0015] Performing a connected domain analysis on all pixel points of the grayscale to be tested to obtain at least one connected domain to be tested;
[0016] The minimum circumscribed rectangle of each connected domain to be tested is used as the rectangle to be analyzed for the gray level to be tested;
[0017] Adjust the grayscale to be measured to obtain all the rectangles to be analyzed corresponding to each original grayscale.
[0018] Furthermore, the step of deleting the rectangles to be analyzed of regular shapes according to the shapes of all the rectangles to be analyzed at each original gray level, and determining the crack degree of each original gray level includes:
[0019] The aspect ratio of any rectangle to be analyzed is used as the shape feature value of the corresponding rectangle to be analyzed;
[0020] The rectangle to be analyzed whose shape feature value frequency is greater than a preset frequency threshold is used as a heat dissipation hole rectangle, and the remaining rectangle after deleting the heat dissipation hole rectangle is used as a suspected crack rectangle;
[0021] The crack extent is calculated based on the shape eigenvalues of all suspected crack rectangles.
[0022] Furthermore, the crack degree is calculated based on the shape characteristic values of all suspected crack rectangles, including:
[0023] The mean normalized value of the shape feature values of all suspected crack rectangles is calculated to obtain the crack degree corresponding to the original gray level.
[0024] Furthermore, the aggregation degree is positively correlated with the defect index, the crack degree is positively correlated with the defect index, and the value of the defect index is a normalized value.
[0025] Furthermore, according to the defect index and the number of pixels corresponding to the original grayscale, each original grayscale is subjected to histogram equalization mapping to obtain an enhanced grayscale, and the corresponding calculation formula is:
[0026] In the formula, G k represents the enhanced gray level of the original gray level k, m represents the index of the original gray level, hist input (m) represents the number of pixels of the mth original grayscale level, W represents the number of all pixels in the grayscale image of the router shell, Z represents the preset first number, hist input (k) represents the number of pixels of the original gray level k, Indicates rounding up, Y k Represents the defect index of the original gray level k.
[0027] Further, the grayscale of the pixel points in the grayscale image of the router housing is updated according to the enhanced grayscales respectively corresponding to all the original grayscales to obtain an enhanced image, including:
[0028] In the router shell grayscale image, the grayscales of all pixels corresponding to the original grayscales are updated to corresponding enhanced grayscales to obtain an enhanced image.
[0029] Further, the performing crack detection on the enhanced image to obtain a detection result includes:
[0030] Performing connected domain analysis on the enhanced image to obtain an enhanced connected domain;
[0031] Determine the crack coefficient according to the grayscale gradient of all pixels in each enhanced connected domain and the aspect ratio of the minimum circumscribed rectangle of the connected domain;
[0032] The connected domain whose crack coefficient is greater than a preset coefficient threshold is taken as a crack connected domain;
[0033] The number of crack connected domains and the total number of pixels in all crack connected domains are counted as the detection results.
[0034] Furthermore, the crack coefficient is determined according to the grayscale gradient of all pixels in each enhanced connected domain and the aspect ratio of the minimum circumscribed rectangle of the connected domain, including:
[0035] Calculate the normalized value of the grayscale gradient mean of all pixels in any enhanced connected domain to obtain the gradient influence coefficient;
[0036] The normalized value of the product of the gradient influence coefficient and the aspect ratio of the enhanced connected domain is calculated to obtain a crack coefficient.
[0037] The present invention has the following beneficial effects:
[0038] The embodiment of the present invention obtains the grayscale image of the router shell, and then determines the aggregation degree of each original grayscale according to the grayscale distribution of the pixel points of each original grayscale in the local range, and determines the crack degree of each original grayscale according to the shape of the minimum circumscribed rectangle of the connected domain. The aggregation degree characterizes the distribution aggregation of the pixel points, which corresponds to the characteristics of the coherent texture area of the crack, and the crack degree characterizes the shape of the texture. In the process of obtaining the crack degree, the influence of the regular-shaped rectangle to be analyzed is screened out, which can effectively remove the error caused by the vent hole, the vent belt, etc. on the crack analysis, thereby improving the accuracy of the crack degree. The present invention combines the aggregation degree and the crack degree to determine The defect index of each original grayscale level, that is, the crack index, can be combined with the texture characteristics and morphological characteristics of the crack itself to achieve more reliable defect analysis and obtain a more reliable defect index; the histogram equalization is optimized by the number of pixels corresponding to the defect index and the original grayscale level to obtain an enhanced image, so that the grayscale level of the crack area in the enhanced image can be displayed more clearly, and the texture of the crack area is deepened. When the morphology and grayscale gradient characteristics of the crack in the enhanced image are combined to perform the quality inspection of the router shell surface, the crack defects can be effectively detected, the accuracy and robustness of the router shell defect detection can be improved, and the inspection effect and reliability of the production quality of the router shell can be enhanced. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0040] Figure 1 A flow chart of a method for detecting the production quality of a router housing based on artificial intelligence provided by one embodiment of the present invention;
[0041] Figure 2A schematic diagram of a grayscale image of a router housing provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0042] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation method, structure, features and effects of a router shell production quality inspection method based on artificial intelligence proposed by the present invention in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0043] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0044] The specific scheme of the router shell production quality detection method based on artificial intelligence provided by the present invention is described in detail below with reference to the accompanying drawings.
[0045] See also Figure 1 , which shows a flow chart of a method for detecting the production quality of a router housing based on artificial intelligence provided by an embodiment of the present invention, the method comprising:
[0046] S101: Acquire a grayscale image of a router shell, divide the pixels in the grayscale image of the router shell into a preset first number of original grayscale levels, and determine the aggregation degree of each original grayscale level according to the grayscale distribution of the pixels of each original grayscale level in a surrounding preset neighborhood.
[0047] A specific application scenario of the present invention is to obtain an original image of the surface of a router housing, and then perform image preprocessing on the original image to obtain a grayscale image of the router housing, such as Figure 2 As shown, Figure 2 A schematic diagram of a grayscale image of a router shell provided by an embodiment of the present invention, wherein image preprocessing may specifically include image denoising processing and image grayscale processing. The image denoising and image grayscale in the embodiment of the present invention are both existing denoising and grayscale methods, that is, the image preprocessing process is a preprocessing process commonly used in the art, and no further elaboration or limitation is made thereon.
[0048] It is understandable that since the router itself has heat dissipation holes in many places, the heat dissipation holes and tiny cracks will affect the final recognition result during identification. Therefore, the embodiment of the present invention screens out the area of the heat dissipation holes and simultaneously achieves a high degree of enhancement of the tiny cracks by adjusting the enhancement coefficient, so that the tiny cracks can be effectively identified, thereby improving the detection effect and detection reliability of the router shell production quality inspection.
[0049] Among them, the preset first number is the corresponding number of gray levels. Optionally, in some embodiments of the present invention, the preset first number can be specifically 256, that is, a standard gray value of 0-255. Of course, considering that there is an error influence of about 1 gray value in the imaging process, the embodiment of the present invention can set the preset first number to 128. Of course, in other embodiments of the present invention, it can also be adjusted according to actual needs, and there is no limitation to this.
[0050] Furthermore, in some embodiments of the present invention, the degree of aggregation of each original grayscale is determined according to the grayscale distribution of the pixel points of each original grayscale within a preset neighborhood range around it, including: selecting any original grayscale as the grayscale to be measured, and taking any pixel point in the grayscale image of the router shell whose grayscale level belongs to the grayscale to be measured as the pixel point to be analyzed; counting the number of other pixel points whose grayscale level is the grayscale to be measured within the preset neighborhood range of the pixel point to be analyzed as the aggregation number; calculating the mean normalized value of the aggregation number of all pixel points corresponding to the grayscale to be measured to obtain the aggregation degree of the grayscale to be measured, adjusting the grayscale to be measured, and obtaining the aggregation degree of each original grayscale level.
[0051] Among them, the preset neighborhood range is the local range of pixel points when performing cluster quantity analysis. Optionally, the preset neighborhood range can be specifically a range of 5×5, for example, or can be adjusted according to actual needs, which is not limited.
[0052] In one embodiment of the present invention, the normalization processing can be specifically, for example, maximum and minimum value normalization processing, and the normalization in subsequent steps can all adopt maximum and minimum value normalization processing. In other embodiments of the present invention, other normalization methods can be selected according to the specific range of numerical values, which will not be described in detail.
[0053] In an embodiment of the present invention, the mean normalized value of the number of clusters of all pixel points corresponding to the grayscale to be measured is calculated. It can be understood that for the texture of crack defects and heat dissipation holes, their pixel points are all clustered together when distributed, that is, the corresponding pixel points to be analyzed have other pixel points with the same original grayscale within a preset neighborhood. Therefore, the embodiment of the present invention counts the number of other pixel points with the same original grayscale as the number of clusters, and calculates the mean of all cluster numbers under the unified original grayscale, and normalizes them to obtain the degree of clustering of the grayscale to be measured. The greater the degree of clustering, the more likely the corresponding pixel points are to be clustered together, and the noise formed in the image during shooting and transmission compression usually presents the characteristics of independent distribution, that is, the influence of the grayscale corresponding to the image noise on the crack texture detection is further eliminated.
[0054] S102: Performing connected domain analysis and minimum circumscribed rectangle analysis on the pixels of each original gray level respectively, obtaining the rectangle to be analyzed corresponding to each connected domain of each original gray level, deleting the rectangle to be analyzed with regular shapes according to the shapes of all the rectangles to be analyzed at each original gray level, and determining the crack degree of each original gray level.
[0055] In an embodiment of the present invention, a connected domain algorithm can be used to perform a connected domain analysis on the pixel points of each original grayscale level. After the connected domain analysis, the minimum bounding rectangle analysis is performed on the obtained connected domain. Furthermore, in some embodiments of the present invention, a connected domain analysis and a minimum bounding rectangle analysis are performed on the pixel points of each original grayscale level, respectively, to obtain a rectangle to be analyzed for each connected domain corresponding to each original grayscale level, including: performing a connected domain analysis on all pixel points of the grayscale level to be measured to obtain at least one connected domain to be measured; using the minimum bounding rectangle of each connected domain to be measured as the rectangle to be analyzed for the grayscale level to be measured; adjusting the grayscale level to be measured to obtain all rectangles to be analyzed corresponding to each original grayscale level.
[0056] Among them, the connected domain analysis and the minimum circumscribed rectangle analysis are well-known technologies in the art, and no further limitation or elaboration is made thereon. In the embodiment of the present invention, the connected domain analysis is first performed, and then the minimum circumscribed rectangle analysis is performed on the connected domain to be tested obtained by the analysis. It can be understood that since the morphology of the crack presents an elongated texture feature, the minimum circumscribed rectangle of the corresponding connected domain also presents an elongated rectangular feature. Based on this, the rectangle to be analyzed is analyzed, so that fine textures can be accurately identified.
[0057] Furthermore, in some embodiments of the present invention, according to the shapes of all rectangles to be analyzed at each original grayscale level, rectangles to be analyzed with regular shapes are deleted, and the degree of cracks at each original grayscale level is determined, including: taking the aspect ratio of any rectangle to be analyzed as the shape feature value of the corresponding rectangle to be analyzed; taking the rectangle to be analyzed whose shape feature value frequency is greater than a preset frequency threshold as a heat dissipation hole rectangle, and taking the remaining rectangles after deleting the heat dissipation hole rectangle as suspected crack rectangles; and calculating the degree of cracks based on the shape feature values of all suspected crack rectangles.
[0058] In the embodiment of the present invention, since the morphology of the crack presents an elongated texture feature, the minimum circumscribed rectangle of the corresponding connected domain also presents an elongated rectangular feature. Based on this, the aspect ratio of any rectangle to be analyzed is used as the shape feature value of the corresponding rectangle to be analyzed.
[0059] Among them, the rectangle to be analyzed of regular shape, that is, the rectangle whose distribution and shape are similar to other rectangles to be analyzed at the same original grayscale level, has regularly arranged heat dissipation holes or heat dissipation stripes on the surface of the router to achieve heat dissipation operation for the circuit board inside the router, and the heat dissipation holes and heat dissipation stripes have the characteristics of digging holes, and their grayscale performance is similar to crack defects. Therefore, it is very easy to identify them as crack defects. Therefore, the present invention takes the heat dissipation holes as an example for specific analysis.
[0060] The preset frequency threshold is a threshold value of the frequency of the shape feature value of the rectangle to be analyzed. Since the number of heat dissipation holes on the surfaces of routers of different styles may be different, the embodiment of the present invention sets a preset frequency threshold to adjust the threshold of the number of heat dissipation holes on the surfaces of routers of different styles. Optionally, the preset frequency threshold can be specifically 30, for example, and there is no limitation on this.
[0061] In the embodiment of the present invention, the rectangle to be analyzed whose shape feature value frequency is greater than a preset frequency threshold is used as a heat dissipation hole rectangle, and then the remaining rectangle after deleting the heat dissipation hole rectangle is used as a suspected crack rectangle to eliminate the influence of the heat dissipation hole.
[0062] Furthermore, in some embodiments of the present invention, the crack degree is calculated based on the shape characteristic values of all suspected crack rectangles, including: calculating the mean normalized value of the shape characteristic values of all suspected crack rectangles to obtain the crack degree corresponding to the original grayscale.
[0063] Since the morphology of the crack presents an elongated texture feature, the minimum circumscribed rectangle of the corresponding connected domain also presents an elongated rectangular feature. Therefore, the mean normalized value of the shape characteristic values of all suspected crack rectangles is used as the crack degree. The greater the crack degree, the greater the mean normalized value representing the corresponding shape characteristic value, that is, the greater the average value of the aspect ratio, that is, the more the corresponding suspected crack rectangle presents an elongated texture feature, and the greater the possibility that it is a crack.
[0064] S103: Determine the defect index of each original gray level according to the aggregation degree and the crack degree; perform histogram equalization mapping on each original gray level according to the defect index and the number of pixels corresponding to the original gray level to obtain an enhanced gray level.
[0065] Among them, the defect index represents the index information of the grayscale corresponding to the crack area corresponding to the original grayscale. The larger the defect index is, the more likely the pixel corresponding to the original grayscale is to contain a crack pixel.
[0066] In the embodiment of the present invention, the greater the degree of aggregation, the greater the possibility that the pixels corresponding to the original grayscale are cracks clustered together, and the greater the degree of crack, the greater the possibility that the connected domain composed of the pixels corresponding to the original grayscale is a connected domain of a long and thin texture. Therefore, in the embodiment of the present invention, the degree of aggregation is positively correlated with the defect index, the degree of crack is positively correlated with the defect index, and the value of the defect index is a normalized value.
[0067] Among them, the positive correlation relationship indicates that the dependent variable will increase as the independent variable increases, and the dependent variable will decrease as the independent variable decreases. The specific relationship can be a multiplication relationship, an addition relationship, or the power of an exponential function, which is determined by practical applications. Optionally, in some embodiments of the present invention, the normalized value of the product of the degree of aggregation and the degree of cracking can be calculated to obtain a defect index, which is not limited to this.
[0068] After determining the defect index, the present invention can combine the defect index of the original grayscale and the number of pixels to perform histogram equalization calculation to achieve better image enhancement processing.
[0069] Furthermore, in some embodiments of the present invention, according to the defect index and the number of pixels corresponding to the original gray level, a histogram equalization mapping is performed on each original gray level to obtain an enhanced gray level. The corresponding calculation formula is:
[0070]
[0071] In the formula, G k represents the enhanced gray level of the original gray level k, m represents the index of the original gray level, hist input(m) represents the number of pixels of the mth original grayscale level, W represents the number of all pixels in the grayscale image of the router shell, Z represents the preset first number, hist input (k) represents the number of pixels of the original gray level k, Indicates rounding up, Y k Indicates the defect index of the original gray level k. The value of k in the embodiment of the present invention is 0 and a positive integer.
[0072] In the embodiment of the present invention, It represents the percentage of pixels corresponding to the original gray level k, that is, That is to perform histogram equalization on the original grayscale.
[0073] In the present invention, when k=0, that is, when the original gray level of the corresponding pixel point is 0, the enhanced gray level is set to 0 for specific analysis. Similarly, when k=1, the enhanced gray level is set to 0. Histogram equalization is performed, and when k is greater than or equal to 2, the enhanced gray level is achieved by When performing histogram equalization, it can be understood that the present invention uses rounding-up processing to avoid the result that the equalization value of the corresponding gray level is incorporated into the previous gray level due to being less than 0.5, so as to improve the recognition of the overall gray level.
[0074] By setting the defect index to influence the equalization result, the gray level with crack defects is more prominent, so that the pixel points corresponding to the crack defects can be more obvious and more recognizable, and can be effectively identified and detected, thereby enhancing the reliability of subsequent detection.
[0075] S104: updating the grayscale of the pixels in the grayscale image of the router housing according to the enhanced grayscales corresponding to all the original grayscales to obtain an enhanced image, and performing crack detection on the enhanced image to obtain a detection result.
[0076] Furthermore, in some embodiments of the present invention, the grayscale levels of pixels in the grayscale image of the router shell are updated according to the enhanced grayscale levels corresponding to all the original grayscale levels to obtain an enhanced image, including: in the grayscale image of the router shell, the grayscale levels of pixels corresponding to all the original grayscale levels are updated to the corresponding enhanced grayscale levels to obtain an enhanced image.
[0077] After obtaining the enhanced grayscale corresponding to each original grayscale, the embodiment of the present invention updates the pixel points belonging to the original grayscale in the grayscale image of the router shell from the original grayscale to the enhanced grayscale, thereby updating the pixel points corresponding to all the original grayscales to obtain an enhanced image.
[0078] Since the pixels belonging to the crack in the enhanced image can be effectively distinguished from the pixels belonging to the background, the texture features of the crack area in the corresponding enhanced image are more obvious.
[0079] Furthermore, in some embodiments of the present invention, crack detection is performed on an enhanced image to obtain a detection result, including: performing a connected domain analysis on the enhanced image to obtain an enhanced connected domain; determining a crack coefficient based on the grayscale gradient of all pixels in each enhanced connected domain and the aspect ratio of the minimum circumscribed rectangle of the connected domain; taking a connected domain with a crack coefficient greater than a preset coefficient threshold as a crack connected domain; and counting the number of crack connected domains and the total number of pixels in all crack connected domains as the detection result.
[0080] In the embodiment of the present invention, a connected domain analysis is performed on the enhanced image to effectively detect the crack according to the elongated texture features of the crack, thereby determining the crack coefficient of each enhanced connected domain.
[0081] Among them, the crack coefficient is the probability value of the enhanced connected domain being the connected domain corresponding to the crack.
[0082] Furthermore, in some embodiments of the present invention, the crack coefficient is determined based on the grayscale gradient of all pixels in each enhanced connected domain and the aspect ratio of the minimum circumscribed rectangle of the connected domain, including: calculating the normalized value of the mean grayscale gradient of all pixels in any enhanced connected domain to obtain the gradient influence coefficient; calculating the normalized value of the product of the gradient influence coefficient and the aspect ratio of the enhanced connected domain to obtain the crack coefficient.
[0083] It can be understood that since the crack area and the background area in the enhanced image have a large difference in enhanced grayscale levels, and due to the slender texture features of the crack area, the average grayscale value of the corresponding pixels is greater than the average grayscale value of the pixels in the background area. Therefore, the present invention calculates the normalized value of the grayscale gradient mean of all pixels in the enhanced connected domain to obtain the gradient influence coefficient. The larger the gradient influence coefficient, the more likely the corresponding enhanced connected domain is to be a crack area.
[0084] The present invention calculates the normalized value of the product of the gradient influence coefficient and the aspect ratio of the enhanced connected domain to obtain the crack coefficient, that is, the gradient information and the morphological information are combined as the crack coefficient. The larger the crack coefficient, the more likely the corresponding enhanced connected domain is to be a crack area.
[0085] In the embodiment of the present invention, a connected domain whose crack coefficient is greater than a preset coefficient threshold is taken as a crack connected domain; the number of crack connected domains and the total number of pixel points in all crack connected domains are counted as detection results.
[0086] The preset coefficient threshold is a threshold value of the crack coefficient. In the embodiment of the present invention, the preset coefficient threshold can be specifically, for example, 0.8. Of course, in other embodiments of the present invention, the preset coefficient threshold can be adjusted according to actual detection requirements, and there is no limitation on this. In the embodiment of the present invention, a connected domain with a crack coefficient greater than 0.8 is regarded as a crack connected domain.
[0087] After determining the crack connected domain, the number of crack connected domains and the total number of pixels in all crack connected domains are taken as the detection results. The more crack connected domains there are, the more total number of pixels there are, and the more serious the corresponding cracks are. Therefore, the production quality of the router surface can be detected.
[0088] The embodiment of the present invention obtains the grayscale image of the router shell, and then determines the aggregation degree of each original grayscale according to the grayscale distribution of the pixel points of each original grayscale in the local range, and determines the crack degree of each original grayscale according to the shape of the minimum circumscribed rectangle of the connected domain. The aggregation degree characterizes the distribution aggregation of the pixel points, which corresponds to the characteristics of the coherent texture area of the crack, and the crack degree characterizes the shape of the texture. In the process of obtaining the crack degree, the influence of the regular-shaped rectangle to be analyzed is screened out, which can effectively remove the error caused by the vent hole, the vent belt, etc. on the crack analysis, thereby improving the accuracy of the crack degree. The present invention combines the aggregation degree and the crack degree to determine The defect index of each original grayscale level, that is, the crack index, can be combined with the texture characteristics and morphological characteristics of the crack itself to achieve more reliable defect analysis and obtain a more reliable defect index; the histogram equalization is optimized by the number of pixels corresponding to the defect index and the original grayscale level to obtain an enhanced image, so that the grayscale level of the crack area in the enhanced image can be displayed more clearly, and the texture of the crack area is deepened. When the morphology and grayscale gradient characteristics of the crack in the enhanced image are combined to perform the quality inspection of the router shell surface, the crack defects can be effectively detected, the accuracy and robustness of the router shell defect detection can be improved, and the inspection effect and reliability of the production quality of the router shell can be enhanced.
[0089] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0090] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
Claims
1. A router shell production quality detection method based on artificial intelligence, characterized in that: The method comprises: Acquire a grayscale image of a router shell, divide pixel points in the grayscale image of the router shell into a preset first number of original grayscale levels, and determine the aggregation degree of each original grayscale level according to the grayscale distribution of the pixel points of each original grayscale level in a surrounding preset neighborhood range; Connected domain analysis and minimum circumscribed rectangle analysis are performed on the pixels of each original gray level respectively, and the rectangle to be analyzed corresponding to each connected domain of each original gray level is obtained. According to the shapes of all the rectangles to be analyzed at each original gray level, the rectangles to be analyzed with regular shapes are deleted to determine the crack degree of each original gray level; Determining a defect index of each original gray level according to the aggregation degree and the crack degree; performing histogram equalization mapping on each original gray level according to the defect index and the number of pixels corresponding to the original gray level to obtain an enhanced gray level; The grayscale of the pixel points in the grayscale image of the router housing is updated according to the enhanced grayscales corresponding to all the original grayscales to obtain an enhanced image, and crack detection is performed on the enhanced image to obtain a detection result; The method of deleting the regular shaped rectangles to be analyzed according to the shapes of all the rectangles to be analyzed at each original gray level and determining the crack degree of each original gray level includes: The aspect ratio of any rectangle to be analyzed is used as the shape feature value of the corresponding rectangle to be analyzed; The rectangle to be analyzed whose shape feature value frequency is greater than a preset frequency threshold is used as a heat dissipation hole rectangle, and the remaining rectangle after deleting the heat dissipation hole rectangle is used as a suspected crack rectangle; The crack extent is calculated based on the shape eigenvalues of all suspected crack rectangles; According to the defect index and the number of pixels corresponding to the original grayscale, each original grayscale is subjected to histogram equalization mapping to obtain an enhanced grayscale. The corresponding calculation formula is: In the formula, G k represents the enhanced gray level of the original gray level k, m represents the index of the original gray level, hist input (m) represents the number of pixels of the mth original grayscale level, W represents the number of all pixels in the grayscale image of the router shell, Z represents the preset first number, hist input (k) represents the number of pixels of the original gray level k, Indicates rounding up, Y k Represents the defect index of the original gray level k.
2. The method for detecting the production quality of a router housing based on artificial intelligence as claimed in claim 1, characterized in that: The step of determining the aggregation degree of each original grayscale level according to the grayscale distribution of the pixel points of each original grayscale level in the surrounding preset neighborhood range includes: An original grayscale is selected as the grayscale to be measured, and any pixel point whose grayscale in the grayscale image of the router housing belongs to the grayscale to be measured is selected as the pixel point to be analyzed; Counting the number of other pixel points whose grayscale is the grayscale to be measured within a preset neighborhood of the pixel point to be analyzed as the number of clusters; The average normalized value of the number of clusters of all pixels corresponding to the gray level to be measured is calculated to obtain the degree of clustering of the gray level to be measured, and the gray level to be measured is adjusted to obtain the degree of clustering of each original gray level.
3. The method for detecting the production quality of a router housing based on artificial intelligence as claimed in claim 2, characterized in that: The method of performing connected domain analysis and minimum bounding rectangle analysis on the pixel points of each original gray level to obtain a rectangle to be analyzed corresponding to each connected domain of each original gray level includes: Performing a connected domain analysis on all pixel points of the grayscale to be tested to obtain at least one connected domain to be tested; The minimum circumscribed rectangle of each connected domain to be tested is used as the rectangle to be analyzed for the gray level to be tested; Adjust the grayscale to be measured to obtain all the rectangles to be analyzed corresponding to each original grayscale.
4. The method for detecting the production quality of a router housing based on artificial intelligence as claimed in claim 1, characterized in that: The crack degree is calculated based on the shape characteristic values of all suspected crack rectangles, including: The mean normalized value of the shape feature values of all suspected crack rectangles is calculated to obtain the crack degree corresponding to the original gray level.
5. The method for detecting the production quality of a router housing based on artificial intelligence as claimed in claim 1, characterized in that: The aggregation degree is positively correlated with the defect index, the crack degree is positively correlated with the defect index, and the value of the defect index is a normalized value.
6. The method for detecting the production quality of a router housing based on artificial intelligence as claimed in claim 1, characterized in that: The step of updating the grayscale of the pixel points in the grayscale image of the router housing according to the enhanced grayscales respectively corresponding to all the original grayscales to obtain an enhanced image comprises: In the router shell grayscale image, the grayscales of all pixels corresponding to the original grayscales are updated to corresponding enhanced grayscales to obtain an enhanced image.
7. The method for detecting the production quality of a router housing based on artificial intelligence as claimed in claim 1, characterized in that: The performing crack detection on the enhanced image to obtain a detection result includes: Performing connected domain analysis on the enhanced image to obtain an enhanced connected domain; Determine the crack coefficient according to the grayscale gradient of all pixels in each enhanced connected domain and the aspect ratio of the minimum circumscribed rectangle of the connected domain; The connected domain whose crack coefficient is greater than a preset coefficient threshold is taken as a crack connected domain; The number of crack connected domains and the total number of pixels in all crack connected domains are counted as the detection results; The method of determining the crack coefficient according to the grayscale gradient of all pixels in each enhanced connected domain and the aspect ratio of the minimum circumscribed rectangle of the connected domain comprises: Calculate the normalized value of the grayscale gradient mean of all pixels in any enhanced connected domain to obtain the gradient influence coefficient; The normalized value of the product of the gradient influence coefficient and the aspect ratio of the enhanced connected domain is calculated to obtain a crack coefficient.
