Bad group correction method and device and electronic equipment

By dynamically determining the correction point set of bad pixels, the problem of difficult processing of clustered dead pixels in the existing technology is solved, and effective correction of single and clustered dead pixels is achieved, improving image quality.

CN119359661APending Publication Date: 2025-01-24FUJIAN XINTU PHOTOELECTRIC CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411400589.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-09
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

The prior art is difficult to effectively correct the bad points that appear in clusters in images, and conventional static bad point correction algorithms can only handle single bad points and cannot handle cluster-shaped bad points.

Method used

By dynamically determining the correction point set of bad pixels, the specific steps include determining the location of the bad pixels, searching and counting non-bad pixels circle by circle within its preset neighborhood, determining the correction point set based on the quantity threshold and the number of non-bad pixels, and based on the correction Point set corrects bad pixels.

Benefits of technology

It achieves effective correction of single bad pixels and bad pixels appearing in clusters, reduces the amount of calculation, and ensures good correction effects, avoiding blurring of image edge details and gray spots at the junction of light and dark.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119359661A_ABST
    Figure CN119359661A_ABST
Patent Text Reader

Abstract

The invention discloses a bad group correction method and device and electronic equipment, and the method comprises the steps: determining the position of a dead pixel, and enabling at least one dead pixel to form a bad group; in a preset neighborhood of the dead pixel in the to-be-corrected image, searching and counting non-dead pixels outwards circle by circle by taking the dead pixel as a center, and determining a correction point set corresponding to the dead pixel according to a preset number threshold value and the counted number of the non-dead pixels; and correcting the dead pixel according to the correction point set corresponding to the dead pixel. By dynamically determining the correction point set of the dead pixels, the calculation amount can be reduced, and the correction effect can be ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a bad cluster correction method, device and electronic equipment. Background Art

[0002] Due to the photosensitive characteristics of the chip and its own manufacturing process defects, some defective points will appear in the image. These defective pixels are called bad pixels. However, the existence of bad pixels is not limited to a single occurrence. There may be multiple pixels in the statistical window (such as 3×3 or 5×5, etc.) that are all bad pixels. Such single and multiple bad pixels are collectively called bad clusters. The size of the bad cluster is related to the characteristics of the chip. Large bad clusters seriously affect the image quality.

[0003] The position of the bad pixel cluster is generally generated by static calibration, that is, the bad pixel position is determined in advance based on the image information, and the correction method is still based on the idea of ​​single bad pixel correction. However, the conventional static bad pixel correction algorithm can only correct a single bad pixel, that is, extract a 3×3 neighborhood window centered on the bad pixel according to the position of the single bad pixel, and use the 3×3 neighborhood window data for correction. If there are many bad pixels in the window or all of them are bad pixels, the correction effect is poor. In other words, the conventional static bad pixel correction algorithm can only correct a single bad pixel, and cannot correct bad pixels that appear in clusters.

[0004] Another correction method is to create a large neighborhood window, such as 9×9 or 15×15, and correct the central bad pixel based on all the data in the window. This method uses a fixed-size correction window. Although it can correct the bad cluster, it consumes more resources because the window is too large. If the bad cluster is small, for example, when correcting a single bad pixel, still using a large window correction will cause blurred image edge details and gray spots at the junction of light and dark in the image. In other words, this method has a poor correction effect when correcting a single bad pixel. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a bad cluster correction method, device and electronic equipment, which can reduce the amount of calculation while ensuring the correction effect by dynamically determining the correction point set of the bad point.

[0006] In a first aspect, the present invention provides a bad cluster correction method, comprising:

[0007] Determine the position of bad pixels, at least one of the bad pixels forms a bad cluster;

[0008] In a preset neighborhood of the bad point in the image to be corrected, with the bad point as the center, search and count the non-bad points circle by circle outward, and determine the correction point set corresponding to the bad point according to a preset number threshold and the number of non-bad points counted;

[0009] The bad pixel is corrected according to the correction point set corresponding to the bad pixel.

[0010] In a second aspect, the present invention further provides a bad cluster correction device, comprising:

[0011] A first determination module is used to determine the position of a bad pixel, at least one of the bad pixels forms a bad cluster;

[0012] A second determination module is used to search and count non-bad points in a circle outward from the bad point as the center within a preset neighborhood of the bad point in the image to be corrected, and determine a correction point set corresponding to the bad point according to a preset number threshold and the number of non-bad points counted;

