Image bad pixel detection and compensation method and device

Through Gaussian convolution processing and median filtering technology, the image bad pixel detection and compensation process is simplified, solving the problems of complex technology and high resource consumption in the existing technology, and realizing simple, practical and efficient compensation of image bad pixel detection.

CN114500889BActive Publication Date: 2024-10-22ARKMICRO TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011267640.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-13
Publication Date
2024-10-22
Estimated Expiration
2040-11-13

AI Technical Summary

Technical Problem

The existing image defective pixel detection and compensation technology is complex and consumes high hardware resources, making it difficult to effectively use it in simple devices.

Method used

Using Gaussian convolution processing and median filtering technology, it performs offset correction by receiving the original image data, constructs an N*N data matrix, performs Gaussian convolution processing and median filtering, and determines bad pixels based on the preset coefficients and judgment thresholds, and Make compensation.

Benefits of technology

It realizes the simplicity, practicality and efficiency of image bad pixel compensation, reduces the consumption of hardware resources, and improves the accuracy of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114500889B_ABST
    Figure CN114500889B_ABST
Patent Text Reader

Abstract

The present invention provides an image bad pixel detection compensation method and device, the method comprising: subtracting a preset offset value from the original pixel value of the image to obtain an offset correction value; selecting offset correction data with the point to be detected as the center point to form an N*N data matrix; performing Gaussian convolution processing on the N*N data matrix to obtain the Gaussian convolution average value; multiplying the absolute difference between the Gaussian convolution average value and the center point data by a preset coefficient to obtain the difference to be determined; determining the judgment threshold corresponding to the Gaussian convolution average value by querying a preset Gaussian convolution and judgment threshold comparison table; performing median filtering on the N*N data matrix in the horizontal, vertical, 45 degree direction, and 135 degree direction, obtaining the maximum and minimum values ​​of the filtering results, performing median filtering on the maximum value, minimum value, and center point data to obtain a pre-replacement value; when the difference to be determined is greater than the judgment threshold, the point to be detected is determined to be a bad pixel, and the pre-replacement value is used to replace the current center point data. The method is simple, practical, and consumes little hardware resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to an image bad pixel compensation method and device. Background Art

[0002] With the development of image processing technology, the application of digital video images is becoming more and more common. In the fields of cameras, mobile devices such as mobile phones, vehicles, and monitoring, the quality requirements for video images are getting higher and higher. Due to the differences in semiconductor manufacturing processes and materials and damage during use, image sensors will have some bad pixels. In order to make the final imaging meet people's visual needs, these bad pixels must be compensated.

[0003] The existing bad pixel detection and compensation technology mainly considers the impact of the moving image on the bad pixel in the previous and next frames to determine whether the pixel is a bad pixel, and judges the bad pixel by judging the change error of the bad pixel in the previous and next frames. This method must store data in frames and has high requirements for memory. Other bad pixel detection and compensation technologies control exposure of different intensities, such as through multiple different exposures from weak exposure to overexposure, to detect the physical location of the bad pixel and then compensate for it. This method is too complicated in operation and is not suitable for use in some simple devices.

[0004] Therefore, it is necessary to design a simple image bad pixel compensation method to solve the above problems and make the image bad pixel compensation simpler, more practical, less hardware resource consuming and relatively more accurate. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a method and device for detecting and compensating image bad pixels, which can accurately compensate for bad pixels and require small hardware resources.

[0006] In order to solve the technical problem of the present invention, the present invention discloses an image bad pixel detection and compensation method, comprising:

[0007] Receiving original image data, subtracting a preset offset value from a pixel value of each pixel point of the original image data, and obtaining an offset correction value after black level correction processing;

[0008] Select the offset correction data with the point to be detected as the center point to form an N*N data matrix;

[0009] Performing Gaussian convolution processing on the N*N data matrix to obtain a Gaussian convolution average value; multiplying the absolute difference between the Gaussian convolution average value and the center point data by a preset coefficient to obtain a difference to be determined; determining a judgment threshold corresponding to the Gaussian convolution average value according to a preset corresponding relationship between the Gaussian convolution and the judgment threshold;

[0010] Performing median filtering on the N*N data matrix in the horizontal, vertical, 45-degree and 135-degree directions, obtaining the maximum and minimum values ​​of the horizontal median filtering results, the vertical median filtering results, the 45-degree median filtering results and the 135-degree median filtering results, and performing median filtering on the maximum value, the minimum value and the center point data to obtain a pre-replacement value;

