Image bad pixel correction method, device, equipment and storage medium

By determining multiple reference pixel points of the same color component in the image, simulating the pixel values ​​of adjacent effective pixels of the bad point pixels, and calculating the corrected pixel values ​​of the bad point pixels, the problem of limited accuracy of image bad point correction in the prior art is solved, and a more efficient image bad point correction effect is achieved.

CN118474563BActive Publication Date: 2025-02-25SHENZHEN RUISHIZHIXIN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310134019.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-08
Publication Date
2025-02-25
Estimated Expiration
2043-02-08

AI Technical Summary

Technical Problem

In the prior art, the accuracy of correcting image bad point pixels is relatively limited, resulting in relatively limited image bad point correction effect.

Method used

By determining the first reference pixel point in the image to be corrected that is closest to the pixel of the bad point to be corrected and the color component is the same, combining with a number of pairs of second reference pixel points with the first reference pixel point as the center of symmetry and the color component is the same, the second pixel values ​​of the plurality of adjacent effective pixel points are obtained, and the corrected pixel values ​​of the bad point pixels are calculated based on these values.

Benefits of technology

Improve the accuracy of image bad point correction, ensure the accuracy of correcting pixel values, and thus improve image quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118474563B_ABST
    Figure CN118474563B_ABST
Patent Text Reader

Abstract

The present application provides a method, device, equipment and storage medium for correcting bad pixels in an image, the method comprising: determining a first reference pixel point in the image that is closest to the bad pixel and has the same color component; determining multiple pairs of second reference pixels from the image that are symmetrically centered on the first reference pixel point, are located at the periphery of the same rectangular array and have the same color component as the bad pixel point; obtaining the second pixel values ​​of multiple adjacent valid pixels of the bad pixel point in combination with the first pixel values ​​of all reference pixels; and calculating the corrected pixel value of the bad pixel point based on the multiple second pixel values. Through the implementation of the scheme of the present application, the pixel values ​​of the adjacent valid pixels of the bad pixel point are simulated by using the pixel values ​​of multiple reference pixels of the same color component that are regularly arranged and sufficient in number, and then the corrected pixel value of the bad pixel point is calculated based on the pixel values ​​of the adjacent valid pixels, which effectively ensures the accuracy of the final calculated corrected pixel value and improves the effect of image bad pixel correction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image bad pixel correction method, device, equipment and storage medium. Background Art

[0002] With the continuous development of science and technology, image sensors are widely used in products such as smart phones, digital cameras, and security cameras. At present, in order to improve the detail clarity of the collected images, the resolution of image sensors is getting higher and higher, and the number of pixels on the sensor target surface is also increasing. Affected by the sensor manufacturing process, there will be some bad pixels on some target surfaces of the sensor, which is reflected in the presence of some bad pixels on the image, causing a negative impact on the image quality.

[0003] In practical applications, researchers try to improve the image quality by correcting the pixel values ​​of bad pixels in the image. At present, the commonly used method in the related art is to use the pixel values ​​of the neighboring pixels of the same color component of the bad pixel to obtain the corresponding corrected pixel value of the bad pixel. However, the number of pixels of the same color component in the neighborhood of the bad pixel cannot be guaranteed, so there are fewer reference indicators for obtaining the corrected pixel value, resulting in limited accuracy of the corrected pixel value obtained in the end, and the effect of image bad pixel correction is correspondingly limited. Summary of the invention

[0004] The embodiments of the present application provide a method, device, equipment and storage medium for correcting bad pixels in an image, which can at least solve the problem of limited accuracy in correcting bad pixel pixels in an image in the related art.

[0005] A first aspect of an embodiment of the present application provides a method for correcting bad pixels in an image, comprising: determining a first reference pixel point in the image to be corrected that is closest to the bad pixel to be corrected and has the same color component as the bad pixel to be corrected; determining from the image to be corrected a plurality of pairs of second reference pixels with the first reference pixel point as the symmetry center and having the same color component as the bad pixel to be corrected; wherein all the second reference pixel points are located at the periphery of the same rectangular array; obtaining the second pixel values ​​of a plurality of adjacent valid pixels of the bad pixel to be corrected in combination with the first pixel values ​​of all the reference pixel points; and calculating the corrected pixel value of the bad pixel to be corrected based on the plurality of second pixel values.

