Defect image detection method and device

By using computational image center and concentric geometric region analysis, the problem of automating lens module defect detection was solved, improving detection accuracy and efficiency, and reducing the false positive rate.

CN121504787APending Publication Date: 2026-02-10GUANGZHOU LUXVISIONS INNOVATION TECH LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411059878.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-02
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

During the assembly of camera lens modules, defect detection is difficult to automate, especially since the location, color, size, and shape of color spots are not fixed, making detection difficult and affecting production efficiency.

Method used

By calculating the image center of the image under test, it is divided into multiple concentric geometric regions. The color ratio value of the pixel is calculated and normalized. It is determined whether the normalized color ratio value of the pixel exceeds the threshold. Combining centroid calculation and concentric geometric region analysis, defective pixels are marked and identified.

Benefits of technology

It improves the accuracy and efficiency of lens module defect detection, reduces the false positive rate, and realizes automated defect detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121504787A_ABST
    Figure CN121504787A_ABST
Patent Text Reader

Abstract

The invention provides a defect image detection method and a defect image detection device, which are suitable for detecting an image to be detected, the image to be detected comprises a plurality of pixels, and the defect image detection method comprises the following steps: calculating an image center of the image to be detected; segmenting the to-be-detected image into a plurality of concentric geometric areas, wherein the center of each concentric geometric area is the center of the image; calculating a color proportion value of each pixel, and normalizing the color proportion value to obtain a normalized color proportion value; and judging that the normalized color proportion value of any pixel is greater than a color proportion threshold value, and marking any pixel.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to an image inspection method, and more particularly to an image inspection method suitable for detecting image defects. Background Technology

[0002] In the camera lens module assembly process, semi-finished or finished lens modules must be tested in real-world shooting scenarios to confirm the presence of defects. For example, during lens module assembly, defects in the components themselves or assembly deviations may lead to color spots in the image. Color spots reflect localized defects on different lens modules; therefore, the location, color, size, and shape of these spots are not fixed. Furthermore, the appearance of these spots varies greatly, increasing the difficulty of automated inspection. Therefore, effectively and accurately detecting defective lens modules to improve production efficiency is crucial. Summary of the Invention

[0003] In view of this, the present invention proposes a defect image detection method and a defect image detection device.

[0004] The defect image detection method is suitable for detecting a test image containing multiple pixels. The defect image detection method includes: calculating the image center of the test image; dividing the test image into multiple concentric geometric regions, with the center of each concentric geometric region being the image center; calculating the color ratio value of each pixel and normalizing it to obtain a normalized color ratio value; and determining that the normalized color ratio value of any pixel is greater than a color ratio threshold, and marking the pixel.

[0005] The defect image detection device is adapted to detect a lens under test, the lens under test being used to generate a test image, and the defect image detection device includes a processor for executing any of the defect image detection methods described in different embodiments of the present invention. Attached Figure Description

[0006] Figure 1 A block diagram showing a defect image detection device according to some embodiments of the present invention;

[0007] Figure 2A A schematic diagram showing an image to be tested according to some embodiments of the present invention;

[0008] Figure 2B A schematic diagram showing an image under test with enhanced saturation according to some embodiments of the present invention;

[0009] Figure 3 A flowchart of a defect image detection method according to some embodiments of the present invention is shown;

[0010] Figure 4A schematic diagram showing the image center of an image to be tested according to some embodiments of the present invention;

[0011] Figure 5 This flowchart shows the steps of obtaining the image center of the image to be tested according to some embodiments of the present invention in the defect image detection method;

[0012] Figure 6 A schematic diagram showing the image under test represented by pixel values ​​according to some embodiments of the present invention;

[0013] Figure 7 This diagram illustrates the segmentation of the image to be tested according to some embodiments of the present invention;

[0014] Figure 8A A schematic diagram showing concentric geometric regions of an image under test according to some embodiments of the present invention;

[0015] Figure 8B A schematic diagram showing concentric geometric regions of a test image with enhanced saturation according to some embodiments of the present invention;

