An LED lamp bead defect detection method and system
Through Gaussian filtering and histogram equalization processing images, combined with gradient direction analysis and region growth algorithm, the accuracy and completeness of LED bead defect detection in the prior art are solved, and accurate identification and integrated display of cracks, dark spots and depressions are achieved.
Patent Information
- Application Number
- CN202510435526.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-09
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2045-04-09
AI Technical Summary
The prior art is difficult to accurately capture the various defect characteristics of the surface of LED lamp beads, especially when the crack paths cross or bend, the detection is incomplete, the fine areas are easily missed in dark spot detection, and the fine deformation cannot be accurately identified in the depression detection, resulting in insufficient detection accuracy and completeness.
The image is processed through Gaussian filtering and histogram equalization, and crack features are constructed using gradient direction analysis and region growth algorithms, and the dark spot area is marked by grayscale entropy values, combined with grating stripes to analyze the depressed deformation, and integrated to generate multi-feature defect distribution map.
It significantly improves the accuracy and completeness of LED lamp bead defect detection, reduces misjudgment and missed detection, accurately identify complex crack forms and subtle depressions, and improves the degree of refinement of the detection.
Smart Images

Figure CN119963547B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing of lamp beads, and particularly to a method and system for detecting defects of LED lamp beads. Background Art
[0002] The method for detecting defects of LED lamp beads refers to a technology that automatically detects defects on the surface of LED lamp beads through specific image acquisition and processing means. It mainly aims at surface defects such as cracks, bubbles, dark spots, and color differences that may occur during lamp bead production. High-resolution imaging equipment is used to collect the surface image of the lamp bead, and through means such as image segmentation, feature extraction, and pattern recognition, the positioning and classification of the defect area are realized, and a judgment is made on whether the lamp bead meets the quality requirements.
[0003] Although the prior art can detect defects on the surface of LED lamp beads through image acquisition and segmentation, it is difficult to accurately capture multiple defect features and fuse complex features. In crack detection, the prior art mostly relies on simple gray-scale change analysis and is difficult to distinguish background noise from crack paths. Especially when the crack paths cross or bend, it is easy to result in incomplete crack detection results. In dark spot detection, the prior art mostly marks through simple statistics of pixel values, but it is easy to miss smaller dark spot areas for the subtle gray-scale differences in the divided areas, or misjudge the high-contrast background as a defect, affecting the detection accuracy. In terms of depression detection, the prior art lacks a quantitative analysis method for the surface deformation of the lamp bead and cannot accurately identify the depression distribution in small areas, resulting in a large deviation in the determination of surface deformation. Especially in lamp beads with uneven surface concavities and convexities, it is easy to have recognition blind spots, resulting in great limitations in the accuracy and integrity of the detection results. Summary of the Invention
[0004] The purpose of the present invention is to solve the deficiencies existing in the prior art, and to propose a method and system for detecting defects of LED lamp beads.
[0005] To achieve the above purpose, the present invention adopts the following technical scheme: A method for detecting defects of LED lamp beads, comprising the following steps:
[0006] S1: Collect the original image of the surface of the LED lamp bead and preprocess it to obtain the preprocessed surface image of the LED lamp bead. Analyze the gradient direction of each pixel point in the preprocessed surface image of the LED lamp bead according to the gray-scale change amount of each pixel point in the horizontal and vertical directions, obtain the area with continuous gradient directions, and generate the crack direction distribution feature of the LED lamp bead.
[0007] S2: Starting from the continuously gradient - direction regions in the crack - direction distribution feature of the LED lamp beads, gradually expand the adjacent regions of the continuously gradient - direction regions and dynamically adjust the expansion conditions during the expansion process, and generate the crack path of the LED lamp beads according to the expansion result;
[0008] S3: Locally segment the pre - processed surface image of the LED lamp beads into multiple block regions of a fixed size, calculate the gray - level entropy value of the block regions, mark the regions suspected of dark spots in each block region after local segmentation with reference to the gray - level entropy value, and generate the dark - spot feature of the LED lamp beads;
[0009] S4: Project grating stripes onto the surface of the LED lamp beads, analyze the bending and spacing changes of the grating stripes, calibrate the sunken deformation regions of the grating stripes, and generate the surface - sunken feature of the LED lamp beads;
[0010] S5: Integrate the crack path, dark - spot feature, and surface - sunken feature of the LED lamp beads and display them in a visual way to generate a multi - feature defect distribution map of the LED lamp beads.
[0011] As a further solution of the present invention, the steps for obtaining the crack - direction distribution feature of the LED lamp beads are specifically as follows:
[0012] S101: Collect the original image of the LED lamp bead surface and pre - process it, including removing random noise in the original image by Gaussian filtering and enhancing the overall gray level of the original image through histogram equalization to generate the pre - processed surface image of the LED lamp beads;
[0013] S102: Use the Sobel operator to calculate the gray - level change amount of each pixel point in the horizontal and vertical directions of the pre - processed surface image of the LED lamp beads respectively, analyze the gradient direction of each pixel point according to the gray - level change amount, and construct a gray - level gradient - direction distribution map;
[0014] S103: Compare the gradient direction of each pixel point in the gray - level gradient - direction distribution map with the gradient direction of adjacent pixel points one by one with a preset continuity threshold, mark the regions of continuous pixel points according to the comparison results, and generate the crack - direction distribution feature of the LED lamp beads according to the regions of continuous pixel points.
[0015] As a further solution of the present invention, the steps for obtaining the crack path of the LED lamp beads are specifically as follows:
[0016] S201: Starting from the continuously gradient - direction regions in the crack - direction distribution feature of the LED lamp beads, use the region - growing algorithm to gradually expand the adjacent regions of the continuously gradient - direction regions and dynamically adjust the expansion conditions during the expansion process, using the formula:
[0017] ;
[0018] Calculate the continuity threshold after dynamic expansion , through the continuity threshold after dynamic expansion Dynamically adjust the expansion conditions during the expansion process to identify continuous paths, cross paths, and curved paths in the expansion path to generate a complete expansion area;
[0019] in, is the continuity threshold, It is used to control The adjustment factor is set according to the expansion range. It represents the total number of pixels obtained by gradually expanding the gradient direction continuous area extracted from the crack direction distribution characteristics of the LED lamp bead as the initial area;
[0020] S202: Based on the complete extended area, by comparing the gradient direction of each pixel point with the average direction of the current extended area, if the gradient direction of the target pixel point deviates from the average direction of the current area and the deviation value exceeds the continuity threshold after dynamic expansion, the target pixel point is marked as a noise point, and the noise point is eliminated to generate the crack path of the LED lamp bead.
[0021] As a further solution of the present invention, the step of calculating the grayscale entropy value of the block area is specifically:
[0022] S301: locally segmenting the pre-processed LED lamp bead surface image into a plurality of fixed-size block regions, each of which contains the same number of pixels, and generating a locally segmented block image data set according to the segmentation result;
[0023] S302: Based on the local segmented block image data set, the formula is used:
[0024] ;
[0025] Calculate the grayscale entropy value of the block area after local segmentation of the LED lamp bead surface image after preprocessing ;
[0026] in, It is the grayscale used to identify the grayscale value range in the pre-processed LED lamp bead surface image. is the total number of gray levels in the block area of the LED lamp bead surface image after preprocessing, is a weighting factor used to adjust the grayscale contribution setting, Is grayscale The probability in the corresponding pre-processed LED lamp bead surface image block area, is the gray level probability The logarithmic value of .
[0027] As a further solution of the present invention, the steps for obtaining the dark spot features of the LED lamp beads are specifically as follows:
[0028] S311: By comparing the gray entropy value of each sub-block region with a preset gray threshold one by one, mark the regions with gray entropy values lower than the gray threshold as suspected dark spot regions, and generate a preliminary marking result;
[0029] S312: Based on the preliminary marking result, check the neighborhood of each suspected dark spot region, eliminate the isolated points in the suspected dark spot regions according to the inspection result, and integrate the remaining regions to generate the dark spot features of the LED lamp beads.
[0030] As a further solution of the present invention, the steps for obtaining the surface depression features of the LED lamp beads are specifically as follows:
[0031] S401: Project grating fringes onto the surface of the LED lamp beads. By adjusting the projection angle and intensity of the grating fringe light source, collect the grating fringe image and scan the central position of the grating fringes, and analyze the bending and spacing changes of adjacent grating fringes at the central position to generate a grating fringe change analysis result;
[0032] S402: Based on the grating fringe change analysis result, screen the positions where the bending and spacing changes of the grating fringes exceed a preset change threshold, and calibrate the corresponding depression deformation regions according to the screening result to generate the surface depression features of the LED lamp beads.
[0033] As a further solution of the present invention, the steps for obtaining the multi-feature defect distribution map of the LED lamp beads are specifically as follows:
[0034] S501: Integrate the crack path, the dark spot features of the LED lamp beads, and the surface depression features of the LED lamp beads, perform spatial mapping and alignment with the original surface image of the LED lamp beads, and generate an integrated marked image by boundary extraction and superposition marking for each type of defect region;
[0035] S502: Based on the integrated marked image, classify and count the attributes of each type of defect region. Among them, the attributes of each type of defect region include data such as quantity, area, and distribution range, and generate a multi-feature defect distribution map of the LED lamp beads in combination with the statistical results.
[0036] An LED lamp bead defect detection system, the system includes:
[0037] The image preprocessing module collects the original image of the LED lamp bead surface and preprocesses it to obtain the image of the LED lamp bead surface after preprocessing. Analyze the gradient direction of each pixel point in the horizontal and vertical directions in the image of the LED lamp bead surface after preprocessing, obtain the region with continuous gradient direction, and generate the crack direction distribution feature of the LED lamp bead;
[0038] The crack path generation module starts from the region with continuous gradient direction in the crack direction distribution feature of the LED lamp bead, gradually expands the adjacent regions of the region with continuous gradient direction and dynamically adjusts the expansion conditions during the expansion process, and generates the crack path of the LED lamp bead according to the expansion result;
[0039] The dark spot feature extraction module locally divides the image of the LED lamp bead surface after preprocessing into multiple block regions of a fixed size, calculates the gray entropy value of the block regions, marks the regions suspected of dark spots in each block region after local division with reference to the gray entropy value, and generates the dark spot feature of the LED lamp bead;
[0040] The surface depression analysis module projects grating stripes onto the surface of the LED lamp bead, analyzes the bending and spacing changes of the grating stripes, calibrates the depression deformation region of the grating stripes, and generates the surface depression feature of the LED lamp bead;
[0041] The defect distribution visualization module integrates the crack path of the LED lamp bead, the dark spot feature of the LED lamp bead, and the surface depression feature of the LED lamp bead and displays them in a visual way to generate a multi-feature defect distribution map of the LED lamp bead.
[0042] Compared with the prior art, the advantages and positive effects of the present invention are as follows:
[0043] In the present invention, through the preprocessing of the surface image of the LED lamp bead, Gaussian filtering is used to eliminate random noise and histogram equalization is used to enhance the overall gray distribution of the image, significantly improving the image quality and laying a foundation for subsequent feature extraction. In crack detection, by analyzing the continuity of the pixel gradient direction, the crack distribution characteristics are constructed, and the region growing algorithm is combined to dynamically expand the continuous region of the gradient direction. At the same time, noise interference is eliminated, effectively capturing the complex shapes in the crack path, including features such as crack extension, intersection, and bending. For the accurate recognition of complex crack shapes, the phenomenon of incomplete crack path recognition is avoided, making the crack detection results more comprehensive. In dark spot detection, after image local block division, the gray entropy value is calculated and compared one by one, and isolated points are eliminated by combining neighborhood inspection, realizing high-precision marking of the dark spot area, significantly reducing the phenomena of misjudgment and missed detection. This process has higher sensitivity to the subtle gray differences in the divided regions, effectively solving the problems of missing small-area dark spots and high-contrast background interference in the dark spot detection process, and ensuring the accuracy and consistency of dark spot marking. In surface depression detection, by analyzing the bending and spacing change characteristics of the grating stripes, through the calibration of the deformation region, the shape and position of the micro depression region are accurately captured, effectively solving the problem in the prior art that the surface subtle deformation cannot be accurately recognized, and improving the refinement degree of depression detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 is a schematic diagram of the working process of the present invention;
[0045] Figure 2 is a flowchart for obtaining the crack direction distribution characteristics of the LED lamp bead of the present invention;
[0046] Figure 3 is a flowchart for obtaining the crack path of the LED lamp bead of the present invention;
[0047] Figure 4 is a flowchart for calculating the gray entropy value of the divided region of the present invention;
[0048] Figure 5 is a flowchart for obtaining the dark spot characteristics of the LED lamp bead of the present invention;
[0049] Figure 6 is a flowchart for obtaining the surface depression characteristics of the LED lamp bead of the present invention;
[0050] Figure 7 is a flowchart for obtaining the multi-feature defect distribution map of the LED lamp bead of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0051] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0052] In the description of the present invention, it should be understood that the orientation or positional relationship indicated by the terms "length", "width", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. is based on the orientation or positional relationship shown in the accompanying drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention. In addition, in the description of the present invention, the meaning of "a plurality of" is two or more unless otherwise specifically defined.
[0053] Please refer to Figure 1 , the present invention provides a technical solution: a method for detecting defects of LED lamp beads, including the following steps:
[0054] S1: Collect the original image of the surface of the LED lamp bead and preprocess it to obtain the image of the surface of the LED lamp bead after preprocessing. Analyze the gradient direction of each pixel point in the horizontal and vertical directions in the image of the surface of the LED lamp bead after preprocessing, obtain the area with continuous gradient direction, and generate the crack direction distribution feature of the LED lamp bead;
[0055] S2: Starting from the area with continuous gradient direction in the crack direction distribution feature of the LED lamp bead, gradually expand the adjacent area of the area with continuous gradient direction and dynamically adjust the expansion conditions during the expansion process, and generate the crack path of the LED lamp bead according to the expansion result;
[0056] S3: Locally divide the image of the surface of the LED lamp bead after preprocessing into multiple block areas with a fixed size, calculate the gray entropy value of the block area, and mark the area suspected of having a dark spot in each block area after local division with reference to the gray entropy value, and generate the dark spot feature of the LED lamp bead;
[0057] S4: Project grating stripes onto the surface of the LED lamp bead, analyze the bending and spacing changes of the grating stripes, calibrate the sunken deformation area of the grating stripes, and generate the surface sunken feature of the LED lamp bead;
[0058] S5: Integrate the crack path of the LED lamp bead, the dark spot feature of the LED lamp bead and the surface sunken feature of the LED lamp bead and display them in a visual manner to generate a multi-feature defect distribution map of the LED lamp bead.
[0059] Please refer to Figure 2, the steps for obtaining the distribution characteristics of the crack directions of LED lamp beads are specifically as follows:
[0060] S101: Collect the original image of the LED lamp bead surface and preprocess it, including removing random noise in the original image using Gaussian filtering, enhancing the overall gray level of the original image through histogram equalization, and generating the preprocessed LED lamp bead surface image;
[0061] First, select a 3×3 Gaussian filter template. The parameters of the template are set based on the experimental analysis of image noise. By comparing the denoising effect and image edge sharpness at different filtering intensities, determine the appropriate filtering range. For example, select a standard template for experiments, input images with different noise levels, adjust the filtering intensity, and finally select the best template under the balance of noise reduction and edge sharpness. Subsequently, use the filtering function in image processing software (such as OpenCV or MATLAB) for processing. The specific operation is to input the image into the Gaussian filtering function, specify the filter size (such as a 3×3 window) and filtering parameters when calling the filtering function, and perform weighted averaging on each pixel point of the image through convolution operations to finally achieve the smoothing processing of the image and effectively remove random noise. Next, perform histogram equalization on the filtered image. Use the gray level histogram analysis tool in the software (such as the calcHist function in OpenCV) to statistically analyze the gray level value distribution of the image. This tool will traverse all pixel points of the image and record the number of pixels at each gray level, generating a distribution histogram of gray level values and pixel numbers. Based on the generated histogram, calculate the cumulative distribution function (CDF), and redistribute the image gray level values through normalization operations to make it cover the complete gray range. The stretched gray level histogram shows a more uniform distribution. For example, for the case where the gray level values in the original image are concentrated in the low gray level segment, the gray level range of the image after equalization processing is extended to 0 to 255, thereby enhancing the overall gray level uniformity and finally obtaining the preprocessed LED lamp bead surface image.
[0062] S102: Use the Sobel operator to calculate the gray level change amount of each pixel point in the horizontal and vertical directions of the preprocessed LED lamp bead surface image respectively, analyze the gradient direction of each pixel point according to the gray level change amount, and construct a gray level gradient direction distribution map;
[0063] For calculating the gray level change amount of each pixel point in the horizontal and vertical directions of the preprocessed LED lamp bead surface image, use the formula:
[0064] ;
[0065] ;
[0066] Obtain the gray-scale change amount of pixel points in the horizontal direction on the surface image of the preprocessed LED lamp bead respectively , and the gray-scale change amount of pixel points in the vertical direction on the surface image of the preprocessed LED lamp bead ;
[0067] Among them, and are in the unit of gray value / pixel, and are obtained by performing convolution operations on the gray value matrix of the surface image of the preprocessed LED lamp bead and the horizontal and vertical direction templates of the Sobel operator and are the horizontal and vertical direction templates of the Sobel operator respectively, and are used to calculate the gray-scale change amount of each pixel point on the surface image of the preprocessed LED lamp bead. For example, the template is in the following form: Horizontal direction template: The horizontal direction template is designed as a sensitive area for responding to the horizontal gray-scale change in the image. The first column (-1, -2, -1) in the template corresponds to the left side of the image, and the third column (1, 2, 1) corresponds to the right side of the image. The increase in the weight value (such as from -1 to -2) is to enhance the detection ability of the horizontal direction edge, emphasizing the gray-scale gradient between adjacent pixels. Vertical direction template: , and the vertical direction template is designed as a sensitive area for responding to the vertical gray-scale change in the image. The first row (-1, -2, -1) in the template corresponds to the upper side of the image, and the third row (1, 2, 1) corresponds to the lower side of the image. Similarly, by increasing the weight value (such as from -1 to -2), the edge detection effect in the vertical direction is enhanced. The two templates are verified by experiments and can adapt to the edge detection requirements in image processing. The weight value is determined by classical image processing theory. The template size is 3×3 to balance the fineness of edge detection and the computational complexity in the calculation. A larger template may increase the computational complexity, but the detection effect on detail changes is limited; a smaller template may be more sensitive to noise represents the gray value of the pixel point located at the coordinate on the surface image of the preprocessed LED lamp bead, and the unit is gray value (0 - 255). For example, assume , the coordinates of a certain neighborhood pixel point are , and its gray value can be directly obtained by reading the value of the 49th row and 51st column of the image gray matrix, such as the gray value is 120. Obtained by directly reading the image gray matrix (such as using tools like OpenCV or NumPy) and represent the horizontal coordinate and vertical coordinate of the pixel point on the surface image of the preprocessed LED lamp bead respectively, in pixels. Obtained directly through the image pixel coordinates and represent the horizontal coordinate and vertical coordinate relative to the pixel point at the center respectively The neighborhood offsets in the horizontal and vertical directions, with a value range of , corresponding to the relative positions in the 3×3 neighborhood of the template. 1 and -1 are the weight values in the Sobel operator and are used for convolution operations. In the horizontal direction template: 1 indicates that the weight of the gray-scale change of the image at this position is positive, that is, it will increase the influence on the result; -1 indicates that the weight of the gray-scale change of the image at this position is negative, that is, it will decrease the influence on the result. In the vertical direction template: the meanings of 1 and -1 are the same, but they are used to detect the gray-scale gradient change in the vertical direction.
[0068] According to the gray-scale change amount of the pixel points in the horizontal direction in the preprocessed surface image of the LED lamp bead , and the gray-scale change amount of the pixel points in the vertical direction in the preprocessed surface image of the LED lamp bead , use the formula:
[0069] ;
[0070] Calculate the gradient direction of each pixel point in the preprocessed surface image of the LED lamp bead , in degrees, and the range of the gradient direction is to ;
[0071] Among them, is the arctangent function, which is used to calculate the gradient direction of each pixel point in the preprocessed surface image of the LED lamp bead. Its function is to calculate the gradient direction angle of the pixel point through the ratio of the gray-scale change amount in the horizontal direction and the gray-scale change amount in the vertical direction.
[0072] The Sobel operator templates are clear, which are the horizontal template and the vertical template : ;
[0073] The neighborhood gray-scale value matrix is the gray-scale values of the 3×3 neighborhood of a certain pixel point in the sampled gray-scale image. Assume the gray-scale value distribution is as follows (value range 0 - 255): ;
[0074] Calculate the gray-scale change rate in the horizontal direction :
[0075] ;
[0076] Calculate the gray-scale change rate in the vertical direction :
[0077] ;
[0078] Calculate the gradient direction : ;
[0079] The results show that the gray-scale change rate in the horizontal direction , the gray-scale change rate in the vertical direction , and the gradient direction . Finally, each pixel value in the image is corresponded with its calculated gradient direction to generate a gradient direction matrix with the same size as the original image. Each element in the matrix represents the gradient direction angle of the pixel. Subsequently, the gradient direction matrix is partitioned. A continuity threshold is set according to the similarity of the direction angles (for example, the direction difference is less than 10°). Pixel points with adjacent pixel direction differences within the threshold range are divided into a continuous region. Next, a region labeling algorithm (such as the FloodFill algorithm) is used to label these continuous regions, and the labeling results form multiple gradient region maps with continuous directions. The above process can be implemented through an image processing library (such as the OpenCV library in Python), using the matrix operations and image labeling provided by it to construct a gray-scale gradient direction distribution map. The final gray-scale gradient direction distribution map visualizes the gradient directions in each region in the form of colors or gray-scale values.
[0080] S103: Compare the gradient direction of each pixel point in the gray-scale gradient direction distribution map with the gradient direction of adjacent pixel points and the preset continuity threshold one by one. Mark the regions of continuous pixel points according to the comparison results, and generate the crack direction distribution characteristics of the LED lamp beads based on the regions of continuous pixel points;
[0081] Based on the calculated results first, take , and the gradient direction into it. The gradient direction distribution map is a two-dimensional array generated by traversing the gradient directions of all pixel points in the image . The value of each pixel point in this array is its gradient direction angle. For example, the values of all gradient directions in a certain area are . Select the threshold for the continuity of the gradient direction. Compare the gradient direction of each pixel point with the gradient direction of its adjacent pixel points. If the difference is less than or equal to , then mark this pixel point and its adjacent pixel points as a continuous region. Otherwise, break the continuity. Then use the region labeling algorithm, through depth-first search or breadth-first search, group all adjacent and directionally continuous pixel points into an independent region, and finally record the coordinate ranges of these continuous regions. For example, if the gradient direction distribution of a certain area in the input image is: , with the center point Starting from [starting point], check one by one whether the difference in the gradient direction of adjacent points is within the continuity threshold If the condition is met, they are grouped into the same region; otherwise, they are excluded or grouped separately. Finally, mark the set of pixel coordinates of the continuous region, generate the crack direction distribution feature through this process, and record it in the form of a matrix or an image.
[0082] Please refer to Figure 3 , and the steps for obtaining the crack path of the LED lamp bead are specifically as follows:
[0083] S201: Starting from the continuous region of the gradient direction in the crack direction distribution feature of the LED lamp bead, use the region growing algorithm to gradually expand the adjacent region of the continuous region of the gradient direction and dynamically adjust the expansion conditions during the expansion process. Use the formula to dynamically adjust the expansion conditions during the expansion process through the continuity threshold after dynamic expansion, so as to identify the continuous path, cross path, and curved path in the expansion path and generate a complete expanded region;
[0084] First, introduce a dynamic expansion determination criterion during the expansion process to further optimize the boundary recognition of the crack region. The starting point of the expansion is the boundary pixel point of the continuous region of the gradient direction extracted in the previous step. For each boundary pixel point, the judgment criterion for its expansion not only includes the difference from the gradient direction of the seed point, but also comprehensively considers the morphology and direction consistency of the entire region during the expansion process. For example, the newly added pixel points must simultaneously meet the following conditions: 1) The difference between the gradient direction and the gradient direction of the current seed point is less than the set (such as 5°); 2) The difference between the gradient direction and the overall average direction of the expanded region is lower than the dynamically adjusted threshold , where will gradually decrease as the size of the expanded region increases. Use the formula:
[0085] ;
[0086] Calculate the continuity threshold after dynamic expansion ;
[0087] Among them, is the continuity threshold, is the adjustment coefficient used to control changing with the expansion range, with no unit. Its setting needs to be analyzed in combination with the crack morphology characteristics, expansion accuracy requirements, and gradient direction characteristics of the image. Crack morphology characteristics: For a crack region with relatively linear and strong direction continuity, a higher requirement for direction consistency is needed during the expansion process. At this time, should be set to a larger value so that the dynamic threshold decreases rapidly as the expansion range increases, avoiding the expanded region deviating from the crack direction. For a crack region with a more complex morphology and more branches, It should be set to a smaller value to allow for a larger dynamic threshold range and ensure that the expansion algorithm can cover the complex morphology of cracks. Expansion accuracy requirement: In the scenario of high-precision crack expansion (such as when detecting small crack details), the value should be larger to strictly control the direction consistency of the expanded area. In the scenario where expansion speed is prioritized (such as the rapid detection of large-area cracks), the value should be smaller to appropriately relax the expansion judgment conditions and improve the efficiency of the algorithm. Image gradient direction characteristics: For the crack detection task with high image noise, it should be appropriately increased according to the influence of noise distribution to eliminate as many direction fluctuation points affected by noise as possible and reduce incorrect expansion. In an image with low noise and clear gradient direction distribution, it can be appropriately reduced to ensure the integrity of the crack morphology. is the number of pixel points in the current expanded area, representing the total number of pixel points obtained by gradually expanding the gradient direction continuous area extracted from the crack direction distribution characteristics of the LED lamp beads as the initial seed area. The unit is dimensionless. During the expansion process, each time a new pixel point is added, increases by 1. is a constant term used to ensure that in the initial stage of expansion the value is not lower than , and at the same time limit from approaching zero due to excessive changes in and . It is directly introduced as a fixed constant.
[0088] Assume that the initial continuous area of the crack direction in the image contains 10 pixel points, the initial , adjustment coefficient . During the expansion process, the total number of pixel points in the current area , calculate the dynamic threshold during the expansion process.
[0089] Substitute the parameters into the formula:
[0090] ;
[0091] The results show that at the 20th pixel point of expansion, the dynamic threshold decreases from the initial to approximately , which means that the extended determination condition is more stringent, can more precisely restrict the deviation of the extended path from the main direction of the crack and avoid the interference of noise points. This dynamic adjustment makes the extended path more conform to the actual crack area morphology, ensuring the reliability and accuracy of the extended result. In addition, in the case of crack crossing, the extension may enter areas in multiple directions simultaneously. At this time, it is necessary to judge the directionality of the branches of the extended path. Based on the average gradient direction of the current extended area and the direction change trend of the newly added pixel points, select the path closest to the extension direction to continue the extension. For example, when extending to the intersection point, if the average direction of the current extended path is -45°, and there are two branch areas with directions of -50° and -10° respectively around the intersection point, the -50° direction closest to the current direction is preferentially selected for extension. The specific judgment basis is to compare the direction deviation of the newly added points, and the direction with the smallest deviation value is selected as the main path for continued extension. In addition, in order to prevent missing other branches, the directions deviating from the main path can be recorded, and after the extension of the main path is completed, the recorded directions are used as new seed points to start independent extension, so as to completely cover all directions of the crossing path. When the crack bends, the average direction of the extended area will gradually deviate from the original seed direction. At this time, it is necessary to dynamically adjust the reference direction of the extension to avoid the extension interruption caused by over-relying on the initial direction. The specific processing method is to continuously monitor the direction fluctuation of the newly added pixel points. For example, when the direction deviation of 5 consecutive newly added points is less than the set continuity threshold after dynamic extension When, update the current direction to the reference direction of the extended area. For example, if the extended path gradually bends from the initial direction of -45°, and the directions of the newly added 5 pixel points are -44°, -43°, -42°, -41°, -40° in turn, since the direction deviations are all less than the current dynamic threshold , the average direction of the extended area is updated to -40°, and the subsequent extension will continue along the bending direction based on this.
[0092] S202: Based on the complete extended area, by comparing the gradient direction of each pixel point with the average direction of the current extended area, if the gradient direction of the target pixel point deviates from the average direction of the current area and the deviation value exceeds the continuity threshold after dynamic extension, mark the target pixel point as a noise point, and eliminate the noise points to generate the crack path of the LED lamp bead;
[0093] First, during the extension process, compare the gradient direction of each newly added pixel point with the average direction of the extended area. The average direction of the extended area is obtained by statistically calculating the gradient direction values of all pixel points in the extended area and calculating the average value of these directions. The specific operation is to accumulate the gradient directions of each pixel point in the current extended area and divide by the total number of pixel points in this area. If the gradient direction of a certain point deviates from the average direction of the current area by more than the set continuity threshold after dynamic extension (that is ), then mark this point as a noise point and remove it from the current extended area. Taking a crack propagation area as an example, the average gradient direction of the extended area is -45°, and the gradient direction of the newly added pixel point is -30°. The deviation of this point from the average direction is 15°. If this deviation exceeds the current set continuity threshold after dynamic expansion (such as 1.67°), then this point will be excluded and no longer included in the extended area. For the completed extended area, a global check of the final result is also required. By statistically analyzing the direction distribution of all pixel points in the area, identify the areas with abnormal distributions and correct or remove these areas. For example, a crack propagation area should present a relatively continuous gradient direction distribution, but in a certain sub-area, the gradient direction shows a random distribution or large fluctuations (such as there are a large number of points with direction deviations exceeding the continuity threshold after dynamic expansion), then determine this sub-area as a noise area and remove it from the expansion result. After removing the noise points, by recording the coordinates of all eligible pixel points in the extended area, a preliminary crack propagation path is generated according to the spatial coherence of these coordinates. For example, a crack area starts from an initial seed point and gradually expands to form a path with a length of 50 pixel points. By analyzing the arrangement of these points in space, a continuous crack direction path can be extracted. The finally generated preliminary expansion path is output in the form of a list of coordinate points.
[0094] Please refer to Figure 4 , the steps for calculating the gray entropy value of the segmented area are specifically as follows:
[0095] S301: Locally segment the preprocessed surface image of the LED lamp bead into multiple fixed-size segmented areas. Each segmented area contains the same number of pixel points, and generate a dataset of segmented images after local segmentation according to the segmentation result;
[0096] First, divide the preprocessed surface image of the LED lamp bead into multiple fixed-size segmented areas. Each segmented area contains a certain number of pixel points. Read the image data block by block and store its gray value separately. Subsequently, record the pixel data of each area in the form of an array according to the segmentation result, and finally generate a dataset of segmented images after local segmentation.
[0097] S302: Based on the dataset of segmented images after local segmentation, use the formula:
[0098] ;
[0099] Calculate the gray entropy value of the segmented area after local segmentation of the preprocessed surface image of the LED lamp bead ;
[0100] Among them, It is used to measure the complexity of the gray-scale distribution of each segmented block area in the surface image of the LED lamp bead after preprocessing. The higher the entropy value, the more uniform the gray-scale distribution in the block area; the lower the entropy value, the more concentrated the gray-scale in certain specific values. The gray level is used to identify the range of gray-scale values statistically in the surface image of the LED lamp bead after preprocessing. It is usually an integer value range from 0 to 255 and can be directly obtained by statistically analyzing the histogram of the surface image of the LED lamp bead after preprocessing. For example, in a certain segmented block area, the gray-scale values indicating that the points with a pixel brightness of 50 are recorded and used for calculation. The total number of gray levels in the segmented block area of the surface image of the LED lamp bead after preprocessing represents the number of gray levels contained in a certain segmented block area of the surface image of the LED lamp bead after preprocessing. It usually equals the gray-level range of the surface image of the LED lamp bead after preprocessing (such as 256) and is determined by analyzing the histogram of the segmented block area. If the gray-scale values of the segmented block area do not cover all gray-scale ranges, then it equals the actual number of gray levels. For example, if a certain segmented block area only contains pixel points with gray-scale values from 30 to 80, then , The weighting factor is used to adjust the setting of the gray-level contribution. The weighting factor is set based on the importance of the gray level in distinguishing the dark spot area from the normal area. The specific rules are as follows: the lower the gray-scale value, the greater the weight. Since dark spots on the surface of the LED lamp bead usually appear in areas with low gray-scale values, the contribution of pixels with low gray levels needs to be increased in the entropy value calculation. For example, when the gray-scale value is less than 50, the weight is set in the range of 1.2 to 1.5 to highlight the importance of the low-gray area. The higher the gray-scale value, the smaller the weight. In the normal area, high gray-scale values are often evenly distributed and change less, having a lower impact on defect detection. Therefore, the weight corresponding to high gray-scale values will be reduced. For example, when the gray-scale value is greater than 200, the weight is set in the range of 0.8 to 1.0 to reduce its impact on the entropy value calculation. Gradual adjustment of the weight: For medium gray-scale values (such as between 50 and 200), the weight can be gradually decreased according to the proximity of the gray-scale value to the low-gray area and can be adjusted in a linear decreasing or piecewise function manner. For example: when the gray-scale value is between 50 and 100, the weight is set in the range of 1.1 to 1.2; when the gray-scale value is between 100 and 200, the weight is set in the range of 1.0 to 1.1, and the weight The specific value is determined after being verified by experimental data. Multiple surface images of LED lamp beads are collected, and the calculation results of the entropy values for different weight schemes are compared respectively. A weight distribution scheme that can more effectively distinguish the dark spot area and the normal area is selected. The setting range is as follows: low gray value ( ) : The weight is between 1.2 and 1.5; medium gray value ( ) : The weight is between 1.0 and 1.2; high gray value ( ) : The weight is between 0.8 and 1.0. is the probability of the gray level in the segmented area of the surface image of the LED lamp bead after corresponding preprocessing, representing the proportion of the number of pixels where the current gray level appears in the total number of pixels in the segmented area. The specific acquisition method is to count the number of pixels of the gray level in the gray level histogram of each segmented area after local segmentation in the surface image of the LED lamp bead after preprocessing, and calculate it in combination with the total number of pixels in the segmented area. The formula is: . is the logarithm of the gray level probability , which is used to quantify the contribution of the current gray level. The base of the logarithm is selected as 2 to unify the measurement unit of entropy (bit).
[0101] Suppose the total number of pixels in the segmented area of the surface image of a preprocessed LED lamp bead (the size of the segmented area is 100×100 pixels), and the gray level probabilities are , , , and the weights are , , .
[0102] According to the formula, the gray entropy value is calculated as:
[0103] ;
[0104] The result shows that the gray entropy value of the segmented area after local segmentation in the surface image of the preprocessed LED lamp bead.
[0105] The method of continuously calculating the gray entropy value through a sliding window is to divide the surface image of the preprocessed LED lamp bead into window areas with a fixed size, calculate the gray entropy value in units of the window each time, and the window moves on the image according to a certain step size. The specific process is as follows: 1. Determine the window size and step size. For example, set the window size to Pixels, with the step size set to pixels, that is, the window moves 50 pixels each time to cover a new area. 2. Starting from the upper left corner of the image, extract the pixel area within the window, count the number of pixels of each gray level within the window, and calculate the corresponding gray probability . 3. According to the calculated gray probability and formula, calculate the gray entropy value of the current window . 4. Move the window to the right according to the set step size, and repeat steps 2 and 3 until the window cannot be fully covered in this row. 5. After completing one row, move the window down by one step size, and repeat steps 2 to 4 until the entire image is covered. The continuous calculation method of the sliding window can obtain the gray entropy value of each window area one by one, forming the distribution data of the local gray features of the image. These data can be further used to mark the suspected dark spot areas and combine with specific thresholds for area recognition and processing
[0106] Please refer to Figure 5 , and the steps for obtaining the dark spot features of the LED lamp beads are specifically as follows
[0107] S311: By comparing the gray entropy value of each block area with the preset gray threshold one by one, mark the area with a gray entropy value lower than the gray threshold as a suspected dark spot area, and generate a preliminary marking result
[0108] First, through the statistical analysis of the surface area of normal LED lamp beads, set the gray entropy threshold , for example, take as the boundary for dividing the normal area and the suspected dark spot area, and judge each block area corresponding to each sliding window one by one. When the gray entropy value of the block area , mark it as a suspected dark spot area. If , then mark it as a normal area. Generate a binary marking map through pixel-by-pixel comparison, and store all areas that meet the suspected dark spot conditions as preliminary results
[0109] S312: Based on the preliminary marking result, check the neighborhood of each suspected dark spot area, remove the isolated points in the suspected dark spot area according to the inspection result, and integrate the remaining areas to generate the dark spot features of the LED lamp beads
[0110] First, calculate the neighborhood marking quantity of each suspected dark spot pixel. For example, use a 3×3 window to count the number of suspected dark spot pixels around each pixel. If the neighborhood marking quantity of a certain pixel is less than the set threshold (such as less than 2 suspected dark spot pixels in the neighborhood), then mark this pixel as an isolated point and remove it. Retain the pixels that are not removed in the neighborhood analysis as the final dark spot area, store the result after removal as the dark spot feature for subsequent analysis and statistics, and finally generate the dark spot features on the surface of the LED lamp beads
[0111] Please refer toFigure 6 , the steps for obtaining the surface depression features of the LED lamp beads are specifically as follows:
[0112] S401: Project grating fringes onto the surface of the LED lamp beads. By adjusting the projection angle and intensity of the grating fringe light source, collect the grating fringe images and scan the central position of the grating fringes, analyze the bending and spacing changes of adjacent grating fringes at the central position, and generate the analysis result of the grating fringe changes;
[0113] Project the grating fringes onto the surface of the LED lamp bead entity. Use the Image Processing Toolbox in MATLAB software combined with a CCD camera to collect the image of the LED lamp bead entity surface after projecting the grating fringes. Subsequently, perform image edge detection through the edge function of MATLAB, scan the collected grating fringe images line by line, and extract the central coordinate positions of each grating fringe. Calculate the grating fringe spacing using the pixel difference between the central positions of adjacent grating fringes. For example, if the central positions of a pair of grating fringes are the 100th pixel and the 120th pixel respectively, then the grating fringe spacing is 20 pixels. Measure the spacing of all grating fringes one by one according to this method, and record the spacing values of each pair of grating fringes. When the grating fringe spacing is less than the set threshold (such as 20 pixels), mark this area as the area where deformation may occur. Subsequently, calculate the curvature of the grating fringes using the Curve Fitting Toolbox in MATLAB. For example, within the marked area, the curvature change of the grating fringe fitting curve is 0.08, exceeding the preset curvature threshold (such as 0.05), then mark this grating fringe area as the bending area. Finally, store the measurement results of the grating fringe spacing and curvature change as an Excel file.
[0114] S402: Based on the analysis result of the grating fringe changes, screen the positions where the bending and spacing changes of the grating fringes exceed the preset change threshold, calibrate the corresponding depression deformation area according to the screening result, and generate the surface depression features of the LED lamp beads;
[0115] According to the measurement results of the bending and spacing changes of the grating fringes, the bwconncomp function in MATLAB is used to extract the distribution of the deformed areas of the grating fringes. The previously stored measurement data of the grating fringe spacing and curvature are read, and the change results of each grating fringe spacing and curvature are compared and analyzed. It is assumed that when the grating fringe spacing is less than 20 pixels and the curvature change is greater than the change threshold of 0.05, this grating fringe can be marked as a deformed area. For the deformed areas that meet the conditions, the bwboundaries function of MATLAB is used to extract the region boundaries. For example, in the marked area, the pixel coordinates of the deformed area boundary are (100, 50), (120, 60), (140, 55), etc. These coordinates are used to generate a contour map of the closed area. Further, the area of the calibrated deformed area is calculated, and the regionprops function in MATLAB is used to count the number of pixels in the region. For example, the region contains 500 pixel points, corresponding to an actual physical area of 0.05 mm². The calculation results are recorded in an Excel file to generate the complete surface depression characteristics of the LED lamp bead.
[0116] Please refer to Figure 7 , the steps for obtaining the multi-feature defect distribution map of the LED lamp bead are specifically as follows:
[0117] S501: Integrate the crack path, dark spot feature, and surface depression feature of the LED lamp bead, perform spatial mapping and alignment with the original LED lamp bead surface image, extract the boundaries and superimpose and mark each type of defect area to generate an integrated marked image;
[0118] Read the Excel files of each feature, including the extended path file of the LED lamp bead crack refinement, the dark spot feature file, and the depression feature file. Use the xlsread function in MATLAB to import the spatial coordinates and corresponding feature information of each type of feature respectively. For example, the crack feature file contains the starting and ending coordinates of the path points, the dark spot feature file records the center point and area data of each dark spot area, and the depression feature file contains the boundary coordinates of the deformed area. Subsequently, use the image processing toolbox of MATLAB to import the original LED lamp bead surface image into the workspace, and superimpose the spatial information of each type of feature onto the original image through coordinate mapping. Use the plot function in MATLAB to visually mark the boundaries of different features. For example, the crack feature is marked with a red solid line for the path, the dark spot feature is marked with a yellow circle for the center point and the area is filled, and the depression feature is marked with a blue dashed line for the deformed boundary. Finally, generate the original image with all feature markings.
[0119] S502: Based on the integrated marked images, classify and statistically analyze the attributes of each type of defect area. Among them, the attributes of each type of defect area include quantity, area, and distribution range data. Combine the statistical results to generate a multi-feature defect distribution map of LED lamp beads;
[0120] Conduct distribution statistics on each type of defect area. Use the regionprops function in MATLAB to read the attribute information of each type of defect area in the marked feature image, including area, perimeter, center point coordinates, etc., and classify and summarize the statistical results separately. At the same time, combine the coordinate information of the defect area to analyze its distribution range. For example, the crack feature is mainly concentrated in the edge area of the lamp bead, the dark spot feature is concentrated in the central area, and the depression feature is distributed in the lower half. After the statistics are completed, use the plotting functions in MATLAB (such as the bar function to generate a bar chart and the heatmap function to generate a heat map) to visually display the distribution statistical results, and superimpose the distribution statistical results of different defect features on the surface image of the LED lamp bead to finally generate a multi-feature defect distribution map of the LED lamp bead for evaluating and analyzing the defect distribution characteristics.
[0121] An LED lamp bead defect detection system, including:
[0122] The image preprocessing module collects the original image on the surface of the LED lamp bead and preprocesses it to obtain the preprocessed surface image of the LED lamp bead. Analyze the gradient direction of each pixel point in the preprocessed surface image of the LED lamp bead according to the gray-scale change amount of each pixel point in the horizontal and vertical directions, obtain the area with continuous gradient direction, and generate the crack direction distribution feature of the LED lamp bead;
[0123] The crack path generation module starts from the area with continuous gradient direction in the crack direction distribution feature of the LED lamp bead, gradually expands the adjacent areas of the area with continuous gradient direction and dynamically adjusts the expansion conditions during the expansion process, and generates the crack path of the LED lamp bead according to the expansion result;
[0124] The dark spot feature extraction module locally divides the preprocessed surface image of the LED lamp bead into multiple block areas of a fixed size, calculates the gray-scale entropy value of the block area, and marks the areas suspected of dark spots in each block area after local segmentation with reference to the gray-scale entropy value to generate the dark spot feature of the LED lamp bead;
[0125] The surface depression analysis module projects grating stripes onto the surface of the LED lamp bead, analyzes the bending and spacing changes of the grating stripes, calibrates the depression deformation area of the grating stripes, and generates the surface depression feature of the LED lamp bead;
[0126] The defect distribution visualization module integrates the crack path of the LED lamp bead, the dark spot feature of the LED lamp bead, and the surface depression feature of the LED lamp bead and displays them in a visual way to generate a multi-feature defect distribution map of the LED lamp bead.
[0127] The above are only the preferred embodiments of the present invention, and do not limit the present invention in other forms. Any person skilled in the art may use the technical content disclosed above to make changes or modifications into equivalent embodiments with equivalent changes and apply them to other fields. However, as long as it does not depart from the technical solution content of the present invention, any simple modification, equivalent change, and modification made to the above embodiments based on the technical essence of the present invention still fall within the protection scope of the technical solution of the present invention.
Claims
1. A method for detecting defects of LED lamp beads, characterized in that, Including the following steps: S1: Collect the original image of the LED lamp bead surface and preprocess it to obtain the image of the LED lamp bead surface after preprocessing. Analyze the gradient direction of each pixel point in the horizontal and vertical directions in the image of the LED lamp bead surface after preprocessing, obtain the regions with continuous gradient directions, and generate the crack direction distribution characteristics of the LED lamp bead; S2: Starting from the region with continuous gradient directions in the crack direction distribution characteristics of the LED lamp bead, gradually expand the adjacent regions of the region with continuous gradient directions and dynamically adjust the expansion conditions during the expansion process, and generate the crack path of the LED lamp bead according to the expansion result; The specific steps for obtaining the crack path of the LED lamp bead are as follows: S201: Starting from the region with continuous gradient directions in the crack direction distribution characteristics of the LED lamp bead, use the region growing algorithm to gradually expand the adjacent regions of the region with continuous gradient directions and dynamically adjust the expansion conditions during the expansion process. Use the formula: Calculate the continuity threshold Δθ' after dynamic expansion, and dynamically adjust the expansion conditions during the expansion process through the continuity threshold Δθ' after dynamic expansion to identify the continuous paths, cross paths, and curved paths in the expansion path, and generate a complete expansion region; Where, Δθ is the continuity threshold, k is the adjustment coefficient set to control the change of Δθ' with the expansion range, and N represents the total number of pixel points gradually expanded starting from the region with continuous gradient directions extracted from the crack direction distribution characteristics of the LED lamp bead as the initial region; S202: Based on the complete expansion region, by comparing the gradient direction of each pixel point with the average direction of the current expansion region, if the gradient direction of the target pixel point deviates from the average direction of the current region and the deviation value exceeds the continuity threshold after dynamic expansion, mark the target pixel point as a noise point, and remove the noise points to generate the crack path of the LED lamp bead; S3: Locally divide the image of the LED lamp bead surface after preprocessing into multiple block regions of a fixed size, calculate the gray entropy value of the block regions, and mark the regions suspected of dark spots in each block region after local division with reference to the gray entropy value to generate the dark spot characteristics of the LED lamp bead; S4: Project grating stripes onto the surface of the LED lamp bead, analyze the bending and spacing changes of the grating stripes, and calibrate the sunken deformation region of the grating stripes to generate the surface sunken characteristics of the LED lamp bead; S5: Integrate the crack path of the LED lamp bead, the dark spot characteristics of the LED lamp bead, and the surface sunken characteristics of the LED lamp bead and display them in a visual way to generate a multi-feature defect distribution map of the LED lamp bead.
2. The LED lamp bead defect detection method according to claim 1, characterized in that The specific steps for obtaining the crack direction distribution characteristics of the LED lamp bead are as follows: S101: Collect the original image of the LED lamp bead surface and preprocess it, including using Gaussian filtering to remove random noise in the original image, and enhancing the overall gray level of the original image through histogram equalization to generate the image of the LED lamp bead surface after preprocessing; S102: Calculate the gray-scale change amounts of each pixel point in the horizontally and vertically directions in the pre-processed surface image of the LED lamp bead by using the Sobel operator, analyze the gradient direction of each pixel point according to the gray-scale change amounts, and construct a gray-scale gradient direction distribution map according to the gradient directions; S103: Compare the gradient direction of each pixel point in the gray-scale gradient direction distribution map with the gradient direction of adjacent pixel points one by one with a preset continuity threshold, mark the regions of continuous pixel points according to the comparison results, and generate the crack direction distribution characteristics of the LED lamp bead according to the regions of continuous pixel points.
3. The LED lamp bead defect detection method according to claim 1, wherein The steps for calculating the gray-scale entropy value of the divided block regions are specifically as follows: S301: Locally divide the pre-processed surface image of the LED lamp bead into multiple block regions of a fixed size. Each block region contains the same number of pixel points, and generate a dataset of block images after local division according to the division results; S302: Based on the dataset of block images after local division, use the formula: Calculate the gray-scale entropy value H of the block regions after local division of the pre-processed surface image of the LED lamp bead; Where a is the gray level used to identify the range of gray values statistically in the surface image of the preprocessed LED lamp bead, n is the total number of gray levels in the segmented area of the surface image of the preprocessed LED lamp bead, w a is the weighting factor used to adjust the gray level contribution setting, p a is the probability of the gray level a in the corresponding segmented area of the surface image of the preprocessed LED lamp bead, log2(p a ) is the logarithm value of the gray level probability p a .
4. The LED lamp bead defect detection method according to claim 3, characterized in that, The steps for obtaining the dark spot characteristics of the LED lamp bead are specifically as follows: S311: By comparing the gray-scale entropy value of each block region with a preset gray-scale threshold one by one, mark the regions with gray-scale entropy values lower than the gray-scale threshold as suspected dark spot regions, and generate a preliminary marking result; S312: Based on the preliminary marking result, check the neighborhood of each suspected dark spot region, remove the isolated points in the suspected dark spot regions according to the check results, and integrate the remaining regions to generate the dark spot characteristics of the LED lamp bead.
5. The LED lamp bead defect detection method according to claim 1, wherein The steps for obtaining the surface depression characteristics of the LED lamp bead are specifically as follows: S401: Project grating stripes onto the surface of the LED lamp bead. By adjusting the projection angle and intensity of the grating stripe light source, collect the grating stripe image and scan the central position of the grating stripes, and analyze the bending and spacing changes of adjacent grating stripes at the central position to generate an analysis result of the grating stripe changes; S402: Based on the analysis result of the grating stripe changes, screen the positions where the bending and spacing changes of the grating stripes exceed a preset change threshold, and calibrate the corresponding depression deformation regions according to the screening results to generate the surface depression characteristics of the LED lamp bead.
6. The LED lamp bead defect detection method according to claim 1, wherein The steps for obtaining the multi-feature defect distribution map of the LED lamp bead are specifically as follows: S501: Integrate the crack path, the dark spot characteristics of the LED lamp bead, and the surface depression characteristics of the LED lamp bead, perform spatial mapping and alignment with the original surface image of the LED lamp bead, and generate an integrated marked image by extracting the boundaries and superimposing and marking each type of defect region; S502: Based on the integrated marked image, classify and count the attributes of each type of defect region. Among them, the attributes of each type of defect region include data such as the quantity, area, and distribution range, and generate a multi-feature defect distribution map of the LED lamp bead in combination with the statistical results.
7. An LED lamp bead defect detection system for implementing the LED lamp bead defect detection method described in any one of claims 1-6, characterized in that, The system includes: The image preprocessing module collects the original image of the LED lamp bead surface and preprocesses it to obtain the image of the LED lamp bead surface after preprocessing. Analyze the gradient direction of each pixel point in the horizontal and vertical directions in the image of the LED lamp bead surface after preprocessing, obtain the regions with continuous gradient directions, and generate the crack direction distribution characteristics of the LED lamp bead; The crack path generation module starts from the region with continuous gradient direction in the crack direction distribution characteristics of the LED lamp bead, gradually expands the adjacent regions of the region with continuous gradient direction, and dynamically adjusts the expansion conditions during the expansion process, and generates the crack path of the LED lamp bead according to the expansion result; The dark spot feature extraction module locally divides the image of the LED lamp bead surface after preprocessing into multiple block regions of a fixed size, calculates the gray entropy value of the block regions, marks the regions suspected of dark spots in each block region after local division with reference to the gray entropy value, and generates the dark spot features of the LED lamp bead; The surface depression analysis module projects grating stripes onto the surface of the LED lamp bead, analyzes the bending and spacing changes of the grating stripes, calibrates the depression deformation region of the grating stripes, and generates the surface depression characteristics of the LED lamp bead; The defect distribution visualization module integrates the crack path of the LED lamp bead, the dark spot features of the LED lamp bead, and the surface depression characteristics of the LED lamp bead and displays them in a visual way to generate a multi-feature defect distribution map of the LED lamp bead.
Citation Information
Patent Citations
Underwater structure surface crack detection device and method based on compound-eye bionic vision
CN105954292A
LED lamp bead detection method and device, equipment and storage medium
CN118470030A