[0006] The second aspect of an embodiment of the present application provides an image bad pixel correction device, including: a first determination module, used to determine a first reference pixel point in the image to be corrected that is closest to the bad pixel to be corrected and has the same color component; a second determination module, used to determine from the image to be corrected a plurality of pairs of second reference pixel points with the first reference pixel point as the symmetry center and having the same color component as the bad pixel to be corrected; wherein all the second reference pixel points are located at the periphery of the same rectangular array; an acquisition module, used to acquire the second pixel values ​​of a plurality of adjacent valid pixels of the bad pixel to be corrected in combination with the first pixel values ​​of all reference pixels; and a calculation module, used to calculate the correction pixel value of the bad pixel to be corrected based on the plurality of second pixel values.

[0007] A third aspect of an embodiment of the present application provides an electronic device, comprising: a memory and a processor, wherein the processor is used to execute a computer program stored in the memory, and when the processor executes the computer program, it implements each step of the image bad pixel correction method provided in the first aspect of the embodiment of the present application.

[0008] The fourth aspect of the embodiments of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, each step of the image bad pixel correction method provided in the first aspect of the embodiments of the present application is implemented.

[0009] As can be seen from the above, according to the image bad pixel correction method, device, equipment and storage medium provided by the scheme of the present application, a first reference pixel point in the image to be corrected that is closest to the bad pixel to be corrected and has the same color component as the bad pixel to be corrected is determined; multiple pairs of second reference pixels with the first reference pixel point as the symmetry center, located at the periphery of the same rectangular array and having the same color component as the bad pixel to be corrected are determined from the image to be corrected; the second pixel values ​​of multiple adjacent valid pixels of the bad pixel to be corrected are obtained by combining the first pixel values ​​of all reference pixels; and the corrected pixel value of the bad pixel to be corrected is calculated based on the multiple second pixel values. Through the implementation of the scheme of the present application, the pixel values ​​of the adjacent valid pixels of the bad pixel are simulated by using the pixel values ​​of multiple reference pixels of the same color component that are regularly arranged and sufficient in number, and then the corrected pixel value of the bad pixel is calculated based on the pixel values ​​of the adjacent valid pixels, which effectively ensures the accuracy of the final calculated corrected pixel value and improves the effect of image bad pixel correction. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] Figure 1 A schematic diagram of the basic flow of a method for correcting bad pixels in an image provided by an embodiment of the present application;

[0011] Figure 2 A schematic diagram of a pixel array of an image to be corrected provided in one embodiment of the present application;

[0012] Figure 3 A detailed flowchart of an image bad pixel correction method provided in an embodiment of the present application;

[0013] Figure 4 A schematic diagram of a program module of an image bad pixel correction device provided in an embodiment of the present application;

[0014] Figure 5 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0015] In order to make the purpose, features, and advantages of the invention of this application more obvious and easy to understand, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0016] In the description of the embodiments of the present application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.

[0017] A method, device, equipment and storage medium for correcting bad pixels in an image according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.

[0018] In order to solve the problem of limited accuracy in correcting bad pixel pixels in an image in the related art, an embodiment of the present application provides a method for correcting bad pixel pixels in an image, such as Figure 1 This is a basic flow chart of an image bad pixel correction method provided by an embodiment of the present application. The image bad pixel correction method specifically includes the following steps:

[0019] Step 101: determine a first reference pixel in an image to be corrected that is closest to a bad pixel to be corrected and has the same color component as the bad pixel to be corrected.

[0020] like Figure 2FIG. 1 is a schematic diagram of a pixel array of an image to be corrected provided by the present embodiment. The sensor pixel array is usually composed of pixels of three color channels, red R, green G, and blue B, so that the image also includes pixel points of these three color components. For details, please refer to R, G, and B in the present embodiment 2. In addition, it should be noted that if there are bad pixels in the sensor pixel array of the present embodiment, then it is correspondingly reflected as bad pixel pixels with no pixel value on the image. For details, please refer to the present embodiment 2. Figure 2 It should be noted that in this embodiment Figure 2 The pixel with pixel value mark p4 is the bad pixel to be corrected, and its default color component is red. Then, a valid pixel with the same color component and the closest relative distance to it is searched from the image to be corrected as the first reference pixel. For details, please refer to this embodiment. Figure 2 It is worth noting that, in this embodiment, when obtaining the distance between the pixels, the distance between the center points of the pixels can be obtained as the relative distance between the two.

[0021] Step 102: Determine, from the image to be corrected, a plurality of pairs of second reference pixels that are symmetrically centered around the first reference pixel and have the same color components as the bad pixel to be corrected.