[0011] When the difference to be determined is greater than the determination threshold, the point to be detected is determined to be a bad point, and the pre-replacement value is used to replace the current center point data.

[0012] Furthermore, the correspondence between the preset Gaussian convolution and the judgment threshold is a linear relationship; the correspondence between the Gaussian convolution and the judgment threshold satisfies the following expression: judgment threshold = Gaussian convolution * (ba) / 256 + a, where a is the starting judgment threshold corresponding to the Gaussian convolution of 0, and b is the ending judgment threshold corresponding to the Gaussian convolution of 256.

[0013] Furthermore, the Gaussian coefficients selected for performing Gaussian convolution processing on the N*N data matrix are N*N data matrices, which satisfy the following conditions: the value at the center point is the largest, and the value gradually decreases as the center point extends to the surrounding areas; the closer to the center point, the larger the value, and the farther away from the center point, the smaller the value; and the elements of the data matrix are symmetrical along the horizontal direction, vertical direction, 45 degree direction, and 135 degree direction passing through the center point.

[0014] Furthermore, the N value is 5.

[0015] The present invention also discloses an image bad pixel detection and compensation device, comprising: an offset correction module, a data selection module, a data processing module, a median filtering module and a judgment and compensation module;

[0016] The offset correction module is used to receive the original image data, and subtract the preset offset value from the pixel value of each pixel point of the original image data to obtain the offset correction value after the black level correction processing;

[0017] The data selection module is used to select the offset correction data with the point to be detected as the center point to form an N*N data matrix;

[0018] The data processing module is used to perform Gaussian convolution processing on the N*N data matrix to obtain a Gaussian convolution average value; multiply the absolute difference between the Gaussian convolution average value and the center point data by a preset coefficient to obtain a difference to be determined; and determine the judgment threshold corresponding to the Gaussian convolution average value according to a preset corresponding relationship between the Gaussian convolution and the judgment threshold;

[0019] The median filtering module is used to perform median filtering on the N*N data matrix horizontally, vertically, in the direction of 45 degrees, and in the direction of 135 degrees, obtain the maximum and minimum values ​​of the horizontal median filtering results, the vertical median filtering results, the 45-degree median filtering results, and the 135-degree median filtering results, and perform median filtering on the maximum value, the minimum value, and the center point data to obtain a pre-replacement value;

[0020] The judgment compensation module is used to judge that the point to be detected is a bad point when the difference to be determined is greater than the judgment threshold, and replace the current center point data with the pre-replacement value.

[0021] Furthermore, the correspondence between the preset Gaussian convolution and the judgment threshold is a linear relationship; the correspondence between the Gaussian convolution and the judgment threshold satisfies the following expression: judgment threshold = Gaussian convolution * (ba) / 256 + a, where a is the starting judgment threshold corresponding to the Gaussian convolution of 0, and b is the ending judgment threshold corresponding to the Gaussian convolution of 256.

[0022] Furthermore, the Gaussian coefficients selected by the data processing module for performing Gaussian convolution processing on the N*N data matrix are N*N data matrices, and the data matrix satisfies the following conditions: the value at the center point is the largest, and the value gradually decreases as the center point extends to the surrounding areas; the closer to the center point, the larger the value, and the farther away from the center point, the smaller the value; and the elements of the data matrix are symmetrical along the horizontal direction, vertical direction, 45 degree direction, and 135 degree direction passing through the center point.

[0023] Furthermore, the N value is 5.

[0024] Compared with the prior art, the present invention has the following beneficial effects: the present invention makes image bad pixel compensation simpler, more practical, consumes less hardware resources and is relatively more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0026] Figure 1 is a flowchart of the steps of a method for detecting and compensating image bad pixels according to an embodiment of the present invention;

[0027] Figure 2 It is a structural diagram of an image bad pixel detection and compensation device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0028] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0029] like Figure 1 As shown, an embodiment of the present invention provides an image bad pixel detection and compensation method, comprising the steps of:

[0030] S101, receiving original image data, and subtracting a preset offset value from a pixel value of each pixel point of the original image data to obtain an offset correction value after black level correction processing.

[0031] Black level is the lowest level value of black data, usually refers to the image sensor signal level value corresponding to the photosensitive image data of 0. Image data is generally 0-255, but when the image sensor leaves the factory, the manufacturer generally sets the image data output range. For example, 5-250, etc., anyway, the lowest level is not zero. Therefore, we need to adjust the image data range so that its minimum value is zero, which is black level correction.