[0013] The correction module is used to correct the bad pixel according to the correction point set corresponding to the bad pixel.

[0014] In a third aspect, the present invention further provides an electronic device, the electronic device comprising:

[0015] one or more processors;

[0016] A storage device for storing one or more programs;

[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the first aspect.

[0018] The beneficial effects of the present invention are as follows: by calibrating the position of the bad pixel and adaptively determining the correction point set according to the number of non-bad pixels in the neighborhood of the bad pixel, it is possible to correct both a single bad pixel and bad pixels that appear in clusters, thereby reducing the amount of calculation and ensuring a good correction effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 This is a flow chart of a bad cluster correction method according to the first embodiment of the present invention;

[0020] Figure 2 Schematic diagram of a 7×9 neighborhood of a bad pixel in Embodiment 1 of the present invention;

[0021] Figure 3 Schematic diagram of the search circle in the first embodiment of the present invention Figure 1 ;

[0022] Figure 4 Schematic diagram of the search circle in the first embodiment of the present invention Figure 2 ;

[0023] Figure 5 Schematic diagram of the search circle in the first embodiment of the present invention Figure 3 ;

[0024] Figure 6A schematic diagram of the structure of a bad cluster correction device provided by the present invention;

[0025] Figure 7 The present invention provides a schematic structural diagram of an electronic device. DETAILED DESCRIPTION

[0026] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0027] Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the steps as sequential processes, many of the steps therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of the steps can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, sub-computer program, etc.

[0028] In addition, the terms "first", "second", etc. can be used in this article to describe various directions, actions, steps or elements, but these directions, actions, steps or elements are not limited by these terms. These terms are only used to distinguish a first direction, action, step or element from another direction, action, step or element. For example, without departing from the scope of the present application, the first information can be referred to as the second information, and similarly, the second information can be referred to as the first information. Both the first information and the second information are information, but they are not the same information. The terms "first", "second", etc. cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first" and "second" can expressly or implicitly include one or more of the features. In the description of the present invention, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0029] See also Figure 1 , a bad cluster correction method, comprising:

[0030] Determine the position of bad pixels, at least one of the bad pixels forms a bad cluster;

[0031] In a preset neighborhood of the bad point in the image to be corrected, with the bad point as the center, search and count the non-bad points circle by circle outward, and determine the correction point set corresponding to the bad point according to a preset number threshold and the number of non-bad points counted;

[0032] The bad pixel is corrected according to the correction point set corresponding to the bad pixel.

[0033] From the above description, it can be seen that the beneficial effect of the present invention is that it can realize the correction of both single bad pixels and bad pixels that appear in clusters, thereby reducing the amount of calculation and ensuring a good correction effect.

[0034] Furthermore, within a preset neighborhood of the bad point in the image to be corrected, the bad point is taken as the center, and non-bad points are searched circle by circle outward and counted, and a correction point set corresponding to the bad point is determined according to a preset number threshold and the number of non-bad points counted, including:

[0035] In a preset neighborhood of the bad pixel in the image to be corrected, with the bad pixel as the center, search and count the non-bad pixels circle by circle outward;

[0036] When the total number of non-bad pixels found exceeds a preset threshold, the search is stopped and the counted non-bad pixels are used as the correction point set corresponding to the bad pixels;

[0037] When the total number of non-bad points searched within the preset neighborhood does not exceed a preset number threshold, all the non-bad points counted within the preset neighborhood are used as the correction point set corresponding to the bad point.

[0038] From the above description, it can be seen that according to the number of non-bad points in the neighborhood and the position distribution of these non-bad points relative to the bad points, the correction point set is adaptively determined, which can reduce the amount of calculation while ensuring the correction effect.

[0039] Further, searching for non-bad pixels circle by circle outwards includes: searching for pixels in each search circle in a circle-by-circle manner;

[0040] Among them, the distance between the pixel points in the same search circle and the bad point is the same, and the distance is Euclidean distance, urban area distance or chessboard distance; or, the Euclidean distance between the pixel points in the kth search circle and the bad point is (k-1, k].

[0041] From the above description, it can be seen that by searching for non-bad points from near to far according to the distance between the bad points and the bad points, the correction point set can be accurately and effectively determined.

