CN118037718B - Electrical terminal production defect detection method - Google Patents

Electrical terminal production defect detection method Download PDF

Info

Publication number
CN118037718B
CN118037718B CN202410430739.XA CN202410430739A CN118037718B CN 118037718 B CN118037718 B CN 118037718B CN 202410430739 A CN202410430739 A CN 202410430739A CN 118037718 B CN118037718 B CN 118037718B
Authority
CN
China
Prior art keywords
image
column
value
expansion
processed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410430739.XA
Other languages
Chinese (zh)
Other versions
CN118037718A (en
Inventor
周吉祥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Haimen Yulong Photoelectric Technology Co ltd
Original Assignee
Haimen Yulong Photoelectric Technology Co ltd
Filing date
Publication date
Application filed by Haimen Yulong Photoelectric Technology Co ltd filed Critical Haimen Yulong Photoelectric Technology Co ltd
Priority to CN202410430739.XA priority Critical patent/CN118037718B/en
Publication of CN118037718A publication Critical patent/CN118037718A/en
Application granted granted Critical
Publication of CN118037718B publication Critical patent/CN118037718B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention relates to the technical field of image processing, in particular to a method for detecting production defects of an electrical terminal, which comprises the following steps: obtaining an image to be processed of an electrical terminal; obtaining gray scale duty ratio, fluctuation value and different areas; obtaining a distribution judgment quantity; obtaining the degree of confusion and the evaluation index of each expansion image, and finally obtaining a preliminary expansion image; calculating the complementary judgment quantity to obtain a detection image; and obtaining a detection result to finish the production defect detection of the electrical terminal. According to the invention, the calculation of the regional distribution judgment quantity of the images by using the row information and the column information is measured, so that the calculation results in different regions have the distribution characteristics of the electrical terminals in the respective regions, the calculation is performed by using the integral information of the electrical terminal images, the process of performing multi-time traversal calculation on local parameters is avoided, the calculation quantity of an algorithm is greatly reduced, and the detection of the production defects of the electrical terminals is accurately and efficiently completed.

Description

Electrical terminal production defect detection method
Technical Field
The invention relates to the technical field of image processing, in particular to a method for detecting production defects of an electrical terminal.
Background
In the process of detecting the defects of the production of the electrical terminal, the shape edges of the image of the electrical terminal can be supplemented according to morphological processing, and defect detection can be performed according to the proportion of the supplemented information, but in fact, different defect types exist in different areas of the image of the electrical terminal, the image of the electrical terminal cannot be subjected to simple and uniform morphological processing to obtain a good detection effect in different areas at the same time, and the algorithm calculation amount is overlarge due to the fact that the iterative operation is performed after the local gradient calculation is performed according to the pixel points.
Disclosure of Invention
In order to solve the above problems, the present invention provides a method for detecting defects in the production of electrical terminals.
The invention relates to a method for detecting production defects of an electrical terminal, which adopts the following technical scheme:
an embodiment of the present invention provides a method for detecting a production defect of an electrical terminal, including the steps of:
Obtaining an image to be processed of an electrical terminal;
Counting a row gray level total value curve and a column gray level total value curve on an image to be processed, obtaining gray level duty ratio of each row according to the row gray level total value curve, obtaining a trusted column according to the column gray level total value curve, dividing the image to be processed into four areas according to the trusted column, calculating fluctuation value of each column, and obtaining distribution judgment quantity of each pixel point according to the gray level duty ratio of each row, the fluctuation value of each column and different areas;
Performing expansion iteration on the image to be processed, obtaining the chaotic degree of each region by using the distribution judgment quantity of each pixel point in the iteration process, calculating the evaluation index of each expansion image according to the chaotic degree of each region, obtaining a preliminary expansion image by using the evaluation index of each expansion image, and correcting and iterating the preliminary expansion image by calculating the complementary judgment quantity of each expansion image to obtain a detection image;
And calculating the difference between the detection image and the image to be processed to obtain a detection result, and finishing the production defect detection of the electrical terminal according to the detection result.
Preferably, the statistical row gray level total value curve and the column gray level total value curve comprise the following specific steps:
Counting the gray value sum of the pixel points of each row of the image to be processed, and taking the column number of the image to be processed as an abscissa and the gray value sum of the pixel points of each row as an ordinate to obtain a row gray value total curve of the image to be processed; and counting the gray value sum of the pixel points of each column of the image to be processed, and obtaining a column gray value total curve of the image to be processed by taking the row number of the image to be processed as the abscissa and the gray value sum of the pixel points of each column as the ordinate.
Preferably, the gray scale duty ratio of each row is obtained according to the row gray scale total value curve, and the trusted column is obtained according to the column gray scale total value curve, which comprises the following specific steps:
Calculating the sum of gray values of all pixel points in the image to be processed, calculating the sum of gray values of the pixel points of each row according to a row gray total value curve, calculating the ratio of the sum of the gray values of the pixel points of each row to the sum of the gray values of all pixel points in the image to be processed, and recording the ratio as the gray duty ratio of each row; calculating the slope of each point on the column gray level total value curve, when the absolute value of the slope of the point a is larger than a preset slope threshold value, marking the column corresponding to the point a as a trusted column, and calculating the slopes of all the points on the column gray level total value curve to obtain a plurality of trusted columns.
Preferably, the method includes the specific steps of dividing the image to be processed into four areas according to the trusted columns and calculating the fluctuation value of each column, wherein the specific steps are as follows:
Counting the difference value of the number of columns of each trusted column and the right trusted column adjacent to the trusted column, and recording the difference value as the trusted distance of each trusted column; counting the largest first three trusted distances in the trusted distances of all trusted columns, dividing the image to be processed into four areas by taking the trusted column corresponding to the largest first three trusted distances as a boundary, marking the four areas as four areas I, II, III and IV in sequence from left to right, calculating the variance of the gray values of all pixel points in each area, marking the variance of the gray values of all pixel points in each area as the integral fluctuation value of each area, and calculating the variance of the gray values of all pixel points in each area as the fluctuation value of each column.
Preferably, the specific calculation formula for obtaining the distribution judgment quantity of each pixel point according to the gray scale ratio of each row, the fluctuation value of each column and different areas is as follows:
Wherein, Represent the firstLine 1The distribution of pixels of a column determines the amount,Represent the firstThe gray scale ratio of the row,Represent the firstThe value of the fluctuation of the column,Represent the firstThe overall fluctuation value of the region to which the column belongs,Represent the firstTrusted distance of columns.
Preferably, the expanding iteration is performed on the image to be processed, and the chaotic degree of each region is obtained by using the distribution judgment quantity of each pixel point in the iteration process, which comprises the following specific steps:
Setting an initial expansion structural element, performing expansion operation on an image to be processed by using the initial expansion structural element to obtain a primary expansion image, calculating the variance of the distribution judgment quantity of all pixels of each region in the primary expansion image, and recording the variance as the chaotic degree of each region.
Preferably, the specific calculation formula for calculating the evaluation index of each expansion image according to the chaotic degree of each region is as follows:
Wherein, Representation ofAn evaluation index of the secondary expansion image,Representation ofThe effective duty cycle of the secondary dilation image,Representation ofThe amount of differential variation of the secondary dilation image,AndRespectively representThe degree of confusion in the four regions I, II, III and IV in the secondary dilation image,An exponential function based on a natural constant is represented.
Preferably, the saidThe specific acquisition method of the effective duty ratio of the secondary expansion image is as follows:
Calculation of The arithmetic mean value of the distribution judgment quantity of all pixel points in the subspan image is recorded asIntegral judgment value of secondary expansion image and statisticsPixels with the judgment value larger than the overall judgment value are distributed in each region in the secondary expansion image and marked as trusted pixels; the number of the trusted pixel points is calculatedThe ratio of the number of all pixel points with gray values not equal to 0 in the subspan image is recorded asThe effective duty cycle of the secondary dilation image.
Preferably, the saidThe specific acquisition method of the differential variation of the secondary expansion image is as follows:
counting the sum of gray values of all pixel points in an image to be processed, and counting Calculating the sum of the gray values of all the pixels in the image to be processed and the sum of the gray values of all the pixels in the sub-expansion imageDividing the absolute value of the difference value of the sum of the gray values of all the pixels in the sub-expansion image by the sum of the gray values of all the pixels in the image to be processedThe differential variation of the secondary dilation image.
Preferably, the preliminary expansion image is obtained by using the evaluation index of each expansion image, and the specific steps are as follows:
Calculating the absolute value of the difference between the evaluation index of the primary expansion image and the evaluation index of the standard component, dividing the absolute value of the difference by the evaluation index of the standard component to obtain the structural element judgment amount of the primary expansion image, comparing the structural element judgment amount of the primary expansion image with the preset judgment amount threshold value, expanding the primary expansion image by the initial expansion structural element to obtain the secondary expansion image if the structural element judgment amount of the primary expansion image is larger than or equal to the preset judgment amount threshold value, calculating the structural element judgment amount of the secondary expansion image and the preset judgment amount threshold value, expanding the secondary expansion image by the initial expansion structural element to obtain the tertiary expansion image if the structural element judgment amount of the secondary expansion image is larger than or equal to the preset judgment amount threshold value, and so on The structural element judgment quantity of the secondary expansion image is smaller than a preset judgment quantity threshold value, and the structural element judgment quantity of the secondary expansion image is equal to or smaller than the preset judgment quantity threshold valueThe secondary dilation image is noted as a preliminary dilation image.
The technical scheme of the invention has the beneficial effects that: aiming at the technical problem that the image of the electrical terminal cannot obtain better detection effect in different areas at the same time by simple and unified morphological processing, the invention measures different column information by utilizing row information and column information, and calculates the distribution judgment quantity of the image in different areas by utilizing the different column information, so that the calculation result in different areas has the distribution characteristics of the electrical terminal in each area; aiming at the problem that the algorithm calculated amount is overlarge because the iterative operation is carried out after the local gradient calculation is carried out according to the pixel points, the invention uses the integral characteristic quantity in the image as a screening condition in the iterative process of the final optimal structural element, avoids the process of carrying out repeated traversal calculation on the local parameters, and greatly reduces the algorithm calculated amount.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart showing the steps of a method for detecting defects in electrical terminal production according to the present invention;
fig. 2 is a schematic view of a partition of an appliance terminal.
Detailed Description
In order to further describe the technical means and effects adopted by the invention to achieve the preset aim, the following detailed description refers to specific implementation, structure, characteristics and effects of an electrical terminal production defect detection method according to the invention, which are provided by the invention, with reference to the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" means that the embodiments are not necessarily the same. Furthermore, the particular features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
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.
The following specifically describes a specific scheme of the method for detecting the production defects of the electrical terminal provided by the invention with reference to the accompanying drawings.
Referring to fig. 1, a flowchart of steps of a method for detecting defects in production of an electrical terminal according to an embodiment of the invention is shown, the method includes the following steps:
S001: and acquiring an electric appliance terminal image, and preprocessing the electric appliance terminal image to obtain an image to be processed.
In the case of performing the area division processing on the electric terminals, it is necessary to match the electric terminals with the information in the horizontal direction and the vertical direction of the image, and therefore, it is necessary to match the horizontal and vertical directions of the electric terminals in the image with the horizontal and vertical directions of the image itself.
Specifically, an industrial camera is utilized to photograph an electrical terminal on a detection assembly line to obtain an electrical terminal image, the electrical terminal image is subjected to graying to obtain a gray image, hough straight line detection is carried out on the gray image to obtain a plurality of straight lines, the slope and intercept of each straight line are counted, straight lines in the horizontal direction are screened out according to parameters of the straight lines, the average slope of all horizontal lines in the gray image is calculated, then a rotation angle is obtained according to an arctangent function, and the gray image is corrected according to the calculated rotation angle by affine transformation according to the rotation angle to obtain an image to be processed.
Thus, an image to be processed is obtained.
S002: on an image to be processed, counting a row gray level total value curve and a column gray level total value curve, obtaining the gray level duty ratio of each row according to the row gray level total value curve, obtaining a trusted column according to the column gray level total value curve, dividing the image to be processed into four areas according to the trusted column, calculating the fluctuation value of each column, and obtaining the distribution judgment quantity of each pixel point according to the gray level duty ratio of each row, the fluctuation value of each column and different areas.
It should be noted that, there is information unified with the horizontal and vertical directions of the electrical terminal in the horizontal and vertical directions of the image to be processed, and according to these information, the area of the electrical terminal may be divided, for convenience of description, in this embodiment, a schematic diagram of the area of the electrical terminal is shown in fig. 2, where the defect types of the A, C area are similar, the defect types of the B, D area are similar, if the four areas are simultaneously processed in morphology, a better effect cannot be obtained, and if the processing unit performs morphology adaptation based on each pixel point in the image to be processed, the calculated amount is too large, so that the image is divided according to the overall information in the horizontal and vertical directions to obtain four areas of i, ii, iii and iv, and preliminary morphological processing is performed, and the structural elements of the morphological processing are preliminarily determined. Wherein the four regions I, II, III, IV correspond to the four regions A, B, C, D in FIG. 2, respectively.
Specifically, counting the gray value sum of the pixel points of each row of the image to be processed, and obtaining a row gray value total curve of the image to be processed by taking the column number of the image to be processed as the abscissa and the gray value sum of the pixel points of each row as the ordinate; counting the total gray value of the pixel points of each column of the image to be processed, and taking the line number of the image to be processed as an abscissa and the total gray value of the pixel points of each column as a value of an ordinate to be processed; calculating the sum of gray values of all pixel points in the image to be processed, calculating the sum of gray values of the pixel points of each row according to a row gray total value curve, calculating the ratio of the sum of the gray values of the pixel points of each row to the sum of the gray values of all pixel points in the image to be processed, and recording the ratio as the gray duty ratio of each row; calculating the slope of each point on the column gray level total value curve, when the absolute value of the slope of the point a is larger than a preset slope threshold value, marking the column corresponding to the point a as a trusted column, and calculating the slopes of all the points on the column gray level total value curve to obtain a plurality of trusted columns, wherein the preset slope threshold value is taken as 30 as an example in the embodiment, and the embodiment is not limited; counting the difference value of the number of columns of each trusted column and the right trusted column adjacent to the trusted column, and recording the difference value as the trusted distance of each trusted column; counting the largest first three trusted distances in the trusted distances of all trusted columns, dividing the image to be processed into four areas by taking the trusted column corresponding to the largest first three trusted distances as a boundary, sequentially marking the four areas as four areas I, II, III and IV from left to right, calculating the variance of the gray values of all pixel points in each area as the integral fluctuation value of each area, calculating the variance of the gray values of all pixel points in each column in each area as the fluctuation value of each column, and calculating the distribution judgment of each pixel point according to the specific calculation formula:
Wherein, Represent the firstLine 1The distribution of pixels of a column determines the amount,Represent the firstThe gray scale ratio of the row,Represent the firstThe value of the fluctuation of the column,Represent the firstThe overall fluctuation value of the region to which the column belongs,Represent the firstTrusted distance of columns. The gray scale ratio of each line measures the probability of whether all pixels on that line belong within the overall more interesting image region,Taking into account that the gray scale ratio takes a value of 0 to 1, the characterization result of the distribution judgment quantity can be a value with large difference, so that the whole range of the value is enlarged by utilizing the mode instead of limiting the value by using the gray scale ratio, and the reliable distance between each column of fluctuation value and the whole fluctuation value in each area is combined, when the difference between each column of fluctuation value and the whole fluctuation value in each area is larger, the whole distribution of the column in the area is characterized to be relatively uneven, the defect of an electric appliance terminal is possibly existed, and when the reliable distance of each column is larger, the distance of the next reliable column is far, the reliability of the reliable column is not high, the defect of the electric appliance terminal is possibly existed between the column and the next reliable column is characterized, and when the reliable distance of each column is larger, the defect of the electric appliance terminal is possibly existedThe larger the distribution judgment amount of the column is, the larger the distribution judgment amount of each pixel point is calculated by utilizing the row information and the column information, and the neighborhood analysis of each pixel point is not needed, so that the calculated amount is greatly reduced under the condition of ensuring a certain detection precision.
Thus, the distribution judgment amount of each pixel point is obtained.
S003: performing expansion iteration on the image to be processed, obtaining the chaotic degree of each region by using the distribution judgment quantity of each pixel point in the iteration process, calculating the evaluation index of each expansion image according to the chaotic degree of each region, obtaining a preliminary expansion image by using the evaluation index of each expansion image, and correcting and iterating the preliminary expansion image by calculating the complementary judgment quantity of each expansion image to obtain a detection image.
It should be noted that, after obtaining the distribution judgment quantity of the pixel points in different areas of the image to be processed according to the row and column information, the iterative acquisition of the expansion optimal structural element can be performed according to different distribution judgment quantities as judgment basis, finally, the difference before and after morphological processing is utilized to obtain the detection result, in this process, how the final result of morphological processing is determined and the standard to be measured in each iterative process needs to be considered, the final result of morphological processing can be rapidly compared by using the standard component method, for the standard to be measured in each iterative process, as shown in fig. 2, the pixel points of the electrical terminals in the B, D area are denser, the size of the required expansion structural element is larger, the pixel points of the electrical terminals in the A, C area are arranged into a plurality of parallel lines, the size of the required expansion structural element is smaller, and the requirement is found that the distribution judgment quantity of the pixel points can be simply used for carrying out positive correlation measurement, but the distribution judgment quantity of the pixel points can not be used, in part can not obtain better effect by the distribution judgment quantity of the pixel points, in order to reduce the calculated quantity, in order to calculate the local calculation quantity, the pixel points can be calculated independently, and the local calculation quantity can not be calculated to obtain the effect on the local expansion structural element is quite different in the whole area, and the local calculation is quite different, and the local calculation effect can be combined with the local calculation effect is quite large, and the local difference can not be calculated.
Specifically, an initial expansion structural element is arranged, the initial expansion structural element is rectangular in shape and is of a sizeThe embodiment usesFor illustration, without limiting the size, performing expansion operation on an image to be processed by using an initial expansion structural element to obtain a primary expansion image, calculating variance of distribution judgment quantity of all pixels in each region in the primary expansion image, marking the variance as chaotic degree of each region, calculating an arithmetic mean value of the distribution judgment quantity of all pixels in the primary expansion image, marking the arithmetic mean value as an integral judgment value of the primary expansion image, and counting pixels with distribution judgment quantity larger than the integral judgment value in each region in the primary expansion image as credible pixels; the ratio of the number of the credible pixel points to the number of the pixel points with the gray value not being 0 in the primary expansion image is recorded as the effective duty ratio of the primary expansion image; counting the sum of gray values of all pixels in the image to be processed, counting the sum of gray values of all pixels in the primary expansion image, calculating the absolute value of the difference value between the sum of gray values of all pixels in the image to be processed and the sum of gray values of all pixels in the primary expansion image, dividing the absolute value by the sum of gray values of all pixels in the image to be processed to obtain the difference variation of the primary expansion image, and calculating the evaluation index of the primary expansion image, wherein the specific calculation formula is as follows:
Wherein, Representation ofAn evaluation index of the secondary expansion image,Representation ofThe effective duty cycle of the secondary dilation image,Representation ofThe amount of differential variation of the secondary dilation image,AndRespectively representThe degree of confusion of the four areas I, II, III and IV in the secondary expansion image,An exponential function based on a natural constant is represented.And in the moleculeAndThe normalization processing is only carried out after the local information of two different areas is measured, the normalization weight is to measure the two different areas by the effective duty ratio and the difference variation, the integral confusion degree of the I area and the III area is represented by the normalization square sum of the confusion degree of the I area and the III area, the pixel point distribution of the two areas is concentrated and is modified by the difference variation, and the integral confusion degree of the II area and the IV area is modified by the effective duty ratio and finally the method is obtainedThe evaluation index, which is the judgment of the effect of the sub-expansion image on the whole and on the part, is obviously that the increase of the degree of confusion in that area leads toThe evaluation index of the sub-expansion image is increased, wherein the difference variation is scaled by using an exponential function because the variation amplitude of the difference variation needs to be large, and the exponential function can just meet the requirement.
Further, calculating the absolute value of the difference between the evaluation index of the primary expansion image and the evaluation index of the standard component, dividing the absolute value of the difference by the evaluation index of the standard component to obtain the structural element judgment amount of the primary expansion image, comparing the structural element judgment amount of the primary expansion image with the preset judgment amount threshold, expanding the primary expansion image by the initial expansion structural element to obtain a secondary expansion image if the structural element judgment amount of the primary expansion image is larger than or equal to the preset judgment amount threshold, calculating the structural element judgment amount of the secondary expansion image and the preset judgment amount threshold, expanding the secondary expansion image by the initial expansion structural element to obtain a tertiary expansion image if the structural element judgment amount of the secondary expansion image is larger than or equal to the preset judgment amount threshold, and so onThe structural element judgment quantity of the secondary expansion image is smaller than a preset judgment quantity threshold value, and the structural element judgment quantity of the secondary expansion image is equal to or smaller than the preset judgment quantity threshold valueThe secondary dilation image is noted as a preliminary dilation image. The present embodiment is described by taking a preset threshold value of 0.1 as an example, and is not limited thereto. The specific obtaining method of the evaluation index of the standard component comprises the following steps: taking a plurality of qualified electrical appliance terminals to photograph to obtain images, calculating the evaluation index of each image, and taking an arithmetic mean value of the evaluation indexes of all the images to obtain the evaluation index of the standard component.
It should be further noted that after the preliminary expansion image is obtained, the expansion optimal structural element can be obtained roughly, but because the integral calculation process depends on the integral characteristics too, the expansion iteration process may be ended too early when the quality of the image to be processed is poor, that is, the production quality of the electrical terminal is too poor, so that the final detection result deviation is larger, and therefore, another angle measurement needs to be performed on the situation in another iteration, and finally, the final detection image is obtained by integrating the two iteration results.
Further, counting the number of pixel points with gray value of 0 in the image to be processed and each expansion image, recording as the complementary parameter of each image, calculating the difference value of the complementary parameters of each image and the image after expansion once, whenCalculating all of the images when the secondary expansion image is recorded as the preliminary expansion imageThe sum of the differences of the complementary parameters is calculatedThe difference between the complementary parameters is allThe ratio of the sum of the differences of the complementary parameters is recorded asComplementary judgment of sub-expansion images, comparisonThe magnitude of the complementary judgment quantity of the secondary expansion image and the preset complementary threshold value, ifIf the complementary judgment quantity of the secondary expansion image is larger than or equal to the preset complementary threshold value, utilizing the initial expansion structural element pairExpanding the secondary expansion image to obtain an i+1 secondary expansion image, and calculatingComplementary judgment of sub-expansion images, comparisonThe magnitude of the complementary judgment quantity of the secondary expansion image and the preset complementary threshold value, ifIf the complementary judgment quantity of the secondary expansion image is larger than or equal to the preset complementary threshold value, utilizing the initial expansion structural element pairExpanding the secondary expansion image to obtain an i+1 secondary expansion image, and the like untilThe complementary judgment quantity of the secondary expansion image is smaller than the preset complementary threshold value, andThe secondary dilation image is noted as the detection image. The present embodiment is described by taking a preset complementary threshold value of 0.95 as an example, and is not limited thereto.
Thus, a detection image is obtained.
S004: and calculating the difference between the detection image and the image to be processed to obtain a detection result, and marking whether the production of the electrical terminal is qualified according to the detection result to finish the defect detection of the production of the electrical terminal.
It should be noted that, after the detected image is obtained, the image to be processed is in a state that the electrical terminal is substantially in a state of no defect, so that the detection can be performed according to the difference between the image to be processed and the detection, if the difference is more, the defect probability of the electrical terminal in the image to be processed is more likely to be the defect of the electrical terminal.
Specifically, subtracting the image to be processed from the detection image to obtain a new image, dividing the gray value of each pixel point in the new image by the gray value of the pixel point at the same position in the image to be processed to obtain a plurality of rational ratio results, and taking the arithmetic mean value of all the rational ratio results as the detection result, wherein the corresponding pixel point does not participate in calculation if the denominator is 0 during division; and comparing the detection result with a preset detection threshold, marking the electrical terminal in the image to be processed as an unqualified product if the detection result is greater than or equal to the preset detection threshold, marking the electrical terminal in the image to be processed as a qualified product if the detection result is less than the preset detection threshold, generating a detection report, and finishing the production defect detection of the electrical terminal. The present embodiment is described by taking a preset detection threshold value of 0.8 as an example, and is not limited thereto.
Thus, the defect detection of the production of the electrical terminal is completed.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the invention, but any modifications, equivalent substitutions, improvements, etc. within the principles of the present invention should be included in the scope of the present invention.

Claims (8)

1. The method for detecting the production defects of the electrical appliance terminals is characterized by comprising the following steps of:
Obtaining an image to be processed of an electrical terminal;
Counting a row gray level total value curve and a column gray level total value curve on an image to be processed, obtaining gray level duty ratio of each row according to the row gray level total value curve, obtaining a trusted column according to the column gray level total value curve, dividing the image to be processed into four areas according to the trusted column, calculating fluctuation value of each column, and obtaining distribution judgment quantity of each pixel point according to the gray level duty ratio of each row, the fluctuation value of each column and different areas;
the specific calculation formula for obtaining the distribution judgment quantity of each pixel point according to the gray scale duty ratio of each row, the fluctuation value of each column and different areas is as follows:
Wherein, Represent the firstLine 1The distribution of pixels of a column determines the amount,Represent the firstThe gray scale ratio of the row,Represent the firstThe value of the fluctuation of the column,Represent the firstThe overall fluctuation value of the region to which the column belongs,Represent the firstTrusted distance of columns;
Performing expansion iteration on the image to be processed, obtaining the chaotic degree of each region by using the distribution judgment quantity of each pixel point in the iteration process, calculating the evaluation index of each expansion image according to the chaotic degree of each region, obtaining a preliminary expansion image by using the evaluation index of each expansion image, and correcting and iterating the preliminary expansion image by calculating the complementary judgment quantity of each expansion image to obtain a detection image;
the expansion iteration is carried out on the image to be processed, and the chaotic degree of each region is obtained by using the distribution judgment quantity of each pixel point in the iteration process, and the method comprises the following specific steps:
Setting an initial expansion structural element, performing expansion operation on an image to be processed by using the initial expansion structural element to obtain a primary expansion image, calculating the variance of the distribution judgment quantity of all pixel points of each region in the primary expansion image, and marking the variance as the chaotic degree of each region;
And calculating the difference between the detection image and the image to be processed to obtain a detection result, and finishing the production defect detection of the electrical terminal according to the detection result.
2. The method for detecting the production defects of the electrical terminal according to claim 1, wherein the statistics of the row gray level total value curve and the column gray level total value curve comprises the following specific steps:
Counting the gray value sum of the pixel points of each row of the image to be processed, and taking the column number of the image to be processed as an abscissa and the gray value sum of the pixel points of each row as an ordinate to obtain a row gray value total curve of the image to be processed; and counting the gray value sum of the pixel points of each column of the image to be processed, and obtaining a column gray value total curve of the image to be processed by taking the row number of the image to be processed as the abscissa and the gray value sum of the pixel points of each column as the ordinate.
3. The method for detecting the production defects of the electrical terminal according to claim 1, wherein the steps of obtaining the gray scale duty ratio of each row according to the row gray scale total value curve and obtaining the credible columns according to the column gray scale total value curve comprise the following specific steps:
Calculating the sum of gray values of all pixel points in the image to be processed, calculating the sum of gray values of the pixel points of each row according to a row gray total value curve, calculating the ratio of the sum of the gray values of the pixel points of each row to the sum of the gray values of all pixel points in the image to be processed, and recording the ratio as the gray duty ratio of each row; calculating the slope of each point on the column gray level total value curve, when the absolute value of the slope of the point a is larger than a preset slope threshold value, marking the column corresponding to the point a as a trusted column, and calculating the slopes of all the points on the column gray level total value curve to obtain a plurality of trusted columns.
4. The method for detecting the production defects of the electrical terminals according to claim 1, wherein the steps of dividing the image to be processed into four areas according to the trusted columns and calculating the fluctuation value of each column comprise the following specific steps:
Counting the difference value of the number of columns of each trusted column and the right trusted column adjacent to the trusted column, and recording the difference value as the trusted distance of each trusted column; counting the largest first three trusted distances in the trusted distances of all trusted columns, dividing the image to be processed into four areas by taking the trusted column corresponding to the largest first three trusted distances as a boundary, marking the four areas as four areas I, II, III and IV in sequence from left to right, calculating the variance of the gray values of all pixel points in each area, marking the variance of the gray values of all pixel points in each area as the integral fluctuation value of each area, and calculating the variance of the gray values of all pixel points in each area as the fluctuation value of each column.
5. The method for detecting defects in electrical terminal production according to claim 4, wherein the specific calculation formula for calculating the evaluation index of each expansion image according to the degree of confusion of each region is as follows:
Wherein, Representation ofAn evaluation index of the secondary expansion image,Representation ofThe effective duty cycle of the secondary dilation image,Representation ofThe amount of differential variation of the secondary dilation image,AndRespectively representThe degree of confusion in the four regions I, II, III and IV in the secondary dilation image,An exponential function based on a natural constant is represented.
6. The method for detecting defects in electrical terminal manufacture according to claim 5, wherein the steps ofThe specific acquisition method of the effective duty ratio of the secondary expansion image is as follows:
Calculation of The arithmetic mean value of the distribution judgment quantity of all pixel points in the subspan image is recorded asIntegral judgment value of secondary expansion image and statisticsPixels with the judgment value larger than the overall judgment value are distributed in each region in the secondary expansion image and marked as trusted pixels; the number of the trusted pixel points is calculatedThe ratio of the number of all pixel points with gray values not equal to 0 in the subspan image is recorded asThe effective duty cycle of the secondary dilation image.
7. The method for detecting defects in electrical terminal manufacture according to claim 5, wherein the steps ofThe specific acquisition method of the differential variation of the secondary expansion image is as follows:
counting the sum of gray values of all pixel points in an image to be processed, and counting Calculating the sum of the gray values of all the pixels in the image to be processed and the sum of the gray values of all the pixels in the sub-expansion imageDividing the absolute value of the difference value of the sum of the gray values of all the pixels in the sub-expansion image by the sum of the gray values of all the pixels in the image to be processedThe differential variation of the secondary dilation image.
8. The method for detecting the production defects of the electrical terminal according to claim 1, wherein the step of obtaining the preliminary expansion image by using the evaluation index of each expansion image comprises the following specific steps:
Calculating the absolute value of the difference between the evaluation index of the primary expansion image and the evaluation index of the standard component, dividing the absolute value of the difference by the evaluation index of the standard component to obtain the structural element judgment amount of the primary expansion image, comparing the structural element judgment amount of the primary expansion image with the preset judgment amount threshold value, expanding the primary expansion image by the initial expansion structural element to obtain the secondary expansion image if the structural element judgment amount of the primary expansion image is larger than or equal to the preset judgment amount threshold value, calculating the structural element judgment amount of the secondary expansion image and the preset judgment amount threshold value, expanding the secondary expansion image by the initial expansion structural element to obtain the tertiary expansion image if the structural element judgment amount of the secondary expansion image is larger than or equal to the preset judgment amount threshold value, and so on The structural element judgment quantity of the secondary expansion image is smaller than a preset judgment quantity threshold value, and the structural element judgment quantity of the secondary expansion image is equal to or smaller than the preset judgment quantity threshold valueThe secondary dilation image is noted as a preliminary dilation image.
CN202410430739.XA 2024-04-11 Electrical terminal production defect detection method Active CN118037718B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410430739.XA CN118037718B (en) 2024-04-11 Electrical terminal production defect detection method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410430739.XA CN118037718B (en) 2024-04-11 Electrical terminal production defect detection method

Publications (2)

Publication Number Publication Date
CN118037718A CN118037718A (en) 2024-05-14
CN118037718B true CN118037718B (en) 2024-07-02

Family

ID=

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116843678A (en) * 2023-08-28 2023-10-03 青岛冠宝林活性炭有限公司 Hard carbon electrode production quality detection method
CN117115075A (en) * 2023-04-12 2023-11-24 福州大学 Metal surface rust spot detection method integrating multidirectional multi-element universe local segmentation

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117115075A (en) * 2023-04-12 2023-11-24 福州大学 Metal surface rust spot detection method integrating multidirectional multi-element universe local segmentation
CN116843678A (en) * 2023-08-28 2023-10-03 青岛冠宝林活性炭有限公司 Hard carbon electrode production quality detection method

Similar Documents

Publication Publication Date Title
CN109978901B (en) Quick and accurate circular detection and circle center positioning method
CN113470562B (en) OLED screen sub-pixel brightness extraction method based on imaging brightness meter
CN107590502A (en) A kind of whole audience dense point fast matching method
CN110793462B (en) Nylon gear reference circle measuring method based on vision technology
CN116523913B (en) Intelligent detection method for quality of screw rod
CN112361977B (en) Linear distance measuring method based on weight distribution
CN117576100B (en) Surface defect grading detection and evaluation method for FPC connector
CN116735612A (en) Welding defect detection method for precise electronic components
CN117437223A (en) Intelligent defect detection method for high-speed board-to-board connector
CN117152163A (en) Bridge construction quality visual detection method
CN116503462A (en) Method and system for quickly extracting circle center of circular spot
CN115082477A (en) Semiconductor wafer processing quality detection method based on light reflection removing effect
CN118037718B (en) Electrical terminal production defect detection method
CN117173160B (en) Image processing-based method for detecting quality of caravan component
CN116168024B (en) Corrugated paper production quality real-time detection method based on computer vision
CN118037718A (en) Electrical terminal production defect detection method
CN115423807B (en) Cloth defect detection method based on outlier detection
CN116167921B (en) Method and system for splicing panoramic images of flight space capsule
CN114693652B (en) Fabric Defect Detection Method Based on Gaussian Mixture Model
CN114742849A (en) Leveling instrument distance measuring method based on image enhancement
CN114882116A (en) Lead screw bending positioning and straightening method and system
CN110874850A (en) Real-time unilateral grid feature registration method oriented to target positioning
CN118037734B (en) Quality detection method for fully-degradable plastic product
CN117764981B (en) Injection mold quality on-line measuring system based on machine vision
CN117874900B (en) House construction engineering supervision method based on BIM technology

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
GR01 Patent grant