[0016] Figure 9 A flowchart showing the steps of normalizing the color ratio values ​​of each pixel in a defect image detection method according to some embodiments of the present invention;

[0017] Figure 10A A schematic diagram showing a binarized representation of an image under test according to some embodiments of the present invention;

[0018] Figure 10B A schematic diagram showing a defect image contained in a marked image of an image under test according to some embodiments of the present invention;

[0019] Figure 11 This is a schematic diagram comparing the false positive rates of defect image detection methods according to different embodiments of the present invention.

[0020] In the attached figures, the following labels are used:

[0021] 10: Defect Image Detection Device

[0022] 11: Processor

[0023] 12: Memory

[0024] 13: User Interface

[0025] 20: Lens to be tested

[0026] 30: Backlight

[0027] I1: Image to be tested

[0028] I2: Image under test with enhanced saturation

[0029] D1, D2: Defect images

[0030] F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10: Concentric geometric regions

[0031] r1, r2, rn: Diameter length

[0032] S101~S111: Steps

[0033] S1021, S1022: Steps

[0034] S1051, S1052: Steps

[0035] Pc: Geometric center

[0036] Pm: Center of mass. Detailed Implementation

[0037] Figure 1 This is a block diagram of a defect image detection device according to some embodiments of the present invention. Please refer to... Figure 1 In this embodiment, the defect image detection device 10 includes a processor 11 and a memory 12, with the processor 11 coupled to the memory 12. The defect image detection device 10 is suitable for detecting the lens 20 under test. Specifically, after the production line personnel complete the assembly of the lens 20 under test, they perform functional testing. During testing, the lens 20 under test is coupled to the defect image detection device 10. The backlight panel 30 generates a background light source. After the lens 20 under test captures the backlight panel 30, it generates the image I1 under test, which is then transmitted to the defect image detection device 10.

[0038] The processor 11 can be a SoC chip, a central processing unit (CPU), a microcontroller unit (MCU), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or a logic circuit. The processor 11 can receive the image under test I1 and execute any of the defect image detection methods described in different embodiments of the present invention to process the image under test I1.

[0039] The memory 12 can be a dynamic random access memory (DRAM), a solid-state drive (SSD), or a hard disk drive (HDD). The memory 12 can store the program code of any of the defect image detection methods described in different embodiments of the present invention. The processor 11 can read the program code from the memory 12 and execute the processing of the image to be tested I1.

[0040] The lens under test 20 can be a lens module containing a photosensitive element such as a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS). A backlight 30 generates a background light source suitable for inspecting the lens under test 20. In some embodiments, the backlight 30 is coupled to the defect image inspection device 10, and the backlight 30 can adjust the intensity or color temperature of the background light source to adapt to different inspection conditions. In some embodiments, the defect image inspection device 10 includes a processor 11, a memory 12, and a user interface 13, with the processor 11 coupled to the memory 12 and the user interface 13. Production line personnel can input inspection conditions or adjust inspection parameters through the user interface 13; for example, they can input the appropriate exposure time for the lens under test 20 to adjust the image brightness, or adjust the on / off state or intensity of the background light source.

[0041] Figure 2A This is a schematic diagram of the image to be tested according to some embodiments of the present invention. Figure 2B This is a schematic diagram of a test image with enhanced saturation according to some embodiments of the present invention. Please refer to [the original text here]. Figure 2A During the research, it was discovered that due to lens structure and differences in refractive index for different wavelengths of light, different wavelengths of light focus at different positions on the image sensor, resulting in color shift. Alternatively, the image sensor may exhibit varying sensitivity to different wavelengths of light at different locations, also causing color shift. For example, Figure 2A The central area of ​​the test image I1 is biased towards green, while the surrounding area is biased towards red. Generally speaking, under the same manufacturing process conditions, different test lenses 20 will result in roughly the same color cast distribution in the test image I1; therefore, color cast problems can be eliminated using software correction. To present this more clearly... Figure 2A The color cast distribution of the image I1 to be tested, the present invention will Figure 2A The saturation of the image under test I1 is improved, and it is presented in Figure 2B The image under test, I2, has improved saturation.