[0042] Furthermore, if the total number of non-bad pixels searched exceeds a preset threshold value when the t-th search circle is searched, the non-bad pixels counted include the non-bad pixels that have been searched, or the non-bad pixels counted include the non-bad pixels that have been searched and the non-bad pixels that have not been searched in the t-th search circle.

[0043] From the above description, it can be known that the non-bad pixels can be counted one by one or circle by circle.

[0044] Furthermore, the pixels in the search circle include bad pixels and / or non-bad pixels, that is, the pixels in the search circle may all be bad pixels, may all be non-bad pixels, or may include both bad pixels and non-bad pixels.

[0045] Furthermore, the image to be corrected includes at least one bad cluster, and the bad cluster is composed of a bad pixel and other bad pixels in its 8-neighborhood.

[0046] Further, the correcting the bad pixel according to the correction point set corresponding to the bad pixel includes:

[0047] Calculating the correction weights of each non-bad point in the correction point set corresponding to a bad point respectively, and calculating the correction value corresponding to the bad point according to the pixel values ​​and correction weights of each non-bad point in the correction point set corresponding to the bad point;

[0048] Correct the bad pixel according to the correction value corresponding to the bad pixel.

[0049] From the above description, it can be seen that bad pixel correction is achieved based on the weight distribution method, so that no gray spots appear at the junction of light and dark in the corrected image, which can ensure the clarity of the image edge and the integrity of the texture details, and improve the image quality.

[0050] Further, respectively calculating the correction weights of each non-bad point in the correction point set corresponding to a bad point, and calculating the correction value corresponding to the bad point according to the pixel values ​​and correction weights of each non-bad point in the correction point set corresponding to the bad point, includes:

[0051] Calculating the correction weight of each non-bad point in the correction point set corresponding to the bad point according to the distance between each non-bad point in the correction point set corresponding to the bad point and the bad point;

[0052] Performing weighted summation according to the pixel values ​​and correction weights of each non-bad pixel in the correction point set corresponding to the bad pixel to obtain a weighted cumulative value;

[0053] Accumulating the correction weights of the non-bad points in the correction point set corresponding to the bad point to obtain a weight accumulation value;

[0054] A correction value corresponding to the bad pixel is calculated according to the weighted accumulated value and the weight accumulated value.

[0055] From the above description, it can be seen that the weight of the non-bad pixel is generated according to the distance between the non-bad pixel and the bad pixel, and correction is achieved based on the weight distribution method, which can ensure the clarity of the image edge and the integrity of the texture details.

[0056] Further, determining the bad pixel location includes:

[0057] Acquire at least one calibration image, where the calibration image is a dark field image or a bright field image;

[0058] A mean image is calculated based on the calibration image, and a basic detection threshold is determined based on the average pixel value and the median pixel value of each pixel point in the mean image;

[0059] If a pixel in the mean image is larger than a corresponding first bad pixel detection threshold or smaller than a corresponding second bad pixel detection threshold, the pixel is determined to be a bad pixel;

[0060] The first bad pixel detection threshold corresponding to the pixel is bp_th+(median a / radio), the corresponding second bad pixel detection threshold is bp_th-(median a / radio), bp_th represents the basic detection threshold, median a represents the median pixel value of the a×a neighborhood of the pixel point in the mean image, a is a preset value and a is an odd number, and radio represents a preset proportional coefficient.

[0061] From the above description, it can be seen that the bad pixel position is calibrated according to the dark field and bright field image data of the Sensor, which ensures the accuracy of bad pixel detection; by combining the basic detection threshold and the pixel values ​​of other pixels in the neighborhood of the pixel, the bad pixel detection threshold corresponding to the pixel is further determined, thereby further improving the accuracy of bad pixel detection.

[0062] Furthermore, if the a×a neighborhood of a pixel point is incomplete, the a×a neighborhood of the pixel point is filled according to the pixel values ​​of other pixel points around the pixel point.

[0063] From the above description, it can be seen that the integrity of neighborhood acquisition is guaranteed.

[0064] Furthermore, the determining of the bad pixel location further includes:

[0065] The bad pixel determined when the calibration image is a dark field image is taken as the first bad pixel, and the bad pixel determined when the calibration image is a bright field image is taken as the second bad pixel, the union of the first bad pixel and the second bad pixel is obtained, and the row and column coordinates of each bad pixel in the union are recorded.

