Image processing method and device and computer readable storage medium
By identifying and adjusting dead pixels in the image sensor and using feature values in similar image blocks for adjustment, the noise problem caused by image sensor failure is solved and the image quality and processing capabilities are improved.
Patent Information
- Application Number
- CN202411307353.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-09-19
AI Technical Summary
Existing image noise reduction technology is difficult to effectively deal with the noise caused by the failure of the photosensitive element of the image sensor, resulting in reduced image quality and limited processing capabilities.
By determining the bad pixels in the image to be processed, and using the feature values of non-bad pixels in similar image blocks to adjust, the impact noise is filtered out and the image quality is improved.
Effectively remove the noise caused by the failure of the photosensitive element in the image sensor, improve the image quality, and enhance the processing capability of the image processing algorithm.
Smart Images

Figure CN118828239A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, device and computer-readable storage medium. Background Art
[0002] Images are widely used in fields such as biomedicine, machine vision, intelligent driving, and security. The quality of images directly affects the effectiveness of their application in these fields. However, images are inevitably interfered by noise during acquisition, processing, and transmission. Therefore, filtering out noise in images is extremely important.
[0003] The existing mainstream image noise reduction technologies are: 1. Spatial domain image denoising: Simple algorithms include mean filtering, Gaussian filtering, median filtering, etc. These denoising algorithms do not distinguish between boundary areas and flat areas. Therefore, a lot of useful image information will be lost while denoising. Slightly more complex algorithms include bilateral filtering and non-local mean algorithms. However, the disadvantage of spatial domain algorithms is that they do not protect textures very well.
[0004] 2. Frequency domain image denoising: The main representatives are wavelet, DCT (Discrete Cosine Transform) and other denoising algorithms. This type of algorithm transforms the image into the frequency domain and performs denoising in the frequency domain. The disadvantage of frequency domain image denoising is that it does not suppress large noise as well as spatial domain denoising.
[0005] 3. Image denoising by mixing spatial domain and frequency domain: Mainly including BM3D (Block-Matching and 3D filtering, three-dimensional block matching filtering), WNNM (Weighted Nuclear Norm Minimization, weighted nuclear norm minimization) and other algorithms. This type of algorithm combines spatial domain and frequency domain noise reduction, greatly improving the image noise reduction capability.
[0006] 4. Learning-based image denoising: There are mainly deep learning and dictionary learning noise reduction algorithms. This type of algorithm uses pre-collected samples to train the noise reduction algorithm and has achieved relatively good results. However, the amount of calculation is huge and it is difficult to apply it to actual products.
[0007] The above noise reduction methods are all universal noise reduction, and none of them is specifically aimed at the noise caused by image sensor failure. Most image sensors have a certain number of photosensitive element failures. These faulty photosensitive elements will affect the image quality of the image sensor and reduce the processing power of the image processing algorithm. Summary of the invention
[0008] To solve the above problems, the present application provides an image processing method, device and computer-readable storage medium, which can improve the quality of images.
[0009] A technical solution provided by the present application is to provide an image processing method, which includes: determining bad pixel pixels in an image to be processed; wherein the bad pixel is caused by a failure of a photosensitive element at a corresponding position in an image sensor; determining a plurality of similar reference image blocks in the image to be processed; for a target bad pixel of a target image block in the plurality of reference image blocks, adjusting the characteristic value of the target bad pixel by using the characteristic value of a non-bad pixel in the target image block, or the characteristic value of a non-bad pixel at the same position in the remaining reference image blocks except the target image block, to obtain a plurality of adjusted reference image blocks; and adjusting the characteristic value of the image to be processed by using the characteristic values of the adjusted plurality of reference image blocks.
[0010] In one embodiment, determining a bad pixel in an image to be processed includes: determining a maximum eigenvalue and a minimum eigenvalue of a plurality of pixels in a neighborhood centered on a target pixel; in response to a eigenvalue of the target pixel being greater than a maximum eigenvalue and a difference with the maximum eigenvalue being greater than a set limit threshold, determining the target pixel to be a bad pixel; or in response to a eigenvalue of the target pixel being less than a minimum eigenvalue and a difference with the minimum eigenvalue being greater than a limit threshold, determining the target pixel to be a bad pixel.
[0011] In one embodiment, determining the maximum eigenvalue and the minimum eigenvalue of multiple pixels in a neighborhood centered on a target pixel includes: determining a 3×3 pixel array centered on the target pixel; and determining the maximum eigenvalue and the minimum eigenvalue of the remaining pixels in the 3×3 pixel array except the target pixel.
[0012] In one embodiment, determining multiple similar reference image blocks in an image to be processed includes: determining a first image block in the image to be processed; determining a candidate image block having the same size as the first image block in a set search area in the image to be processed; determining a similarity between each candidate image block and the first image block; determining a set number of candidate image blocks ranked top in similarity as second image blocks, and the first image block and the multiple second image blocks constitute multiple reference image blocks.
[0013] In one embodiment, for a target bad pixel of a target image block among multiple reference image blocks, a feature value of the target bad pixel is adjusted using a feature value of a non-bad pixel in the target image block or a feature value of a non-bad pixel at the same position in the remaining reference image blocks except the target image block, including: stacking multiple reference image blocks to form a first three-dimensional image block; determining a plurality of reference pixels corresponding to the target bad pixel of the target image block among the multiple reference image blocks in a stacking direction of the first three-dimensional image block; in response to the multiple reference pixels including at least one non-bad pixel, adjusting the feature value of the target bad pixel to: an average feature value of the at least one non-bad pixel; or in response to the multiple reference pixels being all bad pixels, adjusting the feature value of the target bad pixel to: an average feature value of a plurality of non-bad pixels in a neighborhood centered on the target bad pixel in the target image block.
[0014] In one embodiment, the characteristic value of the target bad pixel is adjusted to: the average characteristic value of multiple non-bad pixel pixels in a neighborhood centered on the target bad pixel in the target image block, including: determining a 3×3 pixel array centered on the target bad pixel in the target image block; adjusting the characteristic value of the target bad pixel to: the average characteristic value of multiple non-bad pixel pixels in the remaining pixels except the target bad pixel in the 3×3 pixel array.
[0015] In one embodiment, the image processing method further includes: expanding the first three-dimensional image block to form a first two-dimensional image block; wherein each column of pixels of the first two-dimensional image block corresponds to multiple pixels of a reference image block in the first three-dimensional image block; determining a first reference matrix corresponding to the first two-dimensional image block; performing shrinkage processing on the singular values of the first reference matrix to obtain a second reference matrix; determining a second two-dimensional image block corresponding to the second reference matrix; and restoring the second two-dimensional image block to form a second three-dimensional image block; wherein each column of pixels of the second two-dimensional image block corresponds to multiple pixels of a reference image block in the first three-dimensional image block.
[0016] In one embodiment, the characteristic values of the image to be processed are adjusted using the characteristic values of the adjusted multiple reference image blocks, including: replacing the characteristic value of the bad pixel in the image to be processed with the average characteristic value of the characteristic values of at least one pixel in the same position in the multiple reference image blocks with the same adjusted position.
[0017] Another technical solution provided by the present application is to provide an image processing device, which includes a processor and a memory, the memory is used to store program data, and the processor is used to execute the program data to implement the image processing method as described above.
[0018] Another technical solution provided by the present application is to provide a computer-readable storage medium, which stores program data. When the program data is executed by a processor, it is used to implement the image processing method as described above.
[0019] The image processing method provided by the present application includes: determining bad pixel in the image to be processed; determining multiple similar reference image blocks in the image to be processed; for the target bad pixel of the target image block in the multiple reference image blocks, adjusting the characteristic value of the target bad pixel by using the characteristic value of the non-bad pixel in the target image block, or the characteristic value of the non-bad pixel at the same position in the remaining reference image blocks except the target image block, so as to obtain multiple adjusted reference image blocks; adjusting the characteristic value of the image to be processed by using the characteristic value of the adjusted multiple reference image blocks. Through the above method, the impact noise in the image to be processed can be filtered out by using the method of determining bad pixel, determining similar blocks, and adjusting the bad pixel by using similar blocks. Since the impact noise is generally caused by the failure of the photosensitive element in the image sensor, the above image processing method can remove the noise caused by the damage of the photosensitive element in the image sensor, thereby improving the image quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them: Figure 1 It is a flowchart of an embodiment of the image processing method of the present application; Figure 2 is a schematic diagram of a 3×3 pixel array in one embodiment; Figure 3 An embodiment Figure 1 Schematic diagram of the process of step 12; Figure 4 is a schematic diagram of multiple reference image blocks in one embodiment; Figure 5 An embodiment Figure 1 Schematic diagram of the process of step 13; Figure 6 is a schematic diagram of stacking three-dimensional image blocks in one embodiment; Figure 7 is a flowchart of another embodiment of the image processing method of the present application; Figure 8 An embodiment Figure 7 Schematic diagram of the process of step 74; Fig. 9is a schematic diagram of unfolding a first three-dimensional image block in an embodiment; Fig.10 is a schematic diagram of stacking of a second two-dimensional image block to form a three-dimensional image block in one embodiment; Fig.11 is a structural schematic diagram of an embodiment of an image processing device provided by the present application; Fig.12 It is a structural schematic diagram of an embodiment of a computer-readable storage medium provided by the present application. DETAILED DESCRIPTION
[0021] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It will be appreciated that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only some but not all structures related to the present application are shown in the drawings. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the art without making creative work are within the scope of protection of the present application.
[0022] The terms "first", "second", etc. in this application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0023] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0024] See also Figure 1 , Figure 1 1 is a flow chart of an embodiment of an image processing method of the present application, the image processing method comprising: Step 11: Determine the bad pixels in the image to be processed.
[0025] Among them, the defective pixels are caused by the failure of the photosensitive elements at the corresponding positions in the image sensor. Understandably, most image sensors (sensors) have more or less a certain number of defective photosensitive elements. These defective photosensitive elements will affect the imaging quality of the image sensor and at the same time reduce the processing ability of the image processing algorithm.
[0026] Understandably, in the field of image ISP (Image Signal Processing), the defective pixels of the image sensor are often divided into two categories. One is the dynamic defective pixels, and the imaging values of this type of defective pixels are unstable and have a certain range of fluctuations. The other type is called static defective pixels, and the imaging of this type of defective pixels is similar to impulse noise. Moreover, generally, the pixel values (or gray scale values, brightness values) of adjacent pixels are equal, so the pixel values of adjacent pixels can be used to determine whether the central pixel is a defective pixel.
[0027] Optionally, step 11 can be specifically: determining the maximum eigenvalue and the minimum eigenvalue of multiple pixels in the neighborhood centered on the target pixel; in response to the eigenvalue of the target pixel being greater than the maximum eigenvalue and the difference from the maximum eigenvalue being greater than the set limit threshold, determining the target pixel as a defective pixel; or in response to the eigenvalue of the target pixel being less than the minimum eigenvalue and the difference from the minimum eigenvalue being greater than the limit threshold, determining the target pixel as a defective pixel.
[0028] Among them, the eigenvalue here can be the pixel value, gray scale value or brightness value, etc.
[0029] For example, the maximum eigenvalue of multiple pixels in the neighborhood is Vmax, the minimum eigenvalue of multiple pixels in the neighborhood is Vmin, and the set limit threshold is defThr. Then, if the eigenvalue V0 of the central pixel to be judged is greater than Vmax + defThr, or V0 is less than Vmin - defThr, then it can be considered that the central pixel is a defective pixel.
[0030] In a specific embodiment, the above neighborhood can be a 3×3 pixel area. Specifically, a 3×3 pixel array centered on the target pixel is determined; the maximum eigenvalue and the minimum eigenvalue of the remaining pixels in the 3×3 pixel array except the target pixel are determined.
[0031] As Figure 2 shown, Figure 2 is a schematic diagram of a 3×3 pixel array in an embodiment. If it is necessary to detect whether the central pixel E is a defective pixel, the eigenvalues of 8 pixels in the 3×3 neighborhood are sorted, excluding the E pixel. After sorting, it is , the eigenvalue of pixel E is compared with V1 and V8. If it is smaller than V1 or larger than V8, and the gap exceeds a certain range, then E is considered a defective pixel. Specifically, the following formula can be used:
[0032] Where defThr is the limit threshold, which indicates the maximum difference between the feature value of pixel E and V1 or V8. Mask is 0, which means the pixel is a bad pixel, and mask is 1, which means the pixel is a normal pixel.
[0033] It can be understood that for each pixel, the above-mentioned method can be used to determine whether it is a bad pixel, so that a mask image can be obtained.
[0034] Step 12: Determine multiple similar reference image blocks in the image to be processed.
[0035] The size of the image block can be set according to the requirements and is not limited here. For example, a 3×3 pixel array similar to that in step 11 can be selected as the image block, or a 4×4, 5×5, etc. can be selected. It can be understood that the larger the size of the image block, the better the effect of adjusting the bad pixel in the subsequent image processing.
[0036] Among them, multiple reference image blocks are similar blocks. The similar blocks here refer to reference image blocks having similar feature values, and the similarity of feature values can be determined by calculating the difference between two image blocks.
[0037] Alternatively, if Figure 3 As shown, Figure 3 An embodiment Figure 1 The process diagram of step 12 in FIG. 1 may include: Step 121: Determine a first image block in the image to be processed.
[0038] The selection of the first image block may be arbitrary, and the size of the first image block needs to be defined as BR, that is, a BR×BR pixel array.
[0039] Step 122: Determine a candidate image block having the same size as the first image block in a set search area in the image to be processed.
[0040] Here, the search radius needs to be determined as SR.
[0041] like Figure 4 As shown, Figure 4 1 is a schematic diagram of multiple reference image blocks in an embodiment. Here, BR=3 and SR=4 are taken as an example, that is, a 3×3 pixel array is an image block, and the search radius is 4.
[0042] First, determine the first image block, that is, the red image block centered on pixel C, and then determine the search range centered on the first image block as follows: Figure 4 As shown, there are a total of candidate blocks, including the red image block itself, and each candidate block is 3×3 in size.
[0043] Step 123: Determine the similarity between each candidate image block and the first image block.
[0044] The similarity between the candidate image block and the first image block is defined by the difference between the blocks, that is, the average value of the absolute value of the difference between the pixels of the blocks, as shown in the following formula:
[0045] Wherein, diff is the difference between any image block in the search range and the first image block, and diff0 is Figure 4 The difference between the B0 image block and the first image block (C image block) is and is the mask block at the corresponding position, the value of mask is 0 or 1, and i is the coordinate within the block.
[0046] Step 124: Determine a set number of candidate image blocks with top similarity rankings as second image blocks, and the first image block and the plurality of second image blocks form a plurality of reference image blocks.
[0047] After calculating the diff of all candidate image blocks within the search range, sort them, select the first M blocks with the smallest diff, and add the original block. multiple reference image blocks.
[0048] Step 13: For target bad pixel of a target image block in a plurality of reference image blocks, characteristic values of the target bad pixel are adjusted using characteristic values of non-bad pixel pixels in the target image block or characteristic values of non-bad pixel pixels at the same position in the remaining reference image blocks except the target image block, so as to obtain a plurality of adjusted reference image blocks.
[0049] There are multiple reference image blocks that are similar. Therefore, for any image block, each bad pixel can be adjusted using the characteristic value of a normal pixel at the same position in other similar image blocks. If all pixels at the same position in other similar image blocks are bad pixels, the characteristic values of the neighboring pixels in the pixel block are used for adjustment.
[0050] Alternatively, if Figure 5 As shown, Figure 5 An embodiment Figure 1 The flowchart of step 13 in the embodiment of the present invention may include: Step 131: stack multiple reference image blocks to form a first three-dimensional image block.
[0051] like Figure 6 As shown, Figure 6 is a schematic diagram of stacking three-dimensional image blocks in an embodiment. In which, the multiple reference images determined in the above embodiment are stacked in sequence to form a first three-dimensional image block, that is, A three-dimensional pixel array, Figure 6 In the figure, it is a 3×3×4 three-dimensional pixel array.
[0052] Step 132: Determine a target bad pixel of a target image block among a plurality of reference image blocks, and a plurality of reference pixels corresponding in position in the stacking direction of the first three-dimensional image block.
[0053] Specifically, the above three-dimensional image block is represented by Z, N in represents the layer of the two-dimensional image block (reference image block), and I and J represent the coordinates within the 2D image block.
[0054] Since it has been determined in the above step 11 whether each pixel is a bad pixel, represented by 0 and 1 respectively, 0 represents a bad pixel and 1 represents a normal pixel, then, the mask in step 11 can be used to determine whether each pixel in the first three-dimensional image block is a bad pixel.
[0055] Step 133: In response to the plurality of reference pixels including at least one non-dead pixel, adjusting the characteristic value of the target bad pixel to: an average characteristic value of the at least one non-dead pixel.
[0056] Continue reading Figure 6 , if a pixel in Z is a bad pixel, the position information is , n represents the number of layers of the first three-dimensional image block, i and j represent the coordinates in the two-dimensional image block (reference image block), if in addition to the two-dimensional image block of the nth layer, The other two-dimensional image blocks of this coordinate are all normal pixels, so the characteristic values of these normal pixels can be averaged and replaced by this average value. The pixel value is expressed as follows:
[0057] Here ZM represents a three-dimensional mask stack built with mask. The two-dimensional mask blocks contained in this three-dimensional mask stack and the two-dimensional image blocks in Z have the same position in the original image.
[0058] This uses Adv i,j Replace coordinates In other words, if in the n-layer two-dimensional image, at the corresponding coordinates If there are m bad pixels and nm normal pixels at the position, then the average of the eigenvalues of the nm normal pixels is used to replace the eigenvalues of the m bad pixels.
[0059] Step 134: In response to the fact that the plurality of reference pixels are all bad pixel pixels, the characteristic value of the target bad pixel is adjusted to be: the average characteristic value of a plurality of non-bad pixel pixels in a neighborhood centered on the target bad pixel in the target image block.
[0060] Continue reading Figure 6 , if Z If the values of all the two-dimensional image blocks (reference image blocks) at the position are 0 (all bad pixels), the calculation method in step 133 cannot be used at this time. Here, the average value of the characteristic values of the normal pixels in the neighborhood of the two-dimensional image block is used instead.
[0061] Specifically, a 3×3 pixel array centered on a target bad pixel is determined in a target image block; and a characteristic value of the target bad pixel is adjusted to be: an average characteristic value of a plurality of non-bad pixel pixels in the remaining pixels except the target bad pixel in the 3×3 pixel array.
[0062] For example, If the position is a bad pixel, then use the nth two-dimensional image block, The bad pixel is replaced by the average of the characteristic values of normal pixels in a 3×3 neighborhood, which can be expressed as follows:
[0063] Among them, Adv is used here n,i,j Replace coordinates The value of the bad pixels in other layers needs to be calculated independently.
[0064] Step 14: Use the adjusted feature values of the multiple reference image blocks to adjust the feature values of the image to be processed.
[0065] The characteristic value of the bad pixel in the image to be processed is replaced by the average characteristic value of the characteristic values of at least one pixel in the same position in the multiple reference image blocks in the same position after adjustment.
[0066] It can be understood that the adjusted multiple reference image blocks are tiled to the original position of the reference image blocks in the image to be processed. It can be understood that, because for each pixel, the process such as steps 11 to 13 mentioned above will be adopted, so corresponding to the same pixel position, many of the above-mentioned reference image blocks can be tiled on it, then the average eigenvalue of the eigenvalues of multiple pixels at the same position in the multiple reference image blocks corresponding to the pixel can be used as the latest eigenvalue of the pixel.
[0067] Through the above-mentioned process of step 11 to step 14, the processing of the image to be processed is completed, that is, the noise removal processing is performed on the image to be processed.
[0068] The image processing method provided in this embodiment includes: determining bad pixel in the image to be processed; determining multiple similar reference image blocks in the image to be processed; for the target bad pixel of the target image block in the multiple reference image blocks, adjusting the characteristic value of the target bad pixel by using the characteristic value of the non-bad pixel in the target image block, or the characteristic value of the non-bad pixel at the same position in the remaining reference image blocks except the target image block, so as to obtain multiple adjusted reference image blocks; adjusting the characteristic value of the image to be processed by using the characteristic value of the adjusted multiple reference image blocks. Through the above method, the impact noise in the image to be processed can be filtered out by using the method of determining bad pixel, determining similar blocks, and adjusting bad pixel by using similar blocks. Since the impact noise is generally caused by the failure of the photosensitive element in the image sensor, the above image processing method can remove the noise caused by the damage of the photosensitive element in the image sensor, thereby improving the image quality.
[0069] See also Figure 7 , Figure 7 : is a flow chart of another embodiment of the image processing method of the present application, the image processing method comprising: Step 71: Determine the bad pixels in the image to be processed.
[0070] Among them, bad pixels are caused by failure of the photosensitive element at the corresponding position in the image sensor.
[0071] Optionally, step 11 may specifically include: determining the maximum eigenvalue and the minimum eigenvalue of multiple pixels in a neighborhood centered on the target pixel; in response to the eigenvalue of the target pixel being greater than the maximum eigenvalue, and the difference with the maximum eigenvalue being greater than a set limit threshold, determining that the target pixel is a bad pixel; or in response to the eigenvalue of the target pixel being less than the minimum eigenvalue, and the difference with the minimum eigenvalue being greater than the limit threshold, determining that the target pixel is a bad pixel.
[0072] The characteristic value here may be a pixel value, a grayscale value, a brightness value, etc.
[0073] In a specific embodiment, the neighborhood may be a 3×3 pixel area. Specifically, a 3×3 pixel array centered on the target pixel is determined; and the maximum eigenvalue and the minimum eigenvalue of the remaining pixels in the 3×3 pixel array except the target pixel are determined.
[0074] like Figure 2 As shown, Figure 23×3 is a schematic diagram of a 3×3 pixel array in an embodiment. To detect whether the central pixel E is a bad pixel, the characteristic values of the 8 pixels in the 3×3 area are sorted, excluding the E pixel. After sorting, , the characteristic value of pixel E is compared with V1 and V8. If it is smaller than V1, or larger than V8, and the difference exceeds a certain range, then E is considered a bad pixel. The following formula can be used:
[0075] Where defThr is the limit threshold, which indicates the maximum difference between the feature value of pixel E and V1 or V8. Mask is 0, which means the pixel is a bad pixel, and mask is 1, which means the pixel is a normal pixel.
[0076] It can be understood that for each pixel, the above-mentioned method can be used to determine whether it is a bad pixel, so that a mask image can be obtained.
[0077] Step 72: Determine a plurality of similar reference image blocks in the image to be processed.
[0078] Optionally, in one embodiment, step 72 may include: determining a first image block in the image to be processed; determining a candidate image block having the same size as the first image block in a set search area in the image to be processed; determining a similarity between each candidate image block and the first image block; determining a set number of candidate image blocks ranked top in similarity as second image blocks, and the first image block and the plurality of second image blocks forming a plurality of reference image blocks.
[0079] The size of the first image block is defined as BR, that is, a BR×BR pixel array, and the search radius is SR.
[0080] like Figure 4 As shown, Figure 4 1 is a schematic diagram of multiple reference image blocks in an embodiment. Here, BR=3 and SR=4 are taken as an example, that is, a 3×3 pixel array is an image block, and the search radius is 4.
[0081] First, determine the first image block, that is, the red image block centered on pixel C, and then determine the search range centered on the first image block as follows: Figure 4 As shown, there are a total of candidate blocks, including the red image block itself, and each candidate block is 3×3 in size.
[0082] The similarity between the candidate image block and the first image block is defined by the difference between the blocks, that is, the average value of the absolute value of the difference between the pixels of the blocks, as shown in the following formula:
[0083] Wherein, diff is the difference between any image block in the search range and the first image block, and diff0 is Figure 4 The difference between the B0 image block and the first image block (C image block) is and is the mask block at the corresponding position, the value of mask is 0 or 1, and i is the coordinate within the block.
[0084] After calculating the diff of all candidate image blocks within the search range, sort them, select the first M blocks with the smallest diff, and add the original block. multiple reference image blocks.
[0085] Step 73: For target bad pixel of a target image block in a plurality of reference image blocks, characteristic values of the target bad pixel are adjusted by using characteristic values of non-bad pixel in the target image block or characteristic values of non-bad pixel at the same position in the remaining reference image blocks except the target image block, so as to obtain a plurality of adjusted reference image blocks.
[0086] Optionally, in one embodiment, step 73 may include: stacking multiple reference image blocks to form a first three-dimensional image block; determining a target bad pixel of a target image block among the multiple reference image blocks, and multiple reference pixels corresponding to positions in the stacking direction of the first three-dimensional image block; in response to the multiple reference pixels including at least one non-bad pixel, adjusting the characteristic value of the target bad pixel to: an average characteristic value of at least one non-bad pixel; or in response to the multiple reference pixels being bad pixels, adjusting the characteristic value of the target bad pixel to: an average characteristic value of multiple non-bad pixels in a neighborhood centered on the target bad pixel in the target image block.
[0087] like Figure 6 As shown, Figure 6 1 is a schematic diagram of stacking a plurality of reference image blocks to form a three-dimensional image block in an embodiment. The plurality of reference images determined in the above embodiment are stacked in sequence to form a first three-dimensional image block, that is, A three-dimensional pixel array, Figure 6 In the figure, it is a 3×3×4 three-dimensional pixel array.
[0088] Specifically, the above three-dimensional image block is represented by Z, N in represents the layer of the two-dimensional image block (reference image block), and I and J represent the coordinates within the 2D image block.
[0089] Since it has been determined in the above step 11 whether each pixel is a bad pixel, represented by 0 and 1 respectively, 0 represents a bad pixel and 1 represents a normal pixel, then, the mask in step 11 can be used to determine whether each pixel in the first three-dimensional image block is a bad pixel.
[0090] Continue reading Figure 6 , if a pixel in Z is a bad pixel, the position information is , n represents the number of layers of the first three-dimensional image block, i and j represent the coordinates in the two-dimensional image block (reference image block), if in addition to the two-dimensional image block of the nth layer, The other two-dimensional image blocks of this coordinate are all normal pixels, so the characteristic values of these normal pixels can be averaged and replaced by this average value. The pixel value is expressed as follows:
[0091] Here ZM represents a three-dimensional mask stack built with mask. The two-dimensional mask blocks contained in this three-dimensional mask stack and the two-dimensional image blocks in Z have the same position in the original image.
[0092] This uses Adv i,j Replace coordinates In other words, if in the n-layer two-dimensional image, at the corresponding coordinates If there are m bad pixels and nm normal pixels at the position, then the average of the eigenvalues of the nm normal pixels is used to replace the eigenvalues of the m bad pixels.
[0093] Continue reading Figure 6 , if Z If the values of all the two-dimensional image blocks (reference image blocks) at the position are 0 (all bad pixels), the calculation method in step 133 cannot be used at this time. Here, the average value of the characteristic values of the normal pixels in the neighborhood of the two-dimensional image block is used instead.
[0094] Specifically, a 3×3 pixel array centered on a target bad pixel is determined in a target image block; and a characteristic value of the target bad pixel is adjusted to be: an average characteristic value of a plurality of non-bad pixel pixels in the remaining pixels except the target bad pixel in the 3×3 pixel array.
[0095] For example, If the position is a bad pixel, then use the nth two-dimensional image block, The bad pixel is replaced by the average of the characteristic values of normal pixels in a 3×3 neighborhood, which can be expressed as follows:
[0096] Among them, Adv is used here n,i,j Replace coordinates The value of the bad pixels in other layers needs to be calculated independently.
[0097] Step 74: Perform singular value decomposition and noise reduction processing on the first three-dimensional image block formed by the adjusted multiple reference image blocks to obtain a second three-dimensional image block.
[0098] Alternatively, if Figure 8 As shown, Figure 8 An embodiment Figure 7 Schematic diagram of the process of step 74 in FIG. 1 , step 74 may include: Step 741: Expand the first three-dimensional image block to form a first two-dimensional image block.
[0099] Each column of pixels in the first two-dimensional image block corresponds to a plurality of pixels in a reference image block in the first three-dimensional image block.
[0100] See also Figure 6 and Fig. 9 , Fig. 9 is a schematic diagram of the expansion of the first three-dimensional image block in an embodiment. Each reference image block (two-dimensional image block) in the first two-dimensional image block is expanded into a one-dimensional column vector, and these column vectors are arranged to form a new two-dimensional image block, namely, the first two-dimensional image block. Taking BR=3, N=3 as an example, a The 3D image stack is converted to The two-dimensional image block is represented by H here.
[0101] Step 742: Determine a first reference matrix corresponding to the first two-dimensional image block.
[0102] The first reference matrix here adopts the singular value decomposition method, and H after the singular value decomposition can be expressed as:
[0103] The steps for calculating singular values are as follows: a: Calculation The eigenvalues and eigenvectors of are expressed as follows:
[0104] Where x is the eigenvector, is the eigenvalue, H is the first reference matrix, H T is the transposed matrix of the first reference matrix. Arrange from large to small, Diagonal elements are placed from the upper left corner to the lower right corner. The eigenvector x is arranged according to The order is put into the V matrix from left to right.
[0105] b: Calculation The feature vector of .
[0106] H is After the singular value decomposition, V is Matrix, U is matrix, for matrix.
[0107] Step 743: Perform shrinkage processing on the singular values of the first reference matrix to obtain a second reference matrix.
[0108] It can be understood that this embodiment uses singular value contraction to perform matrix low-rank approximation, thereby achieving the purpose of noise reduction. Specifically, In The diagonal elements are the singular values. Just shrink The diagonal elements can achieve the purpose of low-rank approximation of the matrix.
[0109] in, is a The matrix can be expressed as follows:
[0110] in, for matrix, . for Matrix, all zeros.
[0111] Low-rank approximation requires the following processing:
[0112] It can be understood that the reference threshold deThr is set here, when When it is less than the threshold value deThr, it shrinks directly to 0.
[0113] After processing all singular values, replace the original singular values to get a new matrix , and replace it with the original Using the U and V matrices obtained by the previous singular value decomposition, the new matrix can be recalculated The calculation formula is as follows
[0114] Step 744: Determine a second two-dimensional image block corresponding to the second reference matrix.
[0115] Step 744 is an inverse process to step 742 and will not be described in detail here.
[0116] Step 745: restore the second two-dimensional image block to form a second three-dimensional image block.
[0117] Each column of pixels in the second two-dimensional image block corresponds to a plurality of pixels in a reference image block in the first three-dimensional image block.
[0118] like Fig.10 As shown, Fig.10 It is a schematic diagram of stacking the second two-dimensional image block to form a three-dimensional image block in an embodiment. It can be understood that step 745 is an inverse process to step 741, which will not be described in detail here.
[0119] It is worth noting that in the above process, the three-dimensional image block is converted into a two-dimensional image block, and the arrangement order of multiple pixels in each reference image block in the column direction is not limited here. For example, Figure 2 , can be in the order of ABCDEFGHI from top to bottom, or in other set order, but the order of converting each reference image block into a one-dimensional vector is the same. Similarly, in the process of restoring a two-dimensional image block to a second three-dimensional image block, its sorting order is also determined by the way of expanding the first two-dimensional image block into a two-dimensional image block, and the front and back need to be consistent.
[0120] Step 75: Use the adjusted feature values of the plurality of reference image blocks in the second three-dimensional image block to adjust the feature values of the image to be processed.
[0121] The characteristic value of the bad pixel in the image to be processed is replaced by the average characteristic value of the characteristic values of at least one pixel in the same position in the multiple reference image blocks in the same position after adjustment.
[0122] Understandably, the 3D image stack before denoising is represented as , the 3D image stack after denoising is represented as According to this embodiment, the 3D image heap size is . There are 4 two-dimensional image blocks in total, all of which are denoised image blocks. Repeat the above steps 71-74 to obtain the three-dimensional image blocks after all pixels are denoised. And the two-dimensional image blocks in these denoised three-dimensional image blocks are flattened according to their positions in the original image. There must be many positions where multiple two-dimensional image blocks overlap. Averaging these overlaps can get a denoised image. For example, a certain pixel point has 3 overlapping blocks, and the corresponding pixel eigenvalues are V1, V2 and V3 respectively. Then average them, as expressed by the following formula:
[0123] V is the final eigenvalue of the point after noise reduction.
[0124] The image processing method provided in this embodiment includes: determining bad pixel pixels in the image to be processed; determining multiple similar reference image blocks in the image to be processed; for the target bad pixel of the target image block in the multiple reference image blocks, adjusting the characteristic value of the target bad pixel by using the characteristic value of the non-bad pixel pixel in the target image block or the characteristic value of the non-bad pixel pixel at the same position in the remaining reference image blocks except the target image block, so as to obtain multiple adjusted reference image blocks; performing singular value decomposition and noise reduction processing on the first three-dimensional image block formed by the adjusted multiple reference image blocks to obtain a second three-dimensional image block; adjusting the characteristic value of the image to be processed by using the characteristic values of the multiple reference image blocks in the adjusted second three-dimensional image block. In the above manner, by adjusting the pixel value of the bad pixel and combining the singular value decomposition and noise reduction, on the one hand, the impact noise in the image to be processed can be filtered out, because the impact noise is generally caused by the failure of the photosensitive element in the image sensor, and on the other hand, the bad pixel that has been corrected in the image stack can be corrected again. This correction is based on the image stack as a whole, and the accuracy is higher, thereby improving the image quality.
[0125] See also Fig.11 , Fig.11 1 is a schematic diagram of the structure of an embodiment of an image processing device provided by the present application. The image processing device 110 includes a processor 81 and a memory 82. The memory 82 is used to store program data. The processor 81 is used to execute the above program data to achieve: Determine bad pixel in the image to be processed; determine multiple similar reference image blocks in the image to be processed; for the target bad pixel of the target image block in the multiple reference image blocks, adjust the characteristic value of the target bad pixel by using the characteristic value of the non-bad pixel in the target image block or the characteristic value of the non-bad pixel at the same position in the remaining reference image blocks except the target image block, so as to obtain multiple adjusted reference image blocks; adjust the characteristic value of the image to be processed by using the characteristic values of the adjusted multiple reference image blocks.
[0126] See also Fig.12 , Fig.12 1 is a schematic diagram of a structure of an embodiment of a computer-readable storage medium provided by the present application. The computer-readable storage medium 120 stores program data 121. When the program data 121 is executed by a processor, it is used to implement: Determine bad pixel in the image to be processed; determine multiple similar reference image blocks in the image to be processed; for the target bad pixel of the target image block in the multiple reference image blocks, adjust the characteristic value of the target bad pixel by using the characteristic value of the non-bad pixel in the target image block or the characteristic value of the non-bad pixel at the same position in the remaining reference image blocks except the target image block, so as to obtain multiple adjusted reference image blocks; adjust the characteristic value of the image to be processed by using the characteristic values of the adjusted multiple reference image blocks.
[0127] In the embodiments of the above-mentioned image processing device 110 and computer-readable storage medium 120, when the program data is executed by the processor, it is also used to implement: determining the maximum eigenvalue and the minimum eigenvalue of multiple pixels in a neighborhood centered on the target pixel; in response to the eigenvalue of the target pixel being greater than the maximum eigenvalue, and the difference with the maximum eigenvalue being greater than a set limit threshold, determining that the target pixel is a bad pixel; or in response to the eigenvalue of the target pixel being less than the minimum eigenvalue, and the difference with the minimum eigenvalue being greater than the limit threshold, determining that the target pixel is a bad pixel.
[0128] In the embodiments of the above-mentioned image processing device 110 and computer-readable storage medium 120, when the program data is executed by the processor, it is also used to implement: determining a first image block in the image to be processed; determining a candidate image block with the same size as the first image block in a set search area in the image to be processed; determining the similarity between each candidate image block and the first image block; determining a set number of candidate image blocks with top similarity rankings as second image blocks, and the first image block and the multiple second image blocks form multiple reference image blocks.
[0129] In the above-mentioned embodiments of the image processing device 110 and the computer-readable storage medium 120, when the program data is executed by the processor, it is also used to implement: stacking multiple reference image blocks to form a first three-dimensional image block; determining a target bad pixel of a target image block in the multiple reference image blocks, and multiple reference pixels corresponding to the positions in the stacking direction of the first three-dimensional image block; in response to the multiple reference pixels including at least one non-bad pixel, adjusting the characteristic value of the target bad pixel to: the average characteristic value of at least one non-bad pixel; or in response to the multiple reference pixels being all bad pixels, adjusting the characteristic value of the target bad pixel to: the average characteristic value of multiple non-bad pixels in a neighborhood centered on the target bad pixel in the target image block.
[0130] In the embodiments of the above-mentioned image processing device 110 and computer-readable storage medium 120, when the program data is executed by the processor, it is also used to implement: expanding the first three-dimensional image block to form a first two-dimensional image block; wherein each column of pixels of the first two-dimensional image block corresponds to multiple pixels of a reference image block in the first three-dimensional image block; determining a first reference matrix corresponding to the first two-dimensional image block; performing shrinkage processing on the singular values of the first reference matrix to obtain a second reference matrix; determining a second two-dimensional image block corresponding to the second reference matrix; and restoring the second two-dimensional image block to form a second three-dimensional image block; wherein each column of pixels of the second two-dimensional image block corresponds to multiple pixels of a reference image block in the first three-dimensional image block.
[0131] In the embodiments of the above-mentioned image processing device 110 and computer-readable storage medium 120, when the program data is executed by the processor, it is also used to implement: replacing the characteristic value of the bad pixel in the image to be processed with the average characteristic value of the characteristic values of at least one pixel in the same position in multiple reference image blocks with the same adjusted position.
[0132] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only illustrative, for example, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0133] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0134] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0135] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. An image processing method, characterized in that: The image processing method comprises: Determine a bad pixel in the image to be processed; wherein the bad pixel is caused by a failure of a photosensitive element at a corresponding position in the image sensor; Determining a plurality of similar reference image blocks in the image to be processed; For a target bad pixel of a target image block in the plurality of reference image blocks, adjusting the feature value of the target bad pixel by using the feature value of a non-bad pixel in the target image block or the feature value of a non-bad pixel at the same position in the remaining reference image blocks except the target image block, so as to obtain a plurality of adjusted reference image blocks; The characteristic values of the image to be processed are adjusted using the adjusted characteristic values of the plurality of reference image blocks.
2. The image processing method according to claim 1, characterized in that: The step of determining bad pixels in the image to be processed includes: Determine the maximum eigenvalue and the minimum eigenvalue of multiple pixels in a neighborhood centered on the target pixel; In response to the characteristic value of the target pixel being greater than the maximum characteristic value, and the difference between the characteristic value and the maximum characteristic value being greater than a set limit threshold, determining that the target pixel is a bad pixel; or In response to the characteristic value of the target pixel being smaller than the minimum characteristic value and the difference between the characteristic value and the minimum characteristic value being larger than the limit threshold, the target pixel is determined to be a bad pixel.
3. The image processing method according to claim 2, characterized in that: The step of determining the maximum eigenvalue and the minimum eigenvalue of a plurality of pixels in a neighborhood centered on the target pixel comprises: Determine a 3×3 pixel array centered on the target pixel; The maximum eigenvalue and the minimum eigenvalue of the remaining pixels in the 3×3 pixel array except the target pixel are determined.
4. The image processing method according to claim 1, characterized in that: The determining of a plurality of similar reference image blocks in the image to be processed comprises: Determining a first image block in the image to be processed; Determine, in a set search area in the image to be processed, a candidate image block having the same size as the first image block; Determining a similarity between each of the candidate image blocks and the first image block; A set number of candidate image blocks ranked top in similarity are determined as second image blocks, and the first image block and a plurality of the second image blocks form a plurality of reference image blocks.
5. The image processing method according to claim 1, characterized in that: The step of adjusting the characteristic value of a target bad pixel of a target image block in the plurality of reference image blocks by using the characteristic value of a non-bad pixel in the target image block or the characteristic value of a non-bad pixel at the same position in the remaining reference image blocks except the target image block comprises: Stacking a plurality of the reference image blocks to form a first three-dimensional image block; Determine a target bad pixel of a target image block in a plurality of the reference image blocks, and a plurality of reference pixels corresponding to positions in a stacking direction of the first three-dimensional image block; In response to the plurality of reference pixels including at least one non-dead pixel, adjusting the characteristic value of the target bad pixel to: an average characteristic value of the at least one non-dead pixel; or In response to the fact that the plurality of reference pixels are all bad pixel pixels, the characteristic value of the target bad pixel is adjusted to be: an average characteristic value of a plurality of non-bad pixel pixels in a neighborhood centered on the target bad pixel in the target image block.
6. The image processing method according to claim 5, characterized in that: The step of adjusting the characteristic value of the target bad pixel to the average characteristic value of a plurality of non-bad pixel pixels in a neighborhood centered on the target bad pixel in the target image block includes: Determine a 3×3 pixel array centered on the target bad pixel in the target image block; The characteristic value of the target bad pixel is adjusted to: an average characteristic value of a plurality of non-bad pixel pixels in the remaining pixels except the target bad pixel in the 3×3 pixel array.
7. The image processing method according to claim 5, characterized in that: The image processing method further includes: Expanding the first three-dimensional image block to form a first two-dimensional image block; wherein each column of pixels of the first two-dimensional image block corresponds to a plurality of pixels of one of the reference image blocks in the first three-dimensional image block; Determining a first reference matrix corresponding to the first two-dimensional image block; Performing shrinkage processing on the singular values of the first reference matrix to obtain a second reference matrix; Determine a second two-dimensional image block corresponding to the second reference matrix; The second two-dimensional image block is restored to form a second three-dimensional image block; wherein each column of pixels in the second two-dimensional image block corresponds to a plurality of pixels of one of the reference image blocks in the first three-dimensional image block.
8. The image processing method according to claim 1, characterized in that: The step of adjusting the characteristic value of the image to be processed by using the adjusted characteristic values of the plurality of reference image blocks comprises: The characteristic value of the bad pixel in the to-be-processed image is replaced by the average characteristic value of the characteristic values of at least one pixel at the same position in the multiple reference image blocks at the same position after adjustment.
9. An image processing device, characterized in that: The image processing device comprises a processor and a memory, the memory is used to store program data, and the processor is used to execute the program data to implement the image processing method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program data, and when the program data is executed by a processor, it is used to implement the image processing method according to any one of claims 1 to 8.
Citation Information
Patent Citations
System and method for detecting and correcting defective pixels in an image sensor
CN102640489A
Non-local image denoising method based on low rank restoration
CN106934775A
Elimination method of image dead pixels, terminal and storage medium
CN108198150A
Dead pixel correction method and device for video image, equipment and medium
CN115967865A
Dead pixel detection method, chip, electronic equipment and computer readable storage medium
CN116418970A