[0032] The information collected by the image sensor is converted into raw RAW format data through a series of conversions. Taking 8-bit data as an example, the effective value of a single pixel is 0-255, but the accuracy of the actual analog-to-digital conversion chip may not be able to convert a small part of the voltage value. Therefore, image sensor manufacturers generally add a fixed offset before the input of the analog-to-digital conversion, so that the output pixel value is between 5 (non-fixed)-255, in order to fully retain the details of the dark area. Of course, some bright details will also be lost. Since our attention is more inclined to the dark area for images, a little loss in the bright area is acceptable. In other words, in order to retain details and suppress noise, the image sensor will raise the black level to a certain offset value. In order to correct the offset of the input pixel value, we need to perform black level correction. That is, the pixel value of each pixel point of the original image data is subtracted from the preset offset to obtain the offset correction value of the pixel point after the offset correction without a signed number. Make the effective value of the image pixel 0-255.

[0033] The black level value added to the raw data output by the image sensor needs to be removed at the front end of the image signal processing. If the black level is not removed, the interference information will affect the subsequent image processing, especially causing inaccurate white balance, and the overall image will be green or red. RAW image is the original data that the CMOS or CCD image sensor converts the captured light source signal into a digital signal. In order to prevent the image from being reddish or greenish, black level correction processing is required.

[0034] S102, selecting the offset correction data with the point to be detected as the center point to form an N*N data matrix.

[0035] N rows of data are stored to obtain an N*N data matrix, and the center point data P of the matrix is ​​the current point that needs to be detected and compensated. For each detection compensation point, an N*N data matrix must be reselected each time. Where N is an odd number to ensure that the center point data P is located at the center of the data matrix. The value of N can be 3, 5, 7, 9... However, considering the detection compensation effect and the corresponding software and hardware resource consumption, in this embodiment, the value of N is preferably 5.

[0036] S103, performing Gaussian convolution processing on the N*N data matrix to obtain a Gaussian convolution average value; multiplying the absolute difference between the Gaussian convolution average value and the center point data by a preset coefficient to obtain a difference to be determined; and determining a judgment threshold corresponding to the Gaussian convolution average value according to a preset correspondence between the Gaussian convolution and the judgment threshold.

[0037] The preset Gaussian convolution and the judgment threshold correspond to a linear relationship; the Gaussian convolution and the judgment threshold correspond to the following expression: judgment threshold = Gaussian convolution * (ba) / 256 + a, where a is the starting judgment threshold corresponding to the Gaussian convolution of 0, and b is the ending judgment threshold corresponding to the Gaussian convolution of 256. The starting judgment threshold and the ending judgment threshold are obtained based on experience.

[0038] Perform Gaussian convolution on the N*N data matrix and calculate the average value of the Gaussian convolution. Multiply the absolute difference between the Gaussian convolution average value and the center point data P by the preset coefficient to obtain the judgment difference diff. The preset coefficient is an empirical coefficient and can be adjusted according to the actual processing effect. The range of the preset coefficient is generally 0-2. The larger the preset coefficient is, the greater the probability that the center point P is judged as a bad pixel; the smaller the preset coefficient is, the smaller the probability that the center point P is judged as a bad pixel.

[0039] The judgment threshold THRESH corresponding to the Gaussian convolution average value is determined according to the preset corresponding relationship between the Gaussian convolution and the judgment threshold.

[0040] Different Gaussian convolution average values ​​have different judgment thresholds THRESH, which helps to improve the accuracy of compensation.

[0041] The Gaussian coefficients selected for Gaussian convolution processing of the N*N data matrix are N*N data matrices, and the data matrix satisfies the following conditions: the value at the center point is the largest, and the value gradually decreases as the center point extends to the surrounding areas; the closer to the center point, the larger the value, and the farther away from the center point, the smaller the value. And the elements of the data matrix are symmetrical along the horizontal direction, vertical direction, 45 degree direction, and 135 degree direction passing through the center point.

[0042] Specifically, taking N as 5 as an example, when Gaussian convolution is performed on 5*5 data, in a certain embodiment, the Gaussian coefficient can be

[0043]

[0044]

[0045] In other embodiments, the Gaussian coefficient may also take other values.

[0046] S104, performing median filtering on the N*N data matrix in the horizontal, vertical, 45-degree and 135-degree directions, obtaining the maximum and minimum values ​​of the horizontal median filtering results, the vertical median filtering results, the 45-degree median filtering results and the 135-degree median filtering results, and performing median filtering on the maximum value, the minimum value and the center point data to obtain a pre-replacement value.