[0066] It can be seen from the above description that the accuracy of bad pixel calibration results can be improved.

[0067] The present invention also proposes a bad cluster correction device, comprising:

[0068] A first determination module is used to determine the position of a bad pixel, at least one of the bad pixels forms a bad cluster;

[0069] A second determination module is used to search and count non-bad points in a circle outward from the bad point as the center within a preset neighborhood of the bad point in the image to be corrected, and determine a correction point set corresponding to the bad point according to a preset number threshold and the number of non-bad points counted;

[0070] A correction module is used to correct the bad pixel according to the correction point set corresponding to the bad pixel.

[0071] The present invention further provides an electronic device, comprising:

[0072] one or more processors;

[0073] A storage device for storing one or more programs;

[0074] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.

[0075] Embodiment 1

[0076] Please refer to Figure 1-5 , Embodiment 1 of the present invention is: a bad pixel correction method, such as Figure 1 As shown, the following steps are included:

[0077] S1: Determine the bad pixel position, that is, perform bad pixel position calibration.

[0078] Among them, at least one bad pixel forms a bad cluster. There may be one or more bad clusters in the image, each bad cluster includes at least one bad pixel, and the number of bad pixels contained in different bad clusters may be the same or different. In this embodiment, a bad pixel and other bad pixels in its 8-neighborhood can be regarded as a bad cluster. If there are no other bad pixels in the 8-neighborhood of the bad pixel, the bad pixel can also be regarded as a bad cluster. That is to say, when a bad cluster includes more than two bad pixels, the bad cluster includes the central bad pixel and other bad pixels adjacent to the central bad pixel in its 8-neighborhood.

[0079] In this embodiment, the bad pixel position is calibrated according to the dark field image and the bright field image. Specifically, this step includes the following steps:

[0080] S101: Acquire at least one dark field image and bright field image respectively, wherein the dark field image is an image captured in a dark field environment, and the bright field image is an image captured in a bright field environment with the grayscale value adjusted to half saturation.

[0081] For example, k images are taken with the camera covered with a dust cover as dark-field images; the camera is placed under an integrating sphere, the image grayscale value is adjusted to about half saturation, and k images are taken as bright-field images.

[0082] In actual application scenarios, the grayscale value range of a bright field image can be the maximum grayscale value of the image / 2±10, where the maximum grayscale value of the image is related to the bit depth of the image. For example, when the bit depth of the image is 8 bits (that is, the color of each pixel is represented by an 8-bit binary number), the maximum grayscale value of the image is 255. At this time, the grayscale value of the bright field image can be 128±10.

[0083] S102: Calculate a first mean image based on each dark field image, and calculate a second mean image based on each bright field image.

[0084] That is, the pixel values ​​of the pixels at the same position in the k dark-field images are averaged to obtain the first average image dark_ave. Similarly, the pixel values ​​of the pixels at the same position in the k bright-field images are averaged to obtain the second average image light_ave.

[0085] S103: Determine a first basic detection threshold and a second basic detection threshold according to the first mean image and the second mean image respectively.

[0086] Specifically, according to the pixel value of each pixel in the first mean image, the first mean and the first median are determined, that is, the average value of the pixel values ​​of each pixel in the first mean image dark_ave is calculated to obtain the first mean, and the median of the pixel values ​​of each pixel in the first mean image dark_ave is used as the first median; then the average value of the first mean and the first median is calculated to obtain the first basic detection threshold bp_th_dark.

[0087] Similarly, according to the pixel value of each pixel in the second mean image light_ave, the second mean and the second median are determined, and the average of the second mean and the second median is calculated to obtain the second basic detection threshold bp_th_light.

[0088] S104: determining a first bad pixel in the first mean image according to a first basic detection threshold, and determining a second bad pixel in the second mean image according to a second basic detection threshold.

[0089] Specifically, traverse each pixel point in the first mean image dark_ave, and obtain a pixel point in sequence as the current pixel point; calculate the first bad pixel detection threshold and the second bad pixel detection threshold corresponding to the current pixel point according to the first basic detection threshold bp_th_dark and the neighborhood information of the current pixel point; if the pixel value of the current pixel point is greater than the corresponding first bad pixel detection threshold or less than the corresponding second bad pixel detection threshold, the current pixel point is determined to be the first bad pixel.