[0022] Specifically, all the second reference pixels of this embodiment are located at the periphery of the same rectangular array. In this embodiment, after obtaining the first reference pixel of the bad pixel to be corrected, multiple reference pixels are further obtained based on the reference pixel. Please refer to Figure 2 In this embodiment, the first reference pixel point marked by R4 is used as the symmetry center to plan a rectangular array in the overall pixel array in the order of array size from small to large. When the periphery of the rectangular array has multiple valid pixel points with the same color component as the bad pixel to be corrected that meet the quantity requirements, the multiple valid pixel points on the periphery of the rectangular array are used as second reference pixel points, that is, all the second reference pixel points are regularly distributed relative to the first reference pixel point as the center point.

[0023] In some implementations of this embodiment, the number of second reference pixel points is 8, including 4 corner points and 4 midpoints on the periphery of the rectangular array. It should be understood that the corner points of this embodiment are pixel points located at the right angles of the rectangular array, and the midpoints are pixel points located at the centers of the four sides of the rectangular array. That is, the second reference pixel points determined in this embodiment are Figure 2There are pixel points with pixel value labels R0, R1, R2, R3, R5, R6, R7 and R8, wherein the pixel points marked by R0, R2, R6 and R8 are the corner points of the periphery of the rectangular array, the pixel points marked by R1, R3, R5 and R7 are the midpoints of the periphery of the rectangular array, the pixel points marked by R0 and R8 are symmetrical with respect to the pixel points marked by R4, the pixel points marked by R1 and R7 are symmetrical with respect to the pixel points marked by R4, the pixel points marked by R2 and R6 are symmetrical with respect to the pixel points marked by R4, and the pixel points marked by R3 and R5 are symmetrical with respect to the pixel points marked by R4. It should be noted that, in this embodiment, a first reference pixel point and a plurality of second reference pixel points constitute all the reference pixel points required for the bad pixel to be corrected, refer to the aforementioned Figure 2 In the example of , the total number of reference pixels in this embodiment is preferably 9. It should be noted that if the coordinates of the bad pixel to be corrected are (x, y), the coordinates of the reference pixels are set as follows: (x-5, y-3), (x-1, y-3), (x+3, y-3), (x-5, y+1), (x-1, y+1), (x+3, y+1), (x-5, y+5), (x-1, y+5), (x+3, y+5), which correspond to the 9 reference pixels marked by R0 to R8.

[0024] Step 103: Acquire second pixel values ​​of a plurality of adjacent valid pixels of the bad pixel to be corrected by combining the first pixel values ​​of all reference pixels.

[0025] Specifically, the reference pixel and the adjacent valid pixel are both valid pixel with pixel value, and the difference between the two is that the reference pixel is the same valid pixel with the same color component as the bad pixel to be corrected, while due to the design of the sensor pixel array, not all adjacent valid pixel are the same valid pixel with the same color component as the bad pixel to be corrected, that is, at most only some adjacent valid pixel have the same color component as the bad pixel to be corrected. It should be understood that the relative distance between all second reference pixel and the bad pixel to be corrected in this embodiment is greater than the relative distance between all adjacent valid pixel and the bad pixel to be corrected, and the adjacent valid pixel includes the adjacent valid pixel that shares the same edge with the bad pixel to be corrected and the adjacent valid pixel that shares the same corner with the bad pixel to be corrected.

[0026] In some implementations of this embodiment, the number of adjacent valid pixels is 8, and one corner point of each adjacent pixel is connected to a corner point of the pixel to be corrected. Figure 2 , the adjacent valid pixels are the pixels with pixel value marks p0, p1, p2, p3, p5, p6, p7, and p8 in the figure. The pixel marked by p3 serves as both a reference pixel and an adjacent valid pixel. The value of the marked pixel value p3 is equal to R4.

[0027] In some implementations of the present embodiment, the step of obtaining the second pixel values ​​of multiple adjacent valid pixels of the bad pixel to be corrected by combining the first pixel values ​​of all reference pixels includes: dividing the multiple adjacent valid pixels of the bad pixel to be corrected into first adjacent valid pixels with the same color component as the bad pixel to be corrected and second adjacent valid pixels with different color components from the bad pixel to be corrected; obtaining the actual pixel value of the first adjacent valid pixel as the second pixel value, and calculating the second pixel value of the second adjacent valid pixel by combining the first pixel values ​​of all reference pixels.