[0047] Perform median filtering on the N*N data in the horizontal, vertical, 45-degree and 135-degree directions, obtain the maximum and minimum values ​​of the horizontal median filtering results, the vertical median filtering results, the 45-degree median filtering results and the 135-degree median filtering results, and perform median filtering on the maximum value, the minimum value and the center point P to obtain the pre-replacement value PIXREP;

[0048] Specifically, taking N as 5 as an example, the data of 5*5 is recorded as

[0049]

[0050] Among them, P22 is the center point.

[0051] For P22 in the 5*5 data, perform median filtering in the horizontal direction Mh=median(P20, P22, P24), median filtering in the vertical direction Mv=median(P02, P22, P42), median filtering in the 45-degree direction M45=median(P40, P22, P04), and median filtering in the 135-degree direction M135=median(P00, P22, P44). Among them, median is the median filter, that is, the middle value of the three values ​​is found. The maximum value TRmax=max(Mh, Mv, M45, M135) and the minimum value TRmin=min(Mh, Mv, M45, M135) of Mh, Mv, M45, and M135 are found. Finally, the median filtering value TRmed=median(TRmax, TRmin, P22) of the maximum value, minimum value, and center point data is found. TRmed is the pre-replacement value PIXREP.

[0052] S105: When the difference to be determined is greater than the determination threshold, the point to be detected is determined to be a bad point, and the pre-replacement value is used to replace the current center point data.

[0053] When the difference value to be determined diff is greater than the determination threshold THRESH, the point is determined to be a bad point, and the replacement value PIXREP is used to replace the current center point P to realize the image bad point detection and compensation function.

[0054] The image bad pixel detection and compensation method provided by the embodiment of the present invention does not need to store the entire frame of the image, nor does it need to detect bad pixels by controlling the exposure separately. It is simple and practical, has a good detection and compensation effect, and can play a good role in bad pixel compensation.

[0055] Figure 2 The image bad pixel detection and compensation device provided by an embodiment of the present invention includes: an offset correction module 101, a data selection module 102, a data processing module 103, a median filtering module 104 and a judgment and compensation module 405.

[0056] The offset correction module 101 is used to receive original image data, and subtract a preset offset level from the pixel value of each pixel point of the original image data to obtain an offset correction value after black level correction processing.

[0057] The data selection module 102 is used to select the offset correction data with the point to be detected as the center point to form an N*N data matrix.

[0058] The data processing module 103 is used to perform Gaussian convolution processing on the N*N data matrix to obtain a Gaussian convolution average value; multiply the absolute difference between the Gaussian convolution average value and the center point data by a preset coefficient to obtain a difference to be determined; and determine the judgment threshold corresponding to the Gaussian convolution average value by querying a preset Gaussian convolution and judgment threshold comparison table.

[0059] The median filtering module 104 is used to perform median filtering on the N*N data matrix horizontally, vertically, in the 45-degree direction, and in the 135-degree direction, obtain the maximum and minimum values ​​of the horizontal median filtering results, the vertical median filtering results, the 45-degree direction median filtering results, and the 135-degree direction median filtering results, and perform median filtering on the maximum value, the minimum value, and the center point data to obtain a pre-replacement value.

[0060] The judgment compensation module 105 is used to judge that the point to be detected is a bad point when the difference to be determined is greater than the judgment threshold, and replace the current center point data with the pre-replacement value.

[0061] It should be noted that: the image bad pixel detection and compensation device provided in the above embodiment only uses the division of the above program modules as an example when performing detection and compensation. In actual applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the device is divided into different program modules to complete all or part of the processing described above. In addition, the image bad pixel detection and compensation device provided in the above embodiment and the image bad pixel detection and compensation method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment. The beneficial effects are the same as the method embodiment and will not be repeated here.

[0062] The embodiment of the present invention further provides a computer storage medium, which is a computer-readable storage medium, on which a computer program is stored, and the computer program can be executed by a processor of a computer device to complete the steps of the above-mentioned image bad pixel detection and compensation method. The computer-readable storage medium can be a magnetic random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM) and other memories.

[0063] An embodiment of the present invention further provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned image bad pixel detection and compensation method when executing the computer program.

[0064] In the several embodiments provided by the present invention, it should be understood that the disclosed methods and intelligent devices can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0065] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.