[0090] In this embodiment, the first bad pixel detection threshold corresponding to a pixel in the first mean value image is bp_th_dark+(median_dark a / radio), the corresponding second bad pixel detection threshold is bp_th_dark-(median_dark a / radio), where median_dark a represents the median pixel value of the a×a neighborhood of the pixel point in the first mean image, where a is a preset value and a is an odd number. In this embodiment, a=3; radio represents a preset proportional coefficient, which can be adjusted according to the chip characteristics. In this embodiment, radio=32.

[0091] That is, if the pixel value dark_ave(row,col) of a pixel in the first mean image satisfies: bp_th_dark-(median_dark a / radio)≤dark_ave(row,col)≤bp_th_dark+(median_dark a / radio), then the pixel is not a bad pixel, otherwise the pixel is a bad pixel.

[0092] Similarly, traverse each pixel in the second mean image light_ave and obtain a pixel in sequence as the current pixel; calculate the first bad pixel detection threshold and the second bad pixel detection threshold corresponding to the current pixel according to the second basic detection threshold bp_th_light and the neighborhood information of the current pixel; if the pixel value of the current pixel is greater than the corresponding first bad pixel detection threshold or less than the corresponding second bad pixel detection threshold, the current pixel is determined to be the second bad pixel.

[0093] The first bad pixel detection threshold corresponding to a pixel in the second mean image is bp_th_light+(median_light a / radio), the corresponding second bad pixel detection threshold is bp_th_light-(median_light a / radio), where median_light a Represents the median pixel value of the a×a neighborhood of the pixel in the second mean image.

[0094] That is, if the pixel value light_ave(row,col) of a pixel in the second mean image satisfies: bp_th_light-(median_light a / radio)≤light_ave(row,col)≤bp_th_light+(median_lighta / radio), then the pixel is not a bad pixel, otherwise the pixel is a bad pixel.

[0095] Furthermore, for the pixels located at the edge of the image, it is not possible to obtain a complete a×a neighborhood. In this regard, the a×a neighborhood of these pixels can be filled according to the pixel values ​​of other pixels around these pixels. In this embodiment, these pixels can be symmetrically filled with them as the center. For example, assuming a=3, for a row of pixels at the top of the image, a row of pixels is expanded upward so that a complete 3×3 neighborhood can be obtained, and the pixel values ​​of the expanded pixels can refer to the pixel values ​​of the pixels in the row below (i.e., the second row from the top of the image).

[0096] S105: The union of the first bad pixel and the second bad pixel is used as a bad pixel set, and the row and column coordinates of each bad pixel in the bad pixel set are recorded, that is, the row and column coordinates of all bad pixels are stored as bad pixel position calibration results for subsequent bad pixel correction.

[0097] S2: In the image to be corrected, within the preset neighborhood of the bad pixel, with the bad pixel as the center, search and count the non-bad pixels in a circle outward, and determine the correction point set corresponding to the bad pixel based on the number of non-bad pixels counted and a preset number threshold.

[0098] That is, within a certain area around the bad pixel, the correction point set corresponding to the bad pixel is adaptively determined according to the number of non-bad pixels and the position distribution of these non-bad pixels relative to the bad pixel, and the bad pixel is subsequently corrected based on the non-bad pixels in the correction point set.

[0099] Specifically, in the n×m neighborhood of the bad point, n and m are preset odd numbers, and the bad point is taken as the center, and the non-bad points are searched and counted in circles outward; when the total number of non-bad points searched exceeds the preset number threshold, the search is stopped, and the counted non-bad points are used as the correction point set corresponding to the bad point; when the total number of non-bad points searched in the n×m neighborhood of the bad point does not exceed the preset number threshold, all non-bad points in the n×m neighborhood of the bad point are used as the correction point set corresponding to the bad point.

[0100] The outward search is performed circle by circle, that is, the pixels of each search circle are searched one by one in an outward manner.

[0101] In this embodiment, the distance between the pixel points in the same search circle and the bad point is the same, where the distance can be the Euclidean distance (defined as the straight-line distance between two points), the urban distance (also called Manhattan distance or L1 distance, in two-dimensional space, the urban distance is defined as the sum of the absolute differences between two points on the x-axis and y-axis) or the chessboard distance (also called infinite norm distance, defined as the maximum difference between two points on each coordinate.), and the Euclidean distance between the pixel point in the kth search circle and the bad point can also be defined as (k-1, k].