[0028] Specifically, in this embodiment, the adjacent valid pixels are divided into two categories. The first category is the first adjacent valid pixels having the same color component as the bad pixel to be corrected, that is, Figure 2 The adjacent valid pixel point marked with p3 in the figure has an actual pixel value that can be directly used to calculate the corrected pixel value of the bad pixel; the second category is the adjacent valid pixel points with different color components from the bad pixel to be corrected, that is, Figure 2 The adjacent valid pixels marked with p0, p1, p2, p5, p6, p7, and p8 in the figure are different in color components from the bad pixel to be corrected, and thus cannot form a reference when calculating the corresponding corrected pixel value. Based on this, this embodiment calculates a virtual pixel value for the second adjacent valid pixel according to the actual pixel value of the reference pixel with the same color component as the bad pixel to be corrected, and uses the virtual pixel value as the second pixel value of the second adjacent valid pixel to participate in the calculation of the corrected pixel value of the bad pixel. Figure 2 Among them, p0, p1, p2, p5, p6, p7, and p8 represent the second pixel values ​​of the second adjacent valid pixels.

[0029] Furthermore, in some implementations of the present embodiment, the above-mentioned step of calculating the second pixel value of the second adjacent valid pixel by combining the first pixel values ​​of all reference pixels includes: setting the weight value of each reference pixel according to the relative distance between each reference pixel and the bad pixel to be corrected; and calculating the second pixel value of the second adjacent valid pixel by combining the first pixel values ​​of all reference pixels and the weight value.

[0030] Specifically, the pixel weight value of the present embodiment is negatively correlated with the relative distance between the above-mentioned reference pixel and the bad pixel to be corrected, that is, the farther the reference pixel is from the bad pixel to be corrected, the smaller its correlation with the bad pixel to be corrected, and a smaller weight value is set to participate in the second pixel value calculation. Conversely, the reference pixel with a closer distance has a relatively greater reference to the bad pixel to be corrected, and a larger weight value is set to participate in the second pixel value calculation.

[0031] Furthermore, in some implementations of the present embodiment, the above-mentioned step of calculating the second pixel value of the second adjacent valid pixel point by combining the first pixel values ​​and weight values ​​of all reference pixel points includes: for each second adjacent valid pixel point, obtaining from all reference pixel points a plurality of target reference pixel points whose relative distance to the second adjacent valid pixel point is less than or equal to a preset first distance threshold; based on the first pixel values ​​and weight values ​​of the plurality of target reference pixel points associated with each second adjacent valid pixel point, calculating the second pixel value of each second adjacent valid pixel point accordingly.

[0032] Specifically, in this embodiment, for each second adjacent valid pixel point, a target reference pixel point with an appropriate relative distance is preferably selected to calculate the second pixel value thereof. When calculating the second pixel value, the general pixel value calculation formula used can be expressed as:

[0033] pn=(α 1 R 1 +…+α n R n ) / (α 1 +…+α n );

[0034] Wherein, pn represents the second pixel value of the second adjacent valid pixel numbered n, {R 1 ,…,R n} represents the first pixel value of multiple target reference pixels associated with the second adjacent valid pixel, {α 1 ,…,α n} represents the weight values ​​of multiple target reference pixels associated with the second adjacent valid pixel.

[0035] In an exemplary embodiment, the calculation formulas for p0, p1, p2, p5, p6, p7, and p8 are as follows:

[0036] P0=(1*R0+3*R1+3*R3+9*R4) / 16

[0037] p1=(R1+R4) / 2

[0038] p2=(1*R5+3*R4+3*R2+9*R1) / 16

[0039] p5=(R1+R2+R4+R5) / 4

[0040] p6=(1*R1+3*R2+3*R4+9*R5) / 16

[0041] p7=(R4+R5) / 2

[0042] p8=(1*R8+3*R7+3*R5+9*R4) / 16.

[0043] Step 104: Calculate a correction pixel value of the bad pixel to be corrected based on the multiple second pixel values.

[0044] In some implementations of the present embodiment, when calculating the corrected pixel value of the bad pixel to be corrected based on multiple second pixel values, the horizontal pixel gradient, vertical pixel gradient, 45-degree pixel gradient and 135-degree pixel gradient can be calculated respectively in combination with the multiple second pixel values; then, all the pixel gradients are combined to determine multiple target adjacent valid pixel points in the target direction; finally, the average of the second pixel values ​​corresponding to the multiple target adjacent valid pixel points is calculated to obtain the corrected pixel value of the bad pixel to be corrected.