[0042] Please refer to Figure 2B It can be observed that the central region of the test image I2, with its enhanced saturation, exhibits a greenish tint and is roughly circular. As the imaging region moves away from the center of the test image, the color shift gradually changes from green to yellow, then to pink, and finally to red. In this embodiment, the test lens 20 is circular, which makes the central imaging region of the test image I1 circular, with the color shift gradually changing outward from the center. In other embodiments, the structure of the test lens 20 may affect the geometry of the central imaging region of the test image I1, and the color shift will gradually change outward around the center.

[0043] Damage to components of the lens 20 under test (e.g., lens or image sensor) or assembly deviations may result in defective images, such as color spots, on the image under test I1. Figure 2A and Figure 2B As shown, the central region of the image under test I1 has a defective image D1, and the surrounding region of the image under test I1 has a defective image D2. In this embodiment, defective images D1 and D2 exhibit the same color cast, i.e., a red color cast. This results in defective image D1 exhibiting higher contrast in the central region of the image under test I1, while defective image D2 exhibiting lower contrast in the surrounding region of the image under test I1. Therefore, in this embodiment, the variation in the position of the color spot on the image under test I1 directly affects the defect detection rate. In this embodiment, the central region and surrounding region of the image under test I1 exhibit a green-red cast, while the color spot exhibits a red color cast. The color cast is affected by the layout and characteristics of the photosensitive element, or the filter of the lens 20 under test. In other embodiments, the central region and surrounding region of the image under test I1 may also exhibit other types of color cast differences, such as red-green cast, blue-green cast, green-blue cast, blue-red cast, or red-blue cast, and the color spot may also have different color casts of red, green, or blue.

[0044] Figure 3 This is a flowchart of a defect image detection method according to some embodiments of the present invention. Please refer to it. Figure 3 In this embodiment, the defect image detection method reads the image to be tested I1 (step S101). For example, the defect image detection method is a program code, and the processor 11 executes the program code to receive the image to be tested I1 transmitted by the lens 20 under test. Alternatively, the processor 11 reads the image to be tested I1 temporarily stored in the memory 12. According to some embodiments, the defect image detection method is suitable for detecting the image to be tested I1 with dual-color color shift. According to some embodiments, the color of the color shift gradually changes from the center of the image to be tested I1 to the periphery of the image to be tested I1. The image to be tested I1 contains multiple pixels. In some embodiments, the pixels contain at least two types of color information, and the color information is selected from any primary color in the group consisting of red, green, and blue. The color information includes color level values, which can be represented as any value in the range of 0 to 255.

[0045] The defect image detection method obtains the image center of the image to be tested I1 (step S102). Figure 4 This is a schematic diagram of the image center of the image to be tested according to some embodiments of the present invention. Please refer to... Figure 4 In some embodiments, the image center refers to the geometric center Pc of the image I1 under test. For example... Figure 4 As shown, the image to be tested I1 is rectangular, and the intersection of its diagonals is the geometric center Pc of the image to be tested I1. In some embodiments, the defect image detection method reads multiple images to be tested I1, calculates the geometric center Pc of the first image to be tested I1, and applies the same geometric center Pc to the remaining images to be tested I1; or, the geometric center Pc of each image to be tested I1 is calculated one by one; or, production line personnel can define the geometric center Pc of the image to be tested I1 through the user interface 13. In other embodiments, the image center refers to the centroid Pm of the image to be tested I1. The centroid Pm is the position calculated based on the weighted average of the pixel representative values ​​of the pixels.

[0046] Figure 5 This is a flowchart of the step of obtaining the image center of the image to be tested according to some embodiments of the defect image detection method of the present invention. Please refer to it. Figure 5 In this embodiment, the defect image detection method calculates the pixel representative value of each pixel (step S1021). The defect image detection method calculates the pixel representative value according to the following formula 1:

[0047] PV = W * C c -C s (Formula 1)