[0066] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A method for detecting and compensating image bad pixels, characterized in that: include: Receiving original image data, subtracting a preset offset value from a pixel value of each pixel point of the original image data, and obtaining an offset correction value after black level correction processing; Select the offset correction data with the point to be detected as the center point to form an N*N data matrix; Performing Gaussian convolution processing on the N*N data matrix to obtain a Gaussian convolution average value; multiplying the absolute difference between the Gaussian convolution average value and the center point data by a preset coefficient to obtain a difference to be determined; determining a judgment threshold corresponding to the Gaussian convolution average value according to a preset corresponding relationship between the Gaussian convolution and the judgment threshold; Performing median filtering on the N*N data matrix in the horizontal, vertical, 45-degree and 135-degree directions, obtaining the maximum and minimum values ​​of the horizontal median filtering results, the vertical median filtering results, the 45-degree median filtering results and the 135-degree median filtering results, and performing median filtering on the maximum value, the minimum value and the center point data to obtain a pre-replacement value; When the difference to be determined is greater than the determination threshold, the point to be detected is determined to be a bad point, and the pre-replacement value is used to replace the current center point data.

2. The image bad pixel detection and compensation method according to claim 1, characterized in that: The correspondence between the preset Gaussian convolution and the judgment threshold is a linear relationship; the correspondence between the Gaussian convolution and the judgment threshold satisfies the following expression: judgment threshold = Gaussian convolution * (ba) / 256 + a, where a is the starting judgment threshold corresponding to the Gaussian convolution of 0, and b is the ending judgment threshold corresponding to the Gaussian convolution of 256.

3. The image bad pixel detection and compensation method according to claim 1, characterized in that: The Gaussian coefficients selected for Gaussian convolution processing of the N*N data matrix are N*N data matrices, which satisfy the following conditions: the value at the center point is the largest, and the value gradually decreases as the center point extends to the surrounding areas; the closer to the center point, the larger the value, and the farther away from the center point, the smaller the value; and the elements of the data matrix are symmetrical along the horizontal direction, vertical direction, 45 degree direction, and 135 degree direction passing through the center point.

4. The image bad pixel detection and compensation method according to claim 1, characterized in that: The N value is 5.

5. An image bad pixel detection and compensation device, characterized in that: include: Offset correction module, data selection module, data processing module, median filtering module and judgment compensation module; The offset correction module is used to receive the original image data, and subtract the preset offset value from the pixel value of each pixel point of the original image data to obtain the offset correction value after the black level correction processing; The data selection module is used to select the offset correction data with the point to be detected as the center point to form an N*N data matrix; The data processing module is used to perform Gaussian convolution processing on the N*N data matrix to obtain a Gaussian convolution average value; multiply the absolute difference between the Gaussian convolution average value and the center point data by a preset coefficient to obtain a difference to be determined; and determine the judgment threshold corresponding to the Gaussian convolution average value according to a preset corresponding relationship between the Gaussian convolution and the judgment threshold; The median filtering module is used to perform median filtering on the N*N data matrix horizontally, vertically, in the direction of 45 degrees, and in the direction of 135 degrees, obtain the maximum and minimum values ​​of the horizontal median filtering results, the vertical median filtering results, the 45-degree median filtering results, and the 135-degree median filtering results, and perform median filtering on the maximum value, the minimum value, and the center point data to obtain a pre-replacement value; The judgment compensation module is used to judge that the point to be detected is a bad point when the difference to be determined is greater than the judgment threshold, and replace the current center point data with the pre-replacement value.

6. The image bad pixel detection and compensation device according to claim 5, characterized in that: The correspondence between the preset Gaussian convolution and the judgment threshold is a linear relationship; the correspondence between the Gaussian convolution and the judgment threshold satisfies the following expression: judgment threshold = Gaussian convolution * (ba) / 256 + a, where a is the starting judgment threshold corresponding to the Gaussian convolution of 0, and b is the ending judgment threshold corresponding to the Gaussian convolution of 256.

7. The image bad pixel detection and compensation device according to claim 5, characterized in that: The Gaussian coefficients selected by the data processing module for performing Gaussian convolution processing on the N*N data matrix are N*N data matrices, and the data matrix satisfies the following conditions: the value at the center point is the largest, and the value gradually decreases as the center point extends to the surrounding areas; the closer to the center point, the larger the value, and the farther away from the center point, the smaller the value; and the elements of the data matrix are symmetrical along the horizontal direction, vertical direction, 45 degree direction, and 135 degree direction passing through the center point.

8. The image bad pixel detection and compensation device according to claim 5, characterized in that: The N value is 5.