[0102] For example, assuming the neighborhood size is 7×9, the 7×9 neighborhood of a bad pixel is Figure 2 As shown, Figure 2 The central pixel d5 in is the bad pixel, and its row and column coordinates in the neighborhood are [4,5].

[0103] When the distance is Euclidean, the search circle is Figure 3 As shown, the numbers in the figure represent the order of the search circles, and the same numbers represent the same search circle. For example, the pixel points at number 1 are the pixel points in the first search circle, and the Euclidean distances between these pixel points and the bad pixel at d5 are all 1; the pixel points at number 2 are the pixel points in the second search circle, and the Euclidean distances between these pixel points and the bad pixel at d5 are all √2; the pixel points at number 3 are the pixel points in the third search circle, and the Euclidean distances between these pixel points and the bad pixel at d5 are all 2; and so on.

[0104] When the distance is the chessboard distance, the search circle is as follows Figure 4 As shown, similarly, the numbers in the figure represent the order of the search circles, and the same numbers represent the same search circle.

[0105] When the Euclidean distance between the pixel point in the kth search circle and the bad pixel is defined as (k-1, k], the search circle is as follows Figure 5 As shown in the figure, similarly, the numbers in the figure represent the order of the search circles, and the same numbers represent the same search circle. The Euclidean distance between the pixel point in the first search circle and the bad pixel is (0,1], and the Euclidean distance between the bad pixel at d5 and the four pixels above, below, left and right of it (i.e., the pixels at c5, e5, d4, and d5) is 1, so these four pixels are used as the first search circle; the Euclidean distance between the pixel point in the second search circle and the bad pixel is (1,2], and the Euclidean distance between the pixel points at c4, c6, e4, and e6 and the bad pixel at d5 is √2, and the Euclidean distance between the pixel points at b5, f5, d3, and d7 and the bad pixel at d5 is 2, so these eight pixels are used as the second search circle; and so on.

[0106] Furthermore, in this embodiment, the non-bad pixels counted are non-bad pixels searched in the process of searching circle by circle. For example, assuming that when the first pixel point of the third search circle is searched (the pixel point is a non-bad pixel), the number of non-bad pixels searched reaches a preset threshold value, then the non-bad points in the first two search circles and the first pixel point searched in the third search circle are used as the correction point set.

[0107] In other embodiments, the non-bad points counted are the non-bad points in the search circles that have been searched in the process of searching circle by circle. For example, assuming that when the first pixel point of the third search circle is searched (the pixel point is a non-bad point), the number of non-bad points searched reaches a preset threshold value, then in addition to the non-bad points in the first two search circles and the first pixel point searched in the third search circle as the correction point set, other non-bad points in the third search circle are also used as the correction point set, that is, all non-bad points in the first three search circles are used as the correction point set.

[0108] Further, after determining the correction point set corresponding to the bad pixel, the row and column coordinates of each non-bad pixel in the correction point set are recorded. In this embodiment, the row and column coordinates of the non-bad pixel in the image coordinate system (i.e., a coordinate system established with the upper left corner of the image to be corrected as the origin, the right direction as the positive direction of the X axis, and the downward direction as the positive direction of the Y axis) are recorded.

[0109] In another optional embodiment, what is recorded are the row and column coordinates of the non-bad point in the neighborhood coordinate system of the bad point corresponding to the correction point set to which it belongs (i.e., a coordinate system established with the upper left corner of the n×m neighborhood of the bad point as the origin, the right direction as the positive direction of the X-axis, and the downward direction as the positive direction of the Y-axis).

[0110] S3: Correcting the bad pixel according to the correction point set corresponding to the bad pixel.

[0111] For the convenience of description, in this embodiment, a non-bad point in the correction point set corresponding to a bad point is used as the correction point corresponding to the bad point.

[0112] Specifically, this step includes the following steps:

[0113] S301: Calculate the correction weight of each correction point corresponding to a bad point according to the distance between each correction point corresponding to the bad point and the bad point. Specifically, the correction weight calculation formula is:

[0114]