[0048] Where PV is the pixel representative value, W is the weight value, and C C For the color information of the color shift type in the central region of the image I1 to be tested, C s This refers to color information about the color shift type in the surrounding area of ​​the image I1 under test. For example, Figure 2A The color bias in the central area is defined as green, and the color bias in the surrounding area is defined as red; therefore, color information C C For green, the color information Cs corresponds to red. Formula 1 is based on the color information C of each pixel. C The color level values ​​and color information Cs are used to calculate the color level values. Weight values ​​are used to adjust the contrast difference between the color cast in the central area and the surrounding areas. For example, Figure 2AThe pixel at the very center has color information (red, green, blue) and its color level value is (45, 220, 85). The weight value is defined as 2, therefore the pixel representation value PV of the pixel at the very center is 2*220-45, or 395. It should be understood that this embodiment uses a test image I1 with a green-to-red color shift and defective images D1 and D2 with a red color shift for illustration; in other embodiments, the pixel representation value can also be calculated based on other color combinations.

[0049] When the weight value is increased, the color information C of each pixel with the same color shift as the central region... C The color level values ​​are amplified, resulting in pixels in the central region of the test image I1 having higher pixel representative values, while pixels in the surrounding region have lower pixel representative values. In some embodiments, the color cast type of the color spot is the same as that of the surrounding region. Increasing the weight value helps to increase the contrast of the color spot appearing in the central region, thereby increasing the detection rate of the color spot in the central region; conversely, decreasing the contrast of the color spot appearing in the surrounding region reduces the detection rate of the color spot in the surrounding region. In some embodiments, the process of repeatedly performing the function including... Figure 5 The defect image detection method of the steps, and uses low weight value and high weight value respectively to perform the calculation of Formula 1, so as to improve the detection rate of the defect image detection method for color spots appearing at different positions on the image I1 to be tested.

[0050] Figure 6 This is a schematic diagram showing the image under test represented by pixel values ​​according to some embodiments of the present invention. Please refer to it as well. Figure 2A and Figure 6 As can be seen from the observation of the two embodiments, the defect image D1 in the central region is represented on the test image I1 according to the pixel representation value ( Figure 6 This is more pronounced compared to the original image I1 under test. Figure 2A ).

[0051] After obtaining the pixel representative value for each pixel (step S1021), the defect image detection method calculates the centroid Pm of the image I1 under test (step S1022). The defect image detection method calculates the centroid Pm according to the following formulas 2-1 to 2-5:

[0052] M 00 =∑ x ∑ y PV(x,y) (Formula 2-1)

[0053] M 10 =∑ x ∑ y x*PV(x,y) (Formula 2-2)

[0054] M 01 =∑ x∑ y y*PV(x,y) (Formula 2-3)

[0055]

[0056] Where x and y are the coordinates of each pixel, PV(x,y) is the pixel representative value of the pixel at the specified coordinates, and M x With M y These are the coordinates of the centroid. Please refer to [reference needed]. Figure 2A and Figure 2B In this embodiment, the surrounding area on the right side of the image I1 under test has a large area of ​​red color shift, while the surrounding area on the left side has a smaller area of ​​red color shift, which causes the centroid Pm to shift to the left of the image I1 under test. Figure 4 As shown, the centroid Pm of the image under test I1 is located to the left of the geometric center Pc. This centroid Pm offset may originate from deviations during the assembly of the lens 20 under test, or from axial offset during focusing of the backlight 30 during the testing process. Therefore, in this embodiment, the defect image detection method uses the centroid Pm to find the center point of the color shift range in the central region of the image under test I1.

[0057] Further reference Figure 3 The defect image detection method divides the image to be tested I1 into multiple concentric geometric regions (step S103). Figure 7 This is a schematic diagram illustrating the segmentation of the image to be tested according to some embodiments of the present invention. Please refer to... Figure 7 In this embodiment, the defect image detection method divides the image I1 to be tested into multiple concentric geometric regions, with the center of each concentric geometric region being the image center. In this embodiment, the outer contour of the concentric geometric regions is circular, and the image I1 to be tested is divided into circular regions and multiple annular regions. Figure 7 For example, the central region of the image I1 under test has a circular region with a radius of r1, and an annular region with an inner diameter of r1 and an outer diameter of r2. The surrounding region of the image I1 under test has an annular region with an outer diameter of rn. In other embodiments, the outer contour of the concentric geometric regions is other geometric shapes, such as ellipse, rectangle, or square; and the diameter can correspond to the same geometric parameter of each outer contour, such as the minor axis or major axis of an ellipse; the short side, long side, or diagonal of a rectangle; or the side length or diagonal of a square.