[0045] Specifically, when calculating pixel gradients in the horizontal direction, vertical direction, 45-degree direction, and 135-degree direction based on p0, p1, p2, p3, p5, p6, p7, and p8, the second pixel values ​​of multiple adjacent valid pixels in each target direction are respectively substituted into a preset gradient calculation formula, and the pixel gradient in each target direction is calculated accordingly. The gradient calculation formula is expressed as follows:

[0046] dv=(abs(p2-p6)*2+abs(p1-p3)*2+abs(p5-p7)*2) / 3

[0047] dh=(abs(p0-p8)*2+abs(p3-p7)*2+abs(p1-p5)*2) / 3

[0048] d45=(abs(2p1-p0-p2)+abs(p3-p5)*2+abs(2p7-p6-p8)) / 3

[0049] d135=(abs(2p3-p0-p6)+abs(p1-p7)*2+abs(2p5-p2-p8)) / 3;

[0050] Among them, dv represents the vertical pixel gradient, dh represents the horizontal pixel gradient, d45 represents the 45-degree pixel gradient, d135 represents the 135-degree pixel gradient, and abs() represents the absolute value.

[0051] Furthermore, in some implementations of the present embodiment, the above-mentioned step of determining multiple target adjacent valid pixel points in the target direction by combining all pixel gradients includes: determining the direction corresponding to the minimum pixel gradient among all pixel gradients as the target direction; and determining multiple adjacent valid pixel points among all adjacent valid pixel points in the target direction whose relative distance to the bad pixel to be corrected is less than or equal to a preset second distance threshold as target adjacent valid pixel points.

[0052] Specifically, this embodiment compares the pixel gradients in the above four directions, obtains the minimum gradient direction among the four directions, and then obtains multiple target adjacent valid pixel points that are closer to the bad pixel to be corrected among all adjacent valid pixel points in the minimum gradient direction. Next, the average value is calculated based on the multiple target adjacent valid pixel points to calculate the corrected pixel value that can be assigned to the bad pixel to be corrected.

[0053] For the bad pixel to be corrected marked by p4 in the present embodiment, if the pixel gradients in four directions are not equal, the calculation formula for the corrected pixel value can be expressed as:

[0054]

[0055] It should be understood that, in the embodiment, if the pixel gradients in the four directions are equal, that is, dv=dh=d45=d135, the calculation formula for the corrected pixel value can be expressed as:

[0056] p4=(p0+p1+p2+p3+p5+p6+p7+p8) / 8.

[0057] That is, in this embodiment, when the pixel gradients in all directions are equal, all adjacent valid pixels are determined as target adjacent valid pixels, and then the average value of these pixels is calculated to obtain the corrected pixel value of the bad pixel to be corrected.

[0058] Next, this embodiment further provides a refined image bad pixel correction method, such as Figure 3 FIG. 1 is a flow chart of a refined method for correcting bad pixel images provided by an embodiment of the present application. The method for correcting bad pixel images specifically includes the following steps:

[0059] Step 301, determining a first reference pixel in the image to be corrected which is closest to the bad pixel to be corrected and has the same color component as the bad pixel to be corrected;

[0060] Step 302: determine from the image to be corrected a plurality of pairs of second reference pixels that are symmetrically centered at the first reference pixel, are located at the periphery of the same rectangular array, and have the same color component as the bad pixel to be corrected;

[0061] Step 303: divide a plurality of adjacent valid pixels of the bad pixel to be corrected into first adjacent valid pixels having the same color component as the bad pixel to be corrected and second adjacent valid pixels having a different color component from the bad pixel to be corrected;

[0062] Step 304: obtaining the actual pixel value of the first adjacent valid pixel as the second pixel value, and setting the weight value of each reference pixel according to the relative distance between each reference pixel and the bad pixel to be corrected, and calculating the second pixel value of the second adjacent valid pixel by combining the first pixel values ​​and the weight values ​​of all reference pixels;

[0063] Step 305: Calculate the horizontal pixel gradient, the vertical pixel gradient, the 45-degree pixel gradient, and the 135-degree pixel gradient based on all second pixel values;

[0064] Step 306: determine the direction corresponding to the minimum pixel gradient among all pixel gradients as the target direction;

[0065] Step 307: Determine, among all adjacent valid pixels in the target direction, a plurality of adjacent valid pixels whose relative distance to the bad pixel to be corrected is less than or equal to a preset distance threshold as target adjacent valid pixels;

[0066] Step 308, calculating the average of the second pixel values ​​corresponding to a plurality of target adjacent valid pixels to obtain the corrected pixel value of the bad pixel to be corrected;

