Resistance plate surface flaw real-time detection and positioning method and system
By combining multi-directional light source illumination and derivative curve analysis with the polar coordinate system and Fourier descriptor, the accuracy and efficiency issues of surface defect detection on the resistor plate in traditional methods are solved, high-precision defect detection and positioning are achieved, and the automation and product quality of lithium-ion battery production are improved.
Patent Information
- Application Number
- CN202511174903.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-21
- Publication Date
- 2025-09-26
AI Technical Summary
Traditional methods have difficulty in accurately detecting surface defects on lithium-ion battery resistor plates, especially subtle defects such as wrinkles, bubbles, and scratches, and have problems with low efficiency and limited generalization capabilities.
By illuminating with multi-directional light sources, a sequence of reflected light intensity distribution images at different incident angles is obtained on the surface of the blocking plate. The first-order derivative and second-order derivative curves are calculated. By combining the polar coordinate system and Fourier descriptor, the target contour of the defect boundary is extracted to achieve precise positioning and contour extraction.
It significantly improves the accuracy and sensitivity of defect detection, realizes accurate quantification of defect morphological characteristics, and achieves positioning accuracy up to micron level, which reduces the subjectivity of manual inspection and improves production efficiency and product quality.
Smart Images

Figure CN120703105A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of industrial visual inspection, and in particular to a method and system for real-time detection and positioning of surface defects on a resistive plate. Background Art
[0002] As a key component of lithium-ion batteries, the surface quality of the barrier plate directly impacts battery performance and safety. Surface defects such as wrinkles, bubbles, and scratches on the barrier plate can lead to internal short circuits, capacity degradation, and potential safety hazards. Therefore, real-time detection and location of barrier plate surface defects are crucial during lithium-ion battery production.
[0003] Traditional methods for detecting surface defects on barrier plates primarily include manual visual inspection, machine vision inspection using a single light source, and deep learning-based image recognition. Manual visual inspection relies on the inspector's experience and state, resulting in low efficiency and poor consistency. While machine vision inspection using a single light source improves inspection efficiency, it struggles to accurately capture all types of defect characteristics on barrier plate surfaces, which are sensitive to gloss variations. Deep learning-based image recognition methods require a large number of labeled samples for training and have limited generalization capabilities for new or rare defects. Summary of the Invention
[0004] The embodiments of the present invention provide a method and system for real-time detection and positioning of surface defects on a blocking plate, which can solve the problems in the prior art.
[0005] A first aspect of an embodiment of the present invention provides a method for real-time detection and location of surface defects on a blocking plate, comprising: Obtain a sequence of reflected light intensity distribution images of the barrier plate surface at different incident angles through multi-directional light illumination, calculate the reflected light intensity change curve of each pixel at different incident angles, and extract the first-order derivative curve and the second-order derivative curve; The mutation points of the first-order derivative curve and the second-order derivative curve are regarded as defect points, and the candidate defect areas are delineated according to the local curvature variance and spatial distribution relationship of the defect points; Establishing a polar coordinate system at the edge defect point of the candidate defect area, taking the centroid of the candidate defect area as the pole, and calculating the polar radius function of the edge defect point at different angles; extracting the Fourier descriptor of the polar radius function, matching the amplitude spectrum of the Fourier descriptor with the feature template in the standard defect sample library, determining the target point of the defect boundary through the local maximum of the polar radius function, and obtaining the target contour of the defect; The position coordinates, area and perimeter of the defect are calculated based on the target contour, a defect detection result report is generated, and the detection result is fed back to the production control system.
[0006] Obtain a sequence of reflected light intensity distribution images of the barrier plate surface at different incident angles through multi-directional light illumination, calculate the reflected light intensity change curve of each pixel at different incident angles, and extract the first-order derivative curve and the second-order derivative curve, including: Multiple light sources are evenly arranged in a plane perpendicular to the surface of the blocking plate; a high-speed camera is started to continuously capture 5 frames of reflection images at each incident angle, and the arithmetic mean of the grayscale value of each pixel in the 5 frames of images is calculated to obtain a standard reflection light intensity distribution image at the incident angle; The standard reflected light intensity distribution image obtained at the first incident angle is set as the reference image, and the brightness gradient values of each pixel and its adjacent pixels in the standard reflected light intensity distribution image at other incident angles are calculated respectively. The position offset of the pixel is determined according to the magnitude of the brightness gradient value, and the position offset is compensated to the original coordinate position to obtain the standard reflected light intensity distribution image after position correction; The reflected light intensity value of each pixel point at different incident angles in multiple standard reflected light intensity distribution images after position correction is extracted, and the reflected light intensity values are arranged in order of angle size. The light intensity change rate between adjacent angles is calculated, and the inverse of the light intensity change rate is used as the interpolation weight coefficient. The reflected light intensity change curve is generated using the cubic spline difference function; for the reflected light intensity change curve of each pixel point, the first-order derivative curve and the second-order derivative curve are calculated respectively.
[0007] The mutation points of the first-order derivative curve and the second-order derivative curve are regarded as defect points. The candidate defect areas are delineated according to the local curvature variance and spatial distribution relationship of the defect points, including: For each pixel point, a zero-crossing point is detected on the first-order derivative curve as a first-order derivative mutation point, and an extreme point is detected on the second-order derivative curve as a second-order derivative mutation point. The pixel point with a mutation point is regarded as a defect feature point. The maximum reflected light intensity value is selected from the first-order derivative mutation point as the first-order derivative maximum mutation value; the maximum second-order derivative value is selected from the second-order derivative mutation point as the second-order derivative maximum mutation value; The reflected light intensity variation curve of each defect point is divided into multiple sub-intervals that alternately rise and fall. The local curvature variance is calculated in each sub-interval. When the local curvature variance of a sub-interval is greater than twice the mean curvature variance of all sub-intervals of the pixel point, the sub-interval is marked as an abnormal interval. The number of abnormal intervals for each pixel point is counted. The number of abnormal intervals, the maximum mutation value of the first-order derivative, and the maximum mutation value of the second-order derivative are combined into a feature vector of the defect point, and the Mahalanobis distance between the feature vectors of adjacent defect points is calculated; the defect points whose Mahalanobis distance is less than a distance threshold are divided into the same defect area to obtain candidate defect areas.
[0008] Establishing a polar coordinate system at the edge defect point of the candidate defect area, taking the centroid of the candidate defect area as the pole, and calculating the polar radius function of the edge defect point at different angles, including: Calculating the average abscissa and average ordinate of all edge defect points in the candidate defect area to obtain centroid coordinates, and establishing a polar coordinate system with the centroid coordinates as the pole; Calculating edge slopes between adjacent edge defect points, calculating a curvature value of each edge defect point based on the edge slopes, selecting a maximum curvature value from the curvature values, dividing the curvature value of each edge defect point by the maximum curvature value to obtain a curvature ratio, performing an inverse tangent operation on the curvature ratio and multiplying the result by a preset adjustment coefficient to obtain an angle adjustment amount; Evenly divide a preset number of reference sampling angle sequences, add the angle adjustment amount to the corresponding reference sampling angle sequence to obtain an actual sampling angle; using the centroid coordinates as the pole, respectively calculate the polar diameter value and polar angle value of each edge defect point relative to the centroid coordinates to obtain a representation of the edge defect point in polar coordinates; establish a local window with a fixed angle width at each actual sampling angle position, and extract the polar diameter value and polar angle value of the edge defect point within the local window; Calculate the angle difference between the polar angle value of each edge defect point in the local window and the actual sampling angle, divide the square of the angle difference by twice the preset variance parameter and take the negative exponential operation to obtain the corresponding Gaussian weight coefficient, multiply the polar diameter value of each edge defect point in the local window by the corresponding Gaussian weight coefficient to obtain the weighted polar diameter value, and generate polar diameter functions at different angles.
[0009] Extract the Fourier descriptor of the polar radius function, match the amplitude spectrum of the Fourier descriptor with the feature template in the standard defect sample library, determine the target point of the defect boundary through the local maximum of the polar radius function, and obtain the target contour of the defect, including: Performing a Fourier transform on the polar function to obtain a Fourier coefficient sequence, multiplying the amplitude of each component of the Fourier coefficient sequence by its corresponding frequency value to obtain a frequency-weighted amplitude, summing the frequency-weighted amplitudes to obtain a frequency-weighted sum, summing the amplitudes of each component of the Fourier coefficient sequence to obtain an amplitude sum, dividing the frequency-weighted sum by the amplitude sum to obtain an average frequency, and multiplying the average frequency by a preset adjustment coefficient to obtain a cutoff frequency; Generate a Kaiser window function sequence within the range of zero frequency to the cutoff frequency, multiply the amplitude of each component by the corresponding Kaiser window function sequence value to obtain a weighted amplitude spectrum, divide the weighted amplitude spectrum into multiple frequency bands according to a preset frequency step size, and obtain an amplitude spectrum of each frequency band; Multiplying the amplitude spectrum of each frequency band with the amplitude spectrum of the standard defect sample feature template and summing them to obtain a mutual correlation coefficient, and multiplying the mutual correlation coefficient by the weight coefficient corresponding to the frequency band to obtain the frequency band matching degree; Calculating the first-order derivative and the second-order derivative of the polar function at each angular position, and dividing the second-order derivative by the square of the first-order derivative plus the cube root of one to obtain the local curvature; Calculate the difference between the polar function and its mean and divide it by the mean to obtain the polar deviation, and perform weighted summation of the polar deviation, the local curvature and the frequency band matching degree to obtain the target point score; A boundary target point is marked at a position where the target point score is greater than a target threshold and the local curvature is greater than a curvature threshold, and the position information of the boundary target point is multiplied by a distance weight coefficient and then connected to obtain a target contour.
[0010] Generate a Kaiser window function sequence within the range of zero frequency to the cutoff frequency, and multiply the amplitude of each component by the corresponding Kaiser window function sequence value to obtain a weighted amplitude spectrum, including: receiving the amplitudes of the components of the Fourier coefficient sequence and the sampling frequency, and determining the frequency ranges of the first preset frequency band and the second preset frequency band according to the sampling frequency; Calculating the sum of the amplitudes of the components within the first preset frequency band to obtain a signal amplitude sum, and calculating the sum of the amplitudes of the components within the second preset frequency band to obtain a noise amplitude sum; dividing the signal amplitude sum by the noise amplitude sum to obtain a signal-to-noise ratio, and taking the base-10 logarithm of the signal-to-noise ratio and multiplying it by a shape coefficient to obtain a shape parameter of the Kaiser window function; Determining the length of the Kaiser window function according to the ratio of the cutoff frequency to the sampling frequency, substituting the shape parameter and the length into a zero-order modified Bessel function to generate a Kaiser window function sequence; For the frequency component of each component amplitude, calculating the difference between the frequency component and the cutoff frequency and dividing the difference by the cutoff frequency to obtain a frequency deviation, multiplying the absolute value of the frequency deviation by the frequency coefficient and taking the negative exponent to obtain a frequency weight coefficient corresponding to the frequency component; The amplitude of each component is multiplied by the corresponding Kaiser window function sequence value and the frequency weight coefficient to obtain a weighted amplitude spectrum.
[0011] A second aspect of an embodiment of the present invention provides a real-time detection and positioning system for surface defects of a blocking plate, comprising: The first unit is used to obtain a sequence of reflected light intensity distribution images of the surface of the blocking plate at different incident angles through multi-directional light illumination, calculate the reflected light intensity change curve of each pixel at different incident angles, and extract the first-order derivative curve and the second-order derivative curve; The second unit is used to take the mutation points of the first-order derivative curve and the second-order derivative curve as defect points, and to delineate candidate defect areas based on the local curvature variance and spatial distribution relationship of the defect points; The third unit is configured to establish a polar coordinate system at the edge defect point of the candidate defect area, calculate the polar radius function of the edge defect point at different angles with the centroid of the candidate defect area as the pole; extract the Fourier descriptor of the polar radius function, match the amplitude spectrum of the Fourier descriptor with the feature template in the standard defect sample library, determine the target point of the defect boundary through the local maximum of the polar radius function, and obtain the target contour of the defect; The fourth unit is used to calculate the position coordinates, area and perimeter of the defect according to the target contour, generate a defect detection result report, and feed back the detection result to the production control system.
[0012] According to a third aspect of the embodiments of the present invention, An electronic device is provided, comprising: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the aforementioned method.
[0013] According to a fourth aspect of the embodiments of the present invention, A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method described above is implemented.
[0014] The beneficial effects of this application are as follows: The real-time detection and location method for surface defects on the blocking plate provided by the present invention uses multi-directional light source illumination technology to obtain a sequence of reflected light intensity distribution images at different incident angles. Combined with derivative curve analysis, it can effectively detect various defects on the surface of the blocking plate, including pits, scratches, bubbles and other subtle defects that are difficult to identify using traditional methods, significantly improving the accuracy and sensitivity of defect detection.
[0015] The polar coordinate system and Fourier descriptor are used to accurately locate the defect boundary and extract the contour, overcoming the limitations of traditional image processing methods in dealing with irregular shaped defects, and achieving accurate quantification of defect morphological characteristics, making the classification and identification of defects more accurate and reliable, and the positioning accuracy can reach the micron level.
[0016] This method realizes the automated and real-time detection of surface defects of the barrier plate, and directly feeds back the detection results to the production control system, effectively reducing the subjectivity and inconsistency of manual detection, significantly improving production efficiency and product quality, and reducing production costs. It is of great significance to improving the manufacturing process level and product performance of the barrier plate. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 Schematic diagram of the process of the method for real-time detection and positioning of surface defects of a blocking plate according to an embodiment of the present invention; Figure 2 Schematic diagram of the system architecture for image acquisition and derivative feature analysis on the surface of the resistive plate. DETAILED DESCRIPTION
[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0019] The following specific embodiments are used to describe the technical solution of the present invention in detail. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0020] Figure 1 FIG. 1 is a flow chart of a method for real-time detection and location of surface defects of a blocking plate according to an embodiment of the present invention. Figure 1 As shown, the method includes: Obtain a sequence of reflected light intensity distribution images of the barrier plate surface at different incident angles through multi-directional light illumination, calculate the reflected light intensity change curve of each pixel at different incident angles, and extract the first-order derivative curve and the second-order derivative curve; The mutation points of the first-order derivative curve and the second-order derivative curve are regarded as defect points, and the candidate defect areas are delineated according to the local curvature variance and spatial distribution relationship of the defect points; Establishing a polar coordinate system at the edge defect point of the candidate defect area, taking the centroid of the candidate defect area as the pole, and calculating the polar radius function of the edge defect point at different angles; extracting the Fourier descriptor of the polar radius function, matching the amplitude spectrum of the Fourier descriptor with the feature template in the standard defect sample library, determining the target point of the defect boundary through the local maximum of the polar radius function, and obtaining the target contour of the defect; The position coordinates, area and perimeter of the defect are calculated based on the target contour, a defect detection result report is generated, and the detection result is fed back to the production control system.
[0021] In an optional embodiment, a sequence of reflected light intensity distribution images of the surface of the blocking plate at different incident angles is obtained by illuminating with a multi-directional light source, a reflected light intensity variation curve of each pixel at different incident angles is calculated, and a first-order derivative curve and a second-order derivative curve are extracted, including: Multiple light sources are evenly arranged in a plane perpendicular to the surface of the blocking plate; a high-speed camera is started to continuously capture 5 frames of reflection images at each incident angle, and the arithmetic mean of the grayscale value of each pixel in the 5 frames of images is calculated to obtain a standard reflection light intensity distribution image at the incident angle; The standard reflected light intensity distribution image obtained at the first incident angle is set as the reference image, and the brightness gradient values of each pixel and its adjacent pixels in the standard reflected light intensity distribution image at other incident angles are calculated respectively. The position offset of the pixel is determined according to the magnitude of the brightness gradient value, and the position offset is compensated to the original coordinate position to obtain the standard reflected light intensity distribution image after position correction; The reflected light intensity value of each pixel point at different incident angles in multiple standard reflected light intensity distribution images after position correction is extracted, and the reflected light intensity values are arranged in order of angle size. The light intensity change rate between adjacent angles is calculated, and the inverse of the light intensity change rate is used as the interpolation weight coefficient. The reflected light intensity change curve is generated using the cubic spline difference function; for the reflected light intensity change curve of each pixel point, the first-order derivative curve and the second-order derivative curve are calculated respectively.
[0022] Figure 2 A schematic diagram of the system architecture for image acquisition and derivative feature analysis of the barrier plate surface. In one embodiment, a multi-directional illumination system was constructed to obtain the reflected light intensity distribution characteristics of the barrier plate surface at different incident angles. The system includes a semicircular bracket with 21 light sources evenly arranged on it, with an angular interval of 4.5 degrees between adjacent light sources, covering an incident angle range of 0 to 90 degrees. The light sources used are the same model of LED point light sources with a wavelength of 550nm, a power of 5W, and an irradiation angle of less than 5 degrees to ensure consistent illumination direction.
[0023] The acquisition device uses a high-speed camera with a pixel resolution of 1280×1024 and a frame rate of 500fps. The camera lens has a focal length of 35mm and an aperture of F4.0. The high-speed camera is fixed perpendicular to the surface of the blocker at a distance of 500mm, ensuring that the entire blocker surface is within the camera's field of view.
[0024] In actual operation, each light source is illuminated sequentially according to the preset incident angle. When the light source at the 0-degree position (perpendicular to the surface of the blocking plate) is illuminated, the high-speed camera is activated to continuously capture five frames of reflected images. The exposure time for each of these five frames is 2 ms, and the interval between adjacent frames is 10 ms. The grayscale values of the corresponding pixels in these five frames are arithmetic averaged to obtain the standard reflected light intensity distribution image l0. For each pixel (x, y), its standard reflected light intensity value at a 0-degree incident angle can be expressed as I0(x, y), where I0(x, y) is equal to the average grayscale value of the corresponding pixel in the five frames.
[0025] The incident angle of the light source is changed in sequence, and the reflection images are collected at incident angles of 4.5 degrees, 9 degrees, 13.5 degrees... until 90 degrees. For each incident angle θ, 5 frames of images are collected and the average grayscale value is calculated to obtain the corresponding standard reflected light intensity distribution image I θ .
[0026] Since the position of the light irradiating the blocker plate surface will be slightly offset at different incident angles, the image needs to be corrected. Taking the standard reflected light intensity distribution image I0 at an incident angle of 0 degrees as the reference, the standard reflected light intensity distribution image I θ Calculate the brightness gradient values of each pixel (x,y) with its adjacent pixels in the horizontal and vertical directions. The horizontal gradient value ΔH(x,y) is equal to the difference between the grayscale values of the pixel (x+1,y) and the pixel (x-1,y) divided by 2; the vertical gradient value ΔV(x,y) is equal to the difference between the grayscale values of the pixel (x,y+1) and the pixel (x,y-1) divided by 2.
[0027] Based on the calculated brightness gradient value, the position offset of the pixel point is determined. The horizontal offset Δx(x,y) is equal to the horizontal gradient value ΔH(x,y) multiplied by the sine of the incident angle θ and then multiplied by the correction factor 0.5; the vertical offset Δy(x,y) is equal to the vertical gradient value ΔV(x,y) multiplied by the sine of the incident angle θ and then multiplied by the correction factor 0.5. These position offsets are compensated to the original coordinate position to obtain the standard reflected light intensity distribution image I' after position correction. θ For I' θ For each pixel (x', y'), its gray value is I' θ (x',y') is equal to the original image I θ The grayscale value of the pixel point (x'+Δx,y'+Δy) in the image is calculated by bilinear interpolation method to calculate the grayscale value of the non-integer coordinate position.
[0028] After completing the position correction, extract the reflected light intensity value of each pixel at different incident angles. For example, for the pixel (100,150), extract its reflected light intensity value at 0 degrees, 4.5 degrees, 9 degrees... until 90 degrees, and obtain the reflected light intensity sequence {I0(100,150), I'1(100,150), I'2(100,150), ..., I' 20 (100,150)}.
[0029] In order to generate a continuous reflected light intensity change curve, the cubic spline interpolation method is used. In the interpolation process, the difference in light intensity change rate between different incident angles is taken into account, and the inverse of the light intensity change rate is used as the interpolation weight coefficient. n and θ n+1 The light intensity change rate between R(n,n+1) is calculated as: |I' θn+1 (x,y) - I' θn (x,y)|divided by|θ n+1 -θ n The interpolation weight coefficient w(n,n+1) is equal to 1 divided by (R(n,n+1) + 0.01), where 0.01 is added to avoid the denominator being zero.
[0030] Using these weight coefficients and the cubic spline interpolation function, a continuous reflected light intensity variation curve f(θ) is generated from 0 degrees to 90 degrees. In practice, the angle range of 0 degrees to 90 degrees is evenly divided into 900 points with an interval of 0.1 degrees to generate a reflected light intensity variation curve containing 900 data points.
[0031] For the generated reflected light intensity change curve f(θ), calculate its first-order derivative curve f'(θ) and second-order derivative curve f''(θ). The first-order derivative f'(θ) represents the rate at which the reflected light intensity changes with the incident angle, and the second-order derivative f''(θ) represents the change in the rate of change of the reflected light intensity. The derivative values are calculated using the central difference method. For angle θ, its first-order derivative f'(θ) is equal to (f(θ+0.1) - f(θ-0.1)) divided by 0.2; the second-order derivative f''(θ) is equal to (f(θ+0.1) - 2f(θ) + f(θ-0.1)) divided by 0.01.
[0032] By analyzing the characteristics of the first-order and second-order derivative curves, such as peak position, peak magnitude, and zero point position, it is possible to effectively identify minor defects on the surface of the barrier plate. For example, in an actual case, the first-order derivative value of the reflected light intensity variation curve on the surface of a normal barrier plate near an incident angle of 45 degrees was approximately -2.5, and the second-order derivative value was approximately -0.3; while in an area with a minor scratch, the first-order derivative value was approximately -4.8, and the second-order derivative value was approximately -1.2. This significant difference allows for accurate detection of surface defects on the barrier plate.
[0033] In an optional embodiment, the mutation point of the first-order derivative curve and the second-order derivative curve is used as the defect point, and the candidate defect area is delineated according to the local curvature variance and spatial distribution relationship of the defect point, including: For each pixel point, a zero-crossing point is detected on the first-order derivative curve as a first-order derivative mutation point, and an extreme point is detected on the second-order derivative curve as a second-order derivative mutation point. The pixel point with a mutation point is regarded as a defect feature point. The maximum reflected light intensity value is selected from the first-order derivative mutation point as the first-order derivative maximum mutation value; the maximum second-order derivative value is selected from the second-order derivative mutation point as the second-order derivative maximum mutation value; The reflected light intensity variation curve of each defect point is divided into multiple sub-intervals that alternately rise and fall. The local curvature variance is calculated in each sub-interval. When the local curvature variance of a sub-interval is greater than twice the mean curvature variance of all sub-intervals of the pixel point, the sub-interval is marked as an abnormal interval. The number of abnormal intervals for each pixel point is counted. The number of abnormal intervals, the maximum mutation value of the first-order derivative, and the maximum mutation value of the second-order derivative are combined into a feature vector of the defect point, and the Mahalanobis distance between the feature vectors of adjacent defect points is calculated; the defect points whose Mahalanobis distance is less than a distance threshold are divided into the same defect area to obtain candidate defect areas.
[0034] This embodiment discloses a defect detection method based on curve mutation point and local curvature analysis. This method detects the mutation points of the first-order derivative curve and the second-order derivative curve, and combines the local curvature variance and spatial distribution relationship to accurately delineate the defect area.
[0035] During the image acquisition phase, a high-resolution line scan camera is used to scan the surface of the object to be inspected, acquiring reflected light intensity data. For each pixel, the reflected light intensity value at different angles is recorded to form a reflected light intensity curve. To improve the signal-to-noise ratio, a Gaussian filter is applied to the raw reflected light intensity data, with a filter window size of 5 and a standard deviation of 1.2.
[0036] The first and second derivatives of the filtered reflected light intensity data are calculated. The first derivative represents the rate of change of the reflected light intensity and is calculated by taking the difference between adjacent points. The second derivative represents the speed of change of the reflected light intensity rate of change and is calculated by taking the difference of the first derivative. To improve calculation accuracy, the central difference method is used when calculating the derivatives.
[0037] Zero-crossing points are detected on the first-order derivative curve as first-order derivative mutation points. This is achieved by determining whether the signs of the first-order derivative values at two adjacent points are opposite. If they are opposite, it indicates the presence of a zero-crossing point. For example, if the first-order derivative value at point i is 0.45 and the first-order derivative value at point i+1 is -0.32, a zero-crossing point is determined to exist between these two points, i.e., a first-order derivative mutation point.
[0038] Detect extreme points on the second-order derivative curve as second-order derivative mutation points. By determining the magnitude relationship between the second-order derivative values of three consecutive points, when the second-order derivative value of the middle point is greater or less than the second-order derivative values of the points on either side, the point is identified as an extreme point. For example, if the second-order derivative values of three consecutive points are detected to be 0.21, 0.68, and 0.35, respectively, the middle point 0.68 is the maximum point and is marked as the second-order derivative mutation point.
[0039] Pixels with first-order derivative mutation points or second-order derivative mutation points are marked as defect feature points. Among all first-order derivative mutation points, the point with the largest corresponding reflected light intensity value is selected, and its reflected light intensity value is used as the maximum mutation value of the first-order derivative. For example, if the reflected light intensity values corresponding to the first-order derivative mutation points of a certain pixel are 125, 183, and 97, then 183 is selected as the maximum mutation value of the first-order derivative of the pixel. Among all second-order derivative mutation points, the point with the largest absolute value of the second-order derivative is selected, and its second-order derivative value is used as the maximum mutation value of the second-order derivative. For example, if the second-order derivative values of the second-order derivative mutation points of a certain pixel are 1.35, -2.47, and 1.82, then the absolute value of -2.47, 2.47, is selected as the maximum mutation value of the second-order derivative of the pixel.
[0040] For each defect point, the reflected light intensity curve is divided into multiple subintervals that alternate between rising and falling, based on the sign of the first-order derivative. When the first-order derivative changes from positive to negative, it marks the end of one subinterval and the beginning of the next. The local curvature variance is calculated within each subinterval. The curvature is calculated using the first and second-order derivatives of the reflected light intensity. The curvature is calculated for all points within each subinterval, and the variance of these curvature values is then calculated as the local curvature variance for that subinterval.
[0041] Calculate the mean curvature variance of all subintervals for that pixel. If the local curvature variance of a subinterval is greater than twice the mean, mark that subinterval as an outlier. Count the number of outlier intervals for each pixel. For example, the reflected light intensity curve for a pixel is divided into five subintervals, with local curvature variances of 0.023, 0.052, 0.087, 0.031, and 0.025, respectively, and a mean of 0.0436. 0.087 is greater than twice the mean (0.0872), so the pixel has one outlier interval.
[0042] The number of abnormal intervals, the maximum mutation value of the first-order derivative, and the maximum mutation value of the second-order derivative are combined to form the defect point's feature vector. For two adjacent defect points, the Mahalanobis distance between their feature vectors is calculated. The Mahalanobis distance calculation takes into account the correlation between feature dimensions and the scale differences between these dimensions. A distance threshold of 3.0 is set, and adjacent defect points with a Mahalanobis distance below this threshold are grouped into the same defect region.
[0043] The defect region is expanded using a region growing algorithm. Starting from the initial defect point, adjacent defect points that meet the criteria are gradually added to the same region. When no more adjacent points that meet the criteria can be found, the delineation of one candidate defect region is completed and the next candidate defect region begins. In a practical application, five candidate defect regions were delineated in a certain inspection scenario: Region 1 contained 28 defect points, Region 2 contained 15 defect points, Region 3 contained 9 defect points, Region 4 contained 6 defect points, and Region 5 contained 4 defect points.
[0044] To further improve detection accuracy, morphological processing is applied to candidate defect regions, including dilation and erosion operations, to fill small holes and smooth their boundaries. Based on geometric features such as the defect area, perimeter, and circularity, combined with product quality standards, the candidate defect region is determined to be a true defect and the final defect detection result is generated.
[0045] In an optional embodiment, a polar coordinate system is established at the edge defect point of the candidate defect area, with the centroid of the candidate defect area as the pole, and the polar radius function of the edge defect point at different angles is calculated, including: Calculating the average abscissa and average ordinate of all edge defect points in the candidate defect area to obtain centroid coordinates, and establishing a polar coordinate system with the centroid coordinates as the pole; Calculating edge slopes between adjacent edge defect points, calculating a curvature value of each edge defect point based on the edge slopes, selecting a maximum curvature value from the curvature values, dividing the curvature value of each edge defect point by the maximum curvature value to obtain a curvature ratio, performing an inverse tangent operation on the curvature ratio and multiplying the result by a preset adjustment coefficient to obtain an angle adjustment amount; Evenly divide a preset number of reference sampling angle sequences, add the angle adjustment amount to the corresponding reference sampling angle sequence to obtain an actual sampling angle; using the centroid coordinates as the pole, respectively calculate the polar diameter value and polar angle value of each edge defect point relative to the centroid coordinates to obtain a representation of the edge defect point in polar coordinates; establish a local window with a fixed angle width at each actual sampling angle position, and extract the polar diameter value and polar angle value of the edge defect point within the local window; Calculate the angle difference between the polar angle value of each edge defect point in the local window and the actual sampling angle, divide the square of the angle difference by twice the preset variance parameter and take the negative exponential operation to obtain the corresponding Gaussian weight coefficient, multiply the polar diameter value of each edge defect point in the local window by the corresponding Gaussian weight coefficient to obtain the weighted polar diameter value, and generate polar diameter functions at different angles.
[0046] A defect area edge feature extraction method based on the polar coordinate system is proposed. This method establishes a polar coordinate system, analyzes the distribution characteristics of defect points on the edge of the candidate defect area, extracts the polar radius function, and achieves an accurate description of the defect characteristics.
[0047] In specific implementation, for the detected candidate defect area, the centroid coordinates of all edge defect points in the area are calculated. Assume that a candidate defect area contains N edge defect points, where the coordinates of the i-th point are (x i , y i ), then the centroid coordinates (x c , y c ) is calculated as follows: c Equal to the average value of the horizontal coordinates xi and y of all edge defect points c Equal to the y-coordinate of all edge defect points i For example, for a candidate region containing 10 edge defect points, if the horizontal coordinates of these points are [120, 122, 125, 127, 130, 132, 135, 137, 140, 142] and the vertical coordinates are [85, 87, 90, 92, 95, 97, 100, 102, 105, 107], the calculated centroid coordinates are (131, 96). This centroid coordinate will be used as the pole of the polar coordinate system.
[0048] Calculate the curvature characteristics of the edge defect point. For the i-th edge defect point, calculate the edge slope between it and the two adjacent points (i.e., the i-1th point and the i+1th point). The calculation of the edge slope is based on the difference ratio of the coordinates of the adjacent points, i.e., (y i+1 -y i-1 ) / (x i+1 -x i-1Based on the change in edge slope, the curvature value of each edge defect point can be calculated. For example, for the 10 points above, the curvature values calculated in sequence are [0.12, 0.15, 0.25, 0.30, 0.40, 0.45, 0.35, 0.25, 0.20, 0.10].
[0049] From all calculated curvature values, select the maximum value—in this case, 0.45. Divide the curvature value of each edge defect point by this maximum curvature value to obtain the curvature ratio. For example, the curvature ratio of the first point is 0.12 / 0.45 = 0.267. Perform an inverse tangent on all curvature ratios and multiply them by a preset adjustment factor (such as 2.0) to obtain the angle adjustment for each point. For example, if the inverse tangent value of the first point is 0.26, multiplying by 2.0 yields an angle adjustment of 0.52.
[0050] When performing angle sampling, evenly divide the sample into a preset number of base sampling angle sequences. Assuming the number of sampling angles is set to 36, the base sampling angle sequence is [0°, 10°, 20°, ..., 350°]. The previously calculated angle adjustment is added to the corresponding base sampling angle sequence to obtain the actual sampling angle. For example, if the angle adjustment at the 10th position is 0.52, the actual sampling angle at that position is 10.52 degrees.
[0051] For each edge defect point, calculate its polar coordinate representation relative to the centroid coordinate. Let the edge defect point coordinate be (x i , y i ), the coordinates of the center of mass are (x c , y c ), then the extreme radius value r of the point i Equal to the distance from the point to the centroid, calculated as ((x i -x c ) 2 + (y i -y c ) 2 ) square root; polar angle value θ i Equal to the angle of the point relative to the center of mass, calculated as (y i -y c ) and (x i -x c ). For example, for the edge defect point (120, 85) and the centroid coordinates (131, 96), the polar radius is 16.55 and the polar angle is 138.37 degrees.
[0052] At each actual sampling angle, establish a local window with a fixed angular width, for example, set to 5 degrees. Extract the polar radius and polar angle values of edge defect points within the local window. For example, for an actual sampling angle of 40.25 degrees, extract all edge defect points with polar angles between 37.75 and 42.75 degrees.
[0053] Calculate the difference between the polar angle value of each edge defect point in the local window and the actual sampling angle. For example, if the polar angle value of a point in the local window is 38.5 degrees and the actual sampling angle is 40.25 degrees, the angle difference is -1.75 degrees. Divide the square of the angle difference by twice the preset variance parameter (such as 1.0), take the negative and perform an exponential operation to obtain the Gaussian weight coefficient. In this example, (-1.75 2 ) / (2*1.0)=-1.53,e (-1.53) =0.217, so the Gaussian weight coefficient of this point is 0.217.
[0054] Multiply the polar radius value of each edge defect point within the local window by the corresponding Gaussian weight coefficient to obtain the weighted polar radius value. For example, if the polar radius value of the point is 15.3, the weighted polar radius value is 15.3 * 0.217 = 3.32. The sum of all weighted polar radius values constitutes the polar radius function value at that sampling angle.
[0055] Repeat the above process for all actual sampling angles to generate a complete polar function. This polar function can be represented as a vector of length 36 (the same length as the baseline sampling angle sequence), with each element representing the polar function value at the corresponding angle. For example, the resulting polar function is [12.5, 13.2, 14.7, 15.3, ..., 11.8].
[0056] The polar radius function extracted using this method can effectively describe the shape characteristics of the defect area edge, providing an important basis for subsequent defect classification and identification. This method is particularly suitable for defects with complex and irregular edge shapes, and can capture subtle feature changes that are difficult to describe using conventional methods.
[0057] In an optional embodiment, extracting the Fourier descriptor of the polar radius function, matching the amplitude spectrum of the Fourier descriptor with the feature template in the standard defect sample library, determining the target point of the defect boundary through the local maximum of the polar radius function, and obtaining the target contour of the defect, including: Performing a Fourier transform on the polar function to obtain a Fourier coefficient sequence, multiplying the amplitude of each component of the Fourier coefficient sequence by its corresponding frequency value to obtain a frequency-weighted amplitude, summing the frequency-weighted amplitudes to obtain a frequency-weighted sum, summing the amplitudes of each component of the Fourier coefficient sequence to obtain an amplitude sum, dividing the frequency-weighted sum by the amplitude sum to obtain an average frequency, and multiplying the average frequency by a preset adjustment coefficient to obtain a cutoff frequency; Generate a Kaiser window function sequence within the range of zero frequency to the cutoff frequency, multiply the amplitude of each component by the corresponding Kaiser window function sequence value to obtain a weighted amplitude spectrum, divide the weighted amplitude spectrum into multiple frequency bands according to a preset frequency step size, and obtain an amplitude spectrum of each frequency band; Multiplying the amplitude spectrum of each frequency band with the amplitude spectrum of the standard defect sample feature template and summing them to obtain a mutual correlation coefficient, and multiplying the mutual correlation coefficient by the weight coefficient corresponding to the frequency band to obtain the frequency band matching degree; Calculating the first-order derivative and the second-order derivative of the polar function at each angular position, and dividing the second-order derivative by the square of the first-order derivative plus the cube root of one to obtain the local curvature; Calculate the difference between the polar function and its mean and divide it by the mean to obtain the polar deviation, and perform weighted summation of the polar deviation, the local curvature and the frequency band matching degree to obtain the target point score; A boundary target point is marked at a position where the target point score is greater than a target threshold and the local curvature is greater than a curvature threshold, and the position information of the boundary target point is multiplied by a distance weight coefficient and then connected to obtain a target contour.
[0058] In the image processing process, for the application of defect detection, this embodiment provides a Fourier descriptor matching method based on the polar radius function, which is used to accurately identify and locate the defect contour.
[0059] During the image preprocessing phase, the defect image to be detected was grayscaled and denoised. A Gaussian filter was used to smooth the image, with a kernel size of 5×5 and a standard deviation of 1.5 to reduce noise interference. The Canny edge detection algorithm was applied to the filtered image, with a low threshold set at 0.4 times the image's average grayscale value and a high threshold set at 2.5 times the low threshold to obtain the edge contours of the defect.
[0060] To determine the coordinates of the center point of the defect area, use the centroid method. Take the average x- and y-coordinates of all edge points as the defect center point. Using this center point as the polar origin, convert the edge contour points to polar coordinates. Calculate the distance from the center point to each point on the contour as the polar radius, and the corresponding angle as the polar angle. Sampling angles from 0° to 360°, with a step size of 1°, yields the polar radius function r(θ) containing 360 sampling points.
[0061] Perform a Fourier transform on the polar function to obtain the Fourier coefficient sequence F(k), where k represents the frequency component. For defect detection in practical applications, 128 frequency components are usually sufficient to meet the accuracy requirements. Calculate the amplitude of each frequency component |F(k)| and multiply the amplitude of each component by its corresponding frequency value k to obtain the frequency-weighted amplitude k×|F(k)|. Sum all frequency-weighted amplitudes to obtain the frequency weight sum S w =Σ(k×|F(k)|), and calculate the sum of all amplitudes S at the same time a =Σ|F(k)|. Average frequency F a Obtained by dividing the frequency weight sum by the amplitude sum, i.e., F a =S w / S a .
[0062] The preset adjustment coefficient α is introduced and adjusted according to the complexity of the defect type. For defects with simple shapes, α is 0.8, and for defects with complex shapes, α is 1.2. Calculate the cutoff frequency F c =α×Fa, used for subsequent spectrum analysis.
[0063] From zero frequency to cutoff frequency F c A Kaiser window function sequence W(k) is generated within the range of , with the parameter β set to 3.5 to provide better spectral leakage suppression. The Fourier coefficient amplitude |F(k)| is multiplied by the corresponding Kaiser window function value W(k) to obtain the weighted amplitude spectrum A(k) = |F(k)| × W(k).
[0064] The weighted amplitude spectrum is divided according to the preset frequency step size. For example, every 4 frequency points are a frequency band. For a 128-point Fourier transform, an amplitude spectrum of 32 frequency bands can be obtained. For the amplitude spectrum A of the i-th frequency band i , match the corresponding frequency band amplitude spectrum Ti of the standard defect sample feature template, and calculate the mutual correlation coefficient C i =Σ(A i ×T i ) / sqrt(Σ(A i 2 )×Σ(T i 2 )).
[0065] Assign weight coefficients W to different frequency bands i , the weight of the low frequency band (1-8) is set to 0.4, the weight of the medium frequency band (9-20) is set to 0.5, and the weight of the high frequency band (21-32) is set to 0.1, reflecting the contribution of different frequency bands to the defect characteristics. Calculate the matching degree M of each frequency band i =C i×W i , the overall matching degree is obtained by combining the matching degrees of all frequency bands.
[0066] Calculate the first derivative D of the polar function r(θ) at each angular position r and the second-order derivative D 2 r Using the central difference method, the first-order derivative is calculated as D r (θ)=(r(θ+Δθ)-r(θ-Δθ)) / (2×Δθ), the second-order derivative is calculated as D 2 r (θ)=(r(θ+Δθ)+r(θ-Δθ)-2×r(θ)) / (Δθ^2), where Δθ is the angle sampling step, which is 1°.
[0067] Calculate the local curvature K(θ)=D 2 r (θ) / ((D r (θ) 2 +1)^(1 / 3)). This formula reflects the curvature change of the polar radius function at each angular position. Calculate the polar radius deviation P(θ)=(r(θ)-rmean) / rmean, where rmean is the mean of the polar radius function, reflecting the degree of deviation of the polar radius from the mean radius at each angular position.
[0068] Set the weight coefficient w p =0.3, w k =0.4, w m =0.3, the polar deviation P(θ), local curvature K(θ) and frequency band matching degree M are weighted together to calculate the target point score S(θ)=w p ×P(θ)+w k ×K(θ)+w m ×M.
[0069] Set the target threshold S t = 0.65 and curvature threshold K t =0.4, when S(θ)>S t And K(θ)>K t The angle position θ is marked as the boundary target point. For these target points, the distance weight coefficient W is set according to their distance to the center. d (θ) = 1 - (r(θ) - rmin) / (rmax - rmin), where rmin and rmax are the minimum and maximum values of the polar radius, respectively. The target point location information is multiplied by the distance weight coefficient and connected in angular order to form the target outline of the defect.
[0070] In actual application, a metal surface image containing circular scratches was tested, and the polar function obtained was found to have obvious fluctuations in the angle range of 135° to 155°. After Fourier analysis, the average frequency was calculated to be 9.8, and the adjustment coefficient was selected as 1.0, resulting in a cutoff frequency of 9.8. The frequency band matching results showed that the mutual correlation coefficient in the 12th frequency band reached 0.87, and the matching degree after multiplying by the weight of 0.5 was 0.435. At an angle of 145°, the local curvature reached 0.63, the polar deviation was 0.48, and the comprehensive score was 0.72, which exceeded the set target threshold of 0.65, and the local curvature exceeded the curvature threshold of 0.4, and was successfully marked as a boundary target point. Finally, all target points were connected to accurately depict the outline shape of the defect.
[0071] In an optional implementation, a Kaiser window function sequence is generated within a range from zero frequency to the cutoff frequency, and the amplitude of each component is multiplied by the corresponding Kaiser window function sequence value to obtain a weighted amplitude spectrum, including: receiving the amplitudes of the components of the Fourier coefficient sequence and the sampling frequency, and determining the frequency ranges of the first preset frequency band and the second preset frequency band according to the sampling frequency; Calculating the sum of the amplitudes of the components within the first preset frequency band to obtain a signal amplitude sum, and calculating the sum of the amplitudes of the components within the second preset frequency band to obtain a noise amplitude sum; dividing the signal amplitude sum by the noise amplitude sum to obtain a signal-to-noise ratio, and taking the base-10 logarithm of the signal-to-noise ratio and multiplying it by a shape coefficient to obtain a shape parameter of the Kaiser window function; Determining the length of the Kaiser window function according to the ratio of the cutoff frequency to the sampling frequency, substituting the shape parameter and the length into a zero-order modified Bessel function to generate a Kaiser window function sequence; For the frequency component of each component amplitude, calculating the difference between the frequency component and the cutoff frequency and dividing the difference by the cutoff frequency to obtain a frequency deviation, multiplying the absolute value of the frequency deviation by the frequency coefficient and taking the negative exponent to obtain a frequency weight coefficient corresponding to the frequency component; The amplitude of each component is multiplied by the corresponding Kaiser window function sequence value and the frequency weight coefficient to obtain a weighted amplitude spectrum.
[0072] In this embodiment, in order to improve the accuracy of spectrum analysis in signal processing, a detailed description is given of how to generate a Kaiser window function sequence in the range from zero frequency to cutoff frequency and apply it to signal processing.
[0073] This embodiment receives the amplitude and sampling frequency of each component of the Fourier coefficient sequence. In a specific application, it is assumed that the Fourier coefficient sequence {A1, A2, ..., A m}, the corresponding frequency components are {f1, f2, ..., f m}, where the sampling frequency f s The sampling frequency is 1000Hz. Based on this sampling frequency, the frequency is divided into two preset frequency bands: the first preset frequency band (the main signal frequency band) is selected from 0Hz to 100Hz, and the second preset frequency band (the noise frequency band) is selected from 400Hz to 500Hz. This frequency band division method can effectively distinguish between signal and noise components.
[0074] According to the above division, calculate the sum of the amplitudes in the first preset frequency band. Assuming that there are frequency components f2=50Hz, f5=75Hz, and f8=95Hz in the range of 0Hz to 100Hz, and the corresponding amplitudes are A2=10, A5=15, and A8=8, the sum of the signal amplitudes is 10+15+8=33. Similarly, calculate the sum of the amplitudes in the second preset frequency band. Assuming that there are frequency components f in the range of 400Hz to 500Hz, 20 =420Hz, f 25 =480Hz, the corresponding amplitudes are A 20 =2、A 25 = 3, the sum of the noise amplitudes is 2 + 3 = 5. Dividing the sum of the signal amplitudes by the sum of the noise amplitudes yields the signal-to-noise ratio (SNR): 33 ÷ 5 = 6.6. Taking the decimal logarithm yields 10ln(6.6) ≈ 8.2 dB. Setting the shape factor to 0.5 yields the Kaiser window function's shape parameter, β, = 0.5 × 8.2 ≈ 4.1.
[0075] Determine the length of the Kaiser window function. Assume that the cutoff frequency f c is 200Hz, then the ratio of the cutoff frequency to the sampling frequency is f c / f s =200 / 1000=0.2. According to empirical settings, when the ratio is 0.2, it is appropriate to select a window function with a length of 51. Substitute the shape parameter β=4.1 and the length N=51 into the zero-order modified Bessel function to calculate the Kaiser window function sequence. Since this embodiment does not show the mathematical formula, some of the calculated results are given here: the window function sequence w(0)=0.042, w(1)=0.043, w(2)=0.047...w(25)=1.000...w(50)=0.042. The window function is symmetrical about the center point w(25), and the center point takes the maximum value of 1.0.
[0076] For each frequency component of the Fourier coefficient sequence, calculate its frequency deviation from the cutoff frequency. Take the frequency component f2=50Hz as an example, its frequency deviation from the cutoff frequency f c=200Hz, the difference is 50-200=-150Hz, and the frequency deviation is -150 / 200=-0.75. Taking the absolute value, we get |0.75|=0.75. Selecting the frequency coefficient k=5, the frequency weight coefficient corresponding to this frequency component is e (-5×0.75) ≈0.024. Similarly, for the frequency component f8=95Hz, the frequency deviation is (95-200) / 200=-0.525, and the corresponding frequency weight coefficient is e (-5×0.525) ≈0.074.
[0077] Multiply each component amplitude by the corresponding Kaiser window function sequence value and the frequency weight coefficient to obtain the weighted amplitude spectrum. Taking the frequency component f2 = 50 Hz as an example, this frequency corresponds to the 12th value in the Kaiser window function sequence (assuming w(12) = 0.52), then its weighted amplitude is A2×w(12)×e^(-5×0.75)=10×0.52×0.024≈0.125. For the frequency component f8 = 95 Hz, assuming the corresponding 23rd value in the Kaiser window function sequence w(23) = 0.95, then its weighted amplitude is A8×w(23)×e^(-5×0.525)=8×0.95×0.074≈0.56.
[0078] This approach doubles the weighting of each component in the spectrum: the Kaiser window function provides adaptive amplitude adjustment based on the signal-to-noise ratio, while the frequency weighting coefficient provides additional weight control based on the proximity of the frequency component to the cutoff frequency. This weighting strategy effectively emphasizes the main frequency components of the signal while suppressing noise components far from the cutoff frequency.
[0079] In practical applications, this method can be used to improve the accuracy of spectrum analysis. For example, in one experiment, the original amplitude spectrum contained a large amount of noise interference, making it difficult to identify the signal's main frequency. Applying this method effectively preserved the amplitude of the signal's main frequency (75Hz), while significantly suppressing noise components far from the cutoff frequency (such as 420Hz and 480Hz). This increased the accuracy of identifying the signal's main frequency from 78% to 96%, effectively improving the reliability of spectrum analysis.
[0080] The system for real-time detection and positioning of surface defects of a blocking plate according to an embodiment of the present invention includes: The first unit is used to obtain a sequence of reflected light intensity distribution images of the surface of the blocking plate at different incident angles through multi-directional light illumination, calculate the reflected light intensity change curve of each pixel at different incident angles, and extract the first-order derivative curve and the second-order derivative curve; The second unit is used to take the mutation points of the first-order derivative curve and the second-order derivative curve as defect points, and to delineate candidate defect areas based on the local curvature variance and spatial distribution relationship of the defect points; The third unit is configured to establish a polar coordinate system at the edge defect point of the candidate defect area, calculate the polar radius function of the edge defect point at different angles with the centroid of the candidate defect area as the pole; extract the Fourier descriptor of the polar radius function, match the amplitude spectrum of the Fourier descriptor with the feature template in the standard defect sample library, determine the target point of the defect boundary through the local maximum of the polar radius function, and obtain the target contour of the defect; The fourth unit is used to calculate the position coordinates, area and perimeter of the defect according to the target contour, generate a defect detection result report, and feed back the detection result to the production control system.
[0081] According to a third aspect of an embodiment of the present invention, an electronic device is provided, including: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the aforementioned method.
[0082] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method described above is implemented.
[0083] The present invention may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present invention.
[0084] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for real-time detection and location of surface defects on a resistive plate, characterized in that: include: Obtain a sequence of reflected light intensity distribution images of the barrier plate surface at different incident angles through multi-directional light illumination, calculate the reflected light intensity change curve of each pixel at different incident angles, and extract the first-order derivative curve and the second-order derivative curve; The mutation points of the first-order derivative curve and the second-order derivative curve are regarded as defect points, and the candidate defect areas are delineated according to the local curvature variance and spatial distribution relationship of the defect points; Establishing a polar coordinate system at the edge defect point of the candidate defect area, taking the centroid of the candidate defect area as the pole, and calculating the polar radius function of the edge defect point at different angles; extracting the Fourier descriptor of the polar radius function, matching the amplitude spectrum of the Fourier descriptor with the feature template in the standard defect sample library, determining the target point of the defect boundary through the local maximum of the polar radius function, and obtaining the target contour of the defect; The position coordinates, area and perimeter of the defect are calculated based on the target contour, a defect detection result report is generated, and the detection result is fed back to the production control system.
2. The method according to claim 1, characterized in that Obtain a sequence of reflected light intensity distribution images of the barrier plate surface at different incident angles through multi-directional light illumination, calculate the reflected light intensity change curve of each pixel at different incident angles, and extract the first-order derivative curve and the second-order derivative curve, including: Multiple light sources are evenly arranged in a plane perpendicular to the surface of the blocking plate; a high-speed camera is started to continuously capture 5 frames of reflection images at each incident angle, and the arithmetic mean of the grayscale value of each pixel in the 5 frames of images is calculated to obtain a standard reflection light intensity distribution image at the incident angle; The standard reflected light intensity distribution image obtained at the first incident angle is set as the reference image, and the brightness gradient values of each pixel and its adjacent pixels in the standard reflected light intensity distribution image at other incident angles are calculated respectively. The position offset of the pixel is determined according to the magnitude of the brightness gradient value, and the position offset is compensated to the original coordinate position to obtain the standard reflected light intensity distribution image after position correction; The reflected light intensity value of each pixel point at different incident angles in multiple standard reflected light intensity distribution images after position correction is extracted, and the reflected light intensity values are arranged in order of angle size. The light intensity change rate between adjacent angles is calculated, and the inverse of the light intensity change rate is used as the interpolation weight coefficient. The reflected light intensity change curve is generated using the cubic spline difference function; for the reflected light intensity change curve of each pixel point, the first-order derivative curve and the second-order derivative curve are calculated respectively.
3. The method according to claim 1, characterized in that The mutation points of the first-order derivative curve and the second-order derivative curve are regarded as defect points. The candidate defect areas are delineated according to the local curvature variance and spatial distribution relationship of the defect points, including: For each pixel point, a zero-crossing point is detected on the first-order derivative curve as a first-order derivative mutation point, and an extreme point is detected on the second-order derivative curve as a second-order derivative mutation point. The pixel point with a mutation point is regarded as a defect feature point. The maximum reflected light intensity value is selected from the first-order derivative mutation point as the first-order derivative maximum mutation value; the maximum second-order derivative value is selected from the second-order derivative mutation point as the second-order derivative maximum mutation value; The reflected light intensity variation curve of each defect point is divided into multiple sub-intervals that alternately rise and fall. The local curvature variance is calculated in each sub-interval. When the local curvature variance of a sub-interval is greater than twice the mean curvature variance of all sub-intervals of the pixel point, the sub-interval is marked as an abnormal interval. The number of abnormal intervals for each pixel point is counted. The number of abnormal intervals, the maximum mutation value of the first-order derivative, and the maximum mutation value of the second-order derivative are combined into a feature vector of the defect point, and the Mahalanobis distance between the feature vectors of adjacent defect points is calculated; the defect points whose Mahalanobis distance is less than a distance threshold are divided into the same defect area to obtain candidate defect areas.
4. The method according to claim 1, wherein Establishing a polar coordinate system at the edge defect point of the candidate defect area, taking the centroid of the candidate defect area as the pole, and calculating the polar radius function of the edge defect point at different angles, including: Calculating the average abscissa and average ordinate of all edge defect points in the candidate defect area to obtain centroid coordinates, and establishing a polar coordinate system with the centroid coordinates as the pole; Calculating edge slopes between adjacent edge defect points, calculating a curvature value of each edge defect point based on the edge slopes, selecting a maximum curvature value from the curvature values, dividing the curvature value of each edge defect point by the maximum curvature value to obtain a curvature ratio, performing an inverse tangent operation on the curvature ratio and multiplying the result by a preset adjustment coefficient to obtain an angle adjustment amount; Evenly divide a preset number of reference sampling angle sequences, add the angle adjustment amount to the corresponding reference sampling angle sequence to obtain an actual sampling angle; using the centroid coordinates as the pole, respectively calculate the polar diameter value and polar angle value of each edge defect point relative to the centroid coordinates to obtain a representation of the edge defect point in polar coordinates; establish a local window with a fixed angle width at each actual sampling angle position, and extract the polar diameter value and polar angle value of the edge defect point within the local window; Calculate the angle difference between the polar angle value of each edge defect point in the local window and the actual sampling angle, divide the square of the angle difference by twice the preset variance parameter and take the negative exponential operation to obtain the corresponding Gaussian weight coefficient, multiply the polar diameter value of each edge defect point in the local window by the corresponding Gaussian weight coefficient to obtain the weighted polar diameter value, and generate polar diameter functions at different angles.
5. The method according to claim 1, wherein Extract the Fourier descriptor of the polar radius function, match the amplitude spectrum of the Fourier descriptor with the feature template in the standard defect sample library, determine the target point of the defect boundary through the local maximum of the polar radius function, and obtain the target contour of the defect, including: Performing a Fourier transform on the polar function to obtain a Fourier coefficient sequence, multiplying the amplitude of each component of the Fourier coefficient sequence by its corresponding frequency value to obtain a frequency-weighted amplitude, summing the frequency-weighted amplitudes to obtain a frequency-weighted sum, summing the amplitudes of each component of the Fourier coefficient sequence to obtain an amplitude sum, dividing the frequency-weighted sum by the amplitude sum to obtain an average frequency, and multiplying the average frequency by a preset adjustment coefficient to obtain a cutoff frequency; Generate a Kaiser window function sequence within the range of zero frequency to the cutoff frequency, multiply the amplitude of each component by the corresponding Kaiser window function sequence value to obtain a weighted amplitude spectrum, divide the weighted amplitude spectrum into multiple frequency bands according to a preset frequency step size, and obtain an amplitude spectrum of each frequency band; Multiplying the amplitude spectrum of each frequency band with the amplitude spectrum of the standard defect sample feature template and summing them to obtain a mutual correlation coefficient, and multiplying the mutual correlation coefficient by the weight coefficient corresponding to the frequency band to obtain the frequency band matching degree; Calculating the first-order derivative and the second-order derivative of the polar function at each angular position, and dividing the second-order derivative by the square of the first-order derivative plus the cube root of one to obtain the local curvature; Calculate the difference between the polar function and its mean and divide it by the mean to obtain the polar deviation, and perform weighted summation of the polar deviation, the local curvature and the frequency band matching degree to obtain the target point score; A boundary target point is marked at a position where the target point score is greater than a target threshold and the local curvature is greater than a curvature threshold, and the position information of the boundary target point is multiplied by a distance weight coefficient and then connected to obtain a target contour.
6. The method according to claim 5, characterized in that Generate a Kaiser window function sequence within the range of zero frequency to the cutoff frequency, and multiply the amplitude of each component by the corresponding Kaiser window function sequence value to obtain a weighted amplitude spectrum, including: receiving the amplitudes of the components of the Fourier coefficient sequence and the sampling frequency, and determining the frequency ranges of the first preset frequency band and the second preset frequency band according to the sampling frequency; Calculating the sum of the amplitudes of the components within the first preset frequency band to obtain a signal amplitude sum, and calculating the sum of the amplitudes of the components within the second preset frequency band to obtain a noise amplitude sum; dividing the signal amplitude sum by the noise amplitude sum to obtain a signal-to-noise ratio, and taking the base-10 logarithm of the signal-to-noise ratio and multiplying it by a shape coefficient to obtain a shape parameter of the Kaiser window function; Determining the length of the Kaiser window function according to the ratio of the cutoff frequency to the sampling frequency, substituting the shape parameter and the length into a zero-order modified Bessel function to generate a Kaiser window function sequence; For the frequency component of each component amplitude, calculating the difference between the frequency component and the cutoff frequency and dividing the difference by the cutoff frequency to obtain a frequency deviation, multiplying the absolute value of the frequency deviation by the frequency coefficient and taking the negative exponent to obtain a frequency weight coefficient corresponding to the frequency component; The amplitude of each component is multiplied by the corresponding Kaiser window function sequence value and the frequency weight coefficient to obtain a weighted amplitude spectrum.
7. A real-time detection and positioning system for surface defects of a blocking plate, for implementing the method according to any one of claims 1 to 6, characterized in that: include: The first unit is used to obtain a sequence of reflected light intensity distribution images of the surface of the blocking plate at different incident angles through multi-directional light illumination, calculate the reflected light intensity change curve of each pixel at different incident angles, and extract the first-order derivative curve and the second-order derivative curve; The second unit is used to take the mutation points of the first-order derivative curve and the second-order derivative curve as defect points, and to delineate candidate defect areas based on the local curvature variance and spatial distribution relationship of the defect points; The third unit is configured to establish a polar coordinate system at the edge defect point of the candidate defect area, calculate the polar radius function of the edge defect point at different angles with the centroid of the candidate defect area as the pole; extract the Fourier descriptor of the polar radius function, match the amplitude spectrum of the Fourier descriptor with the feature template in the standard defect sample library, determine the target point of the defect boundary through the local maximum of the polar radius function, and obtain the target contour of the defect; The fourth unit is used to calculate the position coordinates, area and perimeter of the defect according to the target contour, generate a defect detection result report, and feed back the detection result to the production control system.
8. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Cited By
Defect detection method based on machine vision
CN122084633A
A machine vision-based defect detection method
CN122084633B