Mini led appearance detection method and device
The MiniLed appearance detection method with adaptive parameter adjustment solves the problems of manual parameter adjustment and sharpness in MiniLed appearance detection by using an adaptive threshold segmentation algorithm and rectangle fitting technology, and achieves efficient detection results.
Patent Information
- Application Number
- CN202311838242.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-28
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2043-12-28
AI Technical Summary
Existing MiniLed appearance inspection technology requires extensive manual parameter adjustment when dealing with images of varying resolutions, and the fixed-focus lens causes image blurring, affecting the inspection results.
A parameter-adaptive adjustment method is adopted, using the first and second adaptive threshold segmentation algorithms to segment the MiniLed appearance image. Combined with rectangle fitting and specification parameter comparison, the workload of manual parameter adjustment is reduced, and it can adapt to different resolution scenarios.
Without adding hardware, it improves detection efficiency, reduces manual parameter adjustment workload, and can effectively handle detection tasks at different resolutions.
Smart Images

Figure CN117764968B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a MiniLed appearance detection method and apparatus based on parameter adaptive adjustment. Background Technology
[0002] In the manufacturing process of miniLED panels, different process steps can lead to various chip defects, including soldering abnormalities, missing components, misalignment, rotation, tilting, warping, foreign objects, damage, and LED failure. Adding AOI (Automated Optical Inspection) machines at different points in the production line can help manufacturers locate problems promptly, optimize production processes, and thus improve efficiency. Current technical solutions for detecting miniLED appearance defects typically involve first taking a picture of the miniLED board with a high-precision industrial camera, and then determining the presence of defects based on the difference between the image and the target image.
[0003] There are two specific implementation methods. One is to pre-select the best template image, create the template, and then compare the differences between each LED bead and the template. If the difference exceeds a certain range, the LED bead is considered abnormal. The other method is to perform threshold segmentation after image preprocessing, then perform shape fitting on the segmented specific regions, and compare the fitted shape with the known LED bead information. If the shape exceeds the threshold, it indicates that the LED bead is abnormal.
[0004] The former requires high consistency in image clarity. However, during the manufacturing process of miniLED panels, there is a chance that the panels will bend or deform. Since the industrial lenses used for taking pictures are generally fixed-focus lenses, this will lead to blurred images, resulting in errors in the detection results of the algorithm. The latter involves a series of adjustable parameters in processes such as threshold segmentation, morphological filtering, shape selection, and shape fitting. To achieve the best detection effect for images with different clarity, a lot of time and effort is required to adjust the parameters. In addition, the optimal parameters are generally different for different products to be inspected. Summary of the Invention
[0005] The purpose of this invention is to overcome the shortcomings of the prior art. This invention provides a MiniLed appearance detection method and device based on parameter adaptive adjustment, which realizes the segmentation of appearance images through parameter adaptive adjustment without adding hardware equipment, thereby reducing the workload of manual parameter adjustment during image segmentation, and can cope with detection tasks in different resolution scenarios.
[0006] To address the aforementioned technical problems, embodiments of the present invention provide a MiniLed appearance detection method based on adaptive parameter adjustment, the method comprising:
[0007] The first adaptive threshold segmentation algorithm is used to segment the lamp group region in the MiniLed appearance image to obtain the first segmented image containing the pads and lamp groups.
[0008] The second adaptive threshold segmentation algorithm is used to segment each LED region of the first segmented image to obtain the rough shape of each LED in the lamp group and the segmentation threshold of each LED.
[0009] The rough shape of each LED in the lamp assembly is fitted with a rectangle to obtain the fitted rectangle for each LED.
[0010] The length, width, and area of the fitted rectangle corresponding to each LED bead are calculated, and the length, width, and area of the fitted rectangle corresponding to each LED bead are compared with the specification parameters of the corresponding LED bead.
[0011] Optionally, the step of segmenting the lamp group region in the MiniLed appearance image based on the first adaptive threshold segmentation algorithm to obtain a first segmented image containing pads and lamp groups includes:
[0012] When segmenting the MiniLed appearance image, the background of the MiniLed appearance image is selected as bright, and the first adaptive threshold segmentation algorithm is used for segmentation to obtain a preliminary segmented image.
[0013] The centroid position of the preliminary segmented image is calculated to obtain the centroid position of the preliminary segmented image;
[0014] The region of the red LED in the lamp group in the preliminary segmentation image is obtained based on the centroid position of the preliminary segmentation image, and the region of the red LED in the preliminary segmentation image is filled to form a first segmentation image. The first segmentation image consists of a red LED sub-region composed of red LEDs and pads, a green LED sub-region composed of green LEDs and pads, and a blue LED sub-region composed of blue LEDs and pads.
[0015] Optionally, after obtaining the first segmented image containing the pads and lamps, the method further includes:
[0016] Calculate the areas of the red LED bead region, green LED bead region, and blue LED bead region in the first segmented image respectively to obtain the areas of the red LED bead region, green LED bead region, and blue LED bead region.
[0017] Determine whether the areas of the red LED bead region, the green LED bead region, and the blue LED bead region are within a preset threshold range. The preset threshold is between a preset area and twice the preset area.
[0018] If the value is within the preset threshold range, then the first segmented image is segmented based on the second adaptive threshold segmentation algorithm for each LED region.
[0019] If it is not within the preset threshold range, and its area is smaller than the preset area, then the corresponding color LED bead area is determined to be a foreign object area;
[0020] If the area is greater than twice the preset area and is outside the preset threshold range, then the corresponding color LED area is determined to be the pad area of the missing LED.
[0021] Optionally, the step of segmenting each LED region in the first segmented image based on the second adaptive threshold segmentation algorithm to obtain the approximate shape of each LED in the LED group and the segmentation threshold of each LED includes:
[0022] Obtain the green LED bead region, blue LED bead region, and red LED bead region corresponding to the first segmented image;
[0023] When segmenting the green LED bead sub-region and the blue LED bead region, a segmentation threshold where the target is brighter than the background is selected to perform segmentation processing using the second adaptive threshold segmentation algorithm, thereby obtaining the rough shape of the green LED bead, the rough shape of the blue LED bead, the segmentation threshold of the green LED bead, and the segmentation threshold of the blue LED bead.
[0024] When segmenting the red LED bead sub-region, a segmentation threshold where the target is darker than the background is selected, and the second adaptive threshold segmentation algorithm is used for segmentation processing to obtain the rough shape of the red LED bead and the segmentation threshold of the red LED bead.
[0025] Optionally, the step of selecting a segmentation threshold where the target is darker than the background when segmenting the red LED bead region to perform segmentation using the second adaptive threshold segmentation algorithm includes:
[0026] The minimum bounding rectangle region of the red LED bead sub-region is calculated to obtain the minimum bounding rectangle region of the red LED bead.
[0027] When segmenting the minimum bounding rectangle region of the red LED bead, a segmentation threshold where the target is darker than the background is selected, and the second adaptive threshold segmentation algorithm is used for segmentation processing.
[0028] Optionally, the step of performing rectangular fitting processing on the rough shape of each LED bead in the lamp group to obtain the fitted rectangle corresponding to each LED bead includes:
[0029] Morphological filtering was performed on the rough shapes of the green LED, blue LED, and red LED respectively to obtain the filtered rough shapes of the green LED, blue LED, and red LED.
[0030] Rectangle fitting is performed on the rough shapes of the filtered green LED, the rough shapes of the filtered blue LED, and the rough shapes of the filtered red LED to obtain fitted rectangles for the green LED, the blue LED, and the red LED, respectively.
[0031] Optionally, the comparison process based on the length, width, and area of the fitted rectangle corresponding to each LED bead and the specification parameters of the corresponding LED bead includes:
[0032] And determine whether the length, width and area of each LED bead are within the specifications of the corresponding LED bead;
[0033] If any of the length, width, or area of each LED bead is not within the specification parameters of the corresponding LED bead, determine whether the length-to-width ratio of the corresponding LED bead is within the preset ratio range.
[0034] If the aspect ratio of the corresponding LED bead is not within the preset range, the LED bead corresponding to the aspect ratio is determined to be tilted.
[0035] If the aspect ratio of the corresponding LED bead is within the preset range, adjust the segmentation threshold of the LED bead corresponding to the aspect ratio, and after adjusting the segmentation threshold, return to the step of segmenting the first segmented image based on the second adaptive threshold segmentation algorithm.
[0036] If the length, width, and area of each LED bead are all within the specifications of the corresponding LED bead, then the fitted rectangle corresponding to each LED bead is confirmed as the corresponding LED bead area.
[0037] Optionally, adjusting the segmentation threshold of the LED corresponding to the aspect ratio includes:
[0038] The segmentation threshold of the LED beads corresponding to the aspect ratio is adjusted in a fixed step manner.
[0039] Optionally, after confirming that the fitted rectangle corresponding to each LED bead is the corresponding LED bead region, the method further includes:
[0040] The centroid position and rotation angle of the fitted rectangle corresponding to each LED bead are calculated. Based on the centroid position, it is determined whether the corresponding LED bead has a fixed offset defect. At the same time, based on the rotation angle, it is determined whether the corresponding LED bead has a rotation defect.
[0041] In addition, embodiments of the present invention also provide a MiniLED appearance inspection device based on parameter adaptive adjustment, the device comprising:
[0042] First segmentation module: used to segment the lamp group region in the MiniLed appearance image based on the first adaptive threshold segmentation algorithm to obtain a first segmented image containing pads and lamp groups;
[0043] The second segmentation module is used to segment the LED regions of the first segmented image based on the second adaptive threshold segmentation algorithm to obtain the rough shape of each LED in the LED group and the segmentation threshold of each LED.
[0044] Rectangle Fitting Module: Used to perform rectangle fitting on the rough shape of each LED in the lamp group to obtain the fitted rectangle for each LED;
[0045] Comparison module: used to calculate the length, width, and area of the fitted rectangle corresponding to each LED bead, and to compare the length, width, and area of the fitted rectangle corresponding to each LED bead with the specification parameters of the corresponding LED bead.
[0046] In this embodiment of the invention, appearance images are segmented by adaptive parameter adjustment without adding hardware devices, thereby reducing the workload of manual parameter adjustment during image segmentation and enabling detection tasks in different resolution scenarios. Attached Figure Description
[0047] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0048] Figure 1 This is a flowchart illustrating the MiniLed appearance detection method based on parameter adaptive adjustment in an embodiment of the present invention.
[0049] Figure 2 This is a schematic diagram of the structure of the MiniLed appearance inspection device based on parameter adaptive adjustment in an embodiment of the present invention. Detailed Implementation
[0050] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0051] Example 1, please refer to Figure 1 , Figure 1 This is a flowchart illustrating the MiniLed appearance inspection method based on parameter adaptive adjustment in an embodiment of the present invention.
[0052] like Figure 1As shown, a MiniLed appearance detection method based on parameter adaptive adjustment is described, the method comprising:
[0053] S11: Based on the first adaptive threshold segmentation algorithm, the lamp group region in the MiniLed appearance image is segmented to obtain the first segmented image containing pads and lamp groups;
[0054] In a specific implementation of this invention, the step of segmenting the lamp group region in the MiniLed appearance image based on the first adaptive threshold segmentation algorithm to obtain a first segmented image containing pads and lamp groups includes: when segmenting the MiniLed appearance image, selecting the background of the MiniLed appearance image as bright, and using the first adaptive threshold segmentation algorithm for segmentation to obtain a preliminary segmented image; performing centroid position calculation processing on the preliminary segmented image to obtain the centroid position of the preliminary segmented image; obtaining the region of red LEDs in the lamp group in the preliminary segmented image based on the centroid position of the preliminary segmented image, and filling the region of red LEDs in the preliminary segmented image to form the first segmented image, wherein the first segmented image consists of a red LED sub-region composed of red LEDs and pads, a green LED sub-region composed of green LEDs and pads, and a blue LED sub-region composed of blue LEDs and pads.
[0055] Furthermore, after obtaining the first segmented image containing pads and LED groups, the method further includes: calculating the areas of the red LED bead sub-region, green LED bead region, and blue LED bead region in the first segmented image, respectively, to obtain the areas of the red LED bead region, green LED bead region, and blue LED bead region; determining whether the areas of the red LED bead region, green LED bead region, and blue LED bead region are within a preset threshold range, where the preset threshold is between a preset area and twice the preset area; if within the preset threshold range, segmenting each LED bead region in the first segmented image based on a second adaptive threshold segmentation algorithm; if not within the preset threshold range, and its area is less than the preset area, then determining that the corresponding color LED bead region is a foreign object region; if not within the preset threshold range, and its area is greater than twice the preset area, then determining that the corresponding color LED bead region is a pad region with missing LEDs.
[0056] Specifically, when segmenting a MiniLED image, it's necessary to select whether the target is brighter or darker than the background for segmentation. This allows for successful segmentation and returns the optimal segmentation threshold without manually adjusting the grayscale threshold parameter. The specific segmentation process involves selecting a target that is brighter than the background.
[0057] Let the original gray level be M, and the number of pixels with gray level i be n.i Normalizing the grayscale histogram yields:
[0058]
[0059] The probabilities of occurrence for background pixel C0 and target pixel C1 are as follows:
[0060]
[0061] To obtain the optimal segmentation threshold, it is necessary to maximize the variance between background pixels and target pixels; that is, to maximize... in:
[0062]
[0063] Where μ0 and μ1 are the mean gray values of each class, and μ(t) is the cumulative gray value when the gray level is T; the gray levels are traversed from 0 to M-1 until a certain gray value is found that maximizes the value of the above formula, and the segmentation result and the gray value are returned.
[0064] Subsequent segmentation is performed using the aforementioned segmentation algorithm based on the user's selection of dark or bright. After segmentation using the algorithm, a preliminary segmented image is obtained. Then, the centroid position of the preliminary segmented image needs to be calculated to obtain its centroid position. Based on the centroid position, the region of the red LED in the lamp group within the preliminary segmented image is obtained, and this region is filled to form a first segmented image. The first segmented image consists of a red LED sub-region composed of red LEDs and pads, a green LED sub-region composed of green LEDs and pads, and a blue LED sub-region composed of blue LEDs and pads.
[0065] Furthermore, after obtaining the first segmented image, the areas of the red, green, and blue LED regions in the first segmented image need to be calculated separately to obtain the areas of the red, green, and blue LED regions. Then, it is determined whether the areas of the red, green, and blue LED regions are within a preset threshold range, which is between a preset area and twice the preset area. If they are within the preset threshold range, the LED regions in the first segmented image are segmented based on a second adaptive threshold segmentation algorithm. If they are not within the preset threshold range, and their area is smaller than the preset area, the corresponding color LED region is determined to be a foreign object region. If they are not within the preset threshold range, and their area is greater than twice the preset area, the corresponding color LED region is determined to be a pad region of a missing LED. In this way, it is possible to detect whether the segmented region is a foreign object region or a pad region of a valid LED.
[0066] S12: Based on the second adaptive threshold segmentation algorithm, the LED bead regions of the first segmented image are segmented to obtain the rough shape of each LED bead in the lamp group and the segmentation threshold of each LED bead.
[0067] In a specific implementation of this invention, the segmentation of each LED region in the first segmented image based on the second adaptive threshold segmentation algorithm to obtain the approximate shape of each LED in the light group and the segmentation threshold of each LED includes: obtaining the green LED sub-region, blue LED region, and red LED region corresponding to the first segmented image; when segmenting the green LED region and the blue LED region, selecting a segmentation threshold where the target is brighter than the background to segment using the second adaptive threshold segmentation algorithm to obtain the approximate shape of the green LED, the approximate shape of the blue LED, the green LED segmentation threshold, and the blue LED segmentation threshold; when segmenting the red LED region, selecting a segmentation threshold where the target is darker than the background to segment using the second adaptive threshold segmentation algorithm to obtain the approximate shape of the red LED and the red LED segmentation threshold.
[0068] Furthermore, the step of selecting a segmentation threshold where the target is darker than the background when segmenting the red LED sub-region and then using the second adaptive threshold segmentation algorithm for segmentation includes: calculating the minimum bounding rectangle region of the red LED sub-region to obtain the minimum bounding rectangle region of the red LED; and selecting a segmentation threshold where the target is darker than the background when segmenting the minimum bounding rectangle region of the red LED and then using the second adaptive threshold segmentation algorithm for segmentation.
[0069] Specifically, firstly, the green, blue, and red LED regions corresponding to the first segmented image need to be obtained. Then, for the green and blue LED regions, a segmentation threshold where the target is brighter than the background is selected during segmentation, and a second adaptive thresholding algorithm is used for segmentation processing to obtain the approximate shapes of the green and blue LEDs, as well as the segmentation thresholds for the green and blue LEDs. Next, for the red LED region, a segmentation threshold where the target is darker than the background is selected during segmentation, and a second adaptive thresholding algorithm is used for segmentation processing to obtain the approximate shape of the red LED and its segmentation threshold.
[0070] For the segmentation of the red LED bead region, the minimum bounding rectangle region of the red LED bead region needs to be calculated first to obtain the minimum bounding rectangle region of the red LED bead. Then, when segmenting the minimum bounding rectangle region of the red LED bead, a segmentation threshold where the target is darker than the background is selected to use a second adaptive threshold segmentation algorithm for segmentation.
[0071] S13: Perform rectangular fitting on the rough shape of each LED in the lamp group to obtain the fitted rectangle for each LED;
[0072] In the specific implementation of this invention, the step of performing rectangular fitting processing on the rough shape of each LED bead in the lamp group to obtain the corresponding fitted rectangle for each LED bead includes: performing morphological filtering processing on the rough shapes of the green LED bead, the blue LED bead, and the red LED bead respectively to obtain the filtered rough shapes of the green LED bead, the filtered rough shapes of the blue LED bead, and the filtered rough shapes of the red LED bead; and performing rectangular fitting processing on the filtered rough shapes of the green LED bead, the filtered rough shapes of the blue LED bead, and the filtered rough shapes of the red LED bead respectively to obtain the fitted rectangles of the green LED bead, the fitted rectangles of the blue LED bead, and the fitted rectangles of the red LED bead.
[0073] Specifically, firstly, morphological filtering is performed on the rough shapes of the green, blue, and red LEDs respectively to obtain the filtered rough shapes of the green, blue, and red LEDs; then, rectangle fitting is performed on the filtered rough shapes of the green, blue, and red LEDs respectively to obtain the fitted rectangles of the green, blue, and red LEDs.
[0074] S14: Calculate the length, width, and area of the fitted rectangle corresponding to each LED bead, and compare the length, width, and area of the fitted rectangle corresponding to each LED bead with the specification parameters of the corresponding LED bead.
[0075] In the specific implementation of this invention, the comparison processing based on the length, width, and area of the fitted rectangle corresponding to each LED bead with the specification parameters of the corresponding LED bead includes: determining whether the length, width, and area corresponding to each LED bead are all within the specification parameters of the corresponding LED bead; if any one of the length, width, and area corresponding to each LED bead is not within the specification parameters of the corresponding LED bead, determining whether the aspect ratio of the corresponding LED bead is within a preset ratio range; if the aspect ratio of the corresponding LED bead is not within the preset ratio range, determining that the LED bead corresponding to the aspect ratio is tilted; if the aspect ratio of the corresponding LED bead is within the preset ratio range, adjusting the segmentation threshold of the LED bead corresponding to the aspect ratio, and after adjusting the segmentation threshold, returning to the step of segmenting the first segmented image based on the second adaptive threshold segmentation algorithm; if the length, width, and area corresponding to each LED bead are all within the specification parameters of the corresponding LED bead, then confirming that the fitted rectangle corresponding to each LED bead is the corresponding LED bead region.
[0076] Furthermore, adjusting the segmentation threshold of the LED corresponding to the aspect ratio includes:
[0077] The segmentation threshold of the LED beads corresponding to the aspect ratio is adjusted in a fixed step manner.
[0078] Furthermore, after confirming that the fitted rectangle corresponding to each LED bead is the corresponding LED bead region, the method further includes: calculating the centroid position and rotation angle of the fitted rectangle corresponding to each LED bead, determining whether the corresponding LED bead has a fixed offset defect based on the centroid position, and determining whether the corresponding LED bead has a rotation defect based on the rotation angle.
[0079] Specifically, the process begins by calculating the length, width, and area of the fitted rectangle corresponding to each LED bead. Then, it's determined whether these dimensions are within the LED bead's specifications. If any one of these dimensions is outside the specifications, the aspect ratio is checked. If the aspect ratio is outside the preset range, the LED bead is considered "tilted." If the aspect ratio is within the preset range, the segmentation threshold is adjusted using a fixed step size. The process then returns to the second adaptive threshold segmentation algorithm to process the first segmented image, repeating this process. If the length, width, and area of each LED bead are within the specifications, the fitted rectangle for each LED bead is confirmed as its region.
[0080] After confirming that the fitted rectangle corresponding to each LED bead is the corresponding LED bead region, it is necessary to determine whether there are any corresponding defects; that is, it is necessary to calculate the centroid position and rotation angle of the fitted rectangle corresponding to each LED bead; then, based on the centroid position, it is determined whether the corresponding LED bead has a fixed offset defect, and based on the rotation angle, it is determined whether the corresponding LED bead has a rotation defect.
[0081] In this embodiment of the invention, appearance images are segmented by adaptive parameter adjustment without adding hardware devices, thereby reducing the workload of manual parameter adjustment during image segmentation and enabling detection tasks in different resolution scenarios.
[0082] Example 2, please refer to Figure 2 , Figure 2 This is a schematic diagram of the structure of the MiniLed appearance inspection device based on parameter adaptive adjustment in an embodiment of the present invention.
[0083] like Figure 2 As shown, a MiniLED appearance inspection device based on parameter adaptive adjustment is disclosed, the device comprising:
[0084] First segmentation module 21: used to segment the lamp group region in the MiniLed appearance image based on the first adaptive threshold segmentation algorithm to obtain a first segmented image containing pads and lamp groups;
[0085] In a specific implementation of this invention, the step of segmenting the lamp group region in the MiniLed appearance image based on the first adaptive threshold segmentation algorithm to obtain a first segmented image containing pads and lamp groups includes: when segmenting the MiniLed appearance image, selecting the background of the MiniLed appearance image as bright, and using the first adaptive threshold segmentation algorithm for segmentation to obtain a preliminary segmented image; performing centroid position calculation processing on the preliminary segmented image to obtain the centroid position of the preliminary segmented image; obtaining the region of red LEDs in the lamp group in the preliminary segmented image based on the centroid position of the preliminary segmented image, and filling the region of red LEDs in the preliminary segmented image to form the first segmented image, wherein the first segmented image consists of a red LED sub-region composed of red LEDs and pads, a green LED sub-region composed of green LEDs and pads, and a blue LED sub-region composed of blue LEDs and pads.
[0086] Furthermore, after obtaining the first segmented image containing pads and LED groups, the method further includes: calculating the areas of the red LED bead sub-region, green LED bead region, and blue LED bead region in the first segmented image, respectively, to obtain the areas of the red LED bead region, green LED bead region, and blue LED bead region; determining whether the areas of the red LED bead region, green LED bead region, and blue LED bead region are within a preset threshold range, where the preset threshold is between a preset area and twice the preset area; if within the preset threshold range, segmenting each LED bead region in the first segmented image based on a second adaptive threshold segmentation algorithm; if not within the preset threshold range, and its area is less than the preset area, then determining that the corresponding color LED bead region is a foreign object region; if not within the preset threshold range, and its area is greater than twice the preset area, then determining that the corresponding color LED bead region is a pad region with missing LEDs.
[0087] Specifically, when segmenting a MiniLED image, it's necessary to select whether the target is brighter or darker than the background for segmentation. This allows for segmentation to be completed and the optimal segmentation threshold to be returned, eliminating the need for manual adjustment of the grayscale threshold parameter. When segmenting a MiniLED image, selecting a target that is brighter than the background for segmentation involves the following steps:
[0088] Let the original gray level be M, and the number of pixels with gray level i be n. i Normalizing the grayscale histogram yields:
[0089]
[0090] The probabilities of occurrence for background pixel C0 and target pixel c1 are as follows:
[0091]
[0092] To obtain the optimal segmentation threshold, it is necessary to maximize the variance between background pixels and target pixels; that is, to maximize... in:
[0093]
[0094] Where μ0 and μ1 are the mean gray values of each class, and μ(T) is the cumulative gray value when the gray level is T; the gray levels are traversed from 0 to M-1 until a certain gray value is found that maximizes the value of the above formula, and the segmentation result and the gray value are returned.
[0095] Subsequent segmentation is performed using the aforementioned segmentation algorithm based on the user's selection of dark or bright. After segmentation using the algorithm, a preliminary segmented image is obtained. Then, the centroid position of the preliminary segmented image needs to be calculated to obtain its centroid position. Based on the centroid position, the region of the red LED in the lamp group within the preliminary segmented image is obtained, and this region is filled to form a first segmented image. The first segmented image consists of a red LED sub-region composed of red LEDs and pads, a green LED sub-region composed of green LEDs and pads, and a blue LED sub-region composed of blue LEDs and pads.
[0096] Furthermore, after obtaining the first segmented image, the areas of the red, green, and blue LED regions in the first segmented image need to be calculated separately to obtain the areas of the red, green, and blue LED regions. Then, it is determined whether the areas of the red, green, and blue LED regions are within a preset threshold range, which is between a preset area and twice the preset area. If they are within the preset threshold range, the LED regions in the first segmented image are segmented based on a second adaptive threshold segmentation algorithm. If they are not within the preset threshold range, and their area is smaller than the preset area, the corresponding color LED region is determined to be a foreign object region. If they are not within the preset threshold range, and their area is greater than twice the preset area, the corresponding color LED region is determined to be a pad region of a missing LED. In this way, it is possible to detect whether the segmented region is a foreign object region or a pad region of a valid LED.
[0097] The second segmentation module 22 is used to segment each lamp bead region of the first segmented image based on the second adaptive threshold segmentation algorithm to obtain the rough shape of each lamp bead in the lamp group and the segmentation threshold of each lamp bead.
[0098] In a specific implementation of this invention, the segmentation of each LED region in the first segmented image based on the second adaptive threshold segmentation algorithm to obtain the approximate shape of each LED in the light group and the segmentation threshold of each LED includes: obtaining the green LED sub-region, blue LED region, and red LED region corresponding to the first segmented image; when segmenting the green LED region and the blue LED region, selecting a segmentation threshold where the target is brighter than the background to segment using the second adaptive threshold segmentation algorithm to obtain the approximate shape of the green LED, the approximate shape of the blue LED, the green LED segmentation threshold, and the blue LED segmentation threshold; when segmenting the red LED region, selecting a segmentation threshold where the target is darker than the background to segment using the second adaptive threshold segmentation algorithm to obtain the approximate shape of the red LED and the red LED segmentation threshold.
[0099] Furthermore, the step of selecting a segmentation threshold where the target is darker than the background when segmenting the red LED sub-region and then using the second adaptive threshold segmentation algorithm for segmentation includes: calculating the minimum bounding rectangle region of the red LED sub-region to obtain the minimum bounding rectangle region of the red LED; and selecting a segmentation threshold where the target is darker than the background when segmenting the minimum bounding rectangle region of the red LED and then using the second adaptive threshold segmentation algorithm for segmentation.
[0100] Specifically, firstly, the green, blue, and red LED regions corresponding to the first segmented image need to be obtained. Then, for the green and blue LED regions, a segmentation threshold where the target is brighter than the background is selected during segmentation, and a second adaptive thresholding algorithm is used for segmentation processing to obtain the approximate shapes of the green and blue LEDs, as well as the segmentation thresholds for the green and blue LEDs. Next, for the red LED region, a segmentation threshold where the target is darker than the background is selected during segmentation, and a second adaptive thresholding algorithm is used for segmentation processing to obtain the approximate shape of the red LED and its segmentation threshold.
[0101] For the segmentation of the red LED bead region, the minimum bounding rectangle region of the red LED bead region needs to be calculated first to obtain the minimum bounding rectangle region of the red LED bead. Then, when segmenting the minimum bounding rectangle region of the red LED bead, a segmentation threshold where the target is darker than the background is selected to use a second adaptive threshold segmentation algorithm for segmentation.
[0102] Rectangle Fitting Module 23: Used to perform rectangle fitting on the rough shape of each LED bead in the lamp group to obtain the fitted rectangle corresponding to each LED bead;
[0103] In the specific implementation of this invention, the step of performing rectangular fitting processing on the rough shape of each LED bead in the lamp group to obtain the corresponding fitted rectangle for each LED bead includes: performing morphological filtering processing on the rough shapes of the green LED bead, the blue LED bead, and the red LED bead respectively to obtain the filtered rough shapes of the green LED bead, the filtered rough shapes of the blue LED bead, and the filtered rough shapes of the red LED bead; and performing rectangular fitting processing on the filtered rough shapes of the green LED bead, the filtered rough shapes of the blue LED bead, and the filtered rough shapes of the red LED bead respectively to obtain the fitted rectangles of the green LED bead, the fitted rectangles of the blue LED bead, and the fitted rectangles of the red LED bead.
[0104] Specifically, firstly, morphological filtering is performed on the rough shapes of the green, blue, and red LEDs respectively to obtain the filtered rough shapes of the green, blue, and red LEDs; then, rectangle fitting is performed on the filtered rough shapes of the green, blue, and red LEDs respectively to obtain the fitted rectangles of the green, blue, and red LEDs.
[0105] Comparison module 24: used to calculate the length, width, and area of the fitted rectangle corresponding to each LED bead, and to compare the length, width, and area of the fitted rectangle corresponding to each LED bead with the specification parameters of the corresponding LED bead.
[0106] In the specific implementation of this invention, the comparison processing based on the length, width, and area of the fitted rectangle corresponding to each LED bead with the specification parameters of the corresponding LED bead includes: determining whether the length, width, and area corresponding to each LED bead are all within the specification parameters of the corresponding LED bead; if any one of the length, width, and area corresponding to each LED bead is not within the specification parameters of the corresponding LED bead, determining whether the aspect ratio of the corresponding LED bead is within a preset ratio range; if the aspect ratio of the corresponding LED bead is not within the preset ratio range, determining that the LED bead corresponding to the aspect ratio is tilted; if the aspect ratio of the corresponding LED bead is within the preset ratio range, adjusting the segmentation threshold of the LED bead corresponding to the aspect ratio, and after adjusting the segmentation threshold, returning to the step of segmenting the first segmented image based on the second adaptive threshold segmentation algorithm; if the length, width, and area corresponding to each LED bead are all within the specification parameters of the corresponding LED bead, then confirming that the fitted rectangle corresponding to each LED bead is the corresponding LED bead region.
[0107] Furthermore, adjusting the segmentation threshold of the LED corresponding to the aspect ratio includes:
[0108] The segmentation threshold of the LED beads corresponding to the aspect ratio is adjusted in a fixed step manner.
[0109] Furthermore, after confirming that the fitted rectangle corresponding to each LED bead is the corresponding LED bead region, the method further includes: calculating the centroid position and rotation angle of the fitted rectangle corresponding to each LED bead, determining whether the corresponding LED bead has a fixed offset defect based on the centroid position, and determining whether the corresponding LED bead has a rotation defect based on the rotation angle.
[0110] Specifically, the process begins by calculating the length, width, and area of the fitted rectangle corresponding to each LED bead. Then, it's determined whether these dimensions are within the LED bead's specifications. If any one of these dimensions is outside the specifications, the aspect ratio is checked. If the aspect ratio is outside the preset range, the LED bead is considered "tilted." If the aspect ratio is within the preset range, the segmentation threshold is adjusted using a fixed step size. The process then returns to the second adaptive threshold segmentation algorithm to process the first segmented image, repeating this process. If the length, width, and area of each LED bead are within the specifications, the fitted rectangle for each LED bead is confirmed as its region.
[0111] After confirming that the fitted rectangle corresponding to each LED bead is the corresponding LED bead region, it is necessary to determine whether there are any corresponding defects; that is, it is necessary to calculate the centroid position and rotation angle of the fitted rectangle corresponding to each LED bead; then, based on the centroid position, it is determined whether the corresponding LED bead has a fixed offset defect, and based on the rotation angle, it is determined whether the corresponding LED bead has a rotation defect.
[0112] In this embodiment of the invention, appearance images are segmented by adaptive parameter adjustment without adding hardware devices, thereby reducing the workload of manual parameter adjustment during image segmentation and enabling detection tasks in different resolution scenarios.
[0113] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0114] Furthermore, the above provides a detailed description of the MiniLed appearance inspection method and device based on parameter adaptive adjustment provided by the embodiments of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A MiniLED appearance inspection method based on parameter adaptive adjustment, characterized in that, The method includes: The first adaptive threshold segmentation algorithm is used to segment the lamp group region in the MiniLed appearance image to obtain the first segmented image containing the pads and lamp groups. The first segmented image is segmented based on a second adaptive threshold segmentation algorithm to obtain the approximate shape of each LED in the LED group and the segmentation threshold for each LED. This includes: obtaining the green, blue, and red LED sub-regions corresponding to the first segmented image; segmenting the green and blue LED regions using a segmentation threshold where the target is brighter than the background, and then using the second adaptive threshold segmentation algorithm to obtain the approximate shape of the green LED, the approximate shape of the blue LED, the green LED segmentation threshold, and the blue LED segmentation threshold; and segmenting the red LED sub-region using a segmentation threshold where the target is darker than the background, and then using the second adaptive threshold segmentation algorithm to obtain the approximate shape of the red LED and the red LED segmentation threshold. The rough shape of each LED in the lamp assembly is fitted with a rectangle to obtain the fitted rectangle for each LED. The length, width, and area of the fitted rectangle corresponding to each LED bead are calculated, and the length, width, and area of the fitted rectangle corresponding to each LED bead are compared with the specification parameters of the corresponding LED bead. This includes: determining whether the length, width, and area corresponding to each LED bead are all within the specification parameters of the corresponding LED bead; if any one of the length, width, and area corresponding to each LED bead is not within the specification parameters of the corresponding LED bead, determining whether the aspect ratio of the corresponding LED bead is within a preset ratio range; if the aspect ratio of the corresponding LED bead is not within the preset ratio range, determining that the LED bead corresponding to the aspect ratio is tilted; if the aspect ratio of the corresponding LED bead is within the preset ratio range, adjusting the segmentation threshold of the LED bead corresponding to the aspect ratio by a fixed step size, and after adjusting the segmentation threshold, returning to the step of segmenting the first segmented image based on the second adaptive threshold segmentation algorithm; if the length, width, and area corresponding to each LED bead are all within the specification parameters of the corresponding LED bead, then confirming that the fitted rectangle corresponding to each LED bead is the corresponding LED bead region.
2. The MiniLED appearance inspection method according to claim 1, characterized in that, The first adaptive threshold segmentation algorithm is used to segment the lamp group region in the MiniLed appearance image to obtain a first segmented image containing pads and lamp groups, including: When segmenting the MiniLed appearance image, the background of the MiniLed appearance image is selected as bright, and the first adaptive threshold segmentation algorithm is used for segmentation to obtain a preliminary segmented image. The centroid position of the preliminary segmented image is calculated to obtain the centroid position of the preliminary segmented image; The region of the red LED in the lamp group in the preliminary segmentation image is obtained based on the centroid position of the preliminary segmentation image, and the region of the red LED in the preliminary segmentation image is filled to form a first segmentation image. The first segmentation image consists of a red LED sub-region composed of red LEDs and pads, a green LED sub-region composed of green LEDs and pads, and a blue LED sub-region composed of blue LEDs and pads.
3. The MiniLED appearance inspection method according to claim 2, characterized in that, After obtaining the first segmented image containing the pads and lamps, the process further includes: Calculate the areas of the red LED bead region, green LED bead region, and blue LED bead region in the first segmented image respectively to obtain the areas of the red LED bead region, green LED bead region, and blue LED bead region. Determine whether the areas of the red LED bead region, the green LED bead region, and the blue LED bead region are within a preset threshold range, where the preset threshold range is between a preset area and twice the preset area. If the value is within the preset threshold range, then the first segmented image is segmented based on the second adaptive threshold segmentation algorithm for each LED region. If it is not within the preset threshold range, and its area is smaller than the preset area, then the corresponding color LED bead area is determined to be a foreign object area; If the area is greater than twice the preset area and is outside the preset threshold range, then the corresponding color LED area is determined to be the pad area of the missing LED.
4. The MiniLED appearance inspection method according to claim 1, characterized in that, The step of segmenting the red LED bead region by selecting a segmentation threshold where the target is darker than the background and then using the second adaptive threshold segmentation algorithm includes: The minimum bounding rectangle region of the red LED bead sub-region is calculated to obtain the minimum bounding rectangle region of the red LED bead. When segmenting the minimum bounding rectangle region of the red LED bead, a segmentation threshold where the target is darker than the background is selected, and the second adaptive threshold segmentation algorithm is used for segmentation processing.
5. The MiniLED appearance inspection method according to claim 1, characterized in that, The step of performing rectangular fitting processing on the rough shape of each LED in the lamp group to obtain the fitted rectangle corresponding to each LED includes: Morphological filtering was performed on the rough shapes of the green LED, blue LED, and red LED respectively to obtain the filtered rough shapes of the green LED, blue LED, and red LED. Rectangle fitting is performed on the rough shapes of the filtered green LED, the rough shapes of the filtered blue LED, and the rough shapes of the filtered red LED to obtain fitted rectangles for the green LED, the blue LED, and the red LED, respectively.
6. The MiniLED appearance inspection method according to claim 1, characterized in that, After confirming that the fitted rectangle corresponding to each LED bead is the corresponding LED bead region, the process further includes: The centroid position and rotation angle of the fitted rectangle corresponding to each LED bead are calculated. Based on the centroid position, it is determined whether the corresponding LED bead has a fixed offset defect. At the same time, based on the rotation angle, it is determined whether the corresponding LED bead has a rotation defect.
7. A MiniLED appearance inspection device based on parameter adaptive adjustment, characterized in that, The device includes: First segmentation module: used to segment the lamp group region in the MiniLed appearance image based on the first adaptive threshold segmentation algorithm to obtain a first segmented image containing pads and lamp groups; The second segmentation module is used to segment each LED region of the first segmented image based on a second adaptive threshold segmentation algorithm to obtain the approximate shape of each LED in the LED group and the segmentation threshold of each LED. This includes: obtaining the green LED sub-region, blue LED sub-region, and red LED sub-region corresponding to the first segmented image; selecting a segmentation threshold where the target is brighter than the background when segmenting the green and blue LED sub-regions using the second adaptive threshold segmentation algorithm to obtain the approximate shape of the green LED, the approximate shape of the blue LED, the green LED segmentation threshold, and the blue LED segmentation threshold; and selecting a segmentation threshold where the target is darker than the background when segmenting the red LED sub-region using the second adaptive threshold segmentation algorithm to obtain the approximate shape of the red LED and the red LED segmentation threshold. Rectangle Fitting Module: Used to perform rectangle fitting on the rough shape of each LED in the lamp group to obtain the fitted rectangle for each LED; The comparison module is used to calculate the length, width, and area of the fitted rectangle corresponding to each LED bead, and to compare the length, width, and area of the fitted rectangle with the specifications of the corresponding LED bead. This includes: determining whether the length, width, and area of each LED bead are all within the specifications of the corresponding LED bead; if any one of the length, width, or area of each LED bead is not within the specifications of the corresponding LED bead, determining whether the aspect ratio of the corresponding LED bead is within a preset range; if the aspect ratio of the corresponding LED bead is not within the preset range, determining that the LED bead corresponding to the aspect ratio is tilted; if the aspect ratio of the corresponding LED bead is within the preset range, adjusting the segmentation threshold of the LED bead corresponding to the aspect ratio using a fixed step size, and after adjusting the segmentation threshold, returning to the step of segmenting the first segmented image based on the second adaptive threshold segmentation algorithm; if the length, width, and area of each LED bead are all within the specifications of the corresponding LED bead, then confirming that the fitted rectangle corresponding to each LED bead is the corresponding LED bead region.
Citation Information
Patent Citations
Appearance defect detection method and system suitable for LED chip and storage medium
CN114399502A
Mini-LED panel defect detection equipment and method based on machine vision
CN116698753A