[0067] Step 309: Set the correction pixel value to the pixel value of the bad pixel to be corrected in the image to be corrected.

[0068] It should be understood that the size of the serial number of each step in this embodiment does not mean the order of execution of the steps. The execution order of each step should be determined by its function and internal logic, and should not constitute a sole limitation on the implementation process of the embodiment of this application.

[0069] Figure 4 An image bad pixel correction device is provided in one embodiment of the present application. The image bad pixel correction device can be used to implement the image bad pixel correction method in the above embodiment. The image bad pixel correction device mainly includes:

[0070] A first determination module 401 is used to determine a first reference pixel point in the image to be corrected that is closest to the bad pixel to be corrected and has the same color component as the bad pixel to be corrected;

[0071] A second determination module 402 is used to determine, from the image to be corrected, a plurality of pairs of second reference pixels having the first reference pixel as a symmetric center and having the same color component as the bad pixel to be corrected; wherein all the second reference pixels are located at the periphery of the same rectangular array;

[0072] An acquisition module 403 is used to acquire second pixel values ​​of a plurality of adjacent valid pixels of a bad pixel to be corrected by combining the first pixel values ​​of all reference pixels;

[0073] The calculation module 404 is used to calculate the correction pixel value of the bad pixel to be corrected based on the multiple second pixel values.

[0074] In some implementations of the present embodiment, the acquisition module is specifically used to: divide multiple adjacent valid pixel points of the bad pixel to be corrected into first adjacent valid pixel points with the same color component as the bad pixel to be corrected and second adjacent valid pixel points with different color components from the bad pixel to be corrected; obtain the actual pixel value of the first adjacent valid pixel point as the second pixel value, and calculate the second pixel value of the second adjacent valid pixel point in combination with the first pixel values ​​of all reference pixels.

[0075] In some implementations of the present embodiment, when the acquisition module performs the above-mentioned function of calculating the second pixel value of the second adjacent valid pixel point by combining the first pixel values ​​of all reference pixels, it is specifically used to: set the weight value of each reference pixel point according to the relative distance between each reference pixel point and the bad pixel to be corrected; calculate the second pixel value of the second adjacent valid pixel point by combining the first pixel values ​​of all reference pixels and the weight value.

[0076] In some implementations of the present embodiment, when the acquisition module performs the above-mentioned function of calculating the second pixel value of the second adjacent valid pixel point by combining the first pixel values ​​and weight values ​​of all reference pixel points, it is specifically used to: for each second adjacent valid pixel point, acquire from all reference pixel points a plurality of target reference pixel points whose relative distance to the second adjacent valid pixel point is less than or equal to a preset first distance threshold; based on the first pixel values ​​and weight values ​​of the plurality of target reference pixel points associated with each second adjacent valid pixel point, calculate the second pixel value of each second adjacent valid pixel point accordingly.

[0077] In some implementations of this embodiment, when the acquisition module performs the above-mentioned function of calculating the second pixel value of each second adjacent valid pixel point based on the first pixel value and weight value of multiple target reference pixel points associated with each second adjacent valid pixel point, it is specifically used to: substitute the first pixel value and weight value of multiple target reference pixel points associated with each second adjacent valid pixel point into a preset pixel value calculation formula, and calculate the second pixel value of each second adjacent valid pixel point accordingly; the pixel value calculation formula is expressed as:

[0078] pn=(α 1 R 1 +…+α n R n ) / (α 1 +…+α n )

[0079] Wherein, pn represents the second pixel value of the second adjacent valid pixel numbered n, {R 1 ,…,R n} represents the first pixel value of multiple target reference pixels associated with the second adjacent valid pixel, {α 1 ,…,α n} represents the weight values ​​of multiple target reference pixels associated with the second adjacent valid pixel.

[0080] In some implementations of the present embodiment, the calculation module is specifically used to: calculate the horizontal pixel gradient, the vertical pixel gradient, the 45-degree pixel gradient and the 135-degree pixel gradient respectively by combining multiple second pixel values; determine multiple target adjacent valid pixel points in the target direction by combining all pixel gradients; calculate the average of the second pixel values ​​corresponding to the multiple target adjacent valid pixel points to obtain the corrected pixel value of the bad pixel to be corrected.