[0058] In some embodiments, the defect image detection method defines any point outside the image center of the image to be tested I1 as the origin, calculates the distance from the image center to the origin, and divides it by a positive integer segmentation number n to obtain the segmentation diameter r1. In this embodiment, as... Figure 7As shown, the defect image detection method defines the upper left corner of the image I1 under test as the origin, calculates the distance from the centroid Pm to the coordinates (0,0) of the upper left corner origin, and then divides this distance into n equal parts. The outer contour of each concentric geometric region has a diameter N*r1, where N is any positive integer from 1 to n. Therefore, the circular region has a radius r1, the outer diameter r2 of the outward annular region is twice r1, and so on. In some embodiments, the defect image detection method defines any point outside the geometric center Pc of the image I1 under test as the origin, calculates the distance from the geometric center Pc to the origin, and divides it by a positive integer division fraction n to obtain the division diameter. Then, this division diameter is applied to the centroid Pm as the center of the concentric geometric region, and multiple concentric geometric regions are divided.

[0059] Figure 8A This is a schematic diagram of the concentric geometric regions of the image under test according to some embodiments of the present invention; Figure 8B This is a schematic diagram of the concentric geometric regions of the image under test for saturation enhancement according to some embodiments of the present invention. Please refer to it as well. Figure 8A and Figure 8B To present it more clearly Figure 8A The color cast distribution of the image I1 to be tested, the present invention will Figure 8A The saturation of the image I1 under test is improved, and it is presented in Figure 8B The test image I2 has increased saturation. In this embodiment, the lens 20 under test is circular, and the central part of the test image is also circular with a color shift that gradually changes outward from the center. When the test image I1 is divided into multiple concentric geometric regions F0 to F10, the types of color information within each concentric geometric region are roughly the same. For example, most pixels within concentric geometric region F1 have higher green color level values, while most pixels within concentric geometric region F8 have higher red color level values. Therefore, for the defective image D1 appearing within concentric geometric regions F1 and F2, its corresponding pixels have higher red color level values, which is significantly different from other pixels within the same concentric geometric region.

[0060] Further reference Figure 3 The defect image detection method calculates the color ratio value of each pixel (step S104). According to some embodiments, the defect image detection method calculates the color ratio value according to the following formula 3:

[0061]

[0062] Where RC is the color ratio value, C D For color information of the color cast type in defective images, C O This is another type of color information. For example, please refer to... Figure 2A and Figure 2BIn this embodiment, each pixel contains at least two color information: red and green. The color shift of the defective images D1 and D2 is red. Therefore, color information C D Corresponding to red, and color information C O Corresponding to green. Formula 3 is based on the color information C of each pixel. D The color level values ​​and color information C O The color level values ​​are calculated. For example, Figure 2A The central pixel contains color information (red, green) with a color level value of (45, 220), therefore the color ratio value RC of the central pixel is 45 / 220. In other embodiments, each pixel contains three colors, so two color ratio values ​​can be calculated separately for each pixel. For example, Figure 2A The central pixel contains color information (red, green, blue) with a color gradation value of (45, 220, 85). Therefore, the central pixel has a first color ratio value RC: 45 / 220 and a second color ratio value RC: 45 / 85. It should be understood that this embodiment uses a test image I1 with a green-red color cast and defective images D1 and D2 with a red color cast for illustration; in other embodiments, the color ratio value can also be calculated based on combinations of other colors.

