Bad pixel correction method, device, terminal equipment and storage medium
By using a preset scanning sequence and size judgment window in the image sensor to determine the target area and judgment sub-area, and using non-bad pixels to determine the correction value to correct the bad pixels of the image sensor, the problem of bad pixels or bad clusters being unable to be corrected in the existing technology is solved, and the correction efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202211691060.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-27
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2042-12-27
AI Technical Summary
In the prior art, due to the size and shape of bad pixels or bad clusters of the image sensor, it is impossible to determine the correction value within a 3*3 window, and it is impossible to effectively correct the bad pixels in the image to be processed obtained by the image sensor.
The image to be processed is scanned one by one from the first starting point in a preset scanning sequence, the first bad pixel is determined as the target point, the target area and the determination sub-area are determined based on a preset size determination window, and the correction value is determined using the non-bad pixels in the determination sub-area or the non-bad pixels in the target area to correct the bad pixels.
The accurate correction of each bad pixel in the image to be processed obtained by the image sensor is achieved, the correction efficiency and accuracy are improved, and the number of judgments in the correction process is reduced.
Smart Images

Figure CN116017182B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a bad pixel correction method, apparatus, terminal device and storage medium. Background Art
[0002] An image sensor is a sensor chip that converts light signals reflecting image information into electrical signals. Due to processing techniques, aging, and other factors, some photosensitive cells on the image sensor may experience abnormal responses, resulting in pixels (i.e., bad pixels) with brightness differences from normal pixels appearing in the processed image. Multiple adjacent bad pixels form a bad cluster.
[0003] In the related art, the bad pixel correction in the image to be processed is usually performed within a 3*3 window centered on the bad pixel. The correction value used for the bad pixel correction is calculated through the normal pixel points (i.e., non-bad pixels) in the 3*3 window, and then the pixel of the bad pixel is adjusted based on the correction value.
[0004] However, in the actual correction process, due to the influence of the size and shape of the bad clusters in the image to be processed, there may not be normal pixels in the 3*3 window, which leads to inaccurate correction values. Correspondingly, the bad pixels cannot be corrected based on the correction values. For example, Figure 1 A schematic diagram of a bad cluster in an image to be processed is shown in FIG. Figure 1 As shown, in the bad cluster 110 , all pixels within the 3*3 window 120 are bad pixels, making it impossible to determine the correction value of the bad pixel d22 .
[0005] Therefore, there is an urgent need for a method that can correct each bad pixel in the image to be processed. Summary of the Invention
[0006] In order to solve the technical problem that bad pixels or bad clusters cannot be corrected in the image to be processed obtained by the image sensor, the present application provides a bad pixel correction method, apparatus, terminal device and storage medium.
[0007] The embodiment of the present application is implemented as follows:
[0008] A first aspect of an embodiment of the present application provides a bad pixel correction method, comprising the following steps:
[0009] Scanning pixels in the image to be processed one by one from a first starting point in a preset scanning order, and determining the first bad pixel in the image to be processed scanned as a first target point, wherein the first starting point is a non-bad pixel in the image to be processed;
[0010] Based on a predetermined size judgment window, a first target area centered on the first target point is determined, and a judgment sub-area within the first target area is determined, where the judgment sub-area is within the first target area and is an area that has not been scanned when the first target point is scanned;
[0011] If a non-bad pixel exists in the determination sub-region, a correction value of the first target point is determined by determining the non-bad pixel in the determination sub-region, and the first target point is corrected by the correction value;
[0012] If it is determined that there is no non-bad pixel in the sub-area, a correction value of the first target point is determined by the non-bad pixels in the first target area, and the first target point is corrected by the correction value.
[0013] A second aspect of an embodiment of the present application provides a bad pixel correction device, comprising:
[0014] a target point determination module, configured to scan pixels in the image to be processed one by one from a first starting point in a preset scanning order, and determine the first bad pixel in the image to be processed scanned as a first target point, wherein the first starting point is a non-bad pixel in the image to be processed;
[0015] an area determination module, configured to determine, based on a predetermined size determination window, a first target area centered on the first target point, and determine a determination sub-area within the first target area, the determination sub-area being within the first target area and being an area that has not been scanned when the first target point is scanned;
[0016] A determination module, configured to determine a correction value of the first target point based on the non-bad pixels in the determination sub-region if there are any non-bad pixels in the determination sub-region, and to correct the first target point based on the correction value;
[0017] The determination module is further configured to determine a correction value of the first target point based on the non-bad pixels in the first target area if no non-bad pixels exist in the determination sub-area, and to correct the first target point based on the correction value.
[0018] A third aspect of an embodiment of the present application provides a terminal device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the bad pixel correction method of the first aspect are implemented.
[0019] A fourth aspect of the embodiments of the present application is a computer storage medium, wherein a computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the processor executes the steps of the bad pixel correction method of the first aspect.
[0020] The beneficial effects of the present application are as follows: by presetting the scanning sequence, the pixels in the image to be processed are scanned one by one from the first starting point (non-bad pixels in the image to be processed), and the first bad pixel in the scanned image to be processed can be determined as the first target point; based on the preset size judgment window, the first target area centered on the first target point can be determined, and then the judgment sub-area in the first target area can be determined, and the judgment sub-area is located in the first target area, and is the area that has not been scanned when the first target point is scanned; further, if there is a non-bad pixel in the judgment sub-area, the correction value of the first target point is determined by the non-bad pixel in the judgment sub-area, and the first target point is corrected by the correction value; further, if there is no non-bad pixel in the judgment sub-area, the correction value of the first target point is determined by the non-bad pixel in the first target area, and the first target point is corrected by the correction value, so as to realize the correction of each bad pixel in the image to be processed obtained by the image sensor. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0022] Figure 1 A schematic diagram of a bad cluster in an image to be processed is shown;
[0023] Figure 2 A schematic diagram of a process for correcting a bad pixel provided by an embodiment of the present application is shown;
[0024] Figure 3a A schematic diagram showing an image to be processed and its preset scanning order;
[0025] Figure 3b A schematic diagram showing an image to be processed and its preset scanning order;
[0026] Figure 3c Shown Figure 3a a first target area and a determination sub-area of a first target point in the image;
[0027] Figure 3d A schematic diagram showing first target areas corresponding to some first target points when they are located at the boundary of the image to be processed;
[0028] Figure 3e A schematic diagram of a preset direction of a 3*3 preset size determination window is shown;
[0029] Figure 4A schematic flow chart showing another bad pixel correction method according to an embodiment of the present application is shown;
[0030] Figure 5 A flow chart showing a method of determining a correction value of a first target point by determining non-bad points in a sub-region;
[0031] Figure 6 A schematic diagram showing a flow chart of another bad pixel correction method provided by an embodiment of the present application is shown;
[0032] Figure 7 A schematic structural diagram of a bad pixel correction device provided in an embodiment of the present application is shown;
[0033] Among them, 110 is a bad cluster; 120 is a 3*3 window; 311 and 321 are the first starting points; 312 and 322 are the first target points. DETAILED DESCRIPTION
[0034] In order to make the purpose, implementation mode and advantages of the present application clearer, the exemplary implementation mode of the present application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only part of the embodiments of the present application, not all of the embodiments.
[0035] It should be noted that the brief descriptions of terms in this application are only for the purpose of facilitating the understanding of the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their ordinary and usual meanings.
[0036] In the specification and claims of this application and the accompanying drawings, the terms "first," "second," "third," etc. are used to distinguish similar or similar objects or entities, and are not necessarily intended to limit a particular order or sequence, unless otherwise noted. It should be understood that the terms used in this manner are interchangeable under appropriate circumstances.
[0037] The terms "comprise," "include," and "have," and any variations thereof, are intended to cover but not exclude inclusion; for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.
[0038] An image sensor is a sensor chip that converts light signals reflecting image information into electrical signals. Due to processing techniques, aging, and other factors, some photosensitive cells on the image sensor may experience abnormal responses, resulting in pixels (i.e., bad pixels) with brightness differences from normal pixels appearing in the processed image. Multiple adjacent bad pixels form a bad cluster.
[0039] Correction of bad pixels in an image is usually performed within a preset size judgment window centered on the bad pixel. The correction value used to replace the bad pixel is calculated using the non-bad pixels within the preset size judgment window. Due to the size, shape, and other factors of a bad cluster, there may not be normal pixels within the preset size judgment window, resulting in the inability to determine the correction value of the bad cluster. Figure 1 As shown, in the bad cluster 110 , all pixels within the preset size determination window (3*3 window) 120 are isolated bad pixels, making it impossible to determine the correction value corresponding to the bad pixel d22 in the bad cluster.
[0040] In order to solve the problem that bad pixels or bad clusters in the image to be processed cannot be corrected, the embodiments of the present application provide a bad pixel correction method, apparatus, terminal device and storage medium. Through a preset scanning sequence, the pixels in the image to be processed are scanned one by one from a first starting point (a non-bad pixel in the image to be processed), and the first bad pixel scanned in the image to be processed can be determined as the first target point; based on a preset size judgment window, a first target area centered on the first target point can be determined, and then a judgment sub-area in the first target area can be determined. The judgment sub-area is located in the first target area and is an area that has not been scanned when the first target point is scanned; further, if there is a non-bad pixel in the judgment sub-area, the correction value of the first target point is determined by the non-bad pixel in the judgment sub-area, and the first target point is corrected by the correction value; further, if there is no non-bad pixel in the judgment sub-area, the correction value of the first target point is determined by the non-bad pixel in the first target area, and the first target point is corrected by the correction value, and the other bad pixels are corrected by the grayscale value of the corrected non-bad pixel, so as to achieve correction of all bad pixels in the image to be processed obtained by the image sensor.
[0041] The following describes in detail the bad pixel correction method, apparatus, terminal device, and storage medium of the embodiments of the present application with reference to the accompanying drawings.
[0042] Figure 2 FIG. 1 shows a flow chart of a bad pixel correction method provided by an embodiment of the present application. Figure 2 As shown, an embodiment of the present application provides a bad pixel correction method.
[0043] The bad pixel correction method comprises the following steps:
[0044] S210 , scanning pixels in the image to be processed one by one from a first starting point according to a preset scanning sequence, and determining the first bad pixel in the image to be processed scanned as a first target point.
[0045] The first starting point is a non-bad pixel in the image to be processed.
[0046] It should be understood that the preset scanning order is a scanning order starting from the first starting point, and the preset scanning order can scan every pixel in the image to be processed, wherein the first starting point is any non-bad pixel in the image to be processed.
[0047] For example, Figure 3a A schematic diagram of an image to be processed and its preset scanning order is shown in FIG. Figure 3a As shown, the first starting point 311 is the pixel point of the second row and first column in the image to be processed, and the first starting point 311 is a non-bad pixel. At this time, by the preset scanning order (from Figure 3a Starting from the first starting point, from the first column to the last column, then from the first column to the last column of the third row, then the last row and the first row), the pixels in the image to be processed are scanned one by one from the first starting point, and the first bad pixel encountered (third row and fifth column) is the first target point 312.
[0048] In some embodiments, the first starting point is a vertex in the image to be processed, and the vertex is a non-bad pixel. Through a preset scanning order, the pixel points in the image to be processed are scanned one by one from the vertex, and the first bad pixel in the image to be processed scanned is determined to be the first target point.
[0049] For example, the scanning order is preset, with the vertex of the pixel point in the first row and first column (non-bad pixel) as the first starting point, Figure 3b A schematic diagram of an image to be processed and its preset scanning order is shown in FIG. Figure 3b As shown, the vertex of the pixel point in the first row and first column (non-bad pixel) is taken as the first starting point 321, and the first bad pixel encountered (the ninth column in the first row) is taken as the first target point 322 in the order from the first row and first column to the last column, and from the first column to the last column in the last row.
[0050] In some embodiments, when the first starting point can only be a vertex of the image to be processed, at this time, it is required that at least one vertex in the image to be processed is not a bad pixel; if at this time, there is no vertex that is a good pixel, a filter for images in which all vertices of the image to be processed are bad pixels can be added before step 210.
[0051] In some embodiments, before executing step 210 to start bad pixel correction, the process further includes detecting bad pixels in the image to be processed. Figure 4 FIG. 1 shows a flow chart of another bad pixel correction method according to an embodiment of the present application. Figure 4 As shown, before step 210, the following steps are also included:
[0052] S201: Determine the location of bad pixels in the image to be processed.
[0053] It should be noted that bad pixels in the image to be processed can be detected by comparing the deviation of the grayscale value of each pixel with the overall mean value of the image to be processed point by point, or by other conventional methods.
[0054] For the result of detecting bad pixels, the location of the bad pixels in the image to be processed can be determined as follows:
[0055] The position information of the bad pixel can be determined through a bad pixel information map that corresponds one-to-one to the pixel points in the image to be processed. The bad pixel information map includes a first value and a second data, wherein the first data represents that the pixel point at the corresponding position is a bad pixel, and the second data represents that the pixel point at the corresponding position is a non-bad pixel.
[0056] For example, in a bad pixel information map, the number 1 may represent that the pixel at that position is a bad pixel, and the number 0 may represent that the pixel at that position is a normal pixel.
[0057] The position information of the bad pixel can also be determined based on preset information. It should be understood that the spatial coordinates of the image to be processed can be determined based on the preset information, and the position information of the bad pixel can be determined based on the coordinate position.
[0058] After determining the position of the bad pixel in the image to be processed in step 201, determining the first bad pixel in the scanned image to be processed as the first target point in step 210 includes:
[0059] After scanning the first pixel with abnormal brightness in the image to be processed, the position information of the pixel with abnormal brightness is compared with the position information of the bad pixel. If the position information of the pixel with abnormal brightness matches the position information of the bad pixel, the pixel with abnormal brightness is determined to be the first target point.
[0060] In some embodiments, the first bad pixel can be directly determined during scanning in a preset scanning order based on the bad pixel information map or the bad pixel location information, and the bad pixel can be determined as the first target point.
[0061] like Figure 2 As shown, the method further includes: S220, determining a first target area centered on the first target point based on a preset size determination window, and determining a determination sub-area in the first target area.
[0062] The preset size determination window may be a 3*3 size determination window or a 5*5 size determination window. On the premise of ensuring the correction accuracy, the size of the preset size determination window should not be too large.
[0063] The determination sub-region is located within the first target region and is an area that has not been scanned when the first target point is scanned.
[0064] The number of pixels to be determined in the determination sub-region is smaller than the number of pixels in the first target region, thereby reducing the number of bad pixel determinations and improving the processing rate.
[0065] It should be understood that for different preset scanning sequences, the sub-regions determined within the first target region corresponding to the same first target point are different.
[0066] for Figure 3a As shown in the image to be processed, the first target area of the first target point 312 and the determination sub-area are as follows Figure 3c As shown, Figure 3c Shown Figure 3a The first target area and determination sub-area of the first target point in the figure, wherein the first target area is the area described by labels D11, D12, D13, D21, D22, D23, D31, D32, and D33, and the determination sub-area is the area described by D23, D31, D32, and D33.
[0067] like Figure 3c The preset scanning order in Figure 3c Starting from the first starting point 311, from the second row to the last row and the first row, then from the second row of the second column to the last row and the first row, and then from the second row of the last column to the last row and the first row, the determination sub-region at this time is the region described by D32, D13, D23, and D33.
[0068] It should be understood that all points in the scanned area of the first target area are non-bad points. The non-bad points may be originally non-bad points or may be non-bad points that have been corrected.
[0069] Through the above steps 210 and 220, all points in the scanned area of the first target area are non-bad points. When determining the correction value, it is only necessary to determine whether there are non-bad points in the determination sub-area, which reduces the number of determinations in the correction process and improves the efficiency of the correction.
[0070] In some embodiments, if the first target point is located at a boundary of the image to be processed, an area outside the image to be processed in the first target area is determined to be a bad pixel.
[0071] Figure 3d FIG. 4 shows a schematic diagram of the first target area corresponding to some first target points when they are located at the boundary of the image to be processed, such as Figure 3d As shown, in the first target area, the pixel points corresponding to the area outside the image to be processed are all bad pixels.
[0072] S230: If a non-bad pixel exists in the determination sub-region, determine a correction value of the first target point by determining the non-bad pixel in the determination sub-region, and correct the first target point by using the correction value.
[0073] It should be understood that all points in the scanned area of the first target area are non-bad points. The non-bad points may be originally non-bad points or may be non-bad points that have been corrected.
[0074] It is determined that there are non-bad points in the sub-region, that is, the gradient value can be determined at the non-bad point (one or more). The gradient value can only be determined when all the non-bad points in the corresponding preset direction are non-bad points.
[0075] If a non-bad pixel exists in the sub-region, the non-bad pixel is the first pixel (one or more); Figure 5 A flow chart showing a method of determining the correction value of the first target point by determining the non-bad points in the sub-region is shown. Figure 5 As shown, the process includes the following:
[0076] S231. Determine the gradient value of each first pixel point corresponding to a preset direction.
[0077] The preset direction corresponds to the setting of the preset size determination window and can cover the preset size determination window.
[0078] Figure 3e A schematic diagram of a preset direction of a 3*3 preset size determination window is shown, such as Figure 3e As shown, the preset directions include four directions: A, B, C, and D.
[0079] The gradient value of each first pixel point corresponding to the preset direction is the absolute value of the difference between the pixel values of non-defective pixels in the direction.
[0080] Determining the gradient value of each first pixel corresponding to a preset direction includes:
[0081] Determine a gradient value of the first pixel corresponding to the preset direction based on a non-bad pixel in the first target area and in the preset direction corresponding to the first pixel;
[0082] If the non-bad pixels include the second pixel and the third pixel, the gradient value of the first pixel corresponding to the preset direction is determined by the absolute value of the difference between the grayscale value of the second pixel and the grayscale value of the third pixel.
[0083] For example, if the sub-regions are determined to be D23, D31, D32, and D33, and the non-bad points D23 and D33 correspond to preset directions A and D, the gradient values are calculated in directions A and D respectively:
[0084] The gradient value in direction A is |D21-D23|;
[0085] The gradient value in direction D is |D11-D33|.
[0086] S232: Filter out a minimum gradient value from each gradient value, and determine a first preset direction corresponding to the minimum gradient value.
[0087] It should be understood that the preset direction corresponding to the minimum gradient value is selected from the gradient values determined in step 231 .
[0088] If only one gradient value is determined in step 231, the direction corresponding to this gradient value is the first preset direction; if the number of gradient values determined in step 231 is greater than 1, the minimum gradient value is determined therefrom, and the first preset direction corresponding to the minimum gradient value is determined.
[0089] For example, the gradient value of direction A is |D21-D23|, which is greater than the gradient value of direction D is |D11-D33|, and the first preset direction is direction D.
[0090] In some embodiments, there may be multiple minimum gradient values, and the first preset directions corresponding to all minimum gradient values may be obtained.
[0091] For example, when the gradient value of direction A is |D21-D23| and the gradient value of direction D is |D11-D33|, and both are minimum gradient values, the first preset direction includes direction A and direction D.
[0092] S233: Determine a correction value of the first target point based on each non-bad point in the first preset direction within the first target area.
[0093] The correction value of the first target point may be determined by an average of the grayscale values of the non-bad pixels in the first preset direction within the first target area.
[0094] For the possibility of multiple minimum gradient values (ie, multiple first preset directions), the correction value of the first target point can be determined by the average of the grayscale values of all non-bad points in all first preset directions within the first target area.
[0095] For example, when the gradient value |D21-D23| in direction A is equal to the gradient value |D11-D33| in direction D and is the minimum gradient value, the average of the grayscale values of D21, D23, D11 and D33 in directions A and D is determined as the correction value of the first target point.
[0096] like Figure 2 As shown, the method further includes: S240, if it is determined that there is no non-bad pixel in the sub-area, determining the correction value of the first target point through the non-bad pixels in the first target area, and correcting the first target point through the correction value.
[0097] It should be understood that all points in the scanned area (ie, normal sub-area) of the first target area are non-bad points, which may be originally non-bad points or may be non-bad points obtained through correction.
[0098] The non-bad pixels in the first target area are the non-bad pixels in the normal sub-area.
[0099] In step 240, determining the correction value of the first target point using the non-bad pixels in the first target area includes:
[0100] Based on a preset strategy, a correction value of the first target point is determined by the pixel values of non-bad pixels in the normal sub-region.
[0101] There may be one pixel in a normal sub-region, and the corresponding number of non-bad pixels is also one; there may also be multiple pixels in a normal sub-region, and the corresponding number of non-bad pixels is also multiple.
[0102] If there is only one non-defective pixel in the normal sub-region, the correction value of the first target point is the pixel value of the non-defective pixel.
[0103] If there are multiple non-bad pixels in the normal sub-area, the pixel value of one non-bad pixel can be selected from the multiple non-bad pixels as the correction value of the first target point, or the average of the pixel values of the multiple non-bad pixels can be used as the correction value of the first target point.
[0104] For example, if the first target point is located at the left boundary of the image to be processed, the pixel value of the bad pixel D22 is directly replaced by the pixel value of D12. In other cases (such as the right boundary, upper boundary, lower boundary, and other positions), the pixel value of the bad pixel D22 is directly replaced by the pixel value of D21.
[0105] Figure 6 FIG. 1 shows a flow chart of another bad pixel correction method provided by an embodiment of the present application. Figure 6 As shown, after the first target point is corrected in steps 230 and 240, the following steps are further included:
[0106] S450. After correcting the first target point, if the image to be processed also includes other uncorrected bad pixels, the pixels in the image to be processed are scanned one by one from the first target point according to a preset scanning sequence, and the other bad pixels are corrected according to the determination sub-areas corresponding to the scanned other bad pixels.
[0107] It should be understood that it is necessary to traverse each bad pixel in the image to be processed in a preset scanning order, determine the corresponding judgment sub-area for the first bad pixel of each scan, and perform correction. The processing process for each bad pixel is the same as the process of steps 210 to 240 above, and will not be repeated here.
[0108] An embodiment of the present application provides a bad pixel correction method, which scans pixel points in the image to be processed one by one from a first starting point (a non-bad pixel in the image to be processed) through a preset scanning sequence, and can determine the first bad pixel in the image to be processed that is scanned as a first target point; based on a preset size judgment window, a first target area centered on the first target point can be determined, and then a judgment sub-area in the first target area can be determined, the judgment sub-area is located in the first target area, and is an area that has not been scanned when the first target point is scanned; further, if there is a non-bad pixel in the judgment sub-area, the correction value of the first target point is determined by the non-bad pixel in the judgment sub-area, and the first target point is corrected by the correction value; further, if there is no non-bad pixel in the judgment sub-area, the correction value of the first target point is determined by the non-bad pixel in the first target area, and the first target point is corrected by the correction value, thereby realizing correction of each bad pixel in the image to be processed obtained by the image sensor.
[0109] Figure 7 FIG. 1 shows a schematic structural diagram of a bad pixel correction device provided in an embodiment of the present application. Figure 7 As shown, the bad pixel correction device 700 includes a target point determination module 710 , an area determination module 720 and a determination module 730 .
[0110] a target point determination module, configured to scan pixels in the image to be processed one by one from a first starting point in a preset scanning order, and determine the first bad pixel in the image to be processed scanned as a first target point, wherein the first starting point is a non-bad pixel in the image to be processed;
[0111] an area determination module, configured to determine, based on a predetermined size determination window, a first target area centered on the first target point, and determine a determination sub-area within the first target area, the determination sub-area being within the first target area and being an area that has not been scanned when the first target point is scanned;
[0112] A determination module, configured to determine a correction value of the first target point based on the non-bad pixels in the determination sub-region if there are any non-bad pixels in the determination sub-region, and to correct the first target point based on the correction value;
[0113] The determination module is further configured to determine a correction value of the first target point based on the non-bad pixels in the first target area if no non-bad pixels exist in the determination sub-area, and to correct the first target point based on the correction value.
[0114] In some embodiments, the target point determination module in the bad pixel correction device is further configured to, after correcting the first target point, determine whether the image to be processed includes other uncorrected bad pixels. If the image to be processed includes other uncorrected bad pixels, the device scans pixels in the image to be processed one by one from the first target point using a preset scanning sequence. Correction is then performed on the other bad pixels using the determination sub-regions corresponding to the other bad pixels scanned by the region determination module and the determination module.
[0115] In some embodiments, if a non-bad pixel exists in the judgment sub-area, the non-bad pixel is the first pixel point; the judgment module determines the correction value of the first target point by judging the non-bad pixel in the sub-area, and is also used to determine the gradient value of each first pixel point corresponding to the preset direction; the minimum gradient value is screened out from each gradient value, and the first preset direction corresponding to the minimum gradient value is determined; based on each non-bad pixel in the first target area in the first preset direction, the correction value of the first target point is determined.
[0116] In some embodiments, the determination module further includes a gradient determination unit for determining a gradient value of the first pixel corresponding to the preset direction based on non-bad pixels in the first target area corresponding to the preset direction of the first pixel;
[0117] If the non-bad pixels include the second pixel and the third pixel, the gradient value of the first pixel corresponding to the preset direction is determined by the absolute value of the difference between the grayscale value of the second pixel and the grayscale value of the third pixel.
[0118] In some embodiments, the area determination module is further used to determine that an area in the first target area outside the image to be processed is a bad pixel if the first target point is located at the boundary of the image to be processed before determining the correction value of the first target point through the non-bad pixels in the first target area.
[0119] In some embodiments, the first target area also includes a normal sub-area, which is an area in the first target area that has been scanned according to a preset scanning order; the normal sub-area has non-bad pixels, and the judgment module is used to determine the correction value of the first target point through the non-bad pixels in the first target area if there are no non-bad pixels in the judgment sub-area, and is also used to determine the pixel value of the non-bad pixels in the normal sub-area as the correction value of the first target point based on a preset strategy.
[0120] In some embodiments, the bad pixel correction device also includes a bad pixel detection module, which is used to determine the position information of the bad pixel through a bad pixel information map corresponding to the pixel points in the image to be processed before scanning the pixel points in the image to be processed one by one through a preset scanning order. The bad pixel information map includes a first value and a second data, wherein the first data represents that the pixel point at the corresponding position is a bad pixel, and the second data represents that the pixel point at the corresponding position is a non-bad pixel, or the position information of the bad pixel is determined based on preset information.
[0121] The embodiment of the present application provides a bad pixel correction device including a target point determination module, an area determination module and a judgment module. Through a preset scanning order, the pixels in the image to be processed are scanned one by one from the first starting point (non-bad pixels in the image to be processed), and the first bad pixel in the image to be processed scanned can be determined as the first target point; based on a preset size judgment window, a first target area centered on the first target point can be determined, and then a judgment sub-area in the first target area can be determined, the judgment sub-area is located in the first target area, and when the first target point is scanned, the area that has not been scanned is determined; further, if there is a non-bad pixel in the judgment sub-area, the correction value of the first target point is determined by the non-bad pixel in the judgment sub-area, and the first target point is corrected by the correction value; further, if there is no non-bad pixel in the judgment sub-area, the correction value of the first target point is determined by the non-bad pixel in the first target area, and the first target point is corrected by the correction value, thereby achieving correction of each bad pixel in the image to be processed obtained by the image sensor.
[0122] An embodiment of the present application further provides a terminal device, including a memory and a processor, wherein the memory stores a computer program, and is characterized in that the processor implements the above-mentioned bad pixel correction method when executing the computer program.
[0123] Among them, defect correction is generally implemented inside the camera. The chip that usually implements this solution can be FPGA, ARM / GPU, etc. FPGA has the characteristics of high real-time performance and fast processing speed.
[0124] The bad pixel correction method can reduce the number of bad pixel determinations within the FPGA by determining the bad pixels within the determination sub-area, thereby improving the processing rate of the terminal device.
[0125] The implementation principle and technical effects are similar to those of the above method embodiment and will not be repeated here.
[0126] An embodiment of the present application also provides a computer storage medium, on which a computer program is stored. When the computer program is executed by a processor, the processor executes the above-mentioned bad pixel correction method. The implementation principle and technical effect are similar to those of the above-mentioned method embodiment and will not be repeated here.
[0127] The following paragraphs will compare and list the Chinese terms involved in this application specification and their corresponding English terms to facilitate reading and understanding.
[0128] For ease of explanation, the above description has been made in conjunction with specific embodiments. However, the above discussion of some embodiments is not intended to be exhaustive or to limit the embodiments to the specific forms disclosed above. Based on the above teachings, various modifications and variations can be obtained. The selection and description of the above embodiments are intended to better explain the principles and practical applications, so that those skilled in the art can better use the embodiments and various different variations of the embodiments suitable for specific use considerations.
Claims
1. A bad pixel correction method, characterized in that: include: Scanning pixels in the image to be processed one by one from a first starting point in a preset scanning order, and determining the first bad pixel in the image to be processed scanned as a first target point, wherein the first starting point is a non-bad pixel in the image to be processed; Determine, based on a predetermined size judgment window, a first target area centered on the first target point, and determine a judgment sub-area within the first target area, where the judgment sub-area is within the first target area and is an area that has not been scanned when the first target point is scanned; If there is a non-bad pixel in the determination sub-region, the non-bad pixel is a first pixel, determining a correction value of the first target point based on the non-bad pixel in the determination sub-region, and correcting the first target point based on the correction value, wherein a gradient value corresponding to a preset direction of each first pixel is determined; a minimum gradient value is screened out from each gradient value, and a first preset direction corresponding to the minimum gradient value is determined; and the correction value of the first target point is determined based on each non-bad pixel in the first target region in the first preset direction; If there is no non-bad pixel in the determination sub-area, a correction value of the first target point is determined based on the non-bad pixels in the first target area, and the first target point is corrected based on the correction value.
2. The bad pixel correction method according to claim 1, wherein: Also includes: After correcting the first target point, if the image to be processed also includes other uncorrected bad pixels, the pixel points in the image to be processed are scanned one by one from the first target point through the preset scanning sequence, and the other bad pixels are corrected through the judgment sub-areas corresponding to the scanned other bad pixels.
3. The bad pixel correction method according to claim 1, wherein: The determining of the gradient value of each first pixel point corresponding to a preset direction includes: Determining a gradient value of the first pixel corresponding to the preset direction based on non-bad pixels in the first target area in the preset direction corresponding to the first pixel; If the non-bad pixels include a second pixel and a third pixel, the gradient value of the first pixel corresponding to the preset direction is determined by the absolute value of the difference between the grayscale value of the second pixel and the grayscale value of the third pixel.
4. The bad pixel correction method according to claim 1, wherein: Also includes: Before determining the correction value of the first target point through the non-bad pixels in the first target area, if the first target point is located at the boundary of the image to be processed, the area of the first target area outside the image to be processed is determined to be a bad pixel.
5. The bad pixel correction method according to claim 1, wherein: The first target area further includes a normal sub-area, the normal sub-area being an area in the first target area that has been scanned according to the preset scanning order; the normal sub-area having a non-bad pixel, and if no non-bad pixel exists in the determination sub-area, determining the correction value of the first target point based on the non-bad pixel in the first target area includes: Based on a preset strategy, the pixel value of the non-bad pixel in the normal sub-region is determined as the correction value of the first target point.
6. The bad pixel correction method according to claim 1, wherein: Before scanning the pixels in the image to be processed one by one in a preset scanning order, the method further includes: Determining the position information of the bad pixel using a bad pixel information map corresponding one-to-one to pixels in the image to be processed, the bad pixel information map including first data and second data, wherein the first data indicates that the pixel at the corresponding position is a bad pixel and the second data indicates that the pixel at the corresponding position is not a bad pixel, or determining the position information of the bad pixel based on preset information; The determining that the first bad pixel in the scanned image to be processed is the first target point includes: After scanning the first pixel point with abnormal brightness in the image to be processed, compare the position information of the pixel point with abnormal brightness with the position information of the bad pixel. If the position information of the pixel point with abnormal brightness matches the position information of the bad pixel, determine that the pixel point with abnormal brightness is the first target point.
7. A bad pixel correction device, characterized in that: include: a target point determination module, configured to scan pixels in the image to be processed one by one from a first starting point in a preset scanning order, and determine a first bad pixel in the image to be processed scanned as a first target point, wherein the first starting point is a non-bad pixel in the image to be processed; an area determination module, configured to determine, based on a predetermined size determination window, a first target area centered on the first target point, and determine a determination sub-area within the first target area, the determination sub-area being within the first target area and being an area that has not been scanned when the first target point is scanned; a determination module configured to, if a non-bad pixel exists in the determination subregion, the non-bad pixel being a first pixel, determine a correction value for the first target point based on the non-bad pixel in the determination subregion, and correct the first target point based on the correction value, wherein a gradient value corresponding to a preset direction of each first pixel is determined; a minimum gradient value is screened out from each gradient value, and a first preset direction corresponding to the minimum gradient value is determined; and the correction value for the first target point is determined based on each non-bad pixel in the first target region and in the first preset direction; The determination module is further configured to determine a correction value of the first target point using the non-bad pixels in the first target area if there is no non-bad pixel in the determination sub-area, and to correct the first target point using the correction value.
8. A terminal device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the defective pixel correction method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor is caused to perform the steps of the bad pixel correction method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Image dead pixel detection and processing method
CN106210712A
Image dead pixel correction method and device, electronic equipment and storage medium
CN115330638A