Image bad pixel processing method, apparatus, device, medium and product

By selecting the target and auxiliary pixels in the CMOS image sensor, calculating the brightness deviation, and using a directional filter for image defect detection, the problem of insufficient detection accuracy in existing technologies is solved, and more efficient defect identification and correction are achieved.

CN122093556APending Publication Date: 2026-05-26SHANGHAI INTEGRATED CIRCUIT RESEARCH & DEVELOPMENT CENTER CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411691487.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In existing technologies, the accuracy of image defect detection in CMOS image sensors is relatively low, and the commonly used DPC algorithm detection method is not accurate enough.

Method used

By selecting the target pixel and auxiliary pixels in the image under test, the brightness deviation is calculated, and a directional filter is used for directional filtering to obtain the target directional matrix and brightness deviation. The bad pixels are judged by combining the brightness value and the deviation.

Benefits of technology

It improves the accuracy and reliability of image defect detection, reduces false positives, and enhances image quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122093556A_ABST
    Figure CN122093556A_ABST
Patent Text Reader

Abstract

This application provides an image defect detection method, apparatus, device, medium, and product. The method includes: selecting a pixel to be tested in an image; selecting auxiliary pixels centered on the pixel to be tested; calculating the brightness deviation between the auxiliary pixels and the pixel to be tested based on their brightness values; applying a directional filter to the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixels to obtain a target direction matrix, and obtaining the target brightness deviation based on the target direction matrix; and obtaining a detection result based on the brightness value of the pixel to be tested, the brightness deviation of the pixel to be tested, the brightness value of the auxiliary pixels, and the target brightness deviation. This method can improve the accuracy of image defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic circuits, and more particularly to a method, apparatus, device, medium, and product for processing image dead pixels. Background Technology

[0002] In image acquisition and processing circuits, a CMOS (Complementary Metal Oxide Semiconductor) image sensor is typically used. Its function is to convert light signals into electrical signals and transmit these electrical signals to the processing device.

[0003] CMOS image sensors consist of pixel arrays. Due to process limitations, images acquired by CMOS image sensors usually contain one or more dead pixels. These dead pixels cannot correctly convert light signals into electrical signals, thus affecting the overall image quality.

[0004] To avoid this situation, a common approach is to design a DPC (Defect Pixel Correction) logic circuit. This circuit uses the DPC algorithm to define deviation indicators, and determines whether a pixel is a defective pixel based on whether these indicators exceed a preset threshold. However, this method has relatively low accuracy in detecting defective pixels. Summary of the Invention

[0005] This application provides an image defect processing method, apparatus, device, medium, and product to improve the accuracy of image defect detection.

[0006] In a first aspect, embodiments of this application provide an image defect processing method, comprising: selecting a pixel to be tested in an image to be tested; selecting an auxiliary pixel centered on the pixel to be tested; calculating the brightness deviation between the auxiliary pixel and the pixel to be tested based on the brightness values ​​of the auxiliary pixel and the pixel to be tested; wherein the brightness deviation of a pixel represents the brightness deviation between the pixel and its surrounding pixels; using a directional filter to perform directional filtering on the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixel to obtain a target directional matrix, and obtaining the target brightness deviation based on the target directional matrix; and obtaining a detection result based on the brightness value of the pixel to be tested, the brightness deviation of the pixel to be tested, the brightness value of the auxiliary pixel, and the target brightness deviation.

[0007] In one possible implementation, selecting auxiliary pixels centered on the pixel to be tested includes: if the image to be tested is a black and white image, then selecting a first preset number of pixels adjacent to the pixel to be tested as auxiliary pixels centered on the pixel to be tested; if the image to be tested is a color image, then selecting a first preset number of pixels spaced at a preset number of pixels around the pixel to be tested as auxiliary pixels centered on the pixel to be tested.

[0008] In one possible implementation, a directional filter is used to perform directional filtering on the brightness values ​​corresponding to the pixel to be measured and the auxiliary pixel to obtain a target directional matrix, and the target brightness deviation is obtained based on the target directional matrix. This includes: using a directional filter to filter the brightness values ​​corresponding to the pixel to be measured and the auxiliary pixel to obtain a target directional matrix, and calculating the target brightness deviation based on the target directional matrix.

[0009] In one possible implementation, a directional filter is used to filter the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixels to obtain a target direction matrix. This includes: selecting a second preset number of pixels around the pixel to be tested as the center to form an array; performing image filtering convolution calculations on the array and the array of the directional filter in different directions to obtain the response value in each direction; and obtaining the target direction matrix based on the response value in each direction.

[0010] In one possible implementation, a detection result is obtained based on the brightness value of the pixel to be tested, the brightness deviation of the pixel to be tested, the brightness value of the auxiliary pixel, and the target brightness deviation. This includes: detecting whether the brightness value of the pixel to be tested, the brightness deviation of the pixel to be tested, the brightness value of the auxiliary pixel, and the target brightness deviation meet the judgment conditions; if they meet the conditions, a first value is assigned under the current judgment conditions; if they do not meet the conditions, a second value is assigned under the current judgment conditions; a score is obtained based on the assigned value under each judgment condition; if the score is within a preset range, the pixel to be tested is determined to be a bad pixel; otherwise, the pixel to be tested is determined to be a non-bad pixel.

[0011] In one possible implementation, the judgment conditions include: the difference between the average value of the brightness value of the pixel to be measured and the average value of the brightness values ​​of the auxiliary pixels, excluding the maximum and minimum brightness values, is greater than a first threshold; and / or, the brightness deviation of the pixel to be measured is greater than the product of the maximum absolute value of the target brightness deviation and a second threshold; and / or, the absolute value of the difference between the brightness value of the pixel to be measured and the average value of the brightness values ​​of the auxiliary pixels, excluding the maximum and minimum brightness values, is greater than the product of a third threshold and the absolute value of the difference between the brightness value of the pixel to be measured and a third value.

[0012] In one possible implementation, the method further includes: if the detection result is a bad pixel, then correcting the pixel to be tested.

[0013] In one possible implementation, the pixel to be tested is calibrated by: acquiring the second maximum brightness value and the second minimum brightness value among auxiliary pixels, and calibrating the brightness value of the pixel to be tested to a value close to the second maximum brightness value or the second minimum brightness value; and / or, calculating the average brightness value of two pixels adjacent to the pixel to be tested in the direction of the pixel to be tested, and if the average value is too large, using the second maximum brightness value for calibration, and if the average value is too small, using the second minimum brightness value for calibration.

[0014] Secondly, embodiments of this application provide an image defect processing apparatus, comprising: a selection module for selecting a pixel to be tested in an image to be tested; selecting an auxiliary pixel centered on the pixel to be tested; a calculation module for calculating the brightness deviation between the auxiliary pixel and the pixel to be tested based on the brightness values ​​of the auxiliary pixel and the pixel to be tested; wherein the brightness deviation of a pixel represents the brightness deviation between the pixel and its surrounding pixels; a processing module for using a directional filter to perform directional filtering on the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixel to obtain a target direction matrix, and obtaining a target brightness deviation based on the target direction matrix; and a detection module for obtaining a detection result based on the brightness value of the pixel to be tested, the brightness deviation of the pixel to be tested, the brightness value of the auxiliary pixel, and the target brightness deviation.