[0063] For reference Figure 3 The defect image detection method normalizes the color ratio values ​​of each pixel (step S105) to obtain normalized color ratio values. Figure 9 This is a flowchart illustrating the steps of normalizing the color ratio values ​​of each pixel in a defect image detection method according to some embodiments of the present invention. Please refer to... Figure 9 According to some embodiments, the defect image detection method calculates the region color ratio value of each concentric geometric region (step S1051). For example, please refer to... Figure 8A and Figure 8B The defect image detection method calculates the average color ratio value of all pixels within a concentric geometric region F0 as the regional color ratio value of concentric geometric region F0. Similarly, the defect image detection method calculates the average color ratio value of all pixels within a concentric geometric region F1 as the regional color ratio value of concentric geometric region F1. This process continues, with the defect image detection method calculating the regional color ratio values ​​for each concentric geometric region F0 to F10. As mentioned earlier, in some embodiments, each pixel contains three types of color information. The defect image detection method calculates the first regional color ratio value of each concentric geometric region based on the first color ratio value RC of all pixels within each concentric geometric region; then, based on the second color ratio value RC of all pixels within each concentric geometric region, it calculates the second regional color ratio value of each concentric geometric region.

[0064] Please refer to the above as well. Figure 8A and Figure 3 For example, the defect image detection method determines the concentric geometric region to which each pixel belongs based on the following formula 4-1:

[0065]

[0066] Where x and y are the coordinate values ​​of each pixel, P x With P y Image center coordinates (e.g., centroid coordinates M) x With M y (), where r1 is the cutting diameter and k is the number of the concentric geometric region to which each pixel belongs. For example... Figure 8A As shown, the number k of concentric geometric region F0 is 0, the number k of concentric geometric region F1 is 1, and so on. Subsequently, the defect image detection method calculates the average of the region color ratio values ​​for each concentric geometric region according to the following formulas 4-2 and 4-3:

[0067]

[0068]

[0069] Where x and y are the coordinates of each pixel, i and j are the width and height of the image I1 to be measured, and RC (x,y) P represents the color ratio value of each pixel. x With P y Let r be the coordinates of the image center, r be the diameter, and AvgRC(k) be the region color ratio value.

[0070] After calculating the region color ratio value of each concentric geometric region (step S1051), the defect image detection method calculates the ratio of the color ratio value of each pixel to the region color ratio value (step S1052) to obtain the normalized color ratio value of each pixel. The defect image detection method calculates the normalized color ratio value of each pixel according to the following formula 5:

[0071]

[0072] Wherein, RC is the color ratio value of each pixel, AvgRC is the region color ratio value of the concentric geometric region to which each pixel belongs, and NRC is the normalized color ratio value of each pixel. As mentioned above, in some embodiments, each pixel contains three types of color information. The defect image detection method calculates the first normalized color ratio value NRC of the first color ratio value RC of each pixel, and the second normalized color ratio value NRC of the second color ratio value RC of each pixel.

[0073] Further reference Figure 3The defect image detection method binarizes each pixel (step S106). Specifically, the defect image detection method determines that the normalized color ratio value of any pixel is greater than a color ratio threshold and marks this pixel. The color ratio threshold is used to binarize the normalized color ratio value. For example, when the normalized color ratio value of a pixel is greater than the color ratio threshold, it is marked as 1; otherwise, it is marked as 0. The color ratio threshold is adjusted according to the stringency of the detection. It can be the statistical value of the color ratio values ​​(or normalized color ratio values) of all pixels within a specific range of the image I1 under test, such as a multiple of the standard deviation, a ratio of the mean, or a quantile. The specific range can refer to the entire range or a local range of the image I1 under test. According to some embodiments, the specific range refers to the range of any concentric geometric region of the image I1 under test; therefore, each concentric geometric region corresponds to a color ratio threshold. The defect image detection method compares the normalized color ratio value of each pixel with the color ratio threshold of the concentric geometric region to which each pixel belongs to binarize each pixel. As mentioned above, in some embodiments, each pixel contains three types of color information, so each pixel contains two color ratio values ​​RC, and each concentric geometric region also corresponds to two color ratio thresholds.

