Methods, apparatus, equipment and storage media for detecting defects in light sources
By acquiring contour information and color difference information of the light source image, light source defect detection is performed, which solves the problem of inaccurate detection caused by excessive light spot brightness and missing channel colors, and achieves high-precision light source defect detection.
Patent Information
- Application Number
- CN202010825318.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-17
- Publication Date
- 2026-03-06
- Estimated Expiration
- 2040-08-17
AI Technical Summary
In existing technologies, light source defect detection is easily affected by excessive light spot brightness and missing channel colors, leading to inaccurate detection.
By acquiring images of the light source, the contour information of the light source is determined, the target area is determined based on the contour information, and the light source defects are detected by using color difference information. The brightness and color of the light source are judged to meet the standards by using pixel and channel difference information.
It improves the accuracy and precision of light source defect detection, simplifies the detection process, and reduces operational difficulty and interference factors.
Smart Images

Figure CN114155179B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a method, apparatus, device and storage medium for detecting light source defects. Background Technology
[0002] After production, light sources need to be tested for brightness and color to determine if there are any defects. This includes testing the brightness and color of incandescent lamps, fluorescent lamps, and infrared or ultraviolet light sources. Especially in industrial production of PCBs (Printed Circuit Boards), the brightness and color of the light sources on the boards need to be tested upon completion to determine if there are any defective light sources, such as those that are not lit, have insufficient brightness, or exhibit color distortion.
[0003] To avoid harming the eyes of inspectors from light sources, computer vision technology is often used to replace manual inspection. For example, the brightness and color of the light spots produced by the light source in the image are calculated to make a judgment.
[0004] However, because the light spot produced by the light source is too bright, it is easy to overexpose during imaging. If a certain channel of the light spot is missing color, it is not conducive to the detection of defects in the light source. Summary of the Invention
[0005] This invention provides a method, apparatus, device, and storage medium for detecting light source defects, thereby improving the accuracy of light source defect detection and simplifying the detection process.
[0006] In a first aspect, embodiments of the present invention provide a method for detecting defects in a light source, comprising:
[0007] Determine the contour information of the light source in the image based on the acquired light source image;
[0008] The target region in the light source image is determined based on the contour information;
[0009] Determine the color difference information based on the image information in the target area;
[0010] The light source defect detection result in the light source image is determined based on the color difference information.
[0011] Secondly, embodiments of the present invention also provide a light source defect detection device, comprising:
[0012] The contour information determination module is used to determine the contour information of the light source in the image based on the acquired light source image;
[0013] The target region determination module is used to determine the target region in the light source image based on the contour information.
[0014] The color difference information determination module is used to determine color difference information based on image information in the target area;
[0015] The defect detection module is used to determine the light source defect detection result in the light source image based on the color difference information.
[0016] Thirdly, embodiments of the present invention also provide an apparatus, comprising:
[0017] One or more processors;
[0018] Storage device for storing one or more programs.
[0019] When the one or more programs are executed by the one or more processors, the one or more processors implement the light source defect detection method as described in any embodiment of the present invention.
[0020] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the light source defect detection method as described in any embodiment of the present invention.
[0021] This invention determines the light source contour information from the acquired light source image, and then determines the color difference information in the target area based on the contour information. The color difference information reflects the brightness defects of the light source; therefore, the light source defect detection result can be obtained based on the color difference information. This invention achieves light source defect detection based on the color difference information of the image, improving the accuracy and precision of light source defect detection by detecting the essential color characteristics of the light source. Attached Figure Description
[0022] Figure 1 This is a flowchart of the light source defect detection method in Embodiment 1 of the present invention;
[0023] Figure 2 This is a flowchart of the light source defect detection method in Embodiment 2 of the present invention;
[0024] Figure 3 This is a schematic diagram of the light source defect detection device in Embodiment 3 of the present invention;
[0025] Figure 4 This is a schematic diagram of the light source defect detection device in Embodiment 4 of the present invention. Detailed Implementation
[0026] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.
[0027] Example 1
[0028] Figure 1 This is a flowchart of the light source defect detection method in Embodiment 1 of the present invention. This embodiment is applicable to the detection of various light source defects. The following detailed description uses an LED light source on a PCB board as an example. This method can be executed by a light source defect detection device, which can be implemented in software and / or hardware and can be configured in a device, such as a backend server or other device with communication and computing capabilities. Figure 1 As shown, the method specifically includes:
[0029] Step 101: Determine the contour information of the light source in the image based on the acquired light source image.
[0030] In this invention, the light source image refers to an image where the area of light emitted by the light source has a regular shape, including rectangles or near-circular shapes, such as circles and ellipses. In this embodiment, the light source image used for defect detection is an image obtained by photographing the PCB board on which LEDs are mounted. Before acquiring the image, the PCB board is powered on to ensure that the LEDs in the acquired light source image are in the on state. This allows for defect detection of the on-state LEDs based on the image information, determining whether the LED light source has defects such as not lighting up or brightness not meeting standards. The light source contour information refers to the contour information of the aperture produced by the on-state light source, including the boundary coordinates of the contour.
[0031] For example, an image acquisition device is used to acquire an image of the PCB board to obtain an LED image. The outline boundary coordinates of the LED light source are determined based on the brightness produced by the LED in the "on" state in the image. For example, the outline information can be determined by edge extraction or brightness thresholding.
[0032] Step 102: Determine the target region in the light source image based on the contour information.
[0033] The target area is used to represent the area where the light produced by the LED is turned on.
[0034] Specifically, the target region is the area located by the boundary coordinates of the contour information. For example, since the bright area produced by the LED can be approximated as a regular shape, a fitted circle can be determined based on the contour information, and the area containing this circle is the target region.
[0035] In one feasible embodiment, the contour information includes contour area and contour position information;
[0036] Accordingly, the target region in the light source image is determined based on the contour information, including:
[0037] Determine the centroid position of the contour based on the contour position information;
[0038] The maximum inscribed polygon of the contour is determined based on the position of the centroid and the area of the contour, and the maximum inscribed polygon is then identified as the target region.
[0039] Among them, the contour area is used to characterize the bright area produced by the light source; the contour position information refers to the coordinate point information of the contour boundary.
[0040] Contours in an image can be represented using image moments, which describe the feature parameters of the contour, such as color, texture, and shape. Specifically, the zeroth moment of the contour describes the sum of the image gray levels in the contour region, while the first moment determines the gray-level center of the contour region, i.e., the centroid of the contour.
[0041] For example, if the light source image is a color image, it is converted to a grayscale image, and the first moment is determined based on the grayscale image. The grayscale value of each pixel within the contour is determined using the contour position information, and the zeroth moment represents the sum of the grayscale values of all pixels within the contour. The zeroth moment of the contour can be determined using the following formula: M 00 =∑ i ∑ j V(i,j), where V(i,j) represents the gray value of the i-th row and j-th column of the contour. The first moment of the contour can be determined by the following formula: M 10 =∑ i ∑ j i·V(i,j), M 01 =∑ i ∑ j If j·V(i,j), then the centroid position (x,y) of the contour can be expressed by the following formula:
[0042] Building upon the example above, since the bright area produced by the LED light source can be approximated as a circle, the contour radius can be determined based on the contour area. Therefore, the contour can be represented by a circle with its centroid as the center and the contour radius as the radius. The largest inscribed polygon of this circle can then be obtained as the target region. For example, when the largest inscribed polygon is a largest inscribed square, the set of coordinate points for the target region can be (a, b). Where (x, y) is the centroid position of the corresponding contour, and S is the contour area of the corresponding contour. Similarly, the largest inscribed polygon can be the largest inscribed hexagon. The set of coordinate points of the target region can be determined based on the shape characteristics of the regular hexagon, which is well known to those skilled in the art and will not be elaborated here.
[0043] Optionally, a light source image may include at least two contour information. That is, if there are multiple LED light sources on a PCB board, the centroid position of each contour is determined according to each contour information, and the target area corresponding to each contour is determined. Each target area corresponds to the imaging area of a light source on the light source image.
[0044] Step 103: Determine the color difference information based on the image information in the target area.
[0045] The brightness information of the LED can be analyzed by examining the color differences between pixels in the target area. The image information of the target area refers to the three-channel values of each pixel in the target area.
[0046] Specifically, after determining the set of coordinate points of the target area, the three-channel values of each pixel in the target area are obtained based on the corresponding positions of the coordinate points on the light source image. Color difference information is then determined based on the distribution of each channel value, i.e., whether the three-channel values of each pixel in the target area are evenly distributed, and the proportion of pixels with unevenly distributed three-channel values out of all pixels in the target area.
[0047] In one feasible embodiment, the color difference information includes at least one of the following: pixel difference information and channel difference information;
[0048] Accordingly, color difference information is determined based on image information in the target area, including:
[0049] Pixel difference information is determined based on the comparison between the three-channel values of each pixel in the target area and a first preset threshold; and / or
[0050] The channel difference information is determined by comparing the difference between any two channel values of each pixel in the target area with the second preset threshold.
[0051] Pixel difference information represents the proportion of pixels in the target region whose three-channel values meet the standard values. Channel difference information represents the percentage of pixels in the target region whose differences between the three-channel values meet the standard.
[0052] Specifically, pixel difference information is determined based on the comparison results between the three-channel values of each pixel in the target area and a first preset threshold. The three-channel values of each pixel are compared with the first preset threshold to determine the percentage of pixels in the target area whose three-channel values are all greater than the first preset threshold. This percentage is used as the pixel difference information. For example, the differences between the R, G, and B channel values of each pixel in the target area and the first preset threshold V are calculated, such as R_diff = R_targetImg – V, G_diff = G_targetImg – V, B_diff = B_targetImg – V, where R_targetImg, G_targetImg, and B_targetImg are the three-channel values of any pixel. Finally, the percentage of pixels with differences R_diff, G_diff, and B_diff all greater than zero is determined out of the total number of pixels in the target area. The first preset threshold can be determined according to the actual brightness requirements of the LED. Different LEDs produce different brightness standards. The first preset threshold can include three-channel first preset thresholds, that is, a matching first preset threshold is set for each channel, thereby improving the detection accuracy of the channel brightness of the target area.
[0053] Channel difference information is determined by comparing the difference between any two channel values of each pixel's three-channel values in the target area with a second preset threshold. The difference between any two channel values of each pixel's three-channel values is compared with the second preset threshold to determine the percentage of pixels in the target area whose difference between any two channel values is greater than the second preset threshold. For example, the difference between any two R, G, and B channel values of each pixel in the target area is calculated, such as G_targetImg-B_targetImg, R_targetImg-B_targetImg, R_targetImg-G_targetImg, G_targetImg-R_targetImg, etc., to determine the percentage of pixels whose differences are greater than the second preset threshold. The second preset threshold can also be determined based on the actual brightness requirements of the LED. The second preset threshold can be a threshold range, such as (Pmin, Pmax), to determine the percentage of pixels whose differences fall within this threshold range.
[0054] For example, the color difference information determined based on the image information in the target area can be pixel difference information, channel difference information, or a combination of pixel difference information and channel difference information.
[0055] The color difference information obtained from the image information in the LED image can reflect the essential color of the LED, and thus determine whether the LED color is normal. Since the image information is an essential feature of the acquired image and is not affected by the acquisition location, it can improve the accuracy of LED color judgment and is simple to operate.
[0056] Step 104: Determine the light source defect detection result in the light source image based on the color difference information.
[0057] The color difference information of each LED in the LED image is used to determine whether the LED color is normal, thereby confirming the defect detection result. For example, if the pixel difference information and / or channel difference information in the color difference information are greater than 90%, the LED in the LED image is considered to be defect-free.
[0058] In this embodiment of the invention, the light source contour information is determined from the acquired light source image, and the color difference information in the target area is determined based on the contour information. The color difference information reflects the brightness defects of the light source, so the light source defect detection result can be obtained based on the color difference information. Since the light source image acquisition in this embodiment of the invention does not require tooling positioning, the operational difficulty of the detection process is reduced, and interference factors in the detection process are reduced, which is beneficial to improving the accuracy of light source defect detection.
[0059] Example 2
[0060] Figure 2 This is a flowchart of the light source defect detection method in Embodiment 2 of the present invention. Embodiment 2 is a further optimization based on Embodiment 1. Figure 2 As shown, the method includes:
[0061] Step 201: Determine the contour information of the light source in the image based on the acquired light source image.
[0062] In one feasible embodiment, the light source image is acquired using a lens with bokeh and / or an aperture parameter smaller than the standard value.
[0063] Since the image was captured under natural light, this light can interfere with the brightness of the light source. Therefore, the lens parameters for image capture are adjusted by reducing the aperture to a value smaller than the standard value. The standard value can be determined based on the image capture environment. Reducing the aperture filters out most of the natural light, effectively isolating light interference.
[0064] Out-of-focus imaging refers to imaging outside the focal point. When bright light from a light source is focused onto an image, the three channel values of the bright area become equal, making separation difficult, such as with white light sources or light sources of different colors. Therefore, adjusting the distance between the lens and the sensor's photosensitive surface allows the lens to image out of focus, setting the light source image to overexpose. This effectively magnifies and separates the less distinct R, G, and B primary colors, improving the accuracy of constructing color features using these three primary colors, and thus enhancing detection precision.
[0065] Reducing the aperture parameter of the camera helps to reduce interference factors during the detection process. Using the camera's out-of-focus imaging can effectively separate the color values of the R, G, and B channels, improving the accuracy of light source defect detection.
[0066] In one feasible embodiment, before determining the contour information of the light source in the image based on the acquired light source image, the method further includes:
[0067] The acquired light source image is filtered to obtain a filtered image;
[0068] The filtered image is binarized to obtain a binary image;
[0069] Erosion and dilation operations are performed on a binary image to obtain a dilated image;
[0070] Accordingly, the contour information of the light source in the image is determined based on the acquired light source image, including:
[0071] By searching for contours in the dilated image, the contour information of the light source in the image can be obtained.
[0072] If the contour is determined directly from the light source image captured by the lens, the presence of noise and other interference factors will lead to inaccurate contour finding. Therefore, the light source image is preprocessed before determining the contour information.
[0073] Preprocessing includes filtering the acquired light source image to remove noise. In one feasible embodiment, the filtering includes Gaussian filtering, and the aspect ratio of the Gaussian kernel matrix of the Gaussian filter is determined based on the aspect ratio of the light source image. Determining the aspect ratio of the Gaussian kernel matrix of the Gaussian filter using the aspect ratio of the light source image acquired by the camera can improve the accuracy of noise removal from the light source image by Gaussian filtering. For example, the aspect ratio of the Gaussian kernel matrix can be approximately equal to the aspect ratio of the light source image.
[0074] After removing noise, the image is binarized to obtain a binary image of the light source image. Exemplarily, the three-channel values of each pixel point in the Gaussian-blurred image are converted into grayscale values, and then the grayscale values of each point are traversed. All pixels with grayscale values greater than the threshold are set to 255, and those less than the threshold are set to 0, so as to obtain relatively good boundary segmentation features. Exemplarily, the following formula is used to convert the three-channel values of each pixel point in the image into grayscale values: Gray(i, j) = 0.3R(i, j) + 0.59G(i, j) + 0.11B(i, j), where Gray(i, j) represents the grayscale value of the pixel point at coordinates (i, j), and R(i, j), G(i, j), and B(i, j) are the red, green, and blue channel values of the pixel point at image coordinates (i, j), respectively. When Gray(i, j) >= V_threshold, Gray(i, j) = 255; when Gray(i, j) < Gray_threshold, Gray(i, j) = 0. Here, V_threshold represents the threshold of the grayscale value, which can be set according to the specific brightness of the light source image.
[0075] Further, in order to eliminate the influence of interference points in the image, erosion and dilation operations are performed on the binary image. Exemplarily, the binary image is convolved with a convolution kernel to calculate the local minimum value in the convolution kernel region, and the minimum value is used to cover the convolution kernel region. Therefore, the high-brightness regions in the image gradually decrease, and very small high-brightness regions will be covered and gradually filled with black to eliminate interference points; then the image is convolved with the convolution kernel to calculate the local maximum value of the image, and the previously qualified brightness regions are restored.
[0076] After preprocessing the light source image, the processed image is searched for contours. Exemplarily, the contour of the image is located by methods such as edge extraction results or brightness judgment to find the region where the bright light generated by the light source is imaged. Exemplarily, the dilated image is searched for contours, and the number of contours obtained is denoted as k. The set of points of all contours is P = [P[1], P[2], …… P[k]], and P[k] is the set of coordinate points of the k-th contour.
[0077] Step 202: Determine the target region in the light source image according to the contour information.
[0078] Step 203: Determine the color difference information according to the image information in the target region.
[0079] Step 204: Determine the number of light sources in the light source image according to the contour area.
[0080] The contour area can be determined based on the set of contour coordinate points. If the light source has normal brightness, the area of light it produces will be within a certain range. The contour area reflects the size of the area of light produced by the light source. Therefore, contours with a contour area greater than a preset area threshold are defined as conforming contours. The number of conforming contours is the number of light sources.
[0081] For example, based on the above example, the area of each contour in the point set P is determined, and it is checked whether the area of each contour is within the preset area threshold [Smin, Smax]. If it is within the range, it is recorded as the effective area S = [area1, area2, area3...areaN]. The number of effective areas is the number of light sources N. The preset area threshold can be determined according to the actual parameters of the light source.
[0082] Step 205: Obtain the comparison results of the number of light sources and the number of standard light sources.
[0083] The standard number of light sources refers to the theoretical number of light sources on the light source image. For example, the theoretical number of LED light sources on a PCB board, and the number of LED light sources obtained by filtering through effective area, reflects the actual effective number of LED light sources on the PCB board. Comparing this number with the standard number of LED light sources determines whether the number of LED light sources on the PCB board meets the requirements. For instance, if the number of light sources equals the standard number of light sources, the comparison result is normal; otherwise, the comparison result indicates a defect.
[0084] Step 206: Determine the light source defect detection results in the light source image based on the color difference information and quantity comparison results.
[0085] Since the color difference information reflects the color defects of the light produced by the light source, and the quantity comparison result reflects the quantity defects of the light produced by the light source, the light source defect detection result in the light source image is determined by combining the color difference information and the quantity comparison result. If there is a defect in either aspect, the light source defect detection result is that there is a defect. For example, the light source on the PCB board corresponding to the light source image is checked for defects based on the light source defect detection.
[0086] This invention describes a method for determining the contour information of a acquired light source image. Based on this contour information, it determines the color difference information and the number of light sources in the target area. The color difference information reflects brightness defects in the light source, while the number comparison results reflect quantity defects. Therefore, the light source defect detection result can be obtained based on the color difference information and the number comparison results. Since the light source image acquisition in this invention does not require tooling positioning, the operational difficulty and cost of the detection process are reduced, interference factors during the detection process are minimized, and the accuracy of light source defect detection is improved.
[0087] Example 3
[0088] Figure 3 This is a schematic diagram of the light source defect detection device in Embodiment 3 of the present invention. This embodiment is applicable to the detection of brightness defects in LED light sources on PCBs. Figure 3 As shown, the device includes:
[0089] The contour information determination module 310 is used to determine the contour information of the light source in the image based on the acquired light source image;
[0090] The target region determination module 320 is used to determine the target region in the light source image based on the contour information;
[0091] The color difference information determination module 330 is used to determine color difference information based on image information in the target area;
[0092] The defect detection module 340 is used to determine the light source defect detection result in the light source image based on the color difference information.
[0093] In this embodiment of the invention, the light source contour information is determined from the acquired light source image, and the color difference information in the target area is determined based on the contour information. The color difference information reflects the brightness defects of the light source, so the light source defect detection result can be obtained based on the color difference information. Since the light source image acquisition in this embodiment of the invention does not require tooling positioning, the operational difficulty of the detection process is reduced, and interference factors in the detection process are reduced, thereby improving the accuracy of light source defect detection.
[0094] Optionally, the color difference information includes at least one of the following: pixel difference information and channel difference information;
[0095] Correspondingly, the color difference information determination module 330 is specifically used for:
[0096] Pixel difference information is determined based on the comparison results between the three-channel values of each pixel in the target region and a first preset threshold; and / or
[0097] The channel difference information is determined by comparing the difference between any two channel values of each pixel in the target region with a second preset threshold.
[0098] Optionally, the contour information includes contour area and contour position information;
[0099] Correspondingly, the target area determination module 320 is specifically used for:
[0100] The position of the centroid of the contour is determined based on the contour position information;
[0101] The maximum inscribed polygon of the contour is determined based on the centroid position and the area of the contour, and the maximum inscribed polygon is determined as the target region.
[0102] Optionally, the contour information includes the contour area;
[0103] Accordingly, the device also includes a light source quantity comparison module, specifically used for:
[0104] The number of light sources in the light source image is determined based on the contour area;
[0105] The results of comparing the number of light sources with the number of standard light sources were obtained;
[0106] Correspondingly, the defect detection module 340 is specifically used for:
[0107] The light source defect detection result in the light source image is determined based on the color difference information and the quantity comparison result.
[0108] Optionally, the device further includes an image preprocessing module, specifically used for:
[0109] The acquired light source image is filtered to obtain a filtered image;
[0110] The filtered image is binarized to obtain a binary image;
[0111] The binary image is subjected to erosion and dilation operations to obtain a dilated image;
[0112] Correspondingly, the contour information determination module 310 is specifically used for:
[0113] The contours of the light sources in the image are obtained by searching for contours in the inflated image.
[0114] Optionally, the filtering includes Gaussian filtering, and the aspect ratio of the Gaussian kernel matrix of the Gaussian filter is determined according to the aspect ratio of the light source image.
[0115] Optionally, the light source image is acquired using a lens with bokeh and / or an aperture parameter smaller than the standard value.
[0116] The light source defect detection device provided in the embodiments of the present invention can execute the light source defect detection method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the light source defect detection method.
[0117] Example 4
[0118] Figure 4 This is a schematic diagram of the structure of a light source defect detection device provided in Embodiment 4 of the present invention. Figure 4A block diagram of an exemplary device 12 suitable for implementing embodiments of the present invention is shown. Figure 4 The device 12 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0119] like Figure 4 As shown, device 12 is represented as a general-purpose computing device. The components of device 12 may include, but are not limited to: one or more processors or processing units 16, system storage device 28, and bus 18 connecting different system components (including system storage device 28 and processing unit 16).
[0120] Bus 18 represents one or more of several bus architectures, including a memory device bus or memory device controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0121] Device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by device 12, including volatile and non-volatile media, removable and non-removable media.
[0122] System storage device 28 may include computer system readable media in the form of volatile storage devices, such as random access memory (RAM) 30 and / or cache storage device 32. Device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (…). Figure 4 Not shown; usually referred to as a "hard drive"). Although Figure 4 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. Storage device 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0123] A program / utility 40 having a set (at least one) of program modules 42 may be stored in, for example, storage device 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of the present invention.
[0124] Device 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), and with one or more devices that enable a user to interact with device 12, and / or with any device that enables device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 22. Furthermore, device 12 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 20. Figure 4 As shown, network adapter 20 communicates with other modules of device 12 via bus 18. It should be understood that, although... Figure 4 As not shown, other hardware and / or software modules can be used in conjunction with device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0125] Processing unit 16 executes various functional applications and data processing by running programs stored in system storage device 28, such as implementing the light source defect detection method provided in the embodiments of the present invention, including:
[0126] Determine the contour information of the light source in the image based on the acquired light source image;
[0127] The target region in the light source image is determined based on the contour information;
[0128] Determine the color difference information based on the image information in the target area;
[0129] The light source defect detection result in the light source image is determined based on the color difference information.
[0130] Example 5
[0131] Embodiment 5 of the present invention also provides a computer-readable storage medium having a computer program stored thereon. When executed by a processor, the program implements the light source defect detection method provided in the embodiments of the present invention, including:
[0132] Determine the contour information of the light source in the image based on the acquired light source image;
[0133] The target region in the light source image is determined based on the contour information;
[0134] Determine the color difference information based on the image information in the target area;
[0135] The light source defect detection result in the light source image is determined based on the color difference information.
[0136] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0137] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0138] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0139] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0140] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. A method of light source defect detection, characterized by, The method comprises the following steps: determining contour information of a light source in an image according to a collected light source image; wherein the light source image is an image in which a light source produces a regular-shaped bright region; determining a target region in the light source image according to the contour information; wherein the contour information comprises contour area and contour position information; determining color difference value information according to image information in the target region; determining a light source defect detection result in the light source image according to the color difference value information; after determining the contour information of the light source in the image according to the collected light source image, the method further comprises the following steps: determining the number of light sources in the light source image according to the contour area; obtaining a number comparison result of the number of light sources and a standard number of light sources; correspondingly, determining the light source defect detection result in the light source image according to the color difference value information comprises the following steps: determining the light source defect detection result in the light source image according to the color difference value information and the number comparison result; wherein the light source image is collected by using out-of-focus imaging; the color difference value information comprises pixel difference value information and channel difference value information; correspondingly, determining the color difference value information according to the image information in the target region comprises the following steps: determining the pixel difference value information according to a comparison result of three-channel values of each pixel point in the target region and a first preset threshold; and determining the channel difference value information according to a comparison result of a difference value between any two channel values of the three-channel values of each pixel point in the target region and a second preset threshold.
2. The method of claim 1, wherein, the contour information comprises contour area and contour position information; correspondingly, determining the target region in the light source image according to the contour information comprises the following steps: determining a contour centroid position according to the contour position information; determining a maximum inscribed polygon of the contour according to the contour centroid position and the contour area, and determining the maximum inscribed polygon as the target region.
3. The method of claim 1, wherein, before determining the contour information of the light source in the image according to the collected light source image, the method further comprises the following steps: filtering the collected light source image to obtain a filtered image; performing binaryzation processing on the filtered image to obtain a binary image; performing an erosion and expansion operation on the binary image to obtain an expanded image; correspondingly, determining the contour information of the light source in the image according to the collected light source image comprises the following steps: finding a contour in the expanded image to obtain the contour information of the light source in the image.
4. The method of claim 3, wherein, the filtering comprises Gaussian filtering, and an aspect ratio of a Gaussian kernel matrix of the Gaussian filtering is determined according to an aspect ratio of the light source image.
5. The method according to any one of claims 1 to 4, characterized in that, the light source image is collected by using a lens with an aperture parameter less than a standard value.
6. A light source defect detection apparatus characterized by comprising: The method comprises the following steps: a contour information determination module is configured to determine contour information of a light source in an image according to a collected light source image; wherein the light source image is an image in which a light source produces a regular-shaped bright region; a target region determination module is configured to determine a target region in the light source image according to the contour information; wherein the contour information comprises contour area and contour position information; a color difference value information determination module is configured to determine color difference value information according to image information in the target region; a defect detection module is configured to determine a light source defect detection result in the light source image according to the color difference value information; The device also includes: A light source quantity comparison module, specifically configured to determine the number of light sources in the light source image according to the contour area; and obtain a number comparison result of the number of light sources and a standard number of light sources; The defect detection module is specifically configured to determine a light source defect detection result in the light source image according to the color difference value information and the number comparison result; The light source image is obtained by out-of-focus imaging acquisition. The color difference value information includes pixel difference value information and channel difference value information. Correspondingly, the color difference value information is determined according to the image information in the target region, including: The pixel difference value information is determined according to the comparison result of the three-channel values of each pixel point in the target region and a first preset threshold; and the channel difference value information is determined according to the comparison result of the difference value between any two channel values of the three-channel values of each pixel point in the target region and a second preset threshold.
7. An apparatus, comprising: It includes: One or more processors; A storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the light source defect detection method as claimed in any one of claims 1-5.
8. A computer readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the light source defect detection method as claimed in any one of claims 1-5.
Citation Information
Patent Citations
Method and system for determining automatic exposure reference area of mammary glands
CN103637815A
LED light source detection method and system
CN107389318A