A device for detecting uniformity of ink spraying
By segmenting the ink spray image into areas and determining the adaptive filter core, the problem of low accuracy in ink spray uniformity detection in the prior art is solved, and more efficient edge detection and uniformity detection are achieved.
Patent Information
- Application Number
- CN202411295463.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-09-18
AI Technical Summary
In the prior art, the accuracy of ink spray uniformity detection is low, and it is difficult to take into account the texture traces in both the bright and dark areas, resulting in poor edge detection effect.
By collecting ink spray images on the surface of metal workpieces, dividing them into multiple areas, obtaining the degree of light influence and gray scale expansion of each area, determining the adaptive filter core, performing edge detection processing, and improving edge detection effect.
Improve the accuracy of ink spray uniformity detection, detect more texture traces, and enhance the edge detection effect.
Smart Images

Figure CN118823012B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a jetting device, in particular to an ink spraying uniformity detection device. Background Art
[0002] In order to improve the anti-corrosion effect of metal workpieces, anti-corrosion ink is usually sprayed on the surface of the metal workpiece. Whether the ink is sprayed evenly is an indicator to measure the quality of the metal workpiece. If the ink is sprayed unevenly, the coating thickness on the surface of the metal workpiece will be uneven. The area with thinner coating is easy to be corroded, thus affecting the anti-corrosion effect of the metal workpiece. Therefore, it is necessary to detect the uniformity of ink spraying on the metal workpiece.
[0003] In the prior art, edge detection operators are used to perform overall edge detection on the ink spraying image on the surface of the metal workpiece, and whether the ink spraying is uniform is identified based on the edge detection results. Since the depth of ink spraying varies, different areas are affected by light to different degrees. The prior art performs unified edge detection processing on the image, which makes it difficult to take into account the texture traces of the bright area and the dark area at the same time, resulting in poor edge detection effect, and thus low accuracy in ink spraying uniformity detection. Summary of the invention
[0004] In order to solve the technical problem of low accuracy of ink spraying uniformity detection in the prior art, the purpose of the present invention is to provide an ink spraying uniformity detection device, and the technical solution adopted is as follows:
[0005] The present invention provides an ink spraying uniformity detection device, the device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, the method implemented when the processor executes the computer program comprising:
[0006] Collecting an ink spraying image on the surface of a workpiece as an image to be detected, and dividing the image to be detected into multiple areas;
[0007] Obtaining the grayscale value of the ink background color of the image to be detected, and obtaining the light influence degree and grayscale expansion degree of the area according to the grayscale distribution of the area and the grayscale value of the ink background color;
[0008] According to the light influence degree and the grayscale scaling degree, an adaptive filter kernel coefficient of the region is acquired, and according to the adaptive filter kernel coefficient, an adaptive filter kernel of the region is determined;
[0009] Performing edge detection processing on the region according to the adaptive filter kernel to obtain a target image;
[0010] According to the target image, the uniformity of ink spraying on the surface of the workpiece is detected to obtain a detection result.
[0011] In some embodiments, the process of obtaining the light influence degree includes:
[0012] Obtaining the grayscale mean of the region;
[0013] Determine the magnitude relationship between the grayscale mean and the grayscale value of the ink background color;
[0014] The light influence degree is obtained according to the size relationship, the grayscale mean value and the ink background grayscale value.
[0015] In some embodiments, obtaining the light influence degree according to the size relationship, the grayscale mean value and the ink background grayscale value includes:
[0016] The light influence degree is obtained according to a light influence degree formula, wherein the light influence degree formula includes:
[0017]
[0018] in, For the The degree of light influence in an area For the The grayscale mean of the region, is the gray value of the ink background color, is the maximum grayscale mean value in multiple areas of the image to be detected, is the minimum grayscale mean value among multiple regions of the image to be detected, The index of the region.
[0019] In some embodiments, the process of obtaining the grayscale value of the ink background color includes:
[0020] Dividing the grayscale interval of the image to be detected into a plurality of candidate grayscale intervals;
[0021] Obtaining the number of pixels in the candidate grayscale interval, and determining the candidate interval with the largest number of pixels as the target grayscale interval;
[0022] The average grayscale value of the pixels in the target grayscale interval is obtained as the grayscale value of the ink background color of the workpiece.
[0023] In some embodiments, the process of obtaining the grayscale scaling degree includes:
[0024] Determine the maximum grayscale value and the minimum grayscale value of the pixels in the image to be detected;
[0025] The grayscale expansion degree is obtained according to the size relationship, the maximum grayscale value, the minimum grayscale value and the ink background grayscale value.
[0026] In some embodiments, the step of obtaining the grayscale stretching degree according to the size relationship, the maximum grayscale value, the minimum grayscale value, the grayscale mean value, and the ink background grayscale value includes:
[0027] The grayscale scaling degree is obtained according to a grayscale scaling degree formula, wherein the grayscale scaling degree formula includes:
[0028]
[0029] in, For the The grayscale scaling degree of each region is is the maximum gray value of the pixel in the image to be detected, is the minimum gray value of the pixel in the image to be detected, For the The grayscale mean of the region, is the gray value of the ink background color, The index of the region.
[0030] In some embodiments, obtaining the adaptive filter kernel coefficient of the region according to the light influence degree and the grayscale scaling degree includes:
[0031] The product of the light influence degree and the grayscale scaling degree is calculated, and the product is inversely normalized to obtain the adaptive filter kernel coefficient.
[0032] In some embodiments, determining the adaptive filter kernel of the region according to the adaptive filter kernel coefficient includes:
[0033] The parameters of a preset reference filter kernel are adjusted according to the adaptive filter kernel coefficients to obtain the adaptive filter kernel.
[0034] In some embodiments, the uniformity of ink spraying on the surface of the workpiece is detected according to the target image to obtain a detection result, including:
[0035] Obtaining the texture trace degree of the target image;
[0036] If the texture trace degree is greater than the texture trace degree threshold, it is determined that the ink spraying on the surface of the workpiece is uniform;
[0037] If the texture mark degree is less than or equal to the texture mark degree threshold, it is determined that the ink spraying on the workpiece surface is uneven.
[0038] In some embodiments, obtaining the texture trace level of the target image includes:
[0039] Obtaining the gradient direction of each pixel in the target image;
[0040] Determine a pixel point whose gradient direction is within a set direction range as a target pixel point;
[0041] The sum of the gradient amplitudes of all the target pixel points is calculated as the texture trace degree.
[0042] The present invention has the following beneficial effects: by dividing the ink spraying image on the surface of the workpiece into multiple regions, it is convenient to use different filter kernels for edge detection processing in different regions, and the effect of edge detection can be improved compared with the unified edge detection processing of the entire image. Since the degree of light influence and the degree of grayscale scaling are both factors that affect the edge detection effect, the adaptive filter kernel coefficient is determined by comprehensively considering the degree of light influence and the degree of grayscale scaling of the region, and then the adaptive filter kernel of each region is determined. It can be realized that different filter kernels are used for edge detection processing in different regions according to the light influence and grayscale scaling, thereby improving the edge detection effect and detecting more texture traces. Since the target image obtained after the adaptive edge detection of the image to be detected contains more texture traces, the uniformity detection of the ink spraying on the surface of the workpiece according to the target image can improve the accuracy of the ink spraying uniformity detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] 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.
[0044] Figure 1 A schematic flow chart of a method for implementing an ink spraying uniformity detection device provided by an embodiment of the present invention;
[0045] Figure 2 A schematic diagram of an ink spraying method provided by an embodiment of the present invention;
[0046] Figure 3 A schematic diagram of the X-axis size of a reference filter kernel provided by an embodiment of the present invention;
[0047] Figure 4 A schematic diagram of the Y-axis size of a reference filter kernel provided by an embodiment of the present invention;
[0048] Figure 5 A schematic diagram of the X-axis size of an adaptive filter kernel provided by an embodiment of the present invention;
[0049] Figure 6 A schematic diagram of the Y-axis size of an adaptive filter kernel provided by an embodiment of the present invention;
[0050] Figure 7 A schematic diagram of the X-axis size of a filter kernel of a Sobel operator provided by an embodiment of the present invention;
[0051] Figure 8 A schematic diagram of the Y-axis size of a filter kernel of a Sobel operator provided by an embodiment of the present invention;
[0052] Fig. 9 A schematic diagram of the X-axis size of a filter kernel of a Scharr operator provided by an embodiment of the present invention;
[0053] Fig.10 A schematic diagram of the Y-axis size of a filter kernel of a Scharr operator provided by an embodiment of the present invention;
[0054] Fig.11 A schematic diagram of setting a direction range is provided for an embodiment of the present invention. DETAILED DESCRIPTION
[0055] 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 ink spraying uniformity detection device proposed by the present invention, its specific implementation, structure, characteristics and effects, 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.
[0056] 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.
[0057] The specific scheme of the ink spraying uniformity detection device provided by the present invention is described in detail below with reference to the accompanying drawings.
[0058] See also Figure 1 , which shows a flow chart of a method for implementing an ink spraying uniformity detection device provided by an embodiment of the present invention. The ink spraying uniformity detection device in the embodiment of the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor. The method implemented when the processor executes the computer program includes the following steps:
[0059] S101, collecting an ink spraying image on the surface of a workpiece as an image to be detected, and dividing the image to be detected into multiple areas.
[0060] Figure 2 A schematic diagram of an ink spraying method provided by an embodiment of the present invention is as follows: Figure 2 As shown, in order to make the ink on the surface of the workpiece more uniform, the staff usually sprays the first line of the workpiece from left to right, and then sprays the second line of the workpiece from right to left, and repeats this process until the ink is sprayed on the entire workpiece. The sprayed workpiece can be photographed by an industrial camera to obtain an ink spray image as the image to be detected. The workpiece can be made of metal, and there is no restriction on this.
[0061] In some embodiments, the image to be detected may be divided into a plurality of regions according to the size ratio of the image to be detected. Optionally, the image to be detected may be divided into eight regions.
[0062] S102, obtaining the grayscale value of the ink background color of the image to be detected, and obtaining the light influence degree and grayscale expansion degree of the area according to the grayscale distribution of the area and the grayscale value of the ink background color.
[0063] The degree of light influence can represent the degree of reflection influence and the degree of shadow influence. For a relatively uniform area on the workpiece surface, if the area is reflected brighter in the image, the area is more affected by the reflection, resulting in more edges being detected when the edge detection operator with a larger size is used to detect the edge of the area, showing an uneven state. For an uneven area on the workpiece surface, if the area is reflected darker in the image, the area is more affected by the shadow, resulting in fewer edges being detected when the edge detection operator with a smaller size is used to detect the edge of the area, showing a uniform state. Therefore, the degree of light influence is an influencing factor for the adjustment of the parameters of the adaptive filter kernel. It is necessary to obtain the degree of light influence of each area in the image to be detected to provide a basis for the parameter adjustment of the adaptive filter kernel.
[0064] The grayscale scaling degree can represent the stretching or compression degree of the grayscale gradient amplitude between pixels. The grayscale of the ink itself affects the grayscale range of the image to be detected. Different grayscale ranges will affect the grayscale gradient amplitude between pixels, thus affecting the accuracy of edge detection. Therefore, the grayscale scaling degree is another factor affecting the parameters of the adaptive filter kernel. It is necessary to obtain the grayscale scaling degree of each area in the image to be detected to provide a basis for adjusting the parameters of the adaptive filter kernel.
[0065] In an embodiment of the present invention, the process of obtaining the degree of light influence includes: obtaining the grayscale mean of the area, determining the size relationship between the grayscale mean and the grayscale value of the ink background, and obtaining the degree of light influence based on the size relationship, the grayscale mean and the grayscale value of the ink background.
[0066] Specifically, the grayscale mean of each area can be obtained by the following formula.
[0067]
[0068] in, For the The grayscale mean of the region, For the The number of pixels in the area, For the In the region The gray value of a pixel, is the index of the region, For the The index of the pixel in the region.
[0069] In some embodiments, the grayscale interval of the image to be detected is divided into multiple candidate grayscale intervals, the number of pixels in the candidate grayscale intervals is obtained, the candidate interval with the largest number of pixels is determined as the target grayscale interval, and the average grayscale value of the pixels in the target grayscale interval is obtained as the grayscale value of the ink background color of the workpiece.
[0070] The grayscale range of the image to be detected may be [0, 255].
[0071] Optionally, the grayscale interval of the image to be detected can be divided into 8 grayscale intervals, namely [0,31], [32,63], [64,95], [96,127], [128,159], [160,191], [192,223], and [224,255].
[0072] After the grayscale interval of the image to be detected is divided into 8 candidate grayscale intervals, the number of pixels in each candidate grayscale interval is obtained, and the candidate interval with the largest number of pixels is determined as the target grayscale interval. Since the number of pixels in the target grayscale interval is the largest, the average grayscale value of the pixels in the target grayscale interval is obtained as the grayscale value of the ink background color of the workpiece.
[0073] For each area of the image to be detected, the size relationship between the grayscale mean value of the area and the grayscale value of the ink background is compared, and the light influence degree of the area is obtained according to the size relationship, the grayscale mean value and the grayscale value of the ink background.
[0074] Optionally, the light impact degree is obtained according to a light impact degree formula, wherein the light impact degree formula includes:
[0075]
[0076] in, For the The degree of light influence in an area For the The grayscale mean of the region, is the gray value of the ink background color, is the maximum grayscale mean value in multiple areas of the image to be detected, is the minimum grayscale mean value among multiple regions of the image to be detected, The index of the region.
[0077] From the light influence degree formula, we can know that for each area of the image to be detected, if the grayscale mean of the area Greater than or equal to the gray value of the ink base color , then calculate the gray mean Gray value of ink background The first difference between ) is used as the reference to normalize the first difference to obtain the light influence degree of the area. If the grayscale mean of the area Less than the gray value of ink background , then calculate the gray value of the ink background color Grayscale mean The second difference between ) is used as a reference to perform reverse normalization on the second difference to obtain the degree of light influence in the area.
[0078] In an embodiment of the present invention, for each area of the image to be detected, when the grayscale mean of the area is greater than or equal to the grayscale value of the ink background color, the area is mainly affected by reflection, wherein the larger the grayscale mean of the area, the greater the brightness of the area, and correspondingly, the greater the degree of reflection of the area, the greater the degree of influence of light on the area. When the grayscale mean of the area is less than the grayscale value of the ink background color, the area is mainly affected by shadows, wherein the smaller the grayscale mean of the area, the lower the brightness of the area, and correspondingly, the smaller the degree of reflection of the area, the smaller the degree of influence of light, that is, the greater the degree of influence of shadows. Therefore, by calculating the degree of light influence of each area in the area to be detected through the light influence degree formula, the degree of influence of each area on reflection or shadow can be accurately reflected, thereby providing a reliable basis for the subsequent adaptive edge detection of each area, thereby improving the edge detection effect of the image.
[0079] Furthermore, in an embodiment of the present invention, the process of obtaining the grayscale stretching degree includes: determining the maximum grayscale value and the minimum grayscale value of the pixel points in the image to be detected, and obtaining the grayscale stretching degree according to the size relationship, the maximum grayscale value, the minimum grayscale value, the grayscale mean and the grayscale value of the ink background color.
[0080] The grayscale value of each pixel in the image to be detected can be obtained and compared to determine the maximum grayscale value and the minimum grayscale value, and then the size relationship between the grayscale mean value of the area and the grayscale value of the ink background color is compared. According to the size relationship, the maximum grayscale value, the minimum grayscale value, the grayscale mean value and the grayscale value of the ink background color, the degree of grayscale stretching is obtained.
[0081] Optionally, the grayscale scaling degree is obtained according to a grayscale scaling degree formula, wherein the grayscale scaling degree formula includes:
[0082]
[0083] in, For the The grayscale scaling degree of each region is is the maximum gray value of the pixel in the image to be detected, is the minimum gray value of the pixel in the image to be detected, For the The grayscale mean of the region, is the gray value of the ink background color, The index of the region.
[0084] According to the light influence degree formula, for each area of the image to be detected, if the grayscale mean value of the area is greater than or equal to the grayscale value of the ink background color, the maximum grayscale value of the pixel in the image to be detected is calculated. Gray value of ink background The third difference between ) is used as a reference to normalize the third difference to obtain the grayscale expansion degree of the area. If the grayscale mean value of the area is less than the grayscale value of the ink background, the grayscale value of the ink background is calculated. The minimum gray value of the pixel in the image to be detected The fourth difference between ) is used as the reference to perform reverse normalization on the fourth difference, that is, ( ), and obtain the grayscale scaling degree of the area.
[0085] In an embodiment of the present invention, for each area, when the grayscale mean value of the area is greater than or equal to the grayscale value of the ink background color, it indicates that the area is mainly affected by reflection, wherein the greater the degree of reflection influence, the greater the degree of stretching of the grayscale gradient amplitude between pixels, that is, the greater the degree of grayscale scaling; when the grayscale mean value of the area is less than the grayscale value of the ink background color, it indicates that the area is mainly affected by shadows, wherein the greater the degree of shadow influence, the greater the degree of compression of the grayscale gradient amplitude between pixels, that is, the smaller the degree of grayscale scaling.
[0086] S103, acquiring an adaptive filter kernel coefficient of the region according to the degree of light influence and the degree of grayscale scaling, and determining an adaptive filter kernel of the region according to the adaptive filter kernel coefficient.
[0087] In some embodiments, the product of the light influence degree and the grayscale scaling degree is calculated, and the product is inversely normalized to obtain an adaptive filter kernel coefficient.
[0088] Specifically, the adaptive filter kernel coefficient may be calculated using the following adaptive filter kernel coefficient formula.
[0089]
[0090] in, For the Adaptive filter kernel coefficients of regions, is the normalization function, For the The degree of light influence in an area For the The grayscale scaling degree of each region is is the index of the region, Indicates that the product of the light influence and the grayscale scaling is reverse normalized.
[0091] It can be seen from the adaptive filter kernel coefficient formula that for each area in the image to be detected, the greater the degree of light influence and grayscale scaling of the area, the smaller the adaptive filter kernel coefficient of the area, and accordingly, the smaller the size of the adaptive filter kernel, the smaller the degree of light influence and grayscale scaling of the area, the larger the adaptive filter kernel coefficient of the area, and accordingly, the larger the size of the adaptive filter kernel. Therefore, for areas with greater degree of light influence and grayscale scaling in the image to be detected, a smaller adaptive filter kernel can be used for edge detection processing, and for areas with less degree of light influence and grayscale scaling in the image to be detected, a larger adaptive filter kernel can be used for edge detection processing, so as to achieve better edge detection effect.
[0092] In some embodiments, the parameters of a preset reference filter kernel are adjusted according to the adaptive filter kernel coefficients to obtain an adaptive filter kernel.
[0093] Optionally, the parameters of the preset reference filter kernel may be adjusted by the following formula (1) and formula (2) to obtain an adaptive filter kernel.
[0094] (1)
[0095] (2)
[0096] in, is the first size parameter of the benchmark filter kernel, is the second size parameter of the benchmark filter kernel, is the first size parameter of the adaptive filter kernel, It is the second size parameter of the adaptive filter kernel.
[0097] For example, Figure 3 A schematic diagram of the X-axis size of a reference filter kernel provided by an embodiment of the present invention, Figure 4 A schematic diagram of the Y-axis size of a reference filter kernel provided by an embodiment of the present invention, Figure 5 A schematic diagram of the X-axis size of an adaptive filter kernel provided by an embodiment of the present invention, Figure 6 A schematic diagram of the Y-axis size of an adaptive filter kernel provided by an embodiment of the present invention. Figure 3 and Figure 4 As shown, the first size parameter of the benchmark filter kernel is 2, and the second size parameter is 8.
[0098] The size parameters of the reference filter kernel can be adjusted by the following formulas (3) and (4).
[0099] (3)
[0100] (4)
[0101] Specifically, the above formula (3) and formula (4) can be used to Figure 3 The X-axis size of the benchmark filter kernel shown is adjusted to obtain Figure 5 The X-axis size of the adaptive filter kernel shown in the figure, and the above formulas (3) and (4) for Figure 4 The Y-axis size of the benchmark filter kernel shown is adjusted to obtain Figure 6 The x-axis dimension of the adaptive filter kernel is shown.
[0102] It should be noted that the reference filter kernel can be set according to actual needs and is not limited here.
[0103] Optionally, the reference filter kernel may be determined according to the filter kernel of the Sobel operator and the filter kernel of the Scharr operator.
[0104] Figure 7 A schematic diagram of the X-axis size of a filter kernel of a Sobel operator provided by an embodiment of the present invention, Figure 8 A schematic diagram of the Y-axis size of a filter kernel of a Sobel operator provided by an embodiment of the present invention, Fig. 9 A schematic diagram of the X-axis size of a filter kernel of a Scharr operator provided by an embodiment of the present invention, Fig.10 A schematic diagram of the Y-axis size of a filter kernel of a Scharr operator provided by an embodiment of the present invention.
[0105] calculate Figure 7 The X-axis size of the filter kernel of the Sobel operator shown is Fig. 9 The difference between the X-axis dimensions of the filter kernel of the Scharr operator shown in the figure can be obtained Figure 3 The X-axis dimension of the base filter kernel is shown. Figure 8 The Y-axis size of the filter kernel of the Sobel operator shown is Fig.10 The difference between the Y-axis dimensions of the filter kernel of the Scharr operator shown in the figure can be obtained Figure 4 The Y-axis dimension of the baseline filter kernel is shown.
[0106] S104, performing edge detection processing on the region according to the adaptive filtering kernel to obtain a target image.
[0107] After obtaining the adaptive filter kernel of each area in the image to be detected, edge detection processing is performed on the corresponding area through the adaptive filter kernel, and the target image is obtained after all areas are processed.
[0108] S105, detecting the uniformity of ink spraying on the workpiece surface according to the target image to obtain a detection result.
[0109] In the embodiment of the present invention, the texture traces in the target image are caused by the inconsistent coating thickness between the upper and lower rows on the workpiece surface, which mainly manifests as transverse textures. Therefore, the uniformity of ink spraying on the workpiece surface can be detected according to the degree of texture traces in the target image.
[0110] In an embodiment of the present invention, the uniformity of ink spraying on the surface of the workpiece is detected according to the target image to obtain a detection result, including: obtaining the texture trace degree of the target image, if the texture trace degree is greater than the texture trace degree threshold, it is determined that the ink spraying on the surface of the workpiece is uniform; if the texture trace degree is less than or equal to the texture trace degree threshold, it is determined that the ink spraying on the surface of the workpiece is uneven.
[0111] Since the texture traces in the target image are mostly manifested as horizontal textures, and their gradient direction is usually vertical, the degree of texture traces of the target image can be obtained according to the gradient direction of the pixel points in the target image.
[0112] Optionally, the gradient direction of each pixel in the target image is obtained, pixels whose gradient directions are within a set direction range are determined as target pixels, and the sum of the gradient amplitudes of all target pixels is calculated as the degree of texture traces.
[0113] It should be noted that the direction range can be set according to actual needs and is not limited here. Fig.11 A schematic diagram of setting a direction range is provided for an embodiment of the present invention. Optionally, as Fig.11 As shown, the set direction range can be a range of 5 degrees to the left and right in the vertical direction.
[0114] After determining the target pixel point in the target image, the gradient amplitude of the target pixel point is obtained, and then the sum of the gradient amplitudes of all the target pixel points is calculated by the following formula as the texture trace degree.
[0115]
[0116] in, is the texture trace degree of the target image, For the The gradient amplitude of the target pixel, is the index of the target pixel, is the total number of target pixels.
[0117] In the embodiment of the present invention, the greater the sum of the gradient amplitudes of all target pixel points, the more obvious the texture traces of the target image, and accordingly, the greater the degree of texture traces of the target image, the smaller the sum of the gradient amplitudes of all target pixel points, the less obvious the texture traces of the target image, and accordingly, the smaller the degree of texture traces of the target image. Therefore, the sum of the gradient amplitudes of all target pixel points can be used as the degree of texture traces to improve the accuracy of the degree of texture traces, thereby providing a reliable basis for subsequent uniformity judgment of ink spraying.
[0118] Among them, the greater the degree of texture traces, the more and more obvious the transverse textures in the target image are, and the smaller the degree of texture traces, the fewer and less obvious the transverse textures in the target image are. Therefore, whether the ink spraying on the workpiece surface is uniform can be judged according to the degree of texture traces.
[0119] Further, after obtaining the texture trace degree of the target image, it is determined whether the texture trace degree is greater than the texture trace degree threshold. If so, it is determined that the ink spraying on the workpiece surface is uniform; if not, it is determined that the ink spraying on the workpiece surface is uneven.
[0120] It should be noted that the texture trace degree threshold can be set according to actual needs and is not limited here. Optionally, the texture trace degree threshold can be 50.
[0121] In the embodiment of the present invention, the gradient direction and gradient amplitude of each pixel in the target image can be obtained by an edge detection algorithm, wherein the edge detection algorithm is a well-known technology and will not be described in detail here.
[0122] In summary, in the embodiment of the present invention, by dividing the ink spraying image on the surface of the workpiece into multiple regions, it is convenient to use different filter kernels for edge detection processing in different regions, which can improve the effect of edge detection compared with the unified edge detection processing of the entire image. Since the degree of light influence and the degree of grayscale scaling are factors that affect the edge detection effect, by comprehensively considering the degree of light influence and grayscale scaling of the region, the adaptive filter kernel coefficient is determined, and then the adaptive filter kernel of each region is determined. It can be realized that different filter kernels are used for edge detection processing in different regions according to the light influence and grayscale scaling, thereby improving the edge detection effect and detecting more texture traces. Since the target image obtained after adaptive edge detection of the image to be detected contains more texture traces, the uniformity detection of ink spraying on the surface of the workpiece according to the target image can improve the accuracy of ink spraying uniformity detection.
[0123] 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.
[0124] 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. An ink spraying uniformity detection device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: The method implemented when the processor executes the computer program includes: Collecting an ink spraying image on the surface of a workpiece as an image to be detected, and dividing the image to be detected into multiple areas; Obtaining the grayscale value of the ink background color of the image to be detected, and obtaining the light influence degree and grayscale expansion degree of the area according to the grayscale distribution of the area and the grayscale value of the ink background color; According to the light influence degree and the grayscale scaling degree, an adaptive filter kernel coefficient of the region is acquired, and according to the adaptive filter kernel coefficient, an adaptive filter kernel of the region is determined; Performing edge detection processing on the region according to the adaptive filter kernel to obtain a target image; According to the target image, the uniformity of ink spraying on the surface of the workpiece is detected to obtain a detection result.
2. The ink spraying uniformity detection device according to claim 1, characterized in that: The process of obtaining the light influence degree includes: Obtaining the grayscale mean of the region; Determine the magnitude relationship between the grayscale mean and the grayscale value of the ink background color; The light influence degree is obtained according to the size relationship, the grayscale mean value and the ink background grayscale value.
3. The ink spraying uniformity detection device according to claim 2, characterized in that: The step of obtaining the light influence degree according to the size relationship, the grayscale mean value and the ink background grayscale value includes: The light influence degree is obtained according to a light influence degree formula, wherein the light influence degree formula includes: in, For the The degree of light influence in an area For the The grayscale mean of the region, is the gray value of the ink background color, is the maximum grayscale mean value in multiple areas of the image to be detected, is the minimum grayscale mean value among multiple regions of the image to be detected, The index of the region.
4. The ink spraying uniformity detection device according to claim 1, characterized in that: The process of obtaining the grayscale value of the ink background color includes: Dividing the grayscale interval of the image to be detected into a plurality of candidate grayscale intervals; Obtaining the number of pixels in the candidate grayscale interval, and determining the candidate interval with the largest number of pixels as the target grayscale interval; The average grayscale value of the pixels within the target grayscale interval is obtained as the grayscale value of the ink background color of the workpiece.
5. The ink spraying uniformity detection device according to claim 2, characterized in that: The process of obtaining the grayscale scaling degree includes: Determine the maximum grayscale value and the minimum grayscale value of the pixels in the image to be detected; The grayscale expansion degree is obtained according to the size relationship, the maximum grayscale value, the minimum grayscale value, the grayscale mean value and the ink background grayscale value.
6. The ink spraying uniformity detection device according to claim 5, characterized in that: The step of obtaining the grayscale expansion degree according to the size relationship, the maximum grayscale value, the minimum grayscale value, the grayscale mean value, and the ink background grayscale value includes: The grayscale scaling degree is obtained according to a grayscale scaling degree formula, wherein the grayscale scaling degree formula includes: in, For the The grayscale scaling degree of each region is is the maximum gray value of the pixel in the image to be detected, is the minimum gray value of the pixel in the image to be detected, For the The grayscale mean of the region, is the gray value of the ink background color, The index of the region.
7. The ink spraying uniformity detection device according to claim 1, characterized in that: The step of obtaining the adaptive filter kernel coefficient of the region according to the light influence degree and the grayscale scaling degree includes: The product of the light influence degree and the grayscale scaling degree is calculated, and the product is inversely normalized to obtain the adaptive filter kernel coefficient.
8. The ink spraying uniformity detection device according to claim 1, characterized in that: The step of determining the adaptive filter kernel of the region according to the adaptive filter kernel coefficient comprises: The parameters of a preset reference filter kernel are adjusted according to the adaptive filter kernel coefficients to obtain the adaptive filter kernel.
9. The ink spraying uniformity detection device according to claim 1, characterized in that: The method of detecting the uniformity of ink spraying on the surface of the workpiece according to the target image to obtain a detection result includes: Obtaining the texture trace degree of the target image; If the texture trace degree is greater than the texture trace degree threshold, it is determined that the ink spraying on the surface of the workpiece is uniform; If the texture mark degree is less than or equal to the texture mark degree threshold, it is determined that the ink spraying on the workpiece surface is uneven.
10. The ink spraying uniformity detection device according to claim 9, characterized in that: The step of obtaining the texture trace degree of the target image comprises: Obtaining the gradient direction of each pixel in the target image; Determine a pixel point whose gradient direction is within a set direction range as a target pixel point; The sum of the gradient amplitudes of all the target pixel points is calculated as the texture trace degree.
