Image recognition method for lamp points
By using semi-automatic and manual methods to add types of light spot image recognition, the problem of recognition difficulties caused by light spot adhesion or overlap in FCT functional circuit testing equipment has been solved, achieving efficient recognition of different types of light spots and improving ease of use.
Patent Information
- Application Number
- CN202511545904.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-28
- Publication Date
- 2026-01-06
AI Technical Summary
Existing FCT functional circuit testing equipment faces the problem of light spot adhesion or partial overlap when identifying display components such as LEDs and digital tubes, resulting in difficulties in image recognition, especially in the poor recognition of light spots of different sizes, shapes and emitting colors.
Two types of light spot image recognition methods are adopted: semi-automatic detection and manual addition. Semi-automatic detection allows the software to automatically complete the recognition by manually setting parameters such as image detection mode, area threshold, morphological processing parameters, and color difference. Manual addition allows the software to automatically complete the image recognition at a specific location by manually specifying the light spot category and color difference.
It enables universal recognition of light points of different sizes, shapes, and emission colors, eliminating the need to create test templates in advance, thus improving work efficiency and adaptability, and enhancing the ease of use of the equipment.
Smart Images

Figure CN121280409A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of electronic testing and measurement technology, and specifically relates to an image recognition method for lamp points. This method can be applied to the image recognition and detection of lamp points in FCT functional circuit testing equipment. Background Technology
[0002] FCT functional circuit testing equipment generally uses visual technology to identify display components such as LEDs and digital tubes. The circuit boards it needs to test vary greatly, and the size, shape, and color of the LEDs, digital tubes and other display components on the circuit boards also vary. Sometimes, two light-emitting points are so close that the light spots stick together or partially overlap, which brings great difficulties to image recognition. Summary of the Invention
[0003] The technical problem to be solved by this invention is to propose a universal light spot image recognition method that does not require the prior establishment of test templates, can solve the problem of light spot adhesion or partial overlap, is applicable to the recognition of light spots of different sizes, shapes, and emission colors, and can be applied to FCT functional circuit testing equipment.
[0004] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:
[0005] An image recognition method for light points includes a semi-automatic detection method for light points of different types and a manual addition method for light point detection. The semi-automatic detection method requires manually setting five parameters: image detection mode, area threshold, morphological processing parameters, light point category, and color difference. The corresponding software then automatically performs image recognition of the light points. If the recognition result does not meet the requirements, the detection parameters are readjusted and recognition is repeated until the requirements are met. The manual addition method requires manually setting two parameters: light point category and color difference. A specific location on the circuit board image is then manually specified. A certain area within this location is considered the light point spot range, and the corresponding software automatically performs image recognition at that specific location. The semi-automatic detection method for light points of different types includes the following steps: S01, Image detection parameter setting. The parameters set include image detection mode, area threshold, morphological processing parameters, light point category, and color difference; S02, image acquisition, channel separation, and size calculation; S03, obtaining color information of the target location based on the image detection mode; S04, segmenting the single-channel image using different global thresholds to convert the grayscale image into a binary region; S05, applying morphological processing parameters to the optimized binary region; S06, performing connected component segmentation on the optimized binary region to divide it into multiple independent, unconnected connected components; S07, filtering the connected components to obtain the desired connected components; S08, obtaining the number, center coordinates, area, and color information of the connected components; S09, control generation and display, with two different control types: light point pre-detection and automatic generation of light test points.
[0006] Image detection modes include "Brightness," "Monochrome," "Hue," "Multicolor," "Brightness.Hue," "Monochrome.Hue," and "Multicolor.Hue." Area thresholds include lower and upper limits. The lower limit is mandatory and has a default value of 25, while the upper limit is optional. Light spot categories are divided into non-color and color, with color difference levels of large, medium, and small. Hue, saturation, brightness information data, and upper and lower limits of binary regions differ in different modes. Morphological processing parameters involve erosion followed by dilation of the binary region to obtain an optimized binary region. Three quick-setting options for image detection parameters are preset: "Suitable for clear light spots," "Suitable for adhered light spots," and "Suitable for overlapping light spots."
[0007] The image recognition method for manually adding type light spots (2) includes the following steps: S21, setting image detection parameters, the parameters are light spot category and color difference; S22, generating light spot detection area, a circular area is generated with the left mouse button click position as the center and a certain number of pixels as the radius, which serves as the area range of the light spot; S23, saving color information; S24, generating light spot checkbox control.
[0008] The application software, developed based on the image recognition methods for semi-automatic detection of light points and manually added light points, includes three modules: a semi-automatic light point detection module, a light point recognition operation prompt module, and a circuit diagram display and light point selection module.
[0009] The semi-automatic light spot detection module includes image detection mode, area threshold, morphological processing, light spot category, color difference, light spot preset, automatic generation of light test points, and light spot pre-detection control; the light spot recognition operation prompt module provides users with instructions on how to operate in the circuit diagram display and light spot selection module based on the settings of the semi-automatic light spot detection module; the circuit diagram display and light spot selection module allows users to obtain the brightness, grayscale, hue, and area of any point in the image, as well as the range of connected regions, through mouse operation.
[0010] The above technical solution has the following beneficial effects:
[0011] 1. No pattern training is required to form a recognition template on the circuit board being inspected. Only three parameters need to be set: detection mode, area threshold, and morphological processing. Any LED point on the circuit board can be tested instantly, improving work efficiency.
[0012] 2. Any test point can be manually added as the test light point, which solves the hidden danger of not being able to identify special light points and makes it more adaptable.
[0013] 3. The introduction of the light spot pre-detection function makes the area and region to be detected at a glance, which plays a good auxiliary role in setting detection parameters and improves the ease of use of the equipment. Attached Figure Description
[0014] To more clearly illustrate the embodiments of the present invention or the technical solutions in 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 merely exemplary, and those skilled in the art can derive other embodiments based on the provided drawings without creative effort.
[0015] The structures, proportions, sizes, etc. illustrated in this specification are only for the purpose of assisting those skilled in the art in understanding and reading the content disclosed herein, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.
[0016] Figure 1 This is the image recognition step for the semi-automatic detection type of light spot of the present invention;
[0017] Figure 2 The image recognition steps for manually adding typed light points in this invention;
[0018] Figure 3 This is a schematic diagram of the module composition of the FCT application software light spot image recognition system of the present invention;
[0019] Figure 4 This invention provides a specific embodiment of the module composition and operation interface.
[0020] Figure 5 The composition and operation interface of the semi-automatic lamp detection module 1 in a specific embodiment of the present invention are shown below.
[0021] Figure 6 This is the prompt text for module 2 in a specific embodiment of the present invention;
[0022] Figure 7 The grayscale image of the circuit board and the display of pixel brightness values of module 3 in a specific embodiment of the present invention;
[0023] Figure 8 The circuit board image, connected domain of the lamp points, and their area display of module 3 in a specific embodiment of the present invention;
[0024] Figure 9 The circuit board image and lamp selection component of module 3 in a specific embodiment of the present invention are displayed.
[0025] Figure 10 A clear circuit board image of the lamp spot of module 3 in a specific embodiment of the present invention is displayed.
[0026] Figure 11 In a specific embodiment of the present invention, the parameter values of modules 1-1 to 1-9 of module 1 are preset to 1.
[0027] Figure 12 The circuit board image showing the overlapping light spots of module 3 in a specific embodiment of the present invention is displayed.
[0028] Figure 13 In a specific embodiment of the present invention, the light spot of the circuit board lamp point partially overlaps with the pre-detection result of the lamp point with preset parameter 1;
[0029] Figure 14 In a specific embodiment of the present invention, the parameter values of modules 1-1 to 1-9 of module 1 are preset to 3.
[0030] Figure 15 In a specific embodiment of this invention, module 2 provides prompts for color selection operations.
[0031] Figure 16 In a specific embodiment of the present invention, the light spot of the circuit board lamp point partially overlaps with the pre-detection result of the lamp point based on the preset parameter 3;
[0032] Figure 17 In a specific embodiment of the present invention, the light spot of the circuit board lamp point partially overlaps with the automatic detection result of the lamp point with preset parameter 3;
[0033] Figure 18 The circuit board image of module 3 in a specific embodiment of the present invention is displayed with clear light spots and partial overlap.
[0034] Figure 19 In a specific embodiment of the present invention, the light spots of the circuit board lamps are clear, partially overlapping, and have preset parameter 3 lamp pre-detection results;
[0035] Figure 20 In a specific embodiment of the present invention, the light spots of the circuit board lamps are clear, partially overlapping, and have a pre-detection result of the lamps after fine-tuning the area threshold of the preset parameter 3.
[0036] Figure 21 In a specific embodiment of the present invention, the light spots of the circuit board lamps are clear, partially overlapping, and have the automatic detection results of the lamps after the preset parameter fine-tuning area threshold is present. Detailed Implementation
[0037] The specific embodiments of the present invention will be further described below with reference to the accompanying drawings. It should be noted that these descriptions are for the purpose of aiding understanding the present invention, but do not constitute a limitation thereof. Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0038] See Figures 1-21 As shown, this invention discloses an image recognition method for light points, including a semi-automatic light point detection module 1, a light point recognition operation prompt module 2, and a circuit diagram display and light point selection module 3. The detection method is as follows: semi-automatic detection of light points refers to manually setting five parameters: image detection mode, area threshold, morphological processing parameters, light point category, and color difference. Then, the corresponding software automatically completes the image recognition of the light points. If the recognition result does not meet the requirements, the detection parameters are readjusted and recognition is performed again until the requirements are met. Manually adding light points refers to manually setting two parameters, such as light point category and color difference, and then manually specifying a specific location on the circuit board image. The area within a certain range of this location is considered the light point spot range, and the corresponding software automatically completes the image recognition of the specific location of the light point.
[0039] The semi-automatic image recognition method for detecting light spots includes the following steps: S01, setting image detection parameters. The parameters set include image detection mode, area threshold, morphological processing parameters, light spot category, and color difference; S02, image acquisition, channel separation, and size calculation; S03, obtaining color information of the target location based on the image detection mode; S04, segmenting the single-channel image using different global thresholds to convert the grayscale image into a binary region; S05, applying morphological processing parameters to the optimized binary region; S06, performing connected component segmentation on the optimized binary region to divide it into multiple independent, unconnected connected components; S07, filtering the connected components to obtain the desired connected components; S08, obtaining the number, center coordinates, area, and color information of the connected components; S09, control generation and display, with two different control types: light spot pre-detection and automatic generation of light test points.
[0040] Image detection modes include "Brightness," "Monochrome," "Hue," "Multicolor," "Brightness.Hue," "Monochrome.Hue," and "Multicolor.Hue." Area thresholds include lower and upper limits. The lower limit is mandatory and has a default value of 25, while the upper limit is optional. Light spot categories are divided into non-color and color, with color difference levels of large, medium, and small. Hue, saturation, brightness information data, and upper and lower limits of binary regions differ in different modes. Morphological processing parameters involve erosion followed by dilation of the binary region to obtain an optimized binary region. Three quick-setting options for image detection parameters are preset: "Suitable for clear light spots," "Suitable for adhered light spots," and "Suitable for overlapping light spots."
[0041] The image recognition method for manually adding typed light spots includes the following steps: S21, setting image detection parameters, the parameters being light spot category and color difference; S22, generating light spot detection area, generating a circular area with a radius of a certain number of pixels centered on the left mouse click position, as the area range of the light spot; S23, saving color information; S24, generating light spot checkbox control.
[0042] The application software developed based on the image recognition method for semi-automatic detection of light points and manual addition of light points includes three modules: a semi-automatic light point detection module, a light point recognition operation prompt module, and a circuit diagram display and light point selection module.
[0043] The semi-automatic light spot detection module includes image detection mode, area threshold, morphological processing, light spot category and color difference, light spot preset, automatic generation of light test points, and light spot pre-detection control; the light spot recognition operation prompt module provides users with instructions on how to operate in the circuit diagram display and light spot selection module based on the settings of the semi-automatic light spot detection module; the circuit diagram display and light spot selection module allows users to obtain the brightness, grayscale, hue, and area of any point in the image, as well as the range of connected regions, through mouse operation.
[0044] Working principle of the invention:
[0045] I. Image recognition method for semi-automatic detection type of light spots, as shown in the appendix. Figure 1 As shown, it consists of 9 steps, as detailed below:
[0046] Step S101, Image Detection Parameter Setting: The parameters that need to be set include image detection mode, area threshold, morphological processing parameters, light spot category, and color difference. There are seven image detection modes: "Brightness," "Monochrome," "Hue," "Multicolor," "Brightness.Hue," "Monochrome.Hue," and "Multicolor.Hue." The first four modes use a single color parameter to identify objects, while the latter three use two composite color parameters. The area threshold includes a minimum area threshold (lower limit) and a maximum area threshold (upper limit). The lower limit is mandatory and has a default value of 25. The upper limit is optional; if not set by the user, the upper limit defaults. The value is 999999; morphological processing is optional. When morphological processing is selected, both erosion and dilation processes must be performed simultaneously. Erosion is performed first, followed by dilation. The erosion radius is adjustable, with a default value of 6, and the dilation radius is also adjustable, with a default value of 3. Light spot categories are divided into non-color and color. For non-color light spots, the average brightness of the corresponding light spot is ultimately identified, while for color light spots, the average R, G, and B values of the corresponding light spot are ultimately identified. Color difference has three levels: large, medium, and small. Different levels allow different errors in real-time detection, allowing users to flexibly choose according to the specific batches of circuit boards. Additionally, there are preset image detection parameter quick setting options: "Preset 1: Suitable for clear light spots," "Preset 2: Suitable for adhered light spots," and "Preset 3: Suitable for overlapping light spots." Each preset value allows simultaneous setting of image detection mode, area threshold, morphological processing parameters, light spot category, and color difference. Each preset value is based on settings obtained through multiple experiments and can solve the light spot detection problems of most practical circuit boards.
[0047] Step S102, Image Acquisition, Channel Separation, Size Calculation: First, use a camera to acquire an image of the circuit board. Then, calculate the width and height of the image and separate the image into three single-channel images: RGB (red, green, blue) and HSV (hue, saturation, brightness).
[0048] Step S103, Target Location Color Information Acquisition: Based on different image detection modes, obtain the color information of the target location (i.e., the image location clicked by the left mouse button). When the detection mode is "Brightness" or "Multicolor", obtain the brightness information of the target location (the brightness information in "Multicolor" and the brightness information of the object to be identified are in two different half-zones, with a value of 128 as the boundary between the two half-zones); when the detection mode is "Monochrome", obtain the RGB information of the target location; when the detection mode is "Hue", obtain the hue information of the target location; when the detection mode is "Brightness.Hue", obtain the brightness and hue information of the target location (at this time, the hue information and the hue information of the object to be identified are in two different half-zones, with a value of 128 as the boundary between the two half-zones); when the detection mode is "Monochrome.Hue" or "Multicolor.Hue", obtain the brightness, RGB information, and hue of the target location (at this time, the hue information and the hue information of the object to be identified are in two different half-zones, with a value of 128 as the boundary between the two half-zones).
[0049] Step S104, Image Segmentation: Based on different image detection modes, the single-channel image is segmented using different global thresholds, converting the grayscale image into a binary region. The following describes each detection mode in detail.
[0050] (1) "Brightness" detection mode: Assuming the target position brightness information obtained in step S102 is I, when (I*0.9-5)>0, (I*0.9-5) is used as the lower limit and 255 is used as the upper limit to divide the single-channel brightness image of the circuit board into a binary brightness region; when (I*0.9-5)<=0, 0 is used as the lower limit and 255 is used as the upper limit to divide the single-channel brightness image of the circuit board into a binary brightness region.
[0051] (2) Case of "monochrome" detection mode: Assume that the red, green and blue information of the target position obtained in step S102 are R, G and B respectively. First, find the maximum value of R, G and B, and assume that R is the maximum value. Then, divide the single-channel image of R, G and B into binary regions of R, G and B respectively. The allowable error of the larger component is smaller and the allowable error of the smaller component is larger. Taking the largest component as R as an example, when dividing the single-channel image of R, when (R*0.9-15)>0, (R*0.9-15) is used as the lower limit and (R*1.1+15) is used as the upper limit to divide the single-channel image of the circuit board into binary regions of R; when (R*0.9-15)<=0, 0 is used as the lower limit and (R*1.1+15) is used as the upper limit to divide the single-channel image of R of the circuit board into binary regions of R. When segmenting the G-channel single-channel image, if (G*0.8-20)>0, use (G*0.8-20) as the lower limit and (G*1.2+20) as the upper limit to segment the G-channel single-channel image of the circuit board into a G-binary region; if (G*0.8-20)<=0, use 0 as the lower limit and (G*1.2+20) as the upper limit to segment the G-channel single-channel image of the circuit board into a G-binary region. The B-channel single-channel image is segmented into a B-binary region using the same segmentation method as the G-channel. The segmentation method is similar for cases where the maximum component is G or B, as it is for cases where the maximum component is R. Finally, the intersection of the three binary regions (R, G, and B) is calculated to obtain the RGB composite binary region.
[0052] (3) Case of “hue” detection mode: Assuming that the hue information of the target position obtained in step S102 is H, when (H*0.9-15)>0, (H*0.9-15) is used as the lower limit and (H*1.1+15) is used as the upper limit to divide the hue single-channel image of the circuit board into a hue binary region; when (H*0.9-15)<=0, 0 is used as the lower limit and (H*1.1+15) is used as the upper limit to divide the hue single-channel image of the circuit board into a hue binary region.
[0053] (4) Case of "Multi-color" detection mode: Assume that the brightness information of the target position obtained in step S102 is I, and the red, green, and blue information are R, G, and B, respectively. First, obtain the binary regions of the three single-channel images R, G, and B. When I < 128, use 155 as the lower limit and 255 as the upper limit to divide the three single-channel images R, G, and B into three binary regions R, G, and B, respectively; when I >= 128, use 0 as the lower limit and 100 as the upper limit to divide the three single-channel images R, G, and B into three binary regions R, G, and B, respectively. Then, find the intersection of the three binary regions R, G, and B to obtain the RGB composite binary region.
[0054] (5) Case of "Brightness.Hue" detection mode: First, obtain the binary region of brightness according to the "Brightness" detection mode. Next, assuming that the hue information of the target position obtained in step S102 is H, the binary region of hue is segmented according to H. When H<128, 155 is used as the lower limit and 255 is used as the upper limit to segment the single-channel image of the circuit board into a binary region of hue; when H>=128, 0 is used as the lower limit and 100 is used as the upper limit to segment the single-channel image of the circuit board into a binary region of hue. Finally, find the intersection of the binary region of brightness and the binary region of hue to obtain the composite binary region of brightness and hue.
[0055] (6) Case of "Monochrome.Hue" detection mode: First, obtain the RGB composite binary region according to the "monochrome" detection mode. Next, assuming the target position hue information obtained in step S102 is H, segment the hue binary region according to H. When H < 128, use 155 as the lower limit and 255 as the upper limit to segment the hue single-channel image of the circuit board into a hue binary region; when H >= 128, use 0 as the lower limit and 100 as the upper limit to segment the hue single-channel image of the circuit board into a hue binary region. Finally, find the intersection of the RGB composite binary region and the hue binary region to obtain the RGB and hue composite binary region.
[0056] (7) Case of "Multi-color.Tone" detection mode: First, obtain the RGB composite binary region according to the "Multi-color" detection mode. Next, assuming that the target position tone information obtained in step S102 is H, the tone binary region is segmented according to H. When H<128, use 155 as the lower limit and 255 as the upper limit to segment the tone single-channel image of the circuit board into tone binary regions; when H>=128, use 0 as the lower limit and 100 as the upper limit to segment the tone single-channel image of the circuit board into tone binary regions. Finally, find the intersection of the RGB composite binary region and the tone binary region to obtain the RGB and tone composite binary region.
[0057] Step S105, Morphological Processing: When morphological processing is required, based on the set morphological processing parameters, the binary region obtained in step S103 is first subjected to erosion, and then further subjected to dilation to obtain the optimized binary region. Morphological processing is generally required when the target objects in the image are adhered or partially overlapped in order to separate the target objects.
[0058] Step S106, Connected Component Acquisition: Perform connected component segmentation on the optimized binary region obtained in step S105 to divide the binary region into multiple independent, unconnected connected components.
[0059] Step S107, Connected Component Filtering: The connected components obtained in step S106 are filtered according to a set area threshold to obtain the desired connected components. The lower limit of the area is set by the user, while the upper limit is optional. When the user enables the upper limit option, the upper limit is set by the user; when the upper limit option is not enabled, the upper limit is automatically assigned a sufficiently large value by the system, such as 999999. In this invention, each independent connected component is a light spot emitted by a candidate semi-automatic detection type light point.
[0060] Step S108, Connected Component Information Acquisition: Acquire and save the number, center coordinates, area and color information of the connected components selected in step S107. When the light point type is non-color, the color information refers to the average brightness value. When the light point type is color, the color information refers to the average R, G and B values.
[0061] Step S109, Control Generation and Display: The following describes the two cases in detail: "Light Point Pre-detection" and "Automatic Generation of Light Test Points".
[0062] (1) “Pre-detection of light spot”: The original circuit board image is reduced in brightness and used as the background. Then, the border and area value of each connected domain are displayed on it to facilitate users to quickly judge whether the detection result meets the requirements. The area value is used to guide users to set the area threshold.
[0063] (2) In the case of "automatically generating lamp test points": a checkbox is generated and displayed at the center of each independent connected domain (i.e., the light spot of each lamp point) so that the user can easily select the lamp point to be tested in each test step during subsequent operations. When selected, the color information of the corresponding semi-automatic detection type lamp point will also be saved in the functional test settings file.
[0064] II. Image recognition method for manually adding typed light points, as shown in the appendix. Figure 2 As shown, it consists of 4 steps, as detailed below:
[0065] Step S201, Image Detection Parameter Setting: The only parameters that need to be set are lamp type and color difference. Lamp type is divided into non-color and color. For non-color lamps, the average brightness of the corresponding light spot is finally identified, while for color lamps, the average R, G, and B values of the corresponding light spot are finally identified. Color difference has three levels: large, medium, and small. The allowable error for real-time detection is different for different levels, which can be flexibly selected by the user according to the different batches of circuit boards.
[0066] Step S202, Light Spot Detection Area Generation: A circular area is generated with the left mouse click position as the center and a radius of a certain number of pixels (e.g., 3 pixels). This area serves as the range of the light spot and is displayed on the circuit board image with a red border. Each circular area is equivalent to a manually added type of light spot.
[0067] Step S203, color information saving: When the light point type is non-color, calculate the average brightness of each circular area; when the light point type is color, calculate the average R, G, and B values of each circular area. Save the average brightness or average R, G, and B values together with the color difference level as the color information for this manually added type of light point.
[0068] Step S204, Light Point Checkbox Generation: A checkbox is generated and displayed at the left mouse click position so that the user can easily select the manually added type of light point to be tested in each test step during subsequent operations. When selected, the color information of the corresponding manually added type of light point will also be saved in the functional test settings file.
[0069] For example, the application of the method of the present invention in an FCT functional circuit testing device will be described below. The corresponding application software is developed based on the Windows window framework of Microsoft Visual Studio, and the programming language used is C#, as shown in the attached document. Figure 3 As shown, the application software includes a semi-automatic lamp detection module 1, a lamp identification operation prompt module 2, and a circuit diagram display and lamp selection module 3. The corresponding interfaces are shown in the attached figure. Figure 4 Appendix Figure 5 As shown, the graphics processing component of module 3 uses Halcon's hWindowControl control, while the other components of the three modules all use controls included in the Windows window framework of Microsoft Visual Studio. The image detection steps for semi-automatic detection of type LEDs and manual addition of type LEDs are distributed across various modules, with the functions of each module as follows:
[0070] Semi-automatic lamp detection module 1: as attached Figure 5It includes 14 parts, from 1-1 to 1-14. Part 1-1 is the image detection mode selection component, consisting of one Label component and one comboBox component. It offers seven modes: "Brightness," "Monochrome," "Hue," "Multicolor," "Brightness.Hue," "Monochrome.Hue," and "Multicolor.Hue." The first four modes use a single color parameter to identify objects, while the latter three use two composite color parameters. Taking "Brightness.Hue" as an example, it first uses a brightness threshold to filter the image range, then uses a hue threshold to further filter the selected range, and finally separates the selected range into different connected components. These connected components are the initial objects to be identified, serving as the further identification objects for subsequent parameters. Part 1-2 This includes one Label component and one numericUpDown component. Components 1-3 are checkBox components, and 1-4 are numericUpDown components. Components 1-2, 1-3, and 1-4 are used to set an area threshold. This threshold can be used to further filter the connected components and remove interference. Component 1-2 sets the minimum area of the effective connected components in image recognition, with a default value of 25. Component 1-3 sets whether to set the maximum area of the effective connected components, with a default value of no setting. Component 1-4 sets the maximum area of the effective connected components in image recognition, with a default value of 999999. Component 1-5 is a checkBox component, and components 1-6 and 1-7... Each component includes one Label component and one numericUpDown component. Components 1-5, 1-6, and 1-7 are used to set whether to perform morphological processing on the connected components. Component 1-5 sets whether to perform morphological processing on connected components (default is set). Component 1-6 sets the erosion radius in the morphological processing (default is 6). Component 1-7 sets the dilation radius in the morphological processing (default is 3). Morphological processing can separate light spots that are stuck together or overlapping. Component 1-8 includes one Label component and two radioButton components. Components 1-8 are used to set the category of the light spot, including non-color and color. For non-color light spots, the corresponding light is ultimately identified. The average brightness of the spot is used to determine the color difference of the light spot. For colored light spots, the average RGB value of the corresponding light spot is finally identified. 1-9 includes one Label component and one comboBox component. 1-9 is used to set the color difference of FCT when detecting light spots in real time. There are three levels: large, medium, and small. Users can flexibly choose according to the situation of different batches of circuit boards. 1-10 is a comboBox component. 1-10 is used to quickly set 1-1~1-9. There are three cases: "Preset 1: suitable for clear light spots", "Preset 2: suitable for sticky light spots", and "Preset 3: suitable for overlapping light spots". These are setting data obtained through multiple experiments and can solve the light spot detection of many actual circuit boards.1-11 is a single Button component, designated as the LED pre-detection button. After setting the parameters for 1-1 to 1-9, clicking this button will display corresponding operation prompts in module 2. Simultaneously, image recognition will be performed on the circuit board displayed in module 3 to identify the connected components of each LED and display the area of each connected component for easy observation of the recognition effect. 1-12 is another single Button component, designated as the automatic LED detection button. After optimizing the parameter settings for 1-1 to 1-9 based on the operation of 1-11, clicking this button will display corresponding operation prompts in module 2. Simultaneously, image recognition will be performed on the circuit board displayed in module 3 to identify the connected components of each LED and generate a checksum component at the center of each connected component. These LEDs are called automatically identified type LEDs. All old automatically identified light points will be cleared. Alternatively, the pre-detection in steps 1-11 can be omitted, and detection in steps 1-12 can be performed directly. Steps 1-13 and 1-14 are related to manually added light point detection points. Step 1-13 is a checkbox component used to set whether to add manual light point detection points. When checked, clicking on the circuit board image displayed in module 3 will generate a connected component with the clicked point as a circle, using its average color as the color value of that point, and creating a checkbox component at that point. This point can then be selected as a light point for testing. Light points added manually in this way are called manually added type light points. Step 1-14 is a button component used to delete manually added type light points. Clicking on step 1-14 will delete all checkbox components corresponding to manually added type light points. (Appendix) Figure 5 The remaining parts do not affect the image recognition of the light points and will not be discussed here.
[0071] Lamp Spot Recognition Operation Prompt Module 2: This module contains only one Label component. The content displayed changes depending on the operation performed on Modules 1 and 3. For example, when the detection mode of 1-1 is set to "Brightness," clicking 1-11 or 1-12 will cause the Label component of Module 2 to display the message: "Operation Prompt: Left-click the area that is 'already lit and at its darkest' to obtain the lamp spot brightness threshold." (See attached image). Figure 6 As shown, this will show users how to operate in Module 3.
[0072] Circuit diagram display and LED selection module 3: Contains a Halcon hWindowControl control for image display and mouse motion capture. Through mouse operation, it can obtain color information such as brightness, grayscale, and hue of any point in the image. It can identify LED points using parameters set in module 1, automatically calculate and display the area of the bright spots, and dynamically generate a checkBox component at the center of each LED point. Taking the module's 1-1 detection mode set to "Brightness" as an example, after clicking 1-11 or 1-12, module 3 displays a grayscale image of the circuit board. Moving the mouse over the grayscale image will display the brightness value at the current cursor position, as shown in the attached diagram. Figure 7 As shown; after clicking on a segment of the digital tube (considered as a single LED dot), the connected components of all segments will be identified. If 1-11 is clicked, the diagram will display the range and area of the connected components, as shown in the attached figure. Figure 8 As shown, if you click on 1-12, a checkbox component will be generated directly at the center of each light point on the diagram, as shown in the attached image. Figure 9 As shown.
[0073] This section details the specific process of applying the LED image recognition method to circuit board image inspection:
[0074] The first type of circuit board has clearly defined LEDs that are not stuck together or partially overlap; such as... Figure 10 As shown, the goal is to identify each LED dot (i.e., the bit segment of the digital tube). The LED dot image recognition process is as follows (steps 2-4 are optional):
[0075] (1) In module 1, select "Preset 1: Applicable to clear light spots" for the content of 1-10, and set the corresponding parameters of 1-1 to 1-9 as shown in the appendix. Figure 11 The value shown.
[0076] (2) Click the 1-11 button in module 1.
[0077] (3) Follow the operation prompts in module 2 and left-click the darkest area in module 3 to obtain the brightness threshold of the light spot.
[0078] (4) Module 3 will automatically identify the connected components of each light point and display the range and area of each connected component, as shown in the attached diagram. Figure 8 As shown.
[0079] (5) If attached Figure 8 If the recognition result meets the requirements, click the 1-12 button in module 1; otherwise, manually adjust the parameter values of 1-1 to 1-7 and then click the 1-12 button.
[0080] (6) At this point, a checkBox component will be generated at the center of each identified light source, as shown in the attached figure. Figure 9 This allows for the selection of the desired light points in the corresponding test steps of the circuit board functional testing.
[0081] In the second type of circuit board, adjacent light-emitting points partially overlap; for example... Figure 12 As shown, the goal is to identify all light points that emit approximately white light. If the parameters described in the first method are used for identification, the results of the light point pre-detection are as follows: Figure 13 As shown, it clearly does not meet the requirements. The correct process for lamp image recognition is as follows:
[0082] (1) In module 1, select "Preset 3: Applicable to overlapping light points" for the content of 1-10, and set the corresponding parameters of 1-1 to 1-9 as shown in the appendix. Figure 14 The values shown are compared with the first type of detection parameters mentioned above. The detection mode has been changed from "brightness" to "brightness.hue", the morphological processing has been changed from no processing to processing, and the erosion radius is 6 and the expansion radius is 3.
[0083] (2) Click the 1-11 button in module 1.
[0084] (3) Follow the operation prompts in module 2 and left-click the darkest area in module 3 to obtain the brightness threshold of the light spot.
[0085] (4) Module 2 will continue to provide operation prompts: "Left-click on the background with a significantly different hue from the target object (128 is the dividing hue) to obtain the background hue threshold." (See attached image) Figure 15 As shown, since the hue value of the target object is close to 0, click the left mouse button on the image displayed in module 3 where the hue value is ≥128.
[0086] (5) Through dual recognition of brightness and hue, module 3 will automatically identify the connected regions of each light point and display the range and area of each connected region, as shown in the appendix. Figure 16 As shown.
[0087] (6) If attached Figure 16 If the recognition result meets the requirements, click the 1-12 button in module 1; otherwise, manually adjust the parameter values of 1-1 to 1-7 and then click the 1-12 button.
[0088] (7) At this time, a checkBox component will be generated at the center of each identified light source point, as shown in the attached figure. Figure 17 This allows for the selection of the required LEDs in the corresponding test steps of the circuit board functional testing.
[0089] The third type of circuit board exhibits both clearly defined light spots and partial overlap between adjacent light spots, and also contains both red and near-white light spots; for example... Figure 18 As shown, the goal is to detect light points emitting near-white light. If the results after identification using preset parameters do not fully meet the requirements, further detection can be performed by adjusting parameters such as the detection mode, area threshold, and morphological processing. The operation process is as follows:
[0090] (1) The lamp spot pre-test was performed according to the second method described above, and the results are shown in the attached figure. Figure 19 As shown, a red light spot at the top was also detected, with a connected region area of 38, while the connected region areas of the nearly white light spots were all above 189.
[0091] (2) Increase the minimum area threshold from 25 to 50, and then perform pre-detection of light spots. The results are shown in the attached figure. Figure 20 As shown, the results already meet the requirements.
[0092] Click the 1-12 buttons again to perform an automatic detection; the results are shown in the attached image. Figure 21 At this point, a checkBox component has been generated for each target light point, and the result is completely correct.
[0093] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. For those skilled in the art, various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and these variations still fall within the protection scope of the present invention.
Claims
1. A lamp point image recognition method comprising a semi-automatic detection type lamp point, a manual addition type lamp point detection method, characterized in that: The semi-automatic detection type light point refers to that five parameters of image detection mode, area threshold, morphological processing parameter, light point category and color difference need to be manually set first, and then the image recognition of the light point is automatically completed by the corresponding software, if the recognition result does not meet the requirements, the detection parameters are adjusted again and then the recognition is performed until the requirements are met; the manual adding type light point refers to that two parameters of light point category and color difference are manually set first, and then the specific position of the circuit board image is manually specified, the area in a certain range of the position is considered as the light spot range, and the image recognition of the specific position of the light point is automatically completed by the corresponding software; the image recognition method of the semi-automatic detection type light point comprises the following steps: S01, image detection parameter setting. The set parameters include image detection mode, area threshold, morphological processing parameter, light point category and color difference; S02, image acquisition, channel separation and size calculation; S03, obtaining color information of the target position according to the image detection mode; S04, using different global threshold values to segment the single-channel image, and converting the gray-scale image into a binary region; S05, performing morphological processing parameter on the optimized binary region; S06, performing connected domain segmentation operation on the optimized binary region, and dividing the binary region into multiple independent and mutually disconnected connected domains; S07, screening the connected domains to obtain the required connected domains; S08, obtaining the number, center coordinates, area and color information of the connected domains; S09, control generation and display, including two different control types of light point pre-detection and automatic generation of light test points.
2. The method of claim 1, wherein: The image detection mode includes "brightness", "single color", "color tone", "multi-color", "brightness. color tone", "single color. color tone" and "multi-color. color tone" modes, the area threshold includes lower limit value and upper limit value, the lower limit value must be set and the default value is 25, and the upper limit value is not necessarily set; the light point category is divided into non-color and color two categories, and the color difference has three levels of large, medium and small; the tone, saturation, brightness information data and upper and lower limit values of the binary region are different under different modes; the morphological processing parameter is that the binary region is subjected to erosion operation and then dilatation operation to obtain the optimized binary region; three image detection parameter rapid setting options of "suitable for clear light point", "suitable for light point adhesion" and "suitable for light point overlap" are pre-set.
3. The method of claim 1, wherein: The image recognition method of the manual adding type light point comprises the following steps: S21, image detection parameter setting, the parameters are light point category and color difference; S22, light point detection region generation, generating a circular region with a certain pixel as the radius and taking the left mouse click position as the center as the light spot range; S23, color information saving; S24, light point check box control generation.
4. The method of claim 1, wherein: The application software prepared according to the image recognition methods of the semi-automatic detection type light point and the manual adding type light point comprises three modules of light point semi-automatic detection module, light point recognition operation prompt module and circuit diagram display and light point selection module.
5. The method of claim 4, wherein: The lamp point semi-automatic detection module includes an image detection mode, an area threshold, a morphological processing, lamp point categories and color difference, lamp point preset, automatic generation of lamp test points, and lamp point pre-detection controls. The lamp point recognition operation prompt module prompts the user on how to operate in the circuit diagram display and lamp point selection module according to the settings of the lamp point semi-automatic detection module. The circuit diagram display and lamp point selection module can obtain the brightness, grayscale, hue color information and connected domain range area of any point of the image through mouse operation.