[0015] In one possible implementation, the apparatus further includes: a correction module, configured to acquire the second maximum brightness value and the second minimum brightness value in the auxiliary pixels, and correct the brightness value of the pixel to be tested to a close second maximum brightness value or second minimum brightness value; and / or, calculate the average brightness value of two pixels adjacent to the pixel to be tested in the direction of the pixel to be tested, and if the average value is too large, use the second maximum brightness value for correction, and if the average value is too small, use the second minimum brightness value for correction.

[0016] Thirdly, embodiments of this application provide an electronic device, including: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.

[0017] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.

[0018] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.

[0019] The image defect processing method, apparatus, device, medium, and product provided in this application first selects a pixel to be tested in the image to be tested; then, auxiliary pixels are selected with the pixel to be tested as the center; the brightness deviation between the auxiliary pixels and the pixel to be tested is calculated based on the brightness values ​​of the auxiliary pixels and the pixel to be tested; then, a directional filter is used to perform directional filtering on the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixels to obtain a target direction matrix, and the target brightness deviation is obtained based on the target direction matrix; finally, the detection result is obtained based on the brightness value of the pixel to be tested, the brightness deviation of the pixel to be tested, the brightness value of the auxiliary pixels, and the target brightness deviation. The solution of this application, by defining directional filters in various directions, performs directional filtering on the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixels, and performs defect detection based on the target brightness deviation, the brightness value of the pixel to be tested, the brightness deviation, and the brightness value of the auxiliary pixels to obtain the final detection result, thus improving the accuracy of image defect detection. Attached Figure Description

[0020] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0021] Figure 1 The diagram above illustrates a flowchart of the image defect processing method provided in Embodiment 1 of this application.

[0022] Figure 2 This is a schematic diagram illustrating the selection of the target pixel and auxiliary pixels;

[0023] Figure 3 A schematic diagram showing the selection of the target pixel and auxiliary pixels for another example;

[0024] Figure 4 This is a schematic diagram of the eight directions corresponding to the directional filter;

[0025] Figure 5 This is a schematic diagram of eight directional filters corresponding to an example black and white image;

[0026] Figure 6 A schematic diagram of eight directional filters corresponding to an example color image;

[0027] Figure 7 This is a schematic diagram illustrating the array selection for an example of a pixel to be tested.

[0028] Figure 8A flowchart of an image defect processing method provided in Embodiment 2 of this application;

[0029] Figure 9 The diagram above exemplarily illustrates the structure of the image defect processing apparatus provided in Embodiment 3 of this application;

[0030] Figure 10 This is a schematic diagram of the structure of the electronic device provided in Embodiment 4 of this application.

[0031] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0032] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0033] The terms "comprising" and "having" in this application are used to indicate an open-ended inclusion, meaning that additional elements / components / etc. may exist besides the listed elements / components / etc.; the terms "first" and "second," etc., are used only as markings or distinctions and are not intended to limit the order or quantity of the objects. Furthermore, the different elements and areas in the accompanying drawings are only schematic and are therefore not limited to the dimensions or distances shown in the drawings. The technical solutions will be described in detail below with reference to specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0034] A CMOS image sensor is a semiconductor device used to capture images. It converts light signals into electrical signals and is widely used in digital cameras, smartphones, security monitoring, and other fields. With the development of science and technology, the quality of CMOS image sensors has a crucial impact on the quality of displayed images.

[0035] Due to differences in semiconductor manufacturing processes and raw materials, there will always be a certain number of dead pixels in the manufacturing process of CMOS image sensors. The effect is that the pixels are always bright or always dark, or the brightness value deviates significantly from the brightness of the surrounding pixels.

[0036] As an example, in practical applications, some deviation indicators are usually defined to determine whether these indicators exceed preset thresholds to identify bad pixels. Commonly used indicators include brightness deviation, variance deviation, and brightness value sorting position. When using brightness deviation and variance deviation to identify bad pixels, the detection is based on the brightness values ​​of multiple pixels surrounding the pixel to be detected. The brightness values ​​of the pixel to be detected are compared with those of the surrounding pixels, or the mean or standard deviation is compared. If it exceeds a certain threshold, the pixel to be detected is determined to be a bad pixel. When using brightness value sorting position to identify bad pixels, the brightness values ​​of the pixel to be detected are sorted with those of the surrounding pixels. If the pixel is in the first or earlier position, or the last or later position, it is determined to be a bad pixel; otherwise, it is determined to be a non-bad pixel. However, the accuracy of using the above methods for image bad pixel detection is relatively low.

[0037] The technical content provided in this application aims to solve the aforementioned technical problems in related technologies. In the embodiments of this application, firstly, a pixel to be tested is selected in the image to be tested; then, auxiliary pixels are selected centered on the pixel to be tested; based on the brightness values ​​of the auxiliary pixels and the pixel to be tested, the brightness deviation between the auxiliary pixels and the pixel to be tested is calculated; then, a directional filter is used to perform directional filtering on the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixels to obtain a target direction matrix, and the target brightness deviation is obtained based on the target direction matrix; finally, the detection result is obtained based on the brightness value of the pixel to be tested, the brightness deviation of the pixel to be tested, the brightness value of the auxiliary pixels, and the target brightness deviation. The solution of this application, by defining directional filters in various directions, performs directional filtering on the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixels, and performs bad pixel detection based on the target brightness deviation, the brightness value of the pixel to be tested, the brightness deviation, and the brightness value of the auxiliary pixels to obtain the final detection result, thus improving the accuracy of image bad pixel detection.

[0038] Some aspects of this application's examples involve the above considerations. The following examples illustrate the proposed solutions.

[0039] Example 1

[0040] Figure 1 The diagram above illustrates a flowchart of the image defect processing method provided in Embodiment 1 of this application. The executing entity in this embodiment can be an image defect processing device, such as... Figure 1 As shown, the method includes:

[0041] Step 101: Select the pixel to be tested in the image to be tested; select auxiliary pixels centered on the pixel to be tested;

[0042] Step 102: Calculate the brightness deviation between the auxiliary pixel and the pixel to be measured based on the brightness values ​​of the auxiliary pixel and the pixel to be measured; wherein, the brightness deviation of a pixel represents the brightness deviation between the pixel and the surrounding pixels.

[0043] Step 103: Use a directional filter to perform directional filtering on the brightness values ​​corresponding to the pixel to be measured and the auxiliary pixel to obtain the target directional matrix, and obtain the target brightness deviation based on the target directional matrix;

[0044] Step 104: Obtain the detection result based on the brightness value of the pixel to be tested, the brightness deviation of the pixel to be tested, the brightness value of the auxiliary pixel, and the target brightness deviation.

[0045] In practical applications, the execution subject of this method can be an image defect processing device. There are various ways to implement an image defect processing device. For example, it can be implemented through a computer program, such as application software; or it can be implemented as a medium storing relevant computer programs, such as a USB flash drive or cloud drive; or it can be implemented through a physical device that integrates or installs relevant computer programs, such as a chip.