[0115] Among them, (dp row ,dp col ) represents the row and column coordinates of the bad point, (gp row ,gp col ) represents the row and column coordinates of a correction point corresponding to the bad pixel, weight(gprow ,gp col ) represents the correction weight of the correction point. It should be noted that the row and column coordinates of the bad point and its corresponding correction point here are coordinates in the same coordinate system (image coordinate system or neighborhood coordinate system corresponding to the bad point).

[0116] S302: performing weighted summation according to the pixel values ​​and correction weights of each correction point corresponding to the bad pixel to obtain a weighted accumulated value.

[0117] S303: Accumulate the correction weights of the correction points corresponding to the bad pixel to obtain a weight accumulation value.

[0118] S304: Calculate the correction value corresponding to the bad pixel according to the weighted cumulative value and the weighted cumulative value, that is, divide the weighted cumulative value by the weighted cumulative value to obtain the correction value corresponding to the bad pixel.

[0119] S305: Correct the bad pixel according to the correction value corresponding to the bad pixel, that is, modify the pixel value of the bad pixel to its corresponding correction value to complete the correction.

[0120] In actual application scenarios, a bad pixel may be corrected after the correction point set corresponding to the bad pixel is determined, or all bad pixels may be corrected after the correction point sets corresponding to all bad pixels are determined.

[0121] In this embodiment, the bad pixel position is calibrated according to the dark field and bright field image data of the Sensor, thereby ensuring the accuracy of bad pixel detection; by adaptively determining the correction point set according to the number of non-bad pixels in the bad pixel neighborhood and the position distribution of these non-bad pixels relative to the bad pixel, it is possible to correct both a single bad pixel and bad pixels that appear in clusters, thereby reducing the amount of calculation while ensuring the bad pixel correction effect, and no gray dots will appear at the light and dark boundaries of the corrected image; bad pixel correction is achieved by a weight distribution-based method, which can ensure the clarity of the edge and texture details of the corrected image and improve image quality.

[0122] Embodiment 2

[0123] Please refer to Figure 6 The second embodiment of the present invention is: a bad cluster correction device, which can execute the bad cluster correction method provided by the first embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. The device can be implemented by software / or hardware, specifically including:

[0124] A first determination module 601 is used to determine the position of a bad pixel, at least one of the bad pixels forming a bad cluster;

[0125] The second determination module 602 is used to search and count non-bad points in a circle outward from the bad point as the center within a preset neighborhood of the bad point in the image to be corrected, and determine the correction point set corresponding to the bad point according to a preset number threshold and the number of non-bad points counted;

[0126] The correction module 603 is used to correct the bad pixel according to the correction point set corresponding to the bad pixel.

[0127] Embodiment 3

[0128] Please refer to Figure 7 , Embodiment 3 of the present invention is: an electronic device, the electronic device comprising:

[0129] One or more processors 701;

[0130] Storage device 702, used to store one or more programs;

[0131] When the one or more programs are executed by the one or more processors 701, the one or more processors 701 implement the various processes in the bad cluster correction method embodiment as described above, and can achieve the same technical effect. To avoid repetition, they are not repeated here.

[0132] In summary, the present invention provides a bad cluster correction method, device and electronic device, which improves the accuracy of bad pixel calibration by calibrating the bad pixel position according to the dark field image and the bright field image; adaptively determines the correction point set according to the number of non-bad pixels in the bad pixel neighborhood and the position distribution of these non-bad pixels relative to the bad pixel, and implements bad pixel correction based on weight distribution, so that gray points will not appear at the light and dark junction of the corrected image, and the clarity of the image edge and the integrity of the texture details can be guaranteed, thereby improving the image quality. The present invention can realize the correction of both single bad pixels and bad pixels that appear in clusters, reducing the amount of calculation while ensuring a good correction effect.

[0133] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (FLASH), a hard disk or an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0134] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A bad cluster correction method, characterized in that: include: Determine the position of bad pixels, at least one of the bad pixels forms a bad cluster; In a preset neighborhood of the bad point in the image to be corrected, with the bad point as the center, search and count the non-bad points circle by circle outward, and determine the correction point set corresponding to the bad point according to a preset number threshold and the number of non-bad points counted; The bad pixel is corrected according to the correction point set corresponding to the bad pixel.