[0074] In some embodiments, each concentric geometric region corresponds to a color ratio threshold, and the value of the color ratio threshold corresponding to the concentric geometric region decreases as the distance between the concentric geometric region and the image center increases. For example, please refer to... Figure 8B Assuming that concentric geometric regions F0 correspond to color ratio threshold th0, F1 to th1, F2 to th2, ..., and F10 to th10, then th0 > th1 > th2 > ... > th10. Therefore, since the normalized color ratio value is lower in the central region of the image I1 under test and higher in the surrounding regions, this threshold setting distribution can effectively improve the detection rate of defect images D1 and D2 in each concentric geometric region using the defect image detection method.

[0075] Figure 10A This is a schematic diagram of the image I1 to be tested, represented in binary form according to some embodiments of the present invention. Please refer to it as well. Figure 8B and Figure 10A In this embodiment, the pixels contained in the defect image D1 within the concentric geometric regions F1 and F2 are marked as 1 (displayed in white), and the pixels contained in the defect image D2 within the concentric geometric region F8 are also marked as 1. Therefore, by binarizing and marking each pixel, the defect image detection method can identify whether defect images D1 and D2 exist on the image under test I1, thereby inspecting the lens 20 under test.

[0076] For reference Figure 3 In some embodiments, the defect image detection method marks defect pixels according to connected components (step S107). Figure 10B This is a schematic diagram of a defect image included in a marked image of the image under test according to some embodiments of the present invention. Please refer to it as well. Figure 10A and Figure 10B In this embodiment, the marked pixels are defined as defective pixels, and are presented in... Figure 10A The defect image detection method marks defective pixels according to their connected components to obtain a set of defective pixels. For example, any two connected defective pixels are jointly marked, so that all defective pixels in the defective pixel set form interconnected white patches. Then, the defective image detection method determines whether the area of ​​the defective pixel set is greater than an area threshold (step S108). The area threshold is adjusted according to the stringency of the detection to limit the maximum tolerable defective image area, in accordance with the manufacturer's quality requirements for the lens 20 under test.

[0077] In some embodiments, when the defect image detection method determines that the area of ​​the defective pixel set is less than the area threshold (step S108, the determination result is "No"), a detection pass signal is generated to notify that the detection has passed (step S109); when the defective image detection method determines that the area of ​​the defective pixel set is greater than the area threshold (step S108, the determination result is "Yes"), a detection fail signal is generated to notify that the detection has failed (step S110). For example, the processor 11 of the defective image detection device 10 generates a detection fail signal and controls the user interface 13 to generate a detection fail message to notify production line personnel; or, the failed lens 20 is directly classified into the defective product area. In detail, in some embodiments, the automated inspection equipment is adapted to the defective image detection method, and the automated inspection equipment is coupled to the good product area via a first conveyor belt and to the defective product area via a second conveyor belt. When the defect image detection method determines that the area of ​​the defective pixel set is less than the area threshold (step S108, the determination result is "No"), it drives the motor of the first conveyor belt to transport the lens 20 under test to the good product area; when the defective image detection method determines that the area of ​​the defective pixel set is greater than the area threshold (step S108, the determination result is "Yes"), it drives the motor of the second conveyor belt to transport the lens 20 under test to the defective product area. In this embodiment, the detection pass signal is equivalent to the motor drive signal of the first conveyor belt, and the detection fail signal is equivalent to the motor drive signal of the second conveyor belt. In some embodiments, when the defective image detection method determines that the area of ​​the defective pixel set is greater than the area threshold (step S108, the determination result is "Yes"), it further counts the number of color spots (step S111). Figure 10B As shown, the set of defective pixels that are larger than the area threshold are labeled as defect image D1 and defect image D2.

[0078] In some embodiments, when the defect image detection method determines that the area of ​​the defect pixel set is less than the area threshold (step S108, the determination result is "No"), steps S1021-S1022 are re-executed to adjust the weight value, and steps S102-S108 are repeated to detect color spots appearing at different positions on the image to be tested I1. In some embodiments, when the defect image detection method notifies that the detection has passed (step S109) or notifies that the detection has failed (step S110), the processor 11 reads the next image to be tested I1 to repeat steps S102-S108.