[0046] In this example, the image to be tested is first acquired from the CMOS image sensor. This image consists of multiple pixels arranged in a grid, containing a certain number of both dead and non-dead pixels. After acquiring the image, a window of a preset size is selected as the test area. For example, a 7x7 window can be chosen. The test area must be an odd-numbered window, with the pixel to be tested centered within the window. The method of window selection is not limited. For instance, a 7x7 window can be directly selected; a smaller window, such as a 5x4 window, can be selected (in which case the 5x4 window needs to be padded to a 7x7 window); or a larger window, such as a 9x8 window, can be selected (in which case the 9x8 window needs to be modified to a 7x7 window).

[0047] In one example, in step 101, selecting auxiliary pixels with the pixel to be tested as the center includes: if the image to be tested is a black and white image, then with the pixel to be tested as the center, selecting a first preset number of adjacent pixels around the pixel to be tested as auxiliary pixels; if the image to be tested is a color image, then with the pixel to be tested as the center, selecting a first preset number of pixels spaced at preset intervals around the pixel to be tested as auxiliary pixels.

[0048] Specifically, taking a 7x7 window as an example, Figure 2 This is an example of the selection of the pixel to be tested and the auxiliary pixel, as shown in the diagram. Figure 2 As shown, Figure 2The corresponding image to be tested is a black and white image, where one square represents one pixel. P0 is selected as the pixel to be tested, and the eight adjacent pixels surrounding P0 (corresponding to...) are selected as the center. Figure 2 The gray squares in the image are used as auxiliary pixels. Correspondingly, Figure 3 A schematic diagram showing the selection of the target pixel and auxiliary pixels for another example, such as... Figure 3 As shown, Figure 3 The corresponding image to be tested is a color image, where one square represents one pixel. P0 is selected as the pixel to be tested. Centered on P0, eight pixels are selected at intervals of one pixel (i.e., one square) around P0. Figure 3 The gray squares in the image are used as auxiliary pixels. In the example above, by selecting auxiliary pixels, bad pixels can be effectively identified, improving the accuracy of image bad pixel detection.

[0049] Accordingly, after selecting auxiliary pixels, the maximum and minimum brightness values ​​are removed from the brightness values ​​of the eight auxiliary pixels, and the average brightness value of the remaining six pixels is calculated, denoted as Iavg. The difference between the brightness value pix of the pixel to be tested and Iavg is calculated to obtain the brightness deviation Dev corresponding to the pixel to be tested. Then, using the eight auxiliary pixels as the pixels to be tested, the above calculation steps are repeated with the other eight pixels surrounding each auxiliary pixel in the same way as above, to obtain the brightness deviation Dev' corresponding to the eight auxiliary pixels. The brightness deviation of a pixel represents the brightness deviation between that pixel and its surrounding pixels. The surrounding pixels are... Figure 2 and Figure 3 The gray squares in the example represent pixels.

[0050] Specifically, directional filters are defined, including directional filters for black and white images and directional filters for color images. Each filter includes 8 directions, such as... Figure 4 As shown, the 8 directions correspond to Figure 4 Directions 1 through 8 are shown in the diagram. Each directional filter is a 5x5 array, resulting in the following: Figure 5 The black and white image shown corresponds to eight directional filters, namely F1 and F2 filters, F3 and F4 filters, F5 and F6 filters, and F7 and F8 filters, as well as... Figure 6The color image shown has eight directional filters: F1' and F2', F3' and F4', F5' and F6', and F7' and F8'. Based on these defined directional filters, if the image to be tested is a black and white image, the eight directional filters corresponding to the black and white image are selected to perform directional filtering on the brightness values ​​of the pixel to be tested and the auxiliary pixel, obtaining a target direction matrix. The target brightness deviation is then obtained from the target direction matrix. If the image to be tested is a color image, the eight directional filters corresponding to the color image are selected to perform directional filtering on the brightness values ​​of the pixel to be tested and the auxiliary pixel, obtaining a target direction matrix. The target brightness deviation is then obtained from the target direction matrix.

[0051] In another example, after selecting the pixel to be tested and the auxiliary pixel, a directional filter can be used to filter the brightness values ​​corresponding to the selected pixel to be tested and the auxiliary pixel to obtain the target direction matrix. Then, based on the direction corresponding to the target direction matrix, the brightness deviation of the pixel in that direction is calculated to obtain the target brightness deviation. Finally, based on the brightness value pix of the pixel to be tested, the brightness deviation Dev of the pixel to be tested, the brightness value of the auxiliary pixel, and the target brightness deviation, bad pixel detection is performed to obtain the detection result.

[0052] In the example above, by defining directional filters in each direction, the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixel are subjected to directional filtering. Based on the target brightness deviation, the brightness value of the pixel to be tested and the brightness deviation, and the brightness value of the auxiliary pixel, bad pixel detection is performed to obtain the final detection result, which improves the accuracy of image bad pixel detection.

[0053] Optionally, the method for performing directional filtering on the brightness values ​​corresponding to the pixel to be measured and the auxiliary pixel to obtain a target direction matrix, and obtaining the target brightness deviation based on the target direction matrix, is not limited. In one example, in step 103, a directional filter is used to perform directional filtering on the brightness values ​​corresponding to the pixel to be measured and the auxiliary pixel to obtain a target direction matrix, and the target brightness deviation is obtained based on the target direction matrix, specifically including:

[0054] Using a directional filter, the brightness values ​​corresponding to the pixel to be measured and the auxiliary pixel are filtered to obtain the target direction matrix. Based on the target direction matrix, the brightness deviation of the pixel to be measured and the auxiliary pixel is calculated to obtain the target brightness deviation.

[0055] In this example, a directional filter is an important tool for extracting features in specific directions from the image under test. First, the brightness values ​​of the pixel under test and auxiliary pixels are filtered using a directional filter. Directional filters can perform filtering in multiple directions, including... Figure 4The image shows eight directions. Through this multi-directional filtering process, the response value in each direction can be obtained. The response values ​​form a direction matrix, where the response values ​​reflect the changes of the image under test in a specific direction.

[0056] In one example, a directional filter is used to filter the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixels to obtain a target direction matrix. This includes: selecting a second preset number of pixels around the pixel to be tested as the center to form an array; performing image filtering convolution calculations on the array and the array of the directional filter in different directions to obtain the response value in each direction; and obtaining the target direction matrix based on the response value in each direction.

[0057] In this example, Figure 7 This is a schematic diagram illustrating the array selection corresponding to an example pixel to be tested, such as... Figure 7 As shown, each square represents a pixel. P0 is selected as the pixel to be tested, and the neighboring pixels surrounding P0 (corresponding to...) are selected with P0 as the center. Figure 7 The gray squares in the image and the pixels to be measured together form a 5*5 array, which is denoted as array 1.

[0058] Based on the foregoing, taking the eight filters corresponding to a black and white image as an example (the eight filters corresponding to a color image are similar), they are filters F1 and F2, F3 and F4, F5 and F6, and F7 and F8. Image filtering convolution is performed between array 1 and filter F1, and then between array 1 and filter F2 to obtain two response values ​​in the horizontal direction. The larger of the two response values ​​is selected and recorded as response value 1. Image filtering convolution is performed between array 1 and filter F3, and then between array 1 and filter F4 to obtain two response values ​​in the vertical direction. The larger of the two response values ​​is selected and recorded as response value 2. The other two directions are calculated using the same method to obtain response values ​​3 and 4. It should be noted that the method for obtaining response values ​​through image filtering convolution is the same as existing technology and will not be explained further here.

