Screen defect detection method, device, equipment and computer readable storage medium
By using Gaussian filtering and binarization, the system can automatically detect display screen defects, solving the problem of high false negative rates in manual inspection and achieving efficient screen defect detection.
Patent Information
- Application Number
- CN202210985565.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-17
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2042-08-17
AI Technical Summary
The existing technology of manually inspecting display screens has a high probability of missing detections, which increases the risk of defective products entering the market.
A Gaussian filter is used to filter the image to be detected, generating a target Gaussian filter. Combined with binarization processing, screen defects are detected automatically.
It reduced the difficulty of testing, improved testing efficiency, reduced the false negative rate, and protected the eye health of testing personnel.
Smart Images

Figure CN115249244B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of screen inspection technology, and in particular to a method, apparatus, device, and computer-readable storage medium for detecting screen defects. Background Technology
[0002] The rapid development of mobile technology devices, such as smartphones, VR (Virtual Reality) glasses, and tablets, all rely heavily on displays. In mass production of displays, defect detection is an essential step. Currently, most domestic manufacturers still rely on manual inspection, which places high demands on the operators' eyesight. Furthermore, prolonged defect inspection can lead to fatigue and missed detections, increasing the likelihood of defective products entering the market. Therefore, the current method of manually inspecting displays suffers from a high rate of missed detections.
[0003] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention
[0004] The main objective of this invention is to provide a method, apparatus, device, and readable storage medium for detecting screen defects, aiming to solve the technical problem that current methods for manually inspecting display screens have a high rate of missed detections.
[0005] To achieve the above objectives, the present invention provides a method for detecting screen defects, the method comprising the following steps:
[0006] A target Gaussian filter is generated based on a first preset Gaussian filter parameter and a second preset Gaussian filter parameter, wherein the first preset Gaussian filter parameter is different from the second preset Gaussian filter parameter.
[0007] The first processed image is obtained by filtering the image to be detected based on the target Gaussian filter, wherein the image to be detected is generated based on the screen to be detected;
[0008] The first processed image is binarized to obtain a second processed image, and the defect detection of the screen to be detected is performed based on the second processed image.
[0009] Furthermore, the step of generating the target Gaussian filter based on the first preset Gaussian filter parameters and the second preset Gaussian filter parameters includes:
[0010] A first filter template length is generated based on a first preset Gaussian filter parameter, and a second filter template length is generated based on a second preset Gaussian filter parameter.
[0011] A first Gaussian filter is generated based on the first preset Gaussian filter parameters and the first filter template length, and a second Gaussian filter is generated based on the second preset Gaussian filter parameters and the second filter template length.
[0012] A target Gaussian filter is generated based on the first Gaussian filter and the second Gaussian filter.
[0013] Furthermore, the steps of generating a first Gaussian filter based on the first preset Gaussian filter parameters and the first filter template length, and generating a second Gaussian filter based on the second preset Gaussian filter parameters and the second filter template length, include:
[0014] A first filter template is generated based on the length of the first filter template. First template coefficients corresponding to each position in the first filter template are determined based on the first preset Gaussian filter parameters. The first Gaussian filter is obtained based on the first filter template and the first template coefficients.
[0015] A second filter template is generated based on the length of the second filter template. The second template coefficients corresponding to each position in the second filter template are determined based on the second preset Gaussian filter parameters. The second Gaussian filter is obtained based on the second filter template and the second template coefficients.
[0016] Furthermore, the second preset Gaussian filter parameter is greater than the first preset Gaussian filter parameter, and the step of generating the target Gaussian filter based on the first Gaussian filter and the second Gaussian filter includes:
[0017] The first filter template is filled in according to the length of the second filter template to generate a new first filter template, so that the length of the new first filter template is equal to the length of the second filter template. The coefficients corresponding to the filling positions in the new first filter template are all zero, thus obtaining the new first template coefficients.
[0018] Based on the second filter template or the new first filter template, the second template coefficients and the new first template coefficients are subtracted according to their positional correspondence to generate the target Gaussian filter.
[0019] Furthermore, the step of filtering the image to be detected based on the target Gaussian filter to obtain the first processed image includes:
[0020] The target Gaussian filter is used to filter the image to be detected in the horizontal direction to obtain a horizontally processed image; the target Gaussian filter is used to filter the horizontally processed image in the vertical direction to obtain the first processed image;
[0021] Alternatively, the target Gaussian filter can be used to filter the image to be detected in the vertical direction to obtain a vertically processed image; the target Gaussian filter can be used to filter the vertically processed image in the horizontal direction to obtain the first processed image.
[0022] Furthermore, the step of filtering the image to be detected based on the target Gaussian filter to obtain the first processed image also includes:
[0023] The image to be detected is filtered based on a preset convolution table and the target Gaussian filter to obtain a first processed image, wherein the preset convolution table consists of the product of each pixel value and a preset filtering coefficient.
[0024] Furthermore, before the step of filtering the image to be detected based on the preset convolution table and the target Gaussian filter to obtain the first processed image, the method further includes:
[0025] The set of coefficients of the preset filtering coefficients is obtained based on the target Gaussian filter;
[0026] The filtered value is obtained by multiplying each of the filtering coefficients in the coefficient set by each pixel value;
[0027] The preset convolution table is generated based on the filter coefficients, the pixel values, and the product relationship between the filter values.
[0028] Furthermore, to achieve the above objectives, the present invention also provides a screen defect detection device, the screen defect detection device comprising:
[0029] The generation module is used to generate a target Gaussian filter based on a first preset Gaussian filter parameter and a second preset Gaussian filter parameter, wherein the first preset Gaussian filter parameter and the second preset Gaussian filter parameter are different.
[0030] A filtering module is used to filter the image to be detected based on the target Gaussian filter to obtain a first processed image, wherein the image to be detected is generated based on the screen to be detected;
[0031] The detection module is used to binarize the first processed image to obtain a second processed image, and to perform defect detection on the screen to be detected based on the second processed image.
[0032] In addition, to achieve the above objectives, the present invention also provides a screen defect detection device, the screen defect detection device comprising: a memory, a processor, and a screen defect detection program stored in the memory and executable on the processor, wherein when the screen defect detection program is executed by the processor, it implements the steps of the screen defect detection method described above.
[0033] In addition, to achieve the above objectives, the present invention also provides a computer-readable storage medium storing a screen defect detection program, which, when executed by a processor, implements the steps of the screen defect detection method described above.
[0034] This invention proposes a method, apparatus, device, and computer-readable storage medium for detecting screen defects. The method generates a target Gaussian filter based on first and second preset Gaussian filtering parameters, wherein the first and second preset Gaussian filtering parameters are different. A first processed image is obtained by filtering an image to be detected based on the target Gaussian filter, wherein the image to be detected is generated based on the screen to be detected. The first processed image is then binarized to obtain a second processed image, and defect detection of the screen to be detected is performed based on the second processed image. In this embodiment, a filter is generated using two pre-set Gaussian filtering parameters. The screen image is then filtered using the Gaussian filter, and binarization is performed on the filtered image to highlight screen defects in the image to be detected, reducing the difficulty of detection and enabling automated screen defect detection. Furthermore, in this embodiment, only one filter is needed to filter the image to be detected, accelerating the overall screen defect detection speed. Attached Figure Description
[0035] Figure 1 This is a schematic diagram of the device structure of the hardware operating environment involved in the embodiments of the present invention;
[0036] Figure 2 This is a flowchart illustrating the first embodiment of the screen defect detection method of the present invention;
[0037] Figure 3 This is a flowchart illustrating the second embodiment of the screen defect detection method of the present invention;
[0038] Figure 4 This is a schematic diagram of the portion of the image to be detected in the screen defect detection method of the present invention;
[0039] Figure 5 This is a schematic diagram of the image to be detected in the screen defect detection method of the present invention;
[0040] Figure 6 This is a schematic diagram of the first processed image in the screen defect detection method of the present invention;
[0041] Figure 7 This is a schematic diagram of the second processed image in the screen defect detection method of the present invention;
[0042] Figure 8This is a schematic diagram of the device structure involved in the screen defect detection method of the present invention.
[0043] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0044] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0045] like Figure 1 As shown, Figure 1 This is a schematic diagram of the device structure of the hardware operating environment involved in the embodiments of the present invention.
[0046] The device in this invention embodiment can be an automated screen detection device, or an electronic terminal device with data receiving, data processing and data output functions such as a PC, smartphone, tablet computer, or portable computer.
[0047] like Figure 1 As shown, the device may include: a processor 1001, such as a CPU; a network interface 1004; a user interface 1003; a memory 1005; and a communication bus 1002. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as a disk drive. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0048] Optionally, the device may also include a camera, RF (Radio Frequency) circuitry, sensors, audio circuitry, a WiFi module, and so on. Sensors may include light sensors, motion sensors, and other sensors. Specifically, light sensors may include ambient light sensors and proximity sensors. The ambient light sensor can adjust the display brightness according to the ambient light level, while the proximity sensor can turn off the display and / or backlight when the mobile terminal is moved to the ear. As a type of motion sensor, a gravity accelerometer can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity, and can be used for applications that identify the mobile terminal's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition functions (such as pedometers, taps), etc. Of course, mobile devices may also be equipped with other sensors such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, which will not be elaborated here.
[0049] Those skilled in the art will understand that Figure 1 The device structure shown does not constitute a limitation on the device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0050] like Figure 1 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a screen defect detection program.
[0051] exist Figure 1 In the terminal shown, network interface 1004 is mainly used to connect to the backend server and communicate data with it; user interface 1003 is mainly used to connect to the client (user terminal) and communicate data with it; while processor 1001 can be used to call the screen defect detection program stored in memory 1005 and perform the following operations:
[0052] A target Gaussian filter is generated based on a first preset Gaussian filter parameter and a second preset Gaussian filter parameter, wherein the first preset Gaussian filter parameter is different from the second preset Gaussian filter parameter.
[0053] The first processed image is obtained by filtering the image to be detected based on the target Gaussian filter, wherein the image to be detected is generated based on the screen to be detected;
[0054] The first processed image is binarized to obtain a second processed image, and the defect detection of the screen to be detected is performed based on the second processed image.
[0055] Furthermore, the processor 1001 can call the screen defect detection program stored in the memory 1005 and also perform the following operations:
[0056] The step of generating the target Gaussian filter based on the first preset Gaussian filter parameters and the second preset Gaussian filter parameters includes:
[0057] A first filter template length is generated based on a first preset Gaussian filter parameter, and a second filter template length is generated based on a second preset Gaussian filter parameter.
[0058] A first Gaussian filter is generated based on the first preset Gaussian filter parameters and the first filter template length, and a second Gaussian filter is generated based on the second preset Gaussian filter parameters and the second filter template length.
[0059] A target Gaussian filter is generated based on the first Gaussian filter and the second Gaussian filter.
[0060] Furthermore, the processor 1001 can call the screen defect detection program stored in the memory 1005 and also perform the following operations:
[0061] The steps of generating a first Gaussian filter based on the first preset Gaussian filter parameters and the first filter template length, and generating a second Gaussian filter based on the second preset Gaussian filter parameters and the second filter template length, include:
[0062] A first filter template is generated based on the length of the first filter template. First template coefficients corresponding to each position in the first filter template are determined based on the first preset Gaussian filter parameters. The first Gaussian filter is obtained based on the first filter template and the first template coefficients.
[0063] A second filter template is generated based on the length of the second filter template. The second template coefficients corresponding to each position in the second filter template are determined based on the second preset Gaussian filter parameters. The second Gaussian filter is obtained based on the second filter template and the second template coefficients.
[0064] Furthermore, the processor 1001 can call the screen defect detection program stored in the memory 1005 and also perform the following operations:
[0065] The second preset Gaussian filter parameter is greater than the first preset Gaussian filter parameter, and the step of generating a target Gaussian filter based on the first Gaussian filter and the second Gaussian filter includes:
[0066] The first filter template is filled in according to the length of the second filter template to generate a new first filter template, so that the length of the new first filter template is equal to the length of the second filter template. The coefficients corresponding to the filling positions in the new first filter template are all zero, thus obtaining the new first template coefficients.
[0067] Based on the second filter template or the new first filter template, the second template coefficients and the new first template coefficients are subtracted according to their positional correspondence to generate the target Gaussian filter.
[0068] Furthermore, the processor 1001 can call the screen defect detection program stored in the memory 1005 and also perform the following operations:
[0069] The step of filtering the image to be detected based on the target Gaussian filter to obtain the first processed image includes:
[0070] The target Gaussian filter is used to filter the image to be detected in the horizontal direction to obtain a horizontally processed image; the target Gaussian filter is used to filter the horizontally processed image in the vertical direction to obtain the first processed image;
[0071] Alternatively, the target Gaussian filter can be used to filter the image to be detected in the vertical direction to obtain a vertically processed image; the target Gaussian filter can be used to filter the vertically processed image in the horizontal direction to obtain the first processed image.
[0072] Furthermore, the processor 1001 can call the screen defect detection program stored in the memory 1005 and also perform the following operations:
[0073] The step of filtering the image to be detected based on the target Gaussian filter to obtain the first processed image further includes:
[0074] The image to be detected is filtered based on a preset convolution table and the target Gaussian filter to obtain a first processed image, wherein the preset convolution table consists of the product of each pixel value and a preset filtering coefficient.
[0075] Furthermore, the processor 1001 can call the screen defect detection program stored in the memory 1005 and also perform the following operations:
[0076] Before the step of filtering the image to be detected based on the preset convolution table and the target Gaussian filter to obtain the first processed image, the method further includes:
[0077] The set of coefficients of the preset filtering coefficients is obtained based on the target Gaussian filter;
[0078] The filtered value is obtained by multiplying each of the filtering coefficients in the coefficient set by each pixel value;
[0079] The preset convolution table is generated based on the filter coefficients, the pixel values, and the product relationship between the filter values.
[0080] Reference Figure 2 The first embodiment of the screen defect detection method of the present invention includes:
[0081] Step S10: Generate a target Gaussian filter based on the first preset Gaussian filter parameters and the second preset Gaussian filter parameters, wherein the first preset Gaussian filter parameters are different from the second preset Gaussian filter parameters;
[0082] In this embodiment, the first and second preset Gaussian filter parameters are the parameter σ in the Gaussian filter formula. The specific one-dimensional Gaussian filter formula is as follows:
[0083]
[0084] In the formula, σ and δ are constants, and x is a position variable. It can be understood that by setting different σ values, different filters can be obtained (different Gaussian filter formulas correspond to different Gaussian filters). Furthermore, the larger the value of σ, the smoother the filtered image. It should be noted that the first preset Gaussian filter parameter σ1 and the second preset Gaussian filter parameter σ2 mentioned above are different, and all subsequent Gaussian filters are one-dimensional Gaussian filters.
[0085] Furthermore, a first filter template length is generated based on a first preset Gaussian filter parameter, and a second filter template length is generated based on a second preset Gaussian filter parameter; a first Gaussian filter is generated based on the first preset Gaussian filter parameter and the first filter template length, and a second Gaussian filter is generated based on the second preset Gaussian filter parameter and the second filter template length; a target Gaussian filter is generated based on the first Gaussian filter and the second Gaussian filter.
[0086] Specifically, the first preset Gaussian filter parameter σ1 and the second preset Gaussian filter parameter σ2 will be used to generate the first filter template length and the second filter template length, respectively. The template length calculation formula is: Template length = 2 × ceil(σ - 0.5) + 1, where ceil represents the smallest integer greater than or equal to the specified expression. Substituting σ1 and σ2 into the above template length calculation formula, we obtain the first filter template length and the second filter template length. It can be understood that the numbers obtained by the above template length calculation formula are all odd and positive numbers, such as 3, 5, 7, ..., 2n+1.
[0087] Furthermore, a first filter template is generated based on the length of the first filter template, and first template coefficients corresponding to each position in the first filter template are determined based on the first preset Gaussian filter parameters. The first Gaussian filter is obtained based on the first filter template and the first template coefficients. A second filter template is generated based on the length of the second filter template, and second template coefficients corresponding to each position in the second filter template are determined based on the second preset Gaussian filter parameters. The second Gaussian filter is obtained based on the second filter template and the second template coefficients.
[0088] Specifically, after generating the first filter template length (e.g., the first filter length is 5), the first filter template is a 1×5 or 5×1 matrix. For example, [x1, x2, x3, x4, x5] or [x1, x2, x3, x4, x5]. T Furthermore, if the Gaussian filter formula with the first preset Gaussian filter parameter σ1 is G1(x), the filter coefficients a1, a2, a3, a4, and a5, i.e., the first template coefficients, are obtained by substituting each position (e.g., x1, x2, ..., x5) in a filter template into G1(x). These first template coefficients are then placed into their corresponding positions within the first filter template to obtain the first Gaussian filter, such as [a1, a2, a3, a4, a5]. It is understood that the generation method for the second Gaussian filter is similar to that of the first Gaussian filter. The corresponding parameter for the second Gaussian filter is σ2. The specific process can be referred to that of the first Gaussian filter, and will not be repeated here. The second Gaussian filter can be [b1, b2, b3, b4, b5, b6, b7], with a corresponding second filter template length of 7.
[0089] Furthermore, during the generation of the first or second Gaussian filter, the filter coefficients can be obtained from G(x), that is, by substituting the position x into the function G(x) and using the function value of G(x) as the filter coefficient for position x. To ensure the accuracy of the filter coefficients, multiple data acquisitions are performed at each position, and the average of the filter coefficients for each position's dataset is calculated. The formula for calculating the average of the filter coefficients is as follows:
[0090]
[0091] In the formula, σ and δ are constants, x is the location variable, and D is the number of data collections. Similarly, technicians can set σ according to their needs, such as σ1 and σ2 mentioned above.
[0092] The filter coefficients calculated in the filter template using the above method are normalized. The specific normalization formula is as follows:
[0093]
[0094] In the formula, g(x) is the formula for averaging the filter coefficient set, n is the number of positions in the filter template (or the length of the filter template), x is the position variable, and y takes the values x1, x2, ..., xn. Therefore, G 归 In (x), the denominator represents the sum of the filter coefficients at each position in the filter. It is understandable that when generating the first or second Gaussian filter, each filter coefficient can be calculated in the manner described above, and the filter coefficients may or may not be normalized.
[0095] Furthermore, the second preset Gaussian filter parameter is greater than the first preset Gaussian filter parameter. The first filter template is filled according to the length of the second filter template to generate a new first filter template, so that the length of the new first filter template is equal to the length of the second filter template. The coefficients corresponding to the filled positions in the new first filter template are all zero, resulting in new first template coefficients. Based on the second filter template or the new first filter template, the difference between the second template coefficients and the new first template coefficients is calculated according to the position correspondence to generate the target Gaussian filter.
[0096] Specifically, σ2 can be chosen to be greater than σ1. Based on the example above, the length of the first filter template is calculated to be 5, and the length of the second wave template is 7. The first filter template is then symmetrically filled with positions based on the length of the second wave template (7). For example, if the original first filter template is [x1, x2, x3, x4, x5], which differs from the second wave template length of 7 by two positions, then positions are symmetrically added to the original first filter template to obtain a new first filter template [x11, x1, x2, x3, x4, x5, x51], where x11 and x51 are the positions added to the original first filter template. At this point, the template length of the new first filter template is 7, the same as the length of the second wave template. Furthermore, the filter coefficients corresponding to positions x11 and x51 are both 0. Therefore, the new first filter coefficients are: 0, a1, a2, a3, a4, a5, 0. Since the length of the second wave template is the same as the length of the new first filter template, the target Gaussian filter can arbitrarily choose any filter template. If the second template coefficients are b1, b2, b3, b4, b5, b6, b7, the difference between the second template coefficients and the new first template coefficients is calculated according to their positional correspondence, such as b1-0, b2-a1, b3-a2, b4-a3, b5-a4, b6-a5, b7-0. Therefore, the target Gaussian filter is [b1, b2-a1, b3-a2, b4-a3, b5-a4, b6-a5, b7]. Furthermore, it should be noted that σ2 and σ1 can be selected based on the size of the screen defect. In this embodiment, if σ2 is greater than σ1, the length of the first filter template generated based on the selected σ1 must be equal to or less than the size of the screen defect. For example, if the smallest screen defect size is represented by a 5×5 matrix, the length of the first filter template generated based on σ1 is 5 or 3. The length of the second filter template generated based on the selected σ2 must be greater than the size of the screen defect. If the size of the smallest screen defect is represented by a 5×5 matrix, then the length of the first filter template generated based on σ1 is 7 or 9, etc. Therefore, the selection of σ2 and σ1 can be made by technicians based on the size of screen defects in daily production.
[0097] Step S20: Filter the image to be detected based on the target Gaussian filter to obtain a first processed image, wherein the image to be detected is generated based on the screen to be detected;
[0098] Furthermore, a horizontally processed image is obtained by filtering the image to be detected in the horizontal direction using the target Gaussian filter; the first processed image is obtained by filtering the horizontally processed image in the vertical direction using the target Gaussian filter; or, a vertically processed image is obtained by filtering the image to be detected in the vertical direction using the target Gaussian filter; the first processed image is obtained by filtering the vertically processed image in the horizontal direction using the target Gaussian filter.
[0099] Specifically, the first step is to obtain an image of the screen to be tested displaying a preset screen. This can be achieved by taking a picture of the screen, such as... Figure 5 The image to be inspected is shown in the diagram, with the defect locations marked. Filtering the image using a target Gaussian filter can be done in two steps: filtering horizontally and filtering vertically. The order of these steps is not critical. We will illustrate this by performing horizontal filtering first, followed by vertical filtering. Applying Gaussian filtering to an image essentially recalculates the pixel values of each pixel. Typically, pixel values range from 0 to 225. (Refer to...) Figure 4 This is a schematic diagram of a portion of the image to be detected, where each square represents a pixel. If filtering is applied to the pixel at position (i, j), based on the example above, the target Gaussian filter is [b1, b2-a1, b3-a2, b4-a3, b5-a4, b6-a5, b7], and the pixel value of each pixel in the diagram is represented by n(i, j), such as n(i, j) being the pixel value of the pixel at position (i, j). Ig(i, j) represents the pixel value after horizontal filtering, such as Ig(i, j) being the pixel value of the pixel at position (i, j) after horizontal filtering. Specifically, since the target Gaussian filter has a length of 7, the intermediate filtering coefficients (b4-a3) of the target Gaussian filter are aligned with (i, j), and multiplied and summed sequentially in the horizontal direction, i.e., Ig(i, j) = b1×n(i-3, j) + (b2-a1)×n(i-2, j) + (b3-a2)×n(i-1, j) + (b4-a3)×n(i, j) + (b5-a4)×n(i+1, j) + (b6-a5)×n(i+2, j) + b7×n(i+3, j). The pixel values of each pixel are processed sequentially in the horizontal direction using the above method. Then, based on the horizontal filtering, filtering is performed in the vertical direction. If Im(i, j) represents the pixel value after vertical filtering, for example, Im(i, j) is the pixel value of the pixel at position (i, j) after vertical filtering. Taking the pixel at position (i, j) as an example, Im(i, j) = b1×Ig(i, j-3) + (b2-a1)×Ig(i, j-2) + (b3-a2)×Ig(i, j-1) + (b4-a3)×Ig(i, j) + (b5-a4)×Ig(i, j+1) + (b6-a5)×Ig(i, j+2) + b7×Ig(i, j+3). By applying this method to each pixel in the horizontally filtered image, the first processed image is obtained by filtering it vertically. Figure 6The diagram shows a schematic of the first processed image. It can be understood that in this embodiment, two Gaussian filters are generated using two preset σ values, and the filter template lengths of the two Gaussian filters are different. That is, the longer the template length, the higher the smoothness of the filtering (the larger the σ value, the smoother the filtered image). It can be understood that when filtering is performed on pixels at defect-free locations, since the pixel values of the pixels surrounding the defect-free pixels are basically the same, even after filtering, the pixel values of the pixels at defect-free locations will not change significantly. However, for pixels at defective locations, the pixel values of the pixels surrounding them are usually significantly different. Therefore, after filtering pixels at defective locations, the pixel values will change before and after processing. Furthermore, the degree of change varies depending on the Gaussian filter used. Thus, different Gaussian filters can be used to filter the image to be inspected. For pixels at defect-free locations, the difference between the two filtered pixel values is small or zero; for pixels at defective locations, the difference is large. The location of the pixel with the larger difference is taken as the defect point, thereby highlighting the defect. In this embodiment, the target Gaussian filter is obtained by subtracting two Gaussian filters. Therefore, only the target filter is needed to filter the image to be inspected to highlight the defect. Compared to using two Gaussian filters twice, this embodiment uses one Gaussian filter once, saving at least 200ms of processing time for a 100 million resolution image.
[0100] Step S30: Binarize the first processed image to obtain a second processed image, and perform defect detection on the screen to be detected based on the second processed image.
[0101] Specifically, the step of binarizing the first processed image to obtain the second processed image includes: obtaining the pixel value of each pixel in the first processed image; if the pixel value is greater than or equal to a preset threshold, then changing the pixel value to 225; if the pixel value is less than the preset threshold, then changing the pixel value to 0. Therefore, after binarization, the pixel value of each pixel in the first processed image is either 225 or 0, which can be referred to... Figure 7 This is a schematic diagram of the second processed image. For example... Figure 7As shown, the final processed image clearly reveals the defects. This embodiment highlights the screen defects in the image, making defect detection on the screen easier. It is understood that image recognition technology can be used to complete the detection based on the second processed image, and relatively mature image recognition technologies exist, which will not be elaborated upon here. It is also understood that manual screen inspection places high demands on the operator's eyesight, and prolonged defect inspection can cause significant damage to the operator's eyes, such as decreased vision. However, after the above processing, automatic identification can be easily achieved through image recognition technology, thus avoiding harm to the inspection personnel.
[0102] In this embodiment, a target Gaussian filter is generated based on a first preset Gaussian filter parameter and a second preset Gaussian filter parameter, wherein the first preset Gaussian filter parameter and the second preset Gaussian filter parameter are different. A first processed image is obtained by filtering the image to be detected based on the target Gaussian filter, wherein the image to be detected is generated based on the screen to be detected. A second processed image is obtained by binarizing the first processed image, and defect detection of the screen to be detected is performed based on the second processed image. That is, in this embodiment, a filter is generated using two preset Gaussian filter parameters, the screen image is filtered using the Gaussian filter, and then binarization is performed on the basis of the filtering process to highlight the defects on the screen in the image to be detected, reducing the difficulty of detection and enabling automation of screen defect detection, avoiding harm to inspection personnel. Furthermore, in this embodiment, only one filter is needed to filter the image to be detected, accelerating the overall speed of screen defect detection.
[0103] Furthermore, refer to Figure 3 Based on the first embodiment of the screen defect detection method of the present invention, a second embodiment of the screen defect detection method of the present invention is proposed.
[0104] Step S20 includes:
[0105] Step S201: Obtain the set of coefficients of the preset filter coefficients according to the target Gaussian filter;
[0106] Step S202: Multiply each of the filtering coefficients in the coefficient set by each pixel value to obtain the filtered value;
[0107] Step S203: Generate the preset convolution table based on the filter coefficients, the pixel values, and the product relationship between the filter values;
[0108] Step S204: Filter the image to be detected based on the preset convolution table and the target Gaussian filter to obtain the first processed image.
[0109] The preset convolution table consists of the product of each pixel value and a preset filtering coefficient.
[0110] Specifically, the filter coefficients of the filter template (or filter kernel, or convolution kernel) in the target Gaussian filter are obtained. For example, in the first embodiment, the set of filter coefficients of the target filter is: b1, b2-a1, b3-a2, b4-a3, b5-a4, b6-a5, b7. The pixel values are known to range from 0 to 225. Each filter coefficient in the set is multiplied by a pixel value from 0 to 225, such as b1×0, b1×1, b12×2, ..., b1×225, (b2-a1)×0, (b2-a1)×1, ..., (b2-a1)×225, etc., where b1×0, b1×1, b12×2, etc., are the filter values. Based on the product relationship, the filter coefficients, pixel values, and filter values are stored to obtain a preset convolution table. When the target Gaussian filter filters the image to be detected to obtain the first processed image, the above-mentioned preset convolution table can be used for calculation. For example, in the first embodiment, the calculation process of the pixel value after filtering a pixel point is changed to: Ig(i,j)=b1×n(i-3,j)+(b2-a1)×n(i-2,j)+(b3-a2)×n(i-1,j)+(b4-a3)×n(i,j)+(b5-a4)×n(i+1,j)+(b6-a5)×n(i+2,j)+b7×n(i+3,j). Taking b1×n(i-3,j) as an example, n(i-3,j) takes the value from 0 to 225. Then the product value of b1×n(i-3,j) can actually be obtained by looking up the above-mentioned preset convolution table. Therefore, when filtering the image to be detected using the target Gaussian filter, the product value during the calculation process can be obtained by querying a preset convolution table. Thus, only a summation operation is required during filtering, thereby further accelerating the filtering speed of the target filter on the image to be detected. Furthermore, the specific filtering process of the aforementioned Gaussian filter can be referred to in the first embodiment, and will not be repeated here.
[0111] In addition, refer to Figure 8 This invention also proposes a screen defect detection device 1000, which includes:
[0112] The generation module 100 is used to generate a target Gaussian filter based on a first preset Gaussian filter parameter and a second preset Gaussian filter parameter, wherein the first preset Gaussian filter parameter and the second preset Gaussian filter parameter are different.
[0113] The filtering module 200 is used to filter the image to be detected based on the target Gaussian filter to obtain a first processed image, wherein the image to be detected is generated based on the screen to be detected;
[0114] The detection module 300 is used to perform binarization processing on the first processed image to obtain a second processed image, and to perform defect detection on the screen to be detected based on the second processed image.
[0115] Optionally, the generation module 100 is further configured to:
[0116] A first filter template length is generated based on a first preset Gaussian filter parameter, and a second filter template length is generated based on a second preset Gaussian filter parameter.
[0117] A first Gaussian filter is generated based on the first preset Gaussian filter parameters and the first filter template length, and a second Gaussian filter is generated based on the second preset Gaussian filter parameters and the second filter template length.
[0118] A target Gaussian filter is generated based on the first Gaussian filter and the second Gaussian filter.
[0119] Optionally, the generation module 100 is further configured to:
[0120] A first filter template is generated based on the length of the first filter template. First template coefficients corresponding to each position in the first filter template are determined based on the first preset Gaussian filter parameters. The first Gaussian filter is obtained based on the first filter template and the first template coefficients.
[0121] A second filter template is generated based on the length of the second filter template. The second template coefficients corresponding to each position in the second filter template are determined based on the second preset Gaussian filter parameters. The second Gaussian filter is obtained based on the second filter template and the second template coefficients.
[0122] Optionally, the second preset Gaussian filter parameter is greater than the first preset Gaussian filter parameter, and the generation module 100 is further configured to:
[0123] The first filter template is filled in according to the length of the second filter template to generate a new first filter template, so that the length of the new first filter template is equal to the length of the second filter template. The coefficients corresponding to the filling positions in the new first filter template are all zero, thus obtaining the new first template coefficients.
[0124] Based on the second filter template or the new first filter template, the second template coefficients and the new first template coefficients are subtracted according to their positional correspondence to generate the target Gaussian filter.
[0125] Optionally, the filtering module 200 is further configured to:
[0126] The target Gaussian filter is used to filter the image to be detected in the horizontal direction to obtain a horizontally processed image; the target Gaussian filter is used to filter the horizontally processed image in the vertical direction to obtain the first processed image;
[0127] Alternatively, the target Gaussian filter can be used to filter the image to be detected in the vertical direction to obtain a vertically processed image; the target Gaussian filter can be used to filter the vertically processed image in the horizontal direction to obtain the first processed image.
[0128] Optionally, the filtering module 200 is further configured to:
[0129] The image to be detected is filtered based on a preset convolution table and the target Gaussian filter to obtain a first processed image, wherein the preset convolution table consists of the product of each pixel value and a preset filtering coefficient.
[0130] Optionally, the filtering module 200 is further configured to:
[0131] The set of coefficients of the preset filtering coefficients is obtained based on the target Gaussian filter;
[0132] The filtered value is obtained by multiplying each of the filtering coefficients in the coefficient set by each pixel value;
[0133] The preset convolution table is generated based on the filter coefficients, the pixel values, and the product relationship between the filter values.
[0134] The screen defect detection device provided by this invention employs the screen defect detection method described in the above embodiments, solving the technical problem of high false negative rates in current manual display screen inspection methods. Compared with the prior art, the beneficial effects of the screen defect detection device provided by this invention are the same as those of the screen defect detection method described in the above embodiments, and other technical features of this screen defect detection device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0135] Furthermore, this embodiment of the invention also proposes a screen defect detection device, which includes: a memory, a processor, and a screen defect detection program stored in the memory and executable on the processor. When the screen defect detection program is executed by the processor, it implements the steps of the screen defect detection method described above.
[0136] The specific implementation of the screen defect detection device of the present invention is basically the same as the embodiments of the new screen defect detection method described above, and will not be repeated here.
[0137] Furthermore, embodiments of the present invention also propose a computer-readable storage medium storing a screen defect detection program, wherein the screen defect detection program, when executed by a processor, implements the steps of the screen defect detection method described above.
[0138] The specific implementation of the medium of the present invention is basically the same as the embodiments of the new method for detecting screen defects described above, and will not be repeated here.
[0139] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0140] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0141] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, automated screen detection device, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0142] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A method of detecting a screen defect, characterized by, The screen defect detection method comprises the following steps: The method for detecting the screen defect comprises the following steps: The first filter template length is generated based on the first preset Gaussian filter parameter, and the second filter template length is generated based on the second preset Gaussian filter parameter, wherein the first preset Gaussian filter parameter is different from the second preset Gaussian filter parameter; The first Gaussian filter is generated based on the first preset Gaussian filter parameter and the first filter template length, and the second Gaussian filter is generated based on the second preset Gaussian filter parameter and the second filter template length; The target Gaussian filter is generated based on the first Gaussian filter and the second Gaussian filter, wherein the target Gaussian filter is obtained by subtracting the first Gaussian filter from the second Gaussian filter; The first processing image is obtained by filtering the to-be-detected image based on the target Gaussian filter, wherein the to-be-detected image is generated based on a to-be-detected screen; The second processing image is obtained by performing binarization processing on the first processing image, and the defect detection of the to-be-detected screen is performed based on the second processing image; The step of generating the first Gaussian filter based on the first preset Gaussian filter parameter and the first filter template length and generating the second Gaussian filter based on the second preset Gaussian filter parameter and the second filter template length comprises: The first filter template is generated according to the first filter template length, the first template coefficient corresponding to each position in the first filter template is determined according to the first preset Gaussian filter parameter, and the first Gaussian filter is obtained according to the first filter template and the first template coefficient; The second filter template is generated according to the second filter template length, the second template coefficient corresponding to each position in the second filter template is determined according to the second preset Gaussian filter parameter, and the second Gaussian filter is obtained according to the second filter template and the second template coefficient; The second preset Gaussian filter parameter is greater than the first preset Gaussian filter parameter, and the step of generating the target Gaussian filter based on the first Gaussian filter and the second Gaussian filter comprises: The first filter template is padded to generate a new first filter template according to the second filter template length, so that the length of the new first filter template is equal to the length of the second filter template, wherein the coefficients corresponding to the padded positions in the new first filter template are all zero, and a new first template coefficient is obtained; 2. The method of claim 1, wherein the step of detecting the screen defect is performed by using a screen defect detection program. The target Gaussian filter is generated by subtracting the second template coefficient from the new first template coefficient according to the position correspondence relationship based on the second filter template or the new first filter template. The step of filtering the to-be-detected image based on the target Gaussian filter to obtain the first processing image comprises: The horizontal processing image is obtained by performing filtering processing on the to-be-detected image in the horizontal direction through the target Gaussian filter, and the first processing image is obtained by performing filtering processing on the horizontal processing image in the vertical direction through the target Gaussian filter. Or, a vertical processing image is obtained by filtering the to-be-detected image in a vertical direction through the target Gaussian filter; and the first processing image is obtained by filtering the vertical processing image in a horizontal direction through the target Gaussian filter.
3. The method of claim 1, wherein the step of detecting the screen defect is performed by a method comprising: The step of filtering the to-be-detected image based on the target Gaussian filter to obtain the first processing image further comprises: filtering the to-be-detected image based on a preset convolution table and the target Gaussian filter to obtain the first processing image, wherein the preset convolution table is composed of products between each pixel value and a preset filter coefficient.
4. The method of claim 3, wherein the step of detecting the screen defect is performed by using a screen defect detection program. Before the step of filtering the to-be-detected image based on the preset convolution table and the target Gaussian filter to obtain the first processing image, the method further comprises: obtaining a coefficient set of the preset filter coefficient according to the target Gaussian filter; multiplying each filter coefficient in the coefficient set with each pixel value to obtain a filter value; generating the preset convolution table based on a multiplication relationship between the filter coefficient, the pixel value and the filter value.
5. An apparatus for detecting a screen defect, characterized by comprising: The screen defect detection device comprises: a generation module, configured to generate a first filter template length based on first preset Gaussian filter parameters, generate a second filter template length based on second preset Gaussian filter parameters, generate a first Gaussian filter based on the first preset Gaussian filter parameters and the first filter template length, generate a second Gaussian filter based on the second preset Gaussian filter parameters and the second filter template length, and generate a target Gaussian filter based on the first Gaussian filter and the second Gaussian filter, wherein the target Gaussian filter is obtained by subtracting the first Gaussian filter from the second Gaussian filter; a filtering module, configured to filter a to-be-detected image based on the target Gaussian filter to obtain a first processing image, wherein the to-be-detected image is generated based on a to-be-detected screen; a detection module, configured to perform binaryzation processing on the first processing image to obtain a second processing image, and perform defect detection on the to-be-detected screen based on the second processing image. The generation module is further configured to: generate a first filter template according to the first filter template length, determine first template coefficients corresponding to each position in the first filter template according to the first preset Gaussian filter parameters, and obtain the first Gaussian filter based on the first filter template and the first template coefficients; generate a second filter template according to the second filter template length, determine second template coefficients corresponding to each position in the second filter template according to the second preset Gaussian filter parameters, and obtain the second Gaussian filter based on the second filter template and the second template coefficients; the second preset Gaussian filter parameters are greater than the first preset Gaussian filter parameters, and the generation module is further configured to: The first filter template is padded to generate a new first filter template according to the second filter template length, so that the length of the new first filter template is equal to the length of the second filter template, wherein the coefficients corresponding to the padded positions in the new first filter template are all zeros, and a new first template coefficient is obtained; The second template coefficient and the new first template coefficient are subtracted according to the position correspondence relationship based on the second filter template or the new first filter template, and the target Gaussian filter is generated.
6. An apparatus for detecting a screen defect, characterized by comprising: The screen defect detection device includes a memory, a processor, and a screen defect detection program stored on the memory and executable on the processor. When the screen defect detection program is executed by the processor, the steps of the screen defect detection method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a screen defect detection program. When the screen defect detection program is executed by the processor, the steps of the screen defect detection method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Finger-vein feature extraction method, comparison method, storage medium and processor
CN109543580A
A cloth defect detection method based on Fourier transform and image morphology
CN109934802A
Screen display state detection method and device, terminal equipment and readable storage medium
CN110351549A
Defect detection method and device for LCD screen
CN111815630A