[0079] Figure 11 This is a schematic diagram comparing the false positive rates of defect image detection methods according to different embodiments of the present invention. Please refer to it. Figure 11 When the image I1 under test has no color cast, the defect image detection method uses the geometric center Pc as the image center in step S102, and its false positive rate is 0.40%; while when the defect image detection method uses the centroid Pm as the image center in step S102, its false positive rate is 0.00%. When the image I1 under test has a color cast (such as...) Figure 2A In step S102, the defect image detection method uses the geometric center Pc as the image center for processing, and its misjudgment rate is 0.78%; while when the defect image detection method uses the centroid Pm as the image center for processing in step S102, its misjudgment rate is 0.00%.

[0080] Although the above embodiments have been disclosed in this invention, they are not intended to limit this application. Any person skilled in the art may make some modifications and changes without departing from the spirit and scope of this application, but such modifications and changes are still within the scope of the patent application of this invention.

Claims

1. A defect image detection method, characterized in that, Suitable for detecting a test image containing multiple pixels, the defect image detection method includes: Obtain an image center of the image to be tested; The image to be tested is divided into multiple concentric geometric regions, and the center of each concentric geometric region is the center of the image. Calculate the color ratio value of each pixel and normalize it to obtain a normalized color ratio value. as well as If the normalized color ratio value of any pixel is greater than a color ratio threshold, then mark that pixel.

2. The defect image detection method as described in claim 1, characterized in that, Each pixel contains at least two colors of information, and the step of calculating the image center of the image to be tested further includes: Calculate the representative value of a pixel based on the two color information of each pixel; as well as The centroid of the image under test is calculated based on the representative value of each pixel, and the centroid is used as the center of the image.

3. The defect image detection method as described in claim 2, characterized in that, It also includes calculating the representative value of the pixel according to the following formula: PV = W * C. -C Where PV is the representative value of the pixel, W is the weight value, and C... C This color information, C, represents one of the color shift types in the central region of the image under test. s This is another piece of color information regarding the color shift type in the surrounding area of ​​the image under test.

4. The defect image detection method as described in claim 2, characterized in that, The outer contour of each of the concentric geometric regions is circular. The step of dividing the image to be measured into the multiple concentric geometric regions further includes: Using the centroid as the center, the image to be measured is divided into a circular region with radius r and multiple annular regions with outer diameter N*r, where N is a positive integer.

5. The defect image detection method as described in claim 1, characterized in that, Each pixel contains at least two types of color information, and the step of calculating the color ratio value of each pixel further includes: Calculate the color ratio value using the following formula: Where RC is the color ratio value, C D This color information is one of the types of defective color deviation. O This is another piece of color information.

6. The defect image detection method as described in claim 5, characterized in that, The formalization process also includes: The average of the color ratio values ​​of the pixels contained in each concentric geometric region is used to calculate the color ratio value of a region in each concentric geometric region. as well as The normalized color ratio value of each pixel is obtained by dividing the color ratio value of the concentric geometric region to which each pixel belongs.

7. The defect image detection method as described in claim 1, characterized in that, It also includes multiple color ratio thresholds, with each concentric geometric region corresponding to one color ratio threshold; The step of determining that the normalized color ratio value of any pixel is greater than the color ratio threshold further includes: comparing the normalized color ratio value of each pixel with the color ratio threshold of the concentric geometric region to which each pixel belongs.

8. The defect image detection method as described in claim 7, characterized in that, As the distance between each concentric geometric region and the center of the image increases, the value of the color ratio threshold corresponding to each concentric geometric region decreases.

9. The defect image detection method as described in claim 1, characterized in that, After marking any pixel, the process also includes: Based on any one of the marked pixels, multiple defective pixels are defined; The multiple defective pixels are labeled according to the connected components to obtain at least one set of defective pixels; and it is determined that the area occupied by the at least one set of defective pixels in the image under test is greater than an area threshold, and a detection failure signal is generated.

10. A defect image detection device, characterized in that, Suitable for detecting a lens under test, the lens under test being used to generate a test image, the defect image detection device includes a processor for performing the defect image detection method as described in any one of claims 1 to 9.