[0059] Specifically, response values ​​1, 2, 3, and 4 are filtered and reduced. For example, the filtering ratio can be set to 50%, but the specific filtering ratio is determined based on the actual situation and is not limited here. For instance, if the calculated response values ​​are 1 = 2, 2 = 1.8, 3 = 1.5, and 4 = 0.5, the remaining response values ​​2, 3, and 4 are filtered using the largest response value, 1, with a filtering ratio of 50%. This removes response values ​​less than 1, i.e., response value 4, leaving response values ​​1, 2, and 3. The target direction matrix is ​​then constructed based on the remaining response values. The target brightness deviation is calculated by comparing the target direction matrix with the brightness deviations corresponding to the measured pixel and auxiliary pixels.

[0060] In the above example, by selecting adjacent pixels centered on the pixel to be tested to form an array, and performing image filtering convolution calculation and minimization calculation in different directions, directional feature extraction can be enhanced and computational efficiency optimized, thereby achieving more efficient and accurate image defect detection.

[0061] Based on the direction corresponding to the response value, retain the brightness deviation corresponding to the cross-shaped direction and filter out the brightness deviation corresponding to the non-cross-shaped direction; if there is only one cross-shaped direction, then all brightness deviations are retained. The retained brightness deviations are the target brightness deviations.

[0062] Specifically, the horizontal and vertical directions form the first set of cross directions, and the other two directions form the second set of cross directions. If the direction corresponding to the remaining response value includes either the first or second set of cross directions, then the brightness deviation of the auxiliary pixels and the pixels to be tested corresponding to either the first or second set of cross directions is retained, while the brightness deviation corresponding to non-cross directions is filtered out. If the direction corresponding to the remaining response value is only one cross direction, then the brightness deviation of all pixels is retained. This example scheme effectively extracts and processes the deviation of pixels in the image under test, thus providing a data foundation for subsequent image defect detection and processing. This example scheme makes image defect detection more accurate and reliable.

[0063] In one example, in step 104, the detection result is obtained based on the brightness value of the pixel to be measured, the brightness deviation of the pixel to be measured, the brightness value of the auxiliary pixel, and the target brightness deviation, including:

[0064] The system detects whether the brightness value of the pixel under test, the brightness deviation of the pixel under test, the brightness value of the auxiliary pixel, and the target brightness deviation meet the judgment conditions. If they meet the conditions, the system assigns the first value under the current judgment conditions; otherwise, the system assigns the second value under the current judgment conditions.

[0065] The score is obtained based on the value assigned under each judgment condition; if the score is within the preset range, the pixel to be tested is judged as a bad pixel; otherwise, the pixel to be tested is judged as a non-bad pixel.

[0066] In this example, to detect whether a pixel under test is a bad pixel, it is first necessary to check whether the brightness value of the pixel under test, its brightness deviation, the brightness value of the auxiliary pixel, and the target brightness deviation meet preset judgment conditions. Specifically, by analyzing these parameters, it can be determined whether the pixel under test is a bad pixel. These judgment conditions can be set based on various factors such as statistical characteristics, brightness differences, and directional features. If these parameters meet the current judgment conditions, a first value is assigned under that condition; otherwise, a second value is assigned. This process can be carried out through a series of judgment conditions, each corresponding to a specific assignment rule, thereby generating a preliminary judgment result for each pixel under test.

[0067] Accordingly, a comprehensive score is calculated based on the assigned values ​​under each judgment condition. This score is obtained by weighting or summing the assigned values ​​under all judgment conditions, reflecting the overall performance of the pixel under test under multiple judgment conditions. If the score falls within a preset range, the pixel under test can be judged as a bad pixel; otherwise, the pixel under test is judged as a non-bad pixel. It should be noted that the first value, the second value, and the preset range mentioned above are determined based on the actual situation and are not limited here.

[0068] The solution presented in this example allows for a comprehensive evaluation of the pixel under test by considering multiple factors, thereby improving the accuracy and reliability of image defect detection.

[0069] Based on the aforementioned example, the judgment criteria include: the difference between the average value of the brightness value of the pixel to be tested and the average value of the auxiliary pixels, excluding the maximum and minimum brightness values, is greater than a first threshold.

[0070] And / or, the brightness deviation of the pixel to be measured is greater than the product of the maximum absolute value of the target brightness deviation and the second threshold.

[0071] And / or, the absolute value of the difference between the brightness value of the pixel to be tested and the average value of the brightness values ​​of the auxiliary pixels, excluding the maximum and minimum brightness values, is greater than the product of the third threshold and the absolute value of the difference between the brightness value of the pixel to be tested and the third value.

[0072] In this example, multiple criteria can be used to accurately determine whether a pixel under test is a bad pixel. The relationship between the brightness value of the pixel under test and the brightness values ​​of its surrounding auxiliary pixels is an important criterion. Specifically, if the difference between the brightness value of the pixel under test and the average brightness value of the auxiliary pixels (excluding the maximum and minimum brightness values) is greater than a preset first threshold, the brightness of the pixel under test can be considered abnormal. That is, pixel - Iavg > TH1, where pixel represents the brightness value of the pixel under test, Iavg represents the average brightness value of the auxiliary pixels (excluding the maximum and minimum brightness values), and TH1 represents the first threshold, the value of which is determined based on the actual situation. This method improves the accuracy of bad pixel detection by excluding extreme values ​​and using the average of intermediate values, avoiding misjudgments caused by individual abnormal pixels.

[0073] In addition, the brightness deviation of the pixel under test is also a key criterion. If the brightness deviation of the pixel under test is greater than the product of the maximum absolute value of the target brightness deviation and the second threshold, then the brightness of the pixel under test can be considered abnormal. That is, Dev > Dev max *TH2, where Dev represents the brightness deviation of the pixel being measured. max The maximum absolute value of the target brightness deviation, TH2, represents the second threshold, the value of which is determined based on the actual situation. This judgment condition, by comparing the brightness difference between the pixel to be tested and its surrounding pixels, combined with the preset threshold, further improves the accuracy of image defect detection.

[0074] Finally, the absolute value of the difference between the brightness value of the pixel to be tested and the average brightness value of the auxiliary pixels excluding the maximum and minimum brightness values ​​is also an important criterion. If the absolute value of this difference is greater than the product of the third threshold and the absolute value of the difference between the brightness value of the pixel to be tested and the third value, then the brightness of the pixel to be tested can be considered abnormal. That is, dist(pix-Iavg) > TH3*dist(pix-Vd), where pix represents the brightness value of the pixel to be tested, Iavg represents the average brightness value of the auxiliary pixels excluding the maximum and minimum brightness values, TH3 represents the third threshold, the value of which is determined according to the actual situation, and Vd represents the third value, which is the brightest or darkest value (i.e., 0) of all pixels. This method, by introducing the third value and combining it with the product relationship of the threshold, further enhances the ability to detect bad pixels in the image.

[0075] In the above examples, the combined application of these judgment conditions can effectively improve the detection accuracy of bad pixels in images and enhance the stability and reliability of the detection results.

[0076] Based on any of the aforementioned examples, the method further includes: if the detection result is a bad pixel, then correcting the pixel to be tested.