2. The bad cluster correction method according to claim 1, characterized in that: The method further comprises: searching and counting non-bad points in a circle outwards with the bad point as the center within a preset neighborhood of the bad point in the image to be corrected, and determining a correction point set corresponding to the bad point according to a preset number threshold and the number of non-bad points counted, including: In a preset neighborhood of the bad pixel in the image to be corrected, with the bad pixel as the center, search and count the non-bad pixels circle by circle outward; When the total number of non-bad pixels found exceeds a preset threshold, the search is stopped and the counted non-bad pixels are used as the correction point set corresponding to the bad pixels; When the total number of non-bad points searched within the preset neighborhood does not exceed a preset number threshold, all the non-bad points counted within the preset neighborhood are used as the correction point set corresponding to the bad point.

3. The bad cluster correction method according to claim 1, characterized in that: Searching and counting non-bad pixels circle by circle outwards includes: searching and counting the pixels of each search circle in a circle-by-circle manner; Among them, the distance between the pixel points in the same search circle and the bad point is the same, and the distance is Euclidean distance, urban area distance or chessboard distance; or, the Euclidean distance between the pixel points in the kth search circle and the bad point is (k-1, k].

4. The bad cluster correction method according to claim 3, characterized in that: If the total number of non-bad pixels searched exceeds a preset threshold value when searching the t-th search circle, the non-bad pixels counted include the non-bad pixels that have been searched, or the non-bad pixels counted include the non-bad pixels that have been searched and the non-bad pixels that have not been searched in the t-th search circle.

5. The bad cluster correction method according to claim 1, characterized in that: The correcting the bad pixel according to the correction point set corresponding to the bad pixel comprises: Calculating the correction weights of each non-bad point in the correction point set corresponding to a bad point respectively, and calculating the correction value corresponding to the bad point according to the pixel values ​​and correction weights of each non-bad point in the correction point set corresponding to the bad point; Correct the bad pixel according to the correction value corresponding to the bad pixel.

6. The bad cluster correction method according to claim 5, characterized in that: The step of respectively calculating the correction weights of the non-bad points in the correction point set corresponding to the bad point, and calculating the correction value corresponding to the bad point according to the pixel values ​​and correction weights of the non-bad points in the correction point set corresponding to the bad point, comprises: Calculating the correction weight of each non-bad point in the correction point set corresponding to the bad point according to the distance between each non-bad point in the correction point set corresponding to the bad point and the bad point; Performing weighted summation according to the pixel values ​​and correction weights of each non-bad pixel in the correction point set corresponding to the bad pixel to obtain a weighted cumulative value; Accumulating the correction weights of the non-bad points in the correction point set corresponding to the bad point to obtain a weight accumulation value; A correction value corresponding to the bad pixel is calculated according to the weighted accumulated value and the weight accumulated value.

7. The bad cluster correction method according to claim 1, characterized in that: Determining the bad pixel location includes: Acquire at least one calibration image, where the calibration image is a dark field image or a bright field image; According to the calibration image, a mean image is calculated, and a basic detection threshold is determined according to the average pixel value and the median pixel value of each pixel point in the mean image; If a pixel in the mean image is larger than a corresponding first bad pixel detection threshold or smaller than a corresponding second bad pixel detection threshold, the pixel is determined to be a bad pixel; The first bad pixel detection threshold corresponding to the pixel is bp_th+(median a / radio), the corresponding second bad pixel detection threshold is bp_th-(median a / radio), bp_th represents the basic detection threshold, median a represents the median pixel value of the a×a neighborhood of the pixel point in the mean image, a is a preset value and a is an odd number, and radio represents a preset proportional coefficient.

8. The bad cluster correction method according to claim 7, characterized in that: The determining of the bad pixel position also includes: The bad pixel determined when the calibration image is a dark field image is taken as the first bad pixel, and the bad pixel determined when the calibration image is a bright field image is taken as the second bad pixel, the union of the first bad pixel and the second bad pixel is obtained, and the row and column coordinates of each bad pixel in the union are recorded.

9. A bad cluster correction device, characterized in that: include: A first determination module is used to determine the position of a bad pixel, at least one of the bad pixels forms a bad cluster; A second determination module is used to search and count non-bad points in a circle outward from the bad point as the center within a preset neighborhood of the bad point in the image to be corrected, and determine a correction point set corresponding to the bad point according to a preset number threshold and the number of non-bad points counted; A correction module is used to correct the bad pixel according to the correction point set corresponding to the bad pixel.

10. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.