[0081] In some implementations of the present embodiment, when the calculation module executes the above-mentioned function of determining multiple target adjacent valid pixel points in the target direction by combining all pixel gradients, it is specifically used to: determine the direction corresponding to the minimum pixel gradient among all pixel gradients as the target direction; and determine multiple adjacent valid pixel points among all adjacent valid pixel points in the target direction whose relative distance to the bad pixel to be corrected is less than or equal to a preset second distance threshold as target adjacent valid pixel points.

[0082] It should be noted that the image bad pixel correction methods in the aforementioned embodiments can all be implemented based on the image bad pixel correction device provided in this embodiment. Ordinary technicians in the relevant field can clearly understand that for the convenience and conciseness of description, the specific working process of the image bad pixel correction device described in this embodiment can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0083] Based on the technical solution of the above-mentioned embodiment of the present application, a first reference pixel point in the image to be corrected which is closest to the bad pixel to be corrected and has the same color component as the bad pixel to be corrected is determined; multiple pairs of second reference pixels with the first reference pixel point as the symmetric center, located at the periphery of the same rectangular array and having the same color component as the bad pixel to be corrected are determined from the image to be corrected; the second pixel values ​​of multiple adjacent valid pixels of the bad pixel to be corrected are obtained by combining the first pixel values ​​of all reference pixels; and the corrected pixel value of the bad pixel to be corrected is calculated based on the multiple second pixel values. Through the implementation of the solution of the present application, the pixel values ​​of the adjacent valid pixels of the bad pixel are simulated by using the pixel values ​​of multiple reference pixels of the same color component which are regularly arranged and sufficient in number, and then the corrected pixel value of the bad pixel is calculated based on the pixel values ​​of the adjacent valid pixels, which effectively ensures the accuracy of the final calculated corrected pixel value and improves the effect of image bad pixel correction.

[0084] Figure 5An electronic device provided in an embodiment of the present application can be used to implement the image bad pixel correction method in the above embodiment, mainly comprising:

[0085] The memory 501, the processor 502, and the computer program 503 stored in the memory 501 and executable on the processor 502 are connected to the memory 501 and the processor 502 via communication. When the processor 502 executes the computer program 503, the method in the aforementioned embodiment is implemented. The number of processors may be one or more.

[0086] The memory 501 may be a high-speed random access memory (RAM) memory, or a non-volatile memory, such as a disk memory. The memory 501 is used to store executable program codes, and the processor 502 is coupled to the memory 501 .

[0087] Furthermore, the embodiment of the present application also provides a computer-readable storage medium, which may be provided in the electronic device in the above embodiment. The computer-readable storage medium may be the above Figure 5 Memory in the illustrated embodiment.

[0088] The computer readable storage medium stores a computer program, and when the program is executed by the processor, the image bad pixel correction method in the above-mentioned embodiment is implemented. Further, the computer readable storage medium can also be a U disk, a mobile hard disk, a read-only memory (ROM), a RAM, a magnetic disk or an optical disk, etc., which can store program codes.

[0089] It should also be noted that the devices and methods disclosed in the several embodiments provided in this application can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0090] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0091] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.

[0092] If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a readable storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned readable storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.

[0093] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0094] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0095] The above is a description of the image bad pixel correction method, device, equipment and storage medium provided by the present application. For technicians in this field, according to the ideas of the embodiments of the present application, there may be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for correcting bad pixels in an image, characterized in that: include: Determine a first reference pixel in the image to be corrected that is closest to the bad pixel to be corrected and has the same color component as the bad pixel to be corrected; Determine from the image to be corrected a plurality of pairs of second reference pixels with the first reference pixel as the symmetric center and having the same color component as the bad pixel to be corrected; wherein all the second reference pixels are located at the periphery of the same rectangular array; Acquire second pixel values ​​of a plurality of adjacent valid pixels of the bad pixel to be corrected by combining the first pixel values ​​of all reference pixels; The corrected pixel value of the to-be-corrected bad pixel is calculated based on the plurality of second pixel values.

2. The image bad pixel correction method according to claim 1, characterized in that: The step of combining the first pixel values ​​of all reference pixels to obtain the second pixel values ​​of a plurality of adjacent valid pixels of the bad pixel to be corrected comprises: Divide the plurality of adjacent valid pixels of the bad pixel to be corrected into first adjacent valid pixels having the same color component as the bad pixel to be corrected and second adjacent valid pixels having a different color component from the bad pixel to be corrected; The actual pixel value of the first adjacent valid pixel point is obtained as the second pixel value, and the second pixel value of the second adjacent valid pixel point is calculated in combination with the first pixel values ​​of all reference pixels.