[0077] In this example, if the detection result shows that the pixel to be tested is a bad pixel, then the pixel to be tested needs to be corrected. In one example, the correction of the pixel to be tested includes: obtaining the second maximum and second minimum brightness values ​​among the auxiliary pixels, and correcting the brightness value of the pixel to be tested to a value close to the second maximum or second minimum brightness value; and / or, calculating the average brightness value of the two pixels adjacent to the pixel to be tested in the same direction, and if the average value is too large, using the second maximum brightness value for correction; if the average value is too small, using the second minimum brightness value for correction. Specifically, the correction method for the pixel corresponding to the cross direction is to sort the brightness values ​​of the 8 auxiliary pixels to obtain the second maximum and second minimum brightness values, determine whether the brightness value of the pixel to be tested is close to the second maximum or second minimum brightness value, and correct the brightness value of the pixel to be tested to a value close to the second maximum or second minimum brightness value. For pixels that are not in the cross direction, calculate the average brightness value of the two pixels adjacent to the pixel in the direction of the pixel to be tested. Compare this average value with the average brightness value of the auxiliary pixels excluding the maximum and minimum brightness values. If the average value is too large, use the aforementioned second largest brightness value for correction. If the average value is too small, use the aforementioned second smallest brightness value for correction.

[0078] The solution in this example corrects pixels that are detected as bad, reducing damage to the image, avoiding local brightness anomalies, and improving image uniformity.

[0079] The image defect processing method provided in this embodiment first selects a pixel to be tested in the image to be tested; then, auxiliary pixels are selected with the pixel to be tested as the center; the brightness deviation between the auxiliary pixels and the pixel to be tested is calculated based on the brightness values ​​of the auxiliary pixels and the pixel to be tested; then, a directional filter is used to perform directional filtering on the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixels to obtain a target direction matrix, and the target brightness deviation is obtained based on the target direction matrix; finally, the detection result is obtained based on the brightness value of the pixel to be tested, the brightness deviation of the pixel to be tested, the brightness value of the auxiliary pixels, and the target brightness deviation. The solution of this application, by defining directional filters in various directions, performs directional filtering on the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixels, and performs defect detection based on the target brightness deviation, the brightness value of the pixel to be tested, the brightness deviation, and the brightness value of the auxiliary pixels to obtain the final detection result, thus improving the accuracy of image defect detection.

[0080] Example 2

[0081] The image defect processing method provided in this application will be described in detail below with a specific embodiment. Figure 8 A flowchart of an image defect processing method provided in Embodiment 2 of this application is shown below. Figure 8 As shown, the process is as follows:

[0082] Step 801: Select the pixel to be tested in the image to be tested;

[0083] Step 802: If the image to be tested is a black and white image, then take the pixel to be tested as the center and select 8 adjacent pixels around the pixel to be tested as auxiliary pixels; if the image to be tested is a color image, then take the pixel to be tested as the center and select 8 pixels around the pixel to be tested with a spacing of one pixel as auxiliary pixels.

[0084] Step 803: Calculate the brightness deviation between the auxiliary pixel and the pixel to be measured based on the brightness values ​​of the auxiliary pixel and the pixel to be measured.

[0085] Step 804: Using the pixel to be tested as the center, select the neighboring pixels around the pixel to be tested to form a 5*5 array;

[0086] Step 805: Perform image filtering convolution calculations on the array and the directional filter array under different directions to obtain the calculated response values, and then perform filtering calculations on the calculated response values ​​to obtain the target direction matrix;

[0087] Step 806: Calculate the target brightness deviation based on the target direction matrix;

[0088] Step 807: Detect whether the brightness value of the pixel to be tested, the brightness deviation of the pixel to be tested, the brightness value of the auxiliary pixel, and the target brightness deviation meet the judgment conditions; if they meet the conditions, assign the first value under the current judgment conditions; if they do not meet the conditions, assign the second value under the current judgment conditions.

[0089] Step 808: Based on the assigned values ​​under each judgment condition, obtain the score result; if the score result is within the preset range, the pixel to be tested is judged as a bad pixel; otherwise, the pixel to be tested is judged as a non-bad pixel.

[0090] Step 809: If the detection result is a bad pixel, then the pixel to be tested is corrected.

[0091] The specific method for handling image defects can be found in the foregoing embodiments. In summary, the image defect handling method provided in this example defines directional filters for each direction, performs directional filtering on the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixel, and performs defect detection based on the target brightness deviation, the brightness value of the pixel to be tested, the brightness deviation, and the brightness value of the auxiliary pixel, thus obtaining the final detection result and improving the accuracy of image defect detection.

[0092] Example 3

[0093] Figure 9 The diagram above exemplarily illustrates the structure of the image defect processing device provided in Embodiment 3 of this application, such as... Figure 9 As shown, the device includes:

[0094] The selection module 91 is used to select the pixel to be tested in the image to be tested; and to select auxiliary pixels centered on the pixel to be tested.

[0095] The calculation module 92 is used to calculate the brightness deviation between the auxiliary pixel and the pixel to be measured based on the brightness values ​​of the auxiliary pixel and the pixel to be measured; wherein, the brightness deviation of the pixel represents the brightness deviation between the pixel and the surrounding pixels.

[0096] The processing module 93 is used to perform directional filtering on the brightness values ​​corresponding to the pixel to be measured and the auxiliary pixel to obtain the target direction matrix, and obtain the target brightness deviation based on the target direction matrix.

[0097] The detection module 94 is used to obtain the detection result based on the brightness value of the pixel to be tested, the brightness deviation of the pixel to be tested, the brightness value of the auxiliary pixel, and the target brightness deviation.

[0098] In practical applications, there are various ways to implement this image defect processing device. For example, it can be implemented through a computer program, such as application software; or it can be implemented as a medium storing the relevant computer program, such as a USB flash drive or cloud drive; or it can be implemented through a physical device that integrates or installs the relevant computer program, such as a chip.

[0099] In this example, the image to be tested is first acquired from the CMOS image sensor. This image consists of multiple pixels arranged in a grid, containing a certain number of both dead and non-dead pixels. After acquiring the image, a window of a preset size is selected as the test area. For example, a 7x7 window can be chosen. The test area must be an odd-numbered window, with the pixel to be tested centered within the window. The method of window selection is not limited. For instance, a 7x7 window can be directly selected; a smaller window, such as a 5x4 window, can be selected (in which case the 5x4 window needs to be padded to a 7x7 window); or a larger window, such as a 9x8 window, can be selected (in which case the 9x8 window needs to be modified to a 7x7 window).

[0100] In one example, the selection module 91 selects auxiliary pixels centered on the pixel to be tested, including: if the image to be tested is a black and white image, then the first preset number of pixels adjacent to the pixel to be tested are selected as auxiliary pixels centered on the pixel to be tested; if the image to be tested is a color image, then the first preset number of pixels spaced at preset intervals around the pixel to be tested are selected as auxiliary pixels centered on the pixel to be tested.

[0101] Specifically, taking a 7x7 window as an example, Figure 2 This is an example of the selection of the pixel to be tested and the auxiliary pixel, as shown in the diagram. Figure 2 As shown, Figure 2 The corresponding image to be tested is a black and white image, where one square represents one pixel. P0 is selected as the pixel to be tested, and the eight adjacent pixels surrounding P0 (corresponding to...) are selected as the center. Figure 2 The gray squares in the image are used as auxiliary pixels. Correspondingly, Figure 3 A schematic diagram showing the selection of the target pixel and auxiliary pixels for another example, such as... Figure 3 As shown, Figure 3 The corresponding image to be tested is a color image, where one square represents one pixel. P0 is selected as the pixel to be tested. Centered on P0, eight pixels are selected at intervals of one pixel (i.e., one square) around P0. Figure 3 The gray squares in the image are used as auxiliary pixels. In the example above, by selecting auxiliary pixels, bad pixels can be effectively identified, improving the accuracy of image bad pixel detection.

[0102] Accordingly, after selecting auxiliary pixels, the maximum and minimum brightness values ​​are removed from the brightness values ​​of the eight auxiliary pixels, and the average brightness value of the remaining six pixels is calculated, denoted as Iavg. The difference between the brightness value pix of the pixel to be tested and Iavg is calculated to obtain the brightness deviation Dev corresponding to the pixel to be tested. Then, using the eight auxiliary pixels as the pixels to be tested, the above calculation steps are repeated with the other eight pixels surrounding each auxiliary pixel in the same way as above, to obtain the brightness deviation Dev' corresponding to the eight auxiliary pixels. The brightness deviation of a pixel represents the brightness deviation between that pixel and its surrounding pixels. The surrounding pixels are... Figure 2 and Figure 3 The gray squares in the example represent pixels.

[0103] Specifically, directional filters are defined, including directional filters for black and white images and directional filters for color images. Each filter includes 8 directions, such as... Figure 4 As shown, the 8 directions correspond to Figure 4 Directions 1 through 8 are shown in the diagram. Each directional filter is a 5x5 array, resulting in the following: Figure 5 The black and white image shown corresponds to eight directional filters, namely F1 and F2 filters, F3 and F4 filters, F5 and F6 filters, and F7 and F8 filters, as well as... Figure 6 The color image shown has eight directional filters: F1' and F2', F3' and F4', F5' and F6', and F7' and F8'. Based on these defined directional filters, if the image to be tested is a black and white image, the eight directional filters corresponding to the black and white image are selected to perform directional filtering on the brightness values ​​of the pixel to be tested and the auxiliary pixel, obtaining a target direction matrix. The target brightness deviation is then obtained from the target direction matrix. If the image to be tested is a color image, the eight directional filters corresponding to the color image are selected to perform directional filtering on the brightness values ​​of the pixel to be tested and the auxiliary pixel, obtaining a target direction matrix. The target brightness deviation is then obtained from the target direction matrix.

[0104] In another example, after selecting the pixel to be tested and the auxiliary pixel, a directional filter can be used to filter the brightness values ​​corresponding to the selected pixel to be tested and the auxiliary pixel to obtain the target direction matrix. Then, based on the direction corresponding to the target direction matrix, the brightness deviation of the pixel in that direction is calculated to obtain the target brightness deviation. Finally, based on the brightness value pix of the pixel to be tested, the brightness deviation Dev of the pixel to be tested, the brightness value of the auxiliary pixel, and the target brightness deviation, bad pixel detection is performed to obtain the detection result.

[0105] In the example above, by defining directional filters in each direction, the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixel are subjected to directional filtering. Based on the target brightness deviation, the brightness value of the pixel to be tested and the brightness deviation, and the brightness value of the auxiliary pixel, bad pixel detection is performed to obtain the final detection result, which improves the accuracy of image bad pixel detection.

[0106] Optionally, the method for performing directional filtering on the brightness values ​​corresponding to the pixel to be measured and the auxiliary pixel to obtain a target direction matrix, and obtaining the target brightness deviation based on the target direction matrix, is not limited. In one example, the processing module 93 uses a directional filter to perform directional filtering on the brightness values ​​corresponding to the pixel to be measured and the auxiliary pixel to obtain a target direction matrix, and obtains the target brightness deviation based on the target direction matrix, specifically including:

[0107] Using a directional filter, the brightness values ​​corresponding to the pixel to be measured and the auxiliary pixel are filtered to obtain the target direction matrix. Based on the target direction matrix, the brightness deviation of the pixel to be measured and the auxiliary pixel is calculated to obtain the target brightness deviation.

[0108] In this example, a directional filter is an important tool for extracting features in specific directions from the image under test. First, the brightness values ​​of the pixel under test and auxiliary pixels are filtered using a directional filter. Directional filters can perform filtering in multiple directions, including... Figure 4 The image shows eight directions. Through this multi-directional filtering process, the response value in each direction can be obtained. The response values ​​form a direction matrix, where the response values ​​reflect the changes of the image under test in a specific direction.

[0109] In one example, a directional filter is used to filter the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixels to obtain a target direction matrix. This includes: selecting a second preset number of pixels around the pixel to be tested as the center to form an array; performing image filtering convolution calculations on the array and the array of the directional filter in different directions to obtain the response value in each direction; and obtaining the target direction matrix based on the response value in each direction.

[0110] In this example, Figure 7 This is a schematic diagram illustrating the array selection corresponding to an example pixel to be tested, such as... Figure 7 As shown, each square represents a pixel. P0 is selected as the pixel to be tested, and the neighboring pixels surrounding P0 (corresponding to...) are selected with P0 as the center. Figure 7 The gray squares in the image and the pixels to be measured together form a 5*5 array, which is denoted as array 1.

[0111] Based on the foregoing, taking the eight filters corresponding to a black and white image as an example (the eight filters corresponding to a color image are similar), they are filters F1 and F2, F3 and F4, F5 and F6, and F7 and F8. Image filtering convolution is performed between array 1 and filter F1, and then between array 1 and filter F2 to obtain two response values ​​in the horizontal direction. The larger of the two response values ​​is selected and recorded as response value 1. Image filtering convolution is performed between array 1 and filter F3, and then between array 1 and filter F4 to obtain two response values ​​in the vertical direction. The larger of the two response values ​​is selected and recorded as response value 2. The other two directions are calculated using the same method to obtain response values ​​3 and 4. It should be noted that the method for obtaining response values ​​through image filtering convolution is the same as existing technology and will not be explained further here.

[0112] Specifically, response values ​​1, 2, 3, and 4 are filtered out. The specific filtering ratio is determined based on the actual situation and is not limited here. A target direction matrix is ​​formed based on the remaining response values. The target brightness deviation is obtained by calculating the brightness deviation of the target direction matrix and the corresponding brightness deviations of the measured pixel and auxiliary pixels.

[0113] In the above example, by selecting adjacent pixels centered on the pixel to be tested to form an array, and performing image filtering convolution calculation and minimization calculation in different directions, directional feature extraction can be enhanced and computational efficiency optimized, thereby achieving more efficient and accurate image defect detection.

[0114] Based on the direction corresponding to the response value, retain the brightness deviation corresponding to the cross-shaped direction and filter out the brightness deviation corresponding to the non-cross-shaped direction; if there is only one cross-shaped direction, then all brightness deviations are retained. The retained brightness deviations are the target brightness deviations.