3. The image bad pixel correction method according to claim 2, characterized in that: The step of calculating the second pixel value of the second adjacent valid pixel point by combining the first pixel values ​​of all reference pixels comprises: The weight value of each reference pixel is set according to the relative distance between each reference pixel and the bad pixel to be corrected; The second pixel value of the second adjacent valid pixel is calculated by combining the first pixel values ​​of all reference pixels and the weight value.

4. The image bad pixel correction method according to claim 3, characterized in that: The step of calculating the second pixel value of the second adjacent valid pixel point by combining the first pixel values ​​of all reference pixels and the weight value comprises: For each of the second adjacent valid pixel points, a plurality of target reference pixel points whose relative distance to the second adjacent valid pixel point is less than or equal to a preset first distance threshold are acquired from all the reference pixel points; Based on the first pixel values ​​of the plurality of target reference pixels associated with the second adjacent valid pixels and the weight value, the second pixel value of each of the second adjacent valid pixels is calculated accordingly.

5. The image bad pixel correction method according to claim 4, characterized in that: The step of calculating the second pixel value of each of the second adjacent valid pixels based on the first pixel values ​​of the plurality of target reference pixels associated with each of the second adjacent valid pixels and the weight value comprises: Substitute the first pixel values ​​of the plurality of target reference pixels associated with each of the second adjacent valid pixels and the weight value into a preset pixel value calculation formula, and calculate the second pixel value of each of the second adjacent valid pixels accordingly; the pixel value calculation formula is expressed as: pn=(α1R1+…+α n R n ) / (α1+…+α n ) Wherein, pn represents the second pixel value of the second adjacent valid pixel numbered n, {R1,…,R n } represents the first pixel value of the plurality of target reference pixels associated with the second adjacent valid pixel, {α1,…,α n } represents the weight value of the multiple target reference pixel points associated with the second adjacent valid pixel point.

6. The image bad pixel correction method according to claim 1, characterized in that: The number of the second reference pixel points is 8, including 4 corner points and 4 midpoints of the periphery of the rectangular array.

7. The image bad pixel correction method according to claim 1, characterized in that: The number of adjacent valid pixels is 8, and one corner point of each adjacent pixel is connected to a corner point of the bad pixel to be corrected.

8. The image bad pixel correction method according to any one of claims 1 to 7, characterized in that: The step of calculating the corrected pixel value of the bad pixel to be corrected based on the plurality of second pixel values ​​comprises: Calculate the horizontal pixel gradient, the vertical pixel gradient, the 45-degree pixel gradient, and the 135-degree pixel gradient respectively by combining the plurality of the second pixel values; Combining all pixel gradients to determine multiple target adjacent valid pixel points in the target direction; The average of the second pixel values ​​corresponding to the plurality of target adjacent valid pixels is calculated to obtain the corrected pixel value of the bad pixel to be corrected.

9. The image bad pixel correction method according to claim 8, characterized in that: The step of combining all pixel gradients to determine a plurality of target adjacent valid pixel points in the target direction comprises: The direction corresponding to the minimum pixel gradient among all pixel gradients is determined as the target direction; Among all the adjacent valid pixels in the target direction, a plurality of adjacent valid pixels whose relative distance to the bad pixel to be corrected is less than or equal to a preset second distance threshold are determined as target adjacent valid pixels.

10. An image bad pixel correction device, characterized in that: include: A first determination module is used to determine a first reference pixel point in the image to be corrected that is closest to the bad pixel to be corrected and has the same color component as the bad pixel to be corrected; A second determination module is used to determine, from the image to be corrected, a plurality of pairs of second reference pixels having the first reference pixel as a symmetric center and having the same color component as the bad pixel to be corrected; wherein all the second reference pixels are located at the periphery of the same rectangular array; An acquisition module, configured to acquire second pixel values ​​of a plurality of adjacent valid pixels of the bad pixel to be corrected in combination with the first pixel values ​​of all reference pixels; A calculation module is used to calculate the corrected pixel value of the bad pixel to be corrected based on a plurality of the second pixel values.

11. An electronic device, characterized in that: The device comprises a memory and a processor, wherein: The processor is used to execute the computer program stored in the memory; When the processor executes the computer program, the steps of the image bad pixel correction method described in any one of claims 1 to 9 are implemented.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the image bad pixel correction method described in any one of claims 1 to 9 are implemented.

Citation Information

Patent Citations

  • Method and apparatus for compensating bad point

    CN101304485A

  • Image defective pixel correction method, device, electronic device and medium

    CN108765306A