[0115] Specifically, the horizontal and vertical directions form the first set of cross directions, and the other two directions form the second set of cross directions. If the direction corresponding to the remaining response value includes either the first or second set of cross directions, then the brightness deviation of the auxiliary pixels and the pixels to be tested corresponding to either the first or second set of cross directions is retained, while the brightness deviation corresponding to non-cross directions is filtered out. If the direction corresponding to the remaining response value is only one cross direction, then the brightness deviation of all pixels is retained. This example scheme effectively extracts and processes the deviation of pixels in the image under test, thus providing a data foundation for subsequent image defect detection and processing. This example scheme makes image defect detection more accurate and reliable.

[0116] In one example, the detection module 94 obtains the detection result based on the brightness value of the pixel to be measured, the brightness deviation of the pixel to be measured, the brightness value of the auxiliary pixel, and the target brightness deviation, including:

[0117] The system detects whether the brightness value of the pixel under test, the brightness deviation of the pixel under test, the brightness value of the auxiliary pixel, and the target brightness deviation meet the judgment conditions. If they meet the conditions, the system assigns the first value under the current judgment conditions; otherwise, the system assigns the second value under the current judgment conditions.

[0118] The score is obtained based on the value assigned under each judgment condition; if the score is within the preset range, the pixel to be tested is judged as a bad pixel; otherwise, the pixel to be tested is judged as a non-bad pixel.

[0119] In this example, to detect whether a pixel under test is a bad pixel, it is first necessary to check whether the brightness value of the pixel under test, its brightness deviation, the brightness value of the auxiliary pixel, and the target brightness deviation meet preset judgment conditions. Specifically, by analyzing these parameters, it can be determined whether the pixel under test is a bad pixel. These judgment conditions can be set based on various factors such as statistical characteristics, brightness differences, and directional features. If these parameters meet the current judgment conditions, a first value is assigned under that condition; otherwise, a second value is assigned. This process can be carried out through a series of judgment conditions, each corresponding to a specific assignment rule, thereby generating a preliminary judgment result for each pixel under test.

[0120] Accordingly, a comprehensive score is calculated based on the assigned values ​​under each judgment condition. This score is obtained by weighting or summing the assigned values ​​under all judgment conditions, reflecting the overall performance of the pixel under test under multiple judgment conditions. If the score falls within a preset range, the pixel under test can be judged as a bad pixel; otherwise, the pixel under test is judged as a non-bad pixel. It should be noted that the first value, the second value, and the preset range mentioned above are determined based on the actual situation and are not limited here.

[0121] The solution presented in this example allows for a comprehensive evaluation of the pixel under test by considering multiple factors, thereby improving the accuracy and reliability of image defect detection.

[0122] Based on the aforementioned example, the judgment criteria include: the difference between the average value of the brightness value of the pixel to be tested and the average value of the auxiliary pixels, excluding the maximum and minimum brightness values, is greater than a first threshold.

[0123] And / or, the brightness deviation of the pixel to be measured is greater than the product of the maximum absolute value of the target brightness deviation and the second threshold.

[0124] And / or, the absolute value of the difference between the brightness value of the pixel to be tested and the average value of the brightness values ​​of the auxiliary pixels, excluding the maximum and minimum brightness values, is greater than the product of the third threshold and the absolute value of the difference between the brightness value of the pixel to be tested and the third value.

[0125] In this example, multiple criteria can be used to accurately determine whether a pixel under test is a bad pixel. The relationship between the brightness value of the pixel under test and the brightness values ​​of its surrounding auxiliary pixels is an important criterion. Specifically, if the difference between the brightness value of the pixel under test and the average brightness value of the auxiliary pixels (excluding the maximum and minimum brightness values) is greater than a preset first threshold, the brightness of the pixel under test can be considered abnormal. That is, pixel - Iavg > TH1, where pixel represents the brightness value of the pixel under test, Iavg represents the average brightness value of the auxiliary pixels (excluding the maximum and minimum brightness values), and TH1 represents the first threshold, the value of which is determined based on the actual situation. This method improves the accuracy of bad pixel detection by excluding extreme values ​​and using the average of intermediate values, avoiding misjudgments caused by individual abnormal pixels.

[0126] In addition, the brightness deviation of the pixel under test is also a key criterion. If the brightness deviation of the pixel under test is greater than the product of the maximum absolute value of the target brightness deviation and the second threshold, then the brightness of the pixel under test can be considered abnormal. That is, Dev > Dev max *TH2, where Dev represents the brightness deviation of the pixel being measured. max The maximum absolute value of the target brightness deviation, TH2, represents the second threshold, the value of which is determined based on the actual situation. This judgment condition, by comparing the brightness difference between the pixel to be tested and its surrounding pixels, combined with the preset threshold, further improves the accuracy of image defect detection.

[0127] Finally, the absolute value of the difference between the brightness value of the pixel to be tested and the average brightness value of the auxiliary pixels excluding the maximum and minimum brightness values ​​is also an important criterion. If the absolute value of this difference is greater than the product of the third threshold and the absolute value of the difference between the brightness value of the pixel to be tested and the third value, then the brightness of the pixel to be tested can be considered abnormal. That is, dist(pix-Iavg) > TH3*dist(pix-Vd), where pix represents the brightness value of the pixel to be tested, Iavg represents the average brightness value of the auxiliary pixels excluding the maximum and minimum brightness values, TH3 represents the third threshold, the value of which is determined according to the actual situation, and Vd represents the third value, which is the brightest or darkest value (i.e., 0) of all pixels. This method, by introducing the third value and combining it with the product relationship of the threshold, further enhances the ability to detect bad pixels in the image.

[0128] In the above examples, the combined application of these judgment conditions can effectively improve the detection accuracy of bad pixels in images and enhance the stability and reliability of the detection results.

[0129] Based on any of the foregoing examples, the device further includes a correction module for correcting the pixel to be tested if the detection result is a bad pixel.

[0130] In this example, if the detection result shows that the pixel to be tested is a bad pixel, then the pixel to be tested needs to be corrected. In one example, the device further includes: a correction module, used to obtain the second maximum brightness value and the second minimum brightness value among the auxiliary pixels, and correct the brightness value of the pixel to be tested to a close second maximum brightness value or second minimum brightness value; and / or, calculate the average brightness value of two pixels adjacent to the pixel to be tested in the direction of the pixel to be tested, and if the average value is too large, use the second maximum brightness value for correction, and if the average value is too small, use the second minimum brightness value for correction. Specifically, the correction method for the pixel corresponding to the cross direction is to sort the brightness values ​​of the 8 auxiliary pixels to obtain the second maximum brightness value and the second minimum brightness value, determine whether the brightness value of the pixel to be tested is close to the second maximum brightness value or the second minimum brightness value, and correct the brightness value of the pixel to be tested to a close second maximum brightness value or the second minimum brightness value. For pixels that are not in the cross direction, calculate the average brightness value of the two pixels adjacent to the pixel in the direction of the pixel to be tested. Compare this average value with the average brightness value of the auxiliary pixels excluding the maximum and minimum brightness values. If the average value is too large, use the aforementioned second largest brightness value for correction. If the average value is too small, use the aforementioned second smallest brightness value for correction.

[0131] The solution in this example corrects pixels that are detected as bad, reducing damage to the image, avoiding local brightness anomalies, and improving image uniformity.

[0132] In the image defect processing device provided in this embodiment, the selection module first selects the pixel to be tested in the image to be tested; then, with the pixel to be tested as the center, auxiliary pixels are selected; the calculation module calculates the brightness deviation between the auxiliary pixels and the pixel to be tested based on the brightness values ​​of the auxiliary pixels and the pixel to be tested; then, the processing module uses a directional filter to perform directional filtering on the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixels to obtain a target direction matrix, and obtains the target brightness deviation based on the target direction matrix; finally, the detection module obtains the detection result based on the brightness value of the pixel to be tested, the brightness deviation of the pixel to be tested, the brightness value of the auxiliary pixels, and the target brightness deviation. The solution of this application, by defining directional filters in various directions, performs directional filtering on the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixels, and performs defect detection based on the target brightness deviation, the brightness value of the pixel to be tested, the brightness deviation, and the brightness value of the auxiliary pixels to obtain the final detection result, thus improving the accuracy of image defect detection.

[0133] Example 4

[0134] Figure 10 This is a schematic diagram of the structure of the electronic device provided in Embodiment 4 of this application, as shown below. Figure 10 As shown, the electronic device includes:

[0135] The electronic device includes a processor 291 and a memory 292; it may also include a communication interface 293 and a bus 294. The processor 291, memory 292, and communication interface 293 can communicate with each other via the bus 294. The communication interface 293 can be used for information transmission. The processor 291 can invoke logical instructions stored in the memory 292 to execute the methods described in the example above.

[0136] Furthermore, the logic instructions in the aforementioned memory 292 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.

[0137] The memory 292, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of this application. The processor 291 executes functional applications and data processing by running the software programs, instructions, and modules stored in the memory 292, that is, it implements the methods in the above method examples.

[0138] The memory 292 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 292 may include high-speed random access memory and may also include non-volatile memory.

[0139] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method in any of the embodiments.

[0140] This application also provides a computer program product, which, when executed by a processor, implements the method in any of the embodiments.

[0141] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0142] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A method for processing bad pixels in an image, characterized in that, include: Select the pixel to be tested in the image to be tested; Auxiliary pixels are selected with the pixel to be tested as the center; The brightness deviation between the auxiliary pixel and the pixel to be measured is calculated based on the brightness values ​​of the auxiliary pixel and the pixel to be measured; wherein, the brightness deviation of a pixel represents the brightness difference between the pixel and its surrounding pixels. Using a directional filter, the brightness values ​​corresponding to the pixel to be measured and the auxiliary pixel are directionally filtered to obtain a target direction matrix, and the target brightness deviation is obtained based on the target direction matrix. The detection result is obtained based on the brightness value of the pixel to be tested, the brightness deviation of the pixel to be tested, the brightness value of the auxiliary pixel, and the target brightness deviation.

2. The method according to claim 1, characterized in that, The step of selecting auxiliary pixels centered on the pixel to be tested includes: If the image to be tested is a black and white image, then with the pixel to be tested as the center, a first preset number of pixels adjacent to the pixel to be tested are selected as the auxiliary pixels. If the image to be tested is a color image, then, taking the pixel to be tested as the center, a first preset number of pixels with a preset number of pixels spacing around the pixel to be tested are selected as the auxiliary pixels.

3. The method according to claim 1, characterized in that, The step of using a directional filter to perform directional filtering on the brightness values ​​corresponding to the pixel to be measured and the auxiliary pixel to obtain a target direction matrix, and obtaining the target brightness deviation based on the target direction matrix, includes: A directional filter is used to filter the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixel to obtain the target directional matrix. The target brightness deviation is then calculated based on the target directional matrix to obtain the brightness deviation of the pixel to be tested and the auxiliary pixel.

4. The method according to claim 3, characterized in that, The step of using a directional filter to filter the brightness values ​​corresponding to the pixel to be measured and the auxiliary pixel to obtain the target direction matrix includes: Centered on the pixel to be tested, an array is formed by selecting a second preset number of adjacent pixels around the pixel to be tested; Image filtering convolution calculations are performed on the array and the array of the directional filter in different directions to obtain the response value in each direction. Based on the response value in each direction, the target direction matrix is ​​obtained.

5. The method according to claim 1, characterized in that, The step of obtaining the detection result based on the brightness value of the pixel to be tested, the brightness deviation of the pixel to be tested, the brightness value of the auxiliary pixel, and the target brightness deviation includes: The system detects whether the brightness value of the pixel to be tested, the brightness deviation of the pixel to be tested, the brightness value of the auxiliary pixel, and the target brightness deviation meet the judgment conditions; if they meet the conditions, a first value is assigned under the current judgment conditions; if they do not meet the conditions, a second value is assigned under the current judgment conditions. Based on the assigned value under each judgment condition, a score is obtained; if the score is within a preset range, the pixel to be tested is judged to be a bad pixel; otherwise, the pixel to be tested is judged to be a non-bad pixel.

6. The method according to claim 5, characterized in that, The judgment condition includes: the difference between the brightness value of the pixel to be tested and the average value of the auxiliary pixels (excluding the maximum and minimum brightness values) is greater than a first threshold. And / or, the brightness deviation of the pixel to be tested is greater than the product of the maximum absolute value of the target brightness deviation and the second threshold. And / or, the absolute value of the difference between the brightness value of the pixel to be tested and the average value of the brightness values ​​of the auxiliary pixels, excluding the maximum and minimum brightness values, is greater than the product of the third threshold and the absolute value of the difference between the brightness value of the pixel to be tested and the third value.

7. The method according to any one of claims 1-6, characterized in that, The method further includes: If the detection result is a bad pixel, then the pixel to be tested is corrected.

8. The method according to claim 7, characterized in that, The calibration of the pixel to be tested includes: Obtain the second maximum and second minimum brightness values ​​in the auxiliary pixels, and correct the brightness value of the pixel to be tested to be close to the second maximum or second minimum brightness value. And / or, calculate the average brightness value of the two pixels adjacent to the pixel to be tested in the direction of the pixel to be tested. If the average value is too large, the second largest brightness value is used for correction. If the average value is too small, the second smallest brightness value is used for correction.

9. An image defect processing device, characterized in that, include: The selection module is used to select the pixel to be tested in the image to be tested; Auxiliary pixels are selected with the pixel to be tested as the center; The calculation module is used to calculate the brightness deviation between the auxiliary pixel and the pixel to be measured based on the brightness values ​​of the auxiliary pixel and the pixel to be measured; wherein, the brightness deviation of a pixel represents the brightness deviation between the pixel and its surrounding pixels; The processing module is used to perform directional filtering on the brightness values ​​corresponding to the pixel to be tested and the auxiliary pixel using a directional filter to obtain a target directional matrix, and to obtain the target brightness deviation based on the target directional matrix. The detection module is used to obtain the detection result based on the brightness value of the pixel to be tested, the brightness deviation of the pixel to be tested, the brightness value of the auxiliary pixel, and the target brightness deviation.

10. The apparatus according to claim 9, characterized in that, The device further includes: The correction module is used to obtain the second maximum brightness value and the second minimum brightness value in the auxiliary pixels, and correct the brightness value of the pixel to be tested to be close to the second maximum brightness value or the second minimum brightness value. And / or, calculate the average brightness value of the two pixels adjacent to the pixel to be tested in the direction of the pixel to be tested. If the average value is too large, the second largest brightness value is used for correction. If the average value is too small, the second smallest brightness value is used for correction.

11. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method as described in any one of claims 1-8.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-8.

13. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-8.