Image processing method, image processing device, and electronic device

By fusing image gradient information and Gaussian filtering, the color banding problem was solved, improving the color banding repair effect while avoiding image blurring and increased noise, simplifying the operation process, and expanding applicability.

CN116721170BActive Publication Date: 2025-12-05VIVO MOBILE COMM (SHENZHEN) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310800893.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-30
Publication Date
2025-12-05
Estimated Expiration
2043-06-30

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively address color banding issues in large areas of solid color gradients when image bit depth is insufficient or adjustment is excessive. Furthermore, conventional methods are prone to causing image blurring and increased noise.

Method used

By acquiring the gradient information of the image and a preset exponential function, the image after Gaussian filtering is fused to increase the proportion of pixels in the original image with larger gradient values, perform targeted color banding repair, and restore misoptimized pixels when necessary, thereby avoiding increased noise and image blurring.

Benefits of technology

While improving the color banding repair effect, it avoids the problems of increased image noise and blurring, simplifies the operation complexity, expands the scope of application, and reduces the dependence on the training dataset.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116721170B_ABST
    Figure CN116721170B_ABST
Patent Text Reader

Abstract

The application discloses an image processing method, an image processing device and electronic equipment, and belongs to the technical field of image processing. The method comprises the following steps: acquiring a first image, the first image having color discontinuity; performing Gaussian filtering processing on the first image to obtain a second image; determining a fusion coefficient of the first image and the second image according to first gradient information of the first image and a preset exponential function, and obtaining a third image based on the first image, the second image and the fusion coefficient; the first gradient information comprises a first gradient value corresponding to each pixel in the first image; obtaining a fourth image based on second gradient information of the third image and the first image, the second gradient information comprising a second gradient value corresponding to each pixel in the third image.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of image processing, and particularly relates to an image processing method, an image processing device and an electronic device. BACKGROUND

[0002] In the related art, an image is processed by using an Artificial Intelligence (AI) filter, an AI three-dimensional look-up table (3D LUT), and an AI color mapping algorithm. However, in a scenario where the image bit depth is insufficient or the adjustment strength is too large, a color discontinuity problem is very likely to occur when a large-area pure color gradient region is processed.

[0003] Most of the time when the color discontinuity occurs, people add random noise and small kernel Gaussian filtering to the entire image to slow down the obviousness of the color discontinuity, but this cannot fundamentally solve the problem of color discontinuity, and the above operation will cause various problems such as blurring of the details of the entire image and increase of noise. SUMMARY

[0004] The purpose of the embodiments of the present application is to provide an image processing method, an image processing device and an electronic device, which can improve the color discontinuity repair effect of an image, and also will not cause problems such as increase of noise and blurring of the image.

[0005] In a first aspect, the embodiments of the present application provide an image processing method, which comprises:

[0006] obtaining a first image, wherein a color discontinuity exists in the first image;

[0007] performing Gaussian filtering processing on the first image to obtain a second image;

[0008] determining a fusion coefficient of the first image and the second image according to first gradient information of the first image and a preset exponential function, and obtaining a third image based on the first image, the second image and the fusion coefficient, wherein the first gradient information comprises a first gradient value corresponding to each pixel in the first image;

[0009] obtaining a fourth image based on second gradient information of the third image and the first image, wherein the second gradient information comprises a second gradient value corresponding to each pixel in the third image.

[0010] In a second aspect, the embodiments of the present application provide an image processing device, which comprises:

[0011] an obtaining module configured to obtain a first image, wherein a color discontinuity exists in the first image;

[0012] The first processing module is configured to perform Gaussian filtering on the first image to obtain a second image;

[0013] The fusion module is configured to determine a fusion coefficient of the first image and the second image according to first gradient information of the first image and a preset exponential function, and obtain a third image based on the first image, the second image and the fusion coefficient, wherein the first gradient information comprises a first gradient value corresponding to each pixel in the first image.

[0014] The second processing module is configured to obtain a fourth image based on second gradient information of the third image and the first image, wherein the second gradient information comprises a second gradient value corresponding to each pixel in the third image.

[0015] In a third aspect, an electronic device is provided, which includes a processor and a memory. The memory stores programs or instructions executable on the processor. When the programs or instructions are executed by the processor, the steps of the method according to the first aspect are implemented.

[0016] In a fourth aspect, a readable storage medium is provided, which stores programs or instructions. When the programs or instructions are executed by a processor, the steps of the method according to the first aspect are implemented.

[0017] In a fifth aspect, a chip is provided, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is configured to run programs or instructions to implement the method according to the first aspect.

[0018] In a sixth aspect, a computer program product is provided, which is stored in a storage medium. The program product is executed by at least one processor to implement the method according to the first aspect.

[0019] In the embodiments of the present application, the original image (i.e. the first image) is fused with the second image filtered by Gaussian filtering based on the first gradient information of the original image and the preset exponential function. The proportion of the original image pixels with large gradient values in the obtained third image can be improved. The color band repair can be performed more targetedly based on the gradient information. The color discontinuity repair effect of the image is improved, and the problems of noise increase and image blurring are avoided. BRIEF DESCRIPTION OF DRAWINGS

[0020] Figure 1 is a flowchart of an image processing method provided by the embodiments of the present application;

[0021] Figure 2is a flowchart of another image processing method provided by an embodiment of the present application;

[0022] Figure 3 is a structural schematic diagram of an image processing device provided by an embodiment of the present application;

[0023] Figure 4 is a structural schematic diagram of an electronic device provided by an embodiment of the present application;

[0024] Figure 5 is a hardware structural schematic diagram of another electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0025] The technical solutions in the embodiments of the present application will be clearly described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art belong to the scope of protection of the present application.

[0026] The terms "first", "second", and the like in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are usually a category and do not limit the number of objects, for example, the first object can be one or more. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / ", generally represents that the front and rear associated objects are in an "or" relationship.

[0027] In the related art, the image is processed by using algorithms such as AI filter, AI 3D LUT and AI color mapping, but in the scene where the image bit depth is not enough or the adjustment force is too large, the processing of large-area pure color gradient area is very easy to appear color fracture problem. Especially in the landscape photos taken in the early morning or evening (i.e. blue tone time), the color of the sky is rich and the transition is natural, which is very beautiful, but after the photo processing is completed, the color transition of the originally very smooth and natural sky part often becomes a color fracture zone with color blocks.

[0028] In the related art, in order to repair the color band fracture in the image, the following method is used to repair the image:

[0029] Method 1) Slow down the obvious degree of color fracture by adding random noise and small kernel Gaussian filtering to the whole image.

[0030] However, this method 1) cannot fundamentally solve the problem of color banding, and the above operation will cause various problems such as blurring of details and increased noise in the entire image.

[0031] Method 2) Users use image processing software to select the scope of application (selection areas of various shapes) to perform the random noise addition and small kernel Gaussian filtering processing as described in Method 1) on the scope of application.

[0032] However, given that the area surrounding the location where the color band appears is not a large area of ​​pure color, method 2) still cannot overcome the problems of blurring and increased noise.

[0033] Method 3) Reduce the severity of color banding by repeatedly using a bilateral filter to protect sharp object edges.

[0034] However, method 3) still introduces serious ambiguity issues.

[0035] Method 4) Use AI model training to solve the color banding problem.

[0036] However, this method 4) requires the collection of a large number of paired (i.e., a training sample data includes the original image with color bands before restoration and the image with color bands removed after restoration) or unpaired training datasets, and the generalization ability of the model after training is strongly correlated with the coverage of the training set. Therefore, its applicability is poor.

[0037] In the image processing method provided in this application embodiment, based on the first gradient information of the original image (i.e., the first image) and the preset indicator function, the original image is fused with the second image after Gaussian filtering. This can increase the proportion of original image pixels with larger gradient values ​​in the obtained third image, and can perform color banding repair more specifically based on gradient information. While improving the color banding repair effect of the image, it will not cause noise increase or image blurring problems.

[0038] Furthermore, compared to method 2) in the related technologies, the image processing method provided in this application embodiment does not require the user to select or identify the color band range, but processes the entire image, reducing the operational complexity of the image processing method; compared to method 4) in the related technologies, the image processing method provided in this application embodiment does not require the collection of a large training dataset, and has a wider range of applications.

[0039] The image processing method, image processing apparatus, and electronic device provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.

[0040] Please see Figure 1 The image processing method provided in this application includes the following steps:

[0041] Step 101: Obtain the first image, in which color banding exists.

[0042] In one embodiment, the device that performs the image processing method provided in the embodiments of this application may have a shooting function. In this case, the first image can be captured by a camera, and after the image is processed by any algorithm such as AI filter, AI 3D LUT or AI color mapping, color banding is generated.

[0043] In another embodiment, the first image obtained above can be an image input via network transmission, radio frequency transmission, wired transmission, or other means.

[0044] The first image mentioned above can be understood as the original image with color bands, where color bands can also be referred to as color bands.

[0045] In some embodiments, given that low-bit-depth images are more prone to generating color banding, the first image described above may be a low-bit-depth image such as an 8-bit image.

[0046] Of course, the first image mentioned above can also be an image with color banding of any bit depth, and no specific limitation is made here.

[0047] Step 102: Perform Gaussian filtering on the first image to obtain the second image.

[0048] It should be noted that each pixel in the first image can contain at least two channels.

[0049] For example, an RGB image consists of pixels with three channels: R, G, and B. The pixels in the first image can be denoted as img1(i,j,m), where i represents the pixel in the i-th row, j represents the pixel in the j-th column, and m represents the channel. i∈[1,imghigh], j∈[1,imgwidth], m∈[r,g,b], where imghigh represents the height of the first image and imgwidth represents the width of the first image.

[0050] For ease of explanation, a 3-channel pixel representation is used as an example to illustrate the embodiments of this application. It is worth noting that in this embodiment, image processing involves processing the pixel data of each channel of the image separately. For example, Gaussian filtering is applied to the pixels of the R channel, G channel, and B channel in the first image, resulting in a second image with pixels representing three channels. Subsequently, steps 103 and 104 are performed on the image pixels of each channel separately. Furthermore, the fourth image can be a complete image obtained based on data from all channels.

[0051] In some implementations, the kernel size of the Gaussian filter is adjustable. The larger the Gaussian filter kernel, the greater the degree of modification to the pixels in the first image and the better the color banding elimination effect. However, it will also introduce greater image noise or blur the image.

[0052] In some embodiments, the kernel size for Gaussian filtering can be between 30 and 100.

[0053] In this embodiment, by setting a larger Gaussian filter kernel, the color banding elimination effect can be improved, and the subsequent steps 103 and 104 can reduce the image noise or image blurring problems introduced by Gaussian filtering.

[0054] Step 103: Determine the fusion coefficient between the first image and the second image based on the first gradient information of the first image and the preset exponential function, and obtain a third image based on the first image, the second image and the fusion coefficient; wherein, the first gradient information includes the first gradient value corresponding to each pixel in the first image.

[0055] For ease of explanation, in this embodiment of the application, the first pixel refers to any pixel in the first image, the third pixel refers to a pixel in the third image, and the pixel in the second image is referred to as the second pixel.

[0056] It should be noted that the pixels in the first, second, and third images are in one-to-one correspondence. For example, if the first, second, and third images are all 3-channel RGB images, then the pixels in the first, second, and third images can be divided into three pixel matrices: R-channel, G-channel, and B-channel. For pixel matrices corresponding to the same channel, such as the R-channel pixel matrix, the width and length of these three pixel matrices are the same.

[0057] At this time, the third pixel is the pixel in the third image that corresponds to the first pixel. It can be understood that the pixel position of the third pixel in the third image is the same as the pixel position of the first pixel in the first image, and the third pixel and the first pixel belong to the same channel.

[0058] For example: Suppose the first image is img1 and the third image is img3, then the first pixel can be denoted as img1(i,j,m) and the third pixel can be denoted as img3(i,j,m). For a fixed set of i, j, m, img1(i,j,m) and img3(i,j,m) correspond.

[0059] In this embodiment, for pixels at the same pixel position under the same pixel channel, the third pixel in the third image can be obtained by fusing the first pixel and the second pixel.

[0060] For example, the first pixel and the second pixel are weighted and summed to obtain the third pixel. The weight of the first pixel can be understood as a scaling factor or fusion factor, which is positively correlated with the first gradient value of the first pixel. That is, within a certain range, the larger the first gradient value, the larger the weight of the corresponding first pixel. At this time, the proportion of the first pixel in the third image is also larger.

[0061] In one embodiment, the first gradient information can be obtained by calculating the pixel matrix of each channel of the first image separately based on the target gradient algorithm.

[0062] For example, for a certain first pixel img1(i,j,m), its corresponding first gradient value can be denoted as grad1(i,j,m).

[0063] As an optional implementation, the step of determining the fusion coefficient between the first image and the second image based on the first gradient information of the first image and a preset exponential function, and obtaining a third image based on the first image, the second image, and the fusion coefficient, includes:

[0064] Based on the target gradient algorithm, the first gradient value corresponding to each pixel in the first image is determined;

[0065] A set of fusion coefficients is determined based on the first gradient value corresponding to each first pixel in the first image and a preset exponential function, wherein the set of fusion coefficients includes fusion coefficients corresponding to each first pixel in the first image;

[0066] The first product is determined based on the first pixel and the corresponding fusion coefficient;

[0067] A second product is determined based on the second pixel in the second image and (1 - the fusion coefficient corresponding to the first pixel), wherein the second pixel is the pixel in the second image corresponding to the first pixel;

[0068] The third pixel in the third image is determined based on the sum of the first product and the second product.

[0069] In some embodiments, the target gradient algorithm may be the Sobel operator.

[0070] The Sobel operator is mainly used to obtain the first-order gradient of digital images.

[0071] Of course, the target gradient algorithm can also be other gradient algorithms, such as the Roberts operator, the Prewitt operator, the intermediate gradient operator, etc., without being specifically limited here.

[0072] The Roberts operator, based on a gradient algorithm using cross-difference, detects edge lines through local difference calculations. It is often used to process low-noise images with steep edges, and performs particularly well when image edges are close to +45 or -45 degrees. Its drawbacks include less accurate edge localization and relatively coarse extracted edge lines.

[0073] The Prewitt operator performs edge detection by using the difference between pixel grayscale values ​​within a specific region. Because the Prewitt operator uses a 3×3 template to calculate pixel values ​​within the region, its edge detection results are more pronounced than those of the Robert operator in both the horizontal and vertical directions. The Prewitt operator is suitable for recognizing images with significant noise and gradual grayscale changes.

[0074] The Sobel operator detects edges by calculating the weighted differences in gray levels between pixels' top, bottom, left, and right neighbors, where these differences reach extreme values ​​at the edges. It smooths noise and provides relatively accurate edge direction information. Because the Sobel operator combines Gaussian smoothing and differentiation, the result is more robust to noise. When high precision is not required, the Sobel operator is a commonly used edge detection method. The Sobel operator provides more accurate edge localization and is often used for images with high noise levels and gradual gray-level changes.

[0075] An intermediate gradient operator can be an intermediate gradient operator located between other gradient operators.

[0076] In one implementation, the first gradient value corresponding to each pixel in each channel of the first image can be calculated based on the Sobel operator. For example, the pixel gradient value in the R channel of the first image is denoted as grad1(i,j,r), the pixel gradient value in the G channel of the first image is denoted as grad1(i,j,g), and the pixel gradient value in the B channel of the first image is denoted as grad1(i,j,b).

[0077] Then, the first gradient value under each channel is processed in a certain way, such as limiting the gradient range to be processed, calculating the first gradient value using an exponential function, etc., to obtain the fusion coefficient that corresponds one-to-one with the first gradient value.

[0078] It is worth noting that since the first gradient value corresponds one-to-one with the first pixel in each channel, the fusion coefficient also corresponds to the first pixel with the same first gradient value. In this case, the fusion coefficient serves as the weight or scaling factor for the corresponding first pixel.

[0079] Similarly, if the second pixel in the second image corresponds one-to-one with the first pixel in the first image, then the weight or scaling factor of the second pixel is equal to 1 minus the fusion coefficient of the corresponding first pixel.

[0080] For example: for fixed i, j, m, img3(i,j,m) = img1(i,j,m) * ratio m +img2(i,j,m)*(1-ratio m ), where img2(i,j,m) represents the second pixel in the second image, and ratio m This represents the fusion coefficient of img1(i,j,m), where the first product is img1(i,j,m)*ratio m The second product is img2(i,j,m)*(1-ratio) m ).

[0081] As an optional implementation, determining the fusion coefficient set based on the first gradient value corresponding to each first pixel in the first image and a preset exponential function includes:

[0082] Take the absolute value of each first gradient value in the first gradient information to obtain the third gradient information, which includes the third gradient value corresponding to each first pixel in the first image.

[0083] The target third gradient value in the third gradient information is modified to a preset maximum gradient value to obtain the fourth gradient information, wherein the target third gradient value is greater than the preset maximum gradient value or less than the preset minimum gradient value.

[0084] The first value corresponding to each gradient value in the fourth gradient information and the second value corresponding to the preset maximum gradient value are determined based on a preset exponential function.

[0085] The fusion coefficient corresponding to each first pixel in the first image is determined based on the ratio between the first value and the second value corresponding to each gradient value in the fourth gradient information.

[0086] The third gradient value is the absolute value of the corresponding first gradient value.

[0087] In one embodiment, the preset maximum gradient value and the preset minimum gradient value are used to limit the gradient value range that needs to be fused to fuse the first pixel corresponding to the first gradient value within the gradient value range and the second pixel. For the first pixel corresponding to the first gradient value outside the gradient value range, it can be retained in the third image, that is, the original image pixel corresponding to the first gradient value outside the gradient value range is retained in the third image.

[0088] For example, the fourth gradient information can be obtained by modifying the target third gradient value in the third gradient information to a preset maximum gradient value using the following formula:

[0089]

[0090] Wherein, grad2(i,j,m) represents the third gradient value corresponding to img1(i,j,m) in the third gradient information, grad3(i,j,m) represents the gradient value corresponding to img1(i,j,m) in the fourth gradient information, threshold_max represents the preset maximum gradient value, and threshold_min represents the preset minimum gradient value.

[0091] Among them, the fusion coefficient corresponding to threshold_max can be equal to 1, so img3(i,j,m)=img1(i,j,m)*1+img2(i,j,m)*0=img1(i,j,m).

[0092] In one embodiment, the values ​​of the preset maximum gradient value and the preset minimum gradient value can be determined based on the pixel gradient of the color band in the first image. For example, the range defined by the preset maximum gradient value and the preset minimum gradient value is the area where the pixel gradient of the color band in the first image is mainly concentrated.

[0093] In another implementation, the preset maximum gradient value and preset minimum gradient value can be set manually or are adjustable, and are not specifically limited here.

[0094] In some embodiments, the preset maximum gradient value can be equal to 20, and the preset minimum gradient value can be equal to 2.

[0095] In one implementation, a first value corresponding to each gradient value in the fourth gradient information and a second value corresponding to the preset maximum gradient value are determined based on a preset exponential function; and the fusion coefficient corresponding to each first pixel in the first image is determined based on the ratio between the first value and the second value corresponding to each gradient value in the fourth gradient information. Since the exponential function better reflects the gradient change characteristics between color fault locations and non-fault locations, using the exponential function to calculate the fusion ratio coefficient of the first and second pixels can improve the color fault repair effect of the third image obtained by pixel fusion based on this fusion ratio coefficient, while also avoiding increased noise and image blurring.

[0096] Specifically, given that the gradient of the pixels in the color band section that needs to be adjusted in the first image is relatively small, based on a preset exponential function, between the preset maximum gradient value and the preset minimum gradient value, the smaller the gradient, the more Gaussian filter pixels need to be fused, while as the gradient increases, the proportion of Gaussian filter pixels needs to be rapidly reduced.

[0097] Step 104: Based on the second gradient information of the third image and the first image, a fourth image is obtained, wherein the second gradient information includes the second gradient value corresponding to each pixel in the third image.

[0098] In one embodiment, the color band optimization effect of each third pixel in the third image can be determined based on the second gradient information of the fused third image. If the color band optimization effect of a certain third pixel is poor or it has been mistakenly optimized, the corresponding first pixel in the first image can be used to replace or optimize the third pixel, thereby further improving the error correction performance of the color band optimization process.

[0099] As an optional implementation, obtaining the fourth image based on the second gradient information of the third image and the first image includes:

[0100] Based on the second gradient information of the third image, the target third pixel in the third image is updated using the target first pixel in the first image to obtain the fourth image;

[0101] Wherein, the absolute value of the second gradient value corresponding to the target third pixel is greater than the first threshold, and the target first pixel is the pixel in the first image that corresponds to the target third pixel.

[0102] The first threshold can be a preset threshold or a manually adjusted threshold. It is used to determine whether the third pixel in the third image belongs to the pixel that was mistakenly optimized in step 103. For example, pixels that are not at the color bandgap position were mistakenly optimized in step 103.

[0103] By determining whether the absolute value of the second gradient value of each third pixel in the third image is greater than the first threshold, it is determined whether the third pixel belongs to the pixel that was incorrectly optimized in step 103. If so, the third pixel is updated to the corresponding original pixel in the first image, thus realizing the recovery mechanism after incorrect optimization.

[0104] For example: Assuming the fourth image is denoted as img4, the third image img3 can be optimized using the following formula:

[0105]

[0106] Among them, grad opt1(i,j,m) Threshold represents the second gradient value of pixel img3(i,j,m) in the third image. opt This represents the first threshold.

[0107] As an optional implementation, the step of updating the target third pixel in the third image using the target first pixel in the first image based on the second gradient information of the third image to obtain the fourth image includes:

[0108] Execute the target iterative process;

[0109] After the target iteration process has iterated a preset number of times, the fourth image is determined;

[0110] The target iteration process includes:

[0111] The second gradient information of the third image is determined based on a preset gradient algorithm;

[0112] Based on the second gradient information, the target third pixel in the third image is updated using the target first pixel in the first image;

[0113] The preset gradient algorithm includes at least two gradient algorithms, and each iteration in the target iteration process uses any one of the at least two gradient algorithms.

[0114] The preset number of times can be a pre-set value or an adjustable value, which is usually at least 5 times. For example, the preset number of times can be any of the values ​​5, 6, 7, etc.

[0115] In one embodiment, the preset gradient algorithm may include at least two of the Sobel operator, Roberts operator, Prewitt operator, and intermediate gradient operator. For ease of explanation, this application typically uses the Sobel operator, Roberts operator, Prewitt operator, and intermediate gradient operator as examples of preset gradient algorithms. However, it may also include fewer or more gradient algorithms, or it may include other types of gradient algorithms, which are not specifically limited here.

[0116] By using at least two gradient algorithms in each iteration during the target iteration process to determine whether the gradient value of the third pixel is greater than the first threshold, the problem of consecutive pixels being misjudged when using a single gradient algorithm can be overcome. This can prevent pixels at special locations from being optimized due to the inability to detect gradients, thus improving the comprehensiveness of the detection of mis-optimized pixels.

[0117] For example, assuming the fourth image is denoted as img4, the third image img3 can be optimized using the following formula:

[0118]

[0119] Among them, grad opt1(i,j,m) Threshold represents the second gradient value of pixel img4(i,j,m) in the fourth image. opt This represents the first threshold.

[0120] It should be noted that the initial value of the fourth image is the third image, that is, in the first iteration, img4(i,j,m) is equal to img3(i,j,m).

[0121] As an optional implementation, the method further includes:

[0122] If the fourth image does not match the preset color fault repair requirements, adjust the first parameter;

[0123] The first step is repeated based on the adjusted first parameter until the fourth image matches the preset color fault repair requirement information, at which point the fourth image is output.

[0124] The first step includes at least one of the following steps:

[0125] The first image is subjected to Gaussian filtering to obtain the second image;

[0126] Based on the first gradient information of the first image and a preset exponential function, the fusion coefficient between the first image and the second image is determined, and a third image is obtained based on the first image, the second image and the fusion coefficient.

[0127] A fourth image is obtained based on the second gradient information of the third image and the first image.

[0128] In one embodiment, outputting the fourth image may involve displaying the fourth image.

[0129] In another embodiment, the output of the fourth image may be transmitted to other devices via network transmission, radio frequency transmission, wired transmission, or other means.

[0130] In this embodiment, the parameters of at least one of steps 102, 103 and 104 can be adjusted and can be re-executed. After each execution of step 104, it can be detected whether the fourth image meets the preset color tomography repair requirements. If it does, the fourth image is directly output. If it does not, the first parameter is adjusted and at least one of steps 102, 103 and 104 is re-executed until a fourth image that meets the preset color tomography repair requirements is obtained and then output.

[0131] In some embodiments, the first parameter includes at least one of the following:

[0132] The kernel size of the Gaussian filter is the kernel size of the Gaussian filter in step 102;

[0133] The first threshold, which is the gradient threshold used in step 104 to determine whether the third pixel in the third image is an incorrectly optimized pixel. opt ;

[0134] A preset maximum gradient value, i.e., in one embodiment of step 103, is used to limit the upper limit of the gradient value range for which pixel fusion is required. max ;

[0135] A preset minimum gradient value, or in one embodiment of step 103, is used to limit the gradient value range for pixel fusion, specifically the threshold value. min ;

[0136] The parameters of the preset exponential function, i.e., the parameters of the exponential function used to calculate the fusion coefficient in step 103, are, for example, assuming the preset exponential function is f(x) = A. x Where x represents the gradient value of the pixel for which the first or second value is to be calculated, such as grad3(i,j,m) for the first value, or the threshold for the second value.max At this point, the parameter A of the preset exponential function is adjustable.

[0137] In one implementation, the larger the parameter A, the faster the curve of f(x) rises and the fewer third pixels are involved in the modification; the smaller A is, the more third pixel values ​​are involved in the modification, and the better the effect.

[0138] In another implementation, the larger the kernel of the Gaussian filter, the greater the degree of modification to the first pixel in theory, and the better the color banding repair effect.

[0139] In another implementation, threshold max and threshold min The main control is the gradient range of the pixels to be fused, that is, the range in which the pixel gradients at the color band location are mainly concentrated. The larger the range between the two thresholds, the more pixels corresponding to the target third gradient value will participate in the adjustment, and the stronger the repair effect will be. The closer the two thresholds are set to the actual color band gradient size range, the better the repair effect will be.

[0140] In another implementation, the first threshold opt The larger the threshold, the fewer target third pixels in the third image will participate in the restoration, which may lead to the phenomenon of missed detection and incorrect optimization of pixels. Based on this trend, the size of the first threshold can be adjusted to achieve the desired optimal color tomography restoration effect.

[0141] In one embodiment, a fourth image can be displayed on a screen so that the user can visually judge whether the color tomography repair effect of the fourth image meets the requirements. Then, the user's operation is received. If the operation input by the user indicates that the color tomography repair effect of the fourth image meets the requirements, the fourth image is output. If not, the first parameter can be automatically adjusted or the first parameter input by the user can be received to re-execute at least one of the above steps 102, 103 and 104 until a fourth image that meets the preset color tomography repair requirements is obtained and then output.

[0142] In another implementation, software algorithms can be used to detect whether the fourth image meets the preset color fault repair requirements. For example, detecting whether the image noise is below a threshold, calculating and comparing the gradient magnitudes of the original fault region and the optimized region, etc., can achieve automatic detection of whether the fourth image meets the preset color fault repair requirements. No specific limitations are made here.

[0143] In this embodiment, the original image (i.e., the first image) is fused with the Gaussian-filtered second image based on the first gradient information of the original image. This increases the proportion of pixels with larger gradient values ​​in the resulting third image, enabling more targeted color banding repair based on gradient information. This improves the color banding repair effect without increasing noise or blurring the image. Furthermore, after fusing the original image with the Gaussian-filtered image, pixels with gradient values ​​greater than a first threshold in the fused third image are restored to their corresponding pixels in the original image. This restores incorrectly optimized pixels, ensuring clear image details and reducing image noise.

[0144] Please see Figure 2 This application also provides another image processing method, which may include the following steps:

[0145] Step 201: Obtain the original image: img1.

[0146] The original image is the first image, which contains color banding, such as an eight-bit color image.

[0147] The image width of img1 is denoted as imgwidth, and the image height is denoted as imghigh. The image in the following steps can be an RGB three-channel image, or it may be a four-channel image. This is not limited here. The processing in the following steps is performed channel by channel.

[0148] Step 202: Perform Gaussian filtering on img1 to obtain the second image: img2.

[0149] The kernel size for Gaussian filtering is between 30 and 100. For example, filter_kernel = 50, where filter_kernel represents the kernel size of Gaussian filtering.

[0150] Step 202 is mainly used to process color banding.

[0151] Step 203: Calculate the Sobel operator gradient for img1: grad1.

[0152] Here, grad1 is the first gradient information.

[0153] Step 204: Calculate the fusion ratio coefficient of img1 and img2 using the exponential function based on grad1.

[0154] Among them, the fusion ratio coefficient includes the fusion coefficient ratio of img1. m The weighting coefficient (1-ratio) of img2 and img2 m ).

[0155] In step 204, an exponential function is needed because the gradient of pixels in the color bandgap is relatively small. Within the adjustment threshold range, the smaller the gradient, the higher the proportion of pixels fused with Gaussian filtering. As the gradient increases, the proportion of pixels fused with Gaussian filtering needs to be reduced quickly. Therefore, an exponential function is selected as the generator for the fusion ratio coefficient. The specific calculation steps for the ratio coefficient are as follows:

[0156] 1) Take the absolute value of grad1, denoted as grad2 = |grad1|, which is used to directly determine the magnitude of the gradient;

[0157] 2) Perform thresholding on grad2, denoted as grad3:

[0158]

[0159] The exponential function can be f(x) = A x Where A∈(1.0,10.0), for example, setting A=2.2, the fusion coefficient of the first pixel is calculated as follows:

[0160] ratio m = f(x1) / f(x2)

[0161] Where x1 = grad3(i,j,m), x2 = threshold max , m∈[r,g,b].

[0162] Step 205: img1 and img2 are fused based on the fusion ratio coefficient to obtain the third image: img3.

[0163] In this step, the pixel value for each channel in img3 can be calculated based on the following formula:

[0164] img3(i,j,m)=img1(i,j,m)*ratio m +img2(i,j,m)*(1.0-ratio m )

[0165] Step 206: Randomly use one of the following operators—Sobel, Prewitt, Intermediate, or Roberts—to calculate the second gradient information grad_opt of img3.

[0166] Step 207: Replace the pixels in img3 whose gradient exceeds the first threshold threshold_opt with the corresponding pixels in img1.

[0167] It should be noted that steps 206 and 207 above are steps that can be executed iteratively multiple times, and the number of iterations can be at least 5.

[0168] Since steps 206 and 207 require multiple iterations, img4 = img3 is initialized. Assuming threshold_opt = 12, the above iterative process can restore the original image pixels for pixels with gradient values ​​greater than 12. This iterative process is mainly used to protect image details and reduce noise.

[0169] Specifically, the processes of steps 206 and 207 are as follows:

[0170] 1) Randomly select one of the four operators, Sobel, Prewitt, Intermediate, and Roberts, to calculate the gradient of the img4 image, denoted as grad_opt, and take its absolute value, denoted as grad_opt1=|grad_opt|;

[0171] 2) Replace pixels in img3 whose gradient exceeds the first threshold threshold_opt with the corresponding pixels in img1:

[0172]

[0173] The initial value of img4(i,j,m) in the first iteration is img3(i,j,m).

[0174] Step 208: Determine whether the decolorization effect of the fourth image img4 meets expectations.

[0175] Among them, img4 is the image output after the loop iteration of steps 206 and 207.

[0176] If the judgment result of step 208 is "yes", then proceed to step 209; if the judgment result of step 208 is "no", then adjust the first parameter and re-execute at least one of steps 201, 203, 204, 205, 206, 207 and 208 until the judgment result of step 208 is "yes", then proceed to step 209.

[0177] Step 209: Output img4.

[0178] This application proposes an 8-bit image processing method that directly processes the entire image without any preprocessing or color banding region extraction. It is simple and easy to use, and avoids the detail blurring and increased noise issues associated with color banding restoration schemes in related technologies, as well as the negative effect optimization problems. Furthermore, compared to AI solutions that do not require consideration of training set coverage and model generalization ability, this application only needs the color banding image itself as input to process color banding restoration, greatly expanding its applicability. In addition, the optimization of the 8-bit image color banding restoration method provided in this application also expands the post-processing adjustment space for 8-bit color images, eliminating concerns about color banding problems caused by excessive post-processing.

[0179] The image processing method provided in this application can be executed by an image processing device. This application uses an image processing device executing the image processing method as an example to illustrate the image processing device provided in this application.

[0180] Please see Figure 3 The image processing apparatus 300 provided in this application embodiment may include the following modules:

[0181] The acquisition module 301 is used to acquire a first image, in which color banding exists;

[0182] The first processing module 302 is used to perform Gaussian filtering on the first image to obtain the second image;

[0183] The fusion module 303 is used to determine the fusion coefficient between the first image and the second image based on the first gradient information of the first image and a preset exponential function, and to obtain a third image based on the first image, the second image and the fusion coefficient; wherein, the first gradient information includes the first gradient value corresponding to each pixel in the first image;

[0184] The second processing module 304 is used to obtain a fourth image based on the second gradient information of the third image and the first image, wherein the second gradient information includes the second gradient value corresponding to each pixel in the third image.

[0185] Optionally, the fusion module 303 includes:

[0186] The first determining unit is used to determine the first gradient value corresponding to each pixel in the first image based on the target gradient algorithm.

[0187] The second determining unit is configured to determine a set of fusion coefficients based on the first gradient value corresponding to each first pixel in the first image and a preset exponential function, wherein the set of fusion coefficients includes fusion coefficients corresponding to each first pixel in the first image.

[0188] The third determining unit is used to determine a first product based on the first pixel and the corresponding fusion coefficient;

[0189] The fourth determining unit is configured to determine a second product based on the second pixel in the second image and (1 - the fusion coefficient corresponding to the first pixel), wherein the second pixel is the pixel in the second image corresponding to the first pixel;

[0190] The fifth determining unit is used to determine the third pixel in the third image based on the sum of the first product and the second product.

[0191] Optionally, the second determining unit includes:

[0192] The first processing subunit is used to take the absolute value of each first gradient value in the first gradient information to obtain the third gradient information, wherein the third gradient information includes the third gradient value corresponding to each first pixel in the first image.

[0193] The second processing subunit is used to modify the target third gradient value in the third gradient information to a preset maximum gradient value to obtain fourth gradient information, wherein the target third gradient value is greater than the preset maximum gradient value or less than the preset minimum gradient value.

[0194] The first determining subunit is used to determine the first value corresponding to each gradient value in the fourth gradient information and the second value corresponding to the preset maximum gradient value based on a preset exponential function.

[0195] The first determining subunit is used to determine the fusion coefficient corresponding to each first pixel in the first image based on the ratio between the first value and the second value corresponding to each gradient value in the fourth gradient information.

[0196] Optionally, the second processing module 304 is specifically used for:

[0197] Based on the second gradient information of the third image, the target third pixel in the third image is updated using the target first pixel in the first image to obtain the fourth image;

[0198] Wherein, the absolute value of the second gradient value corresponding to the target third pixel is greater than the first threshold, and the target first pixel is the pixel in the first image that corresponds to the target third pixel.

[0199] Optionally, the second processing module 304 includes:

[0200] The execution unit is used to execute the target iteration process;

[0201] The sixth determining unit is used to determine the fourth image after the target iteration process has iterated a preset number of times;

[0202] The target iteration process includes:

[0203] The second gradient information of the third image is determined based on a preset gradient algorithm;

[0204] Based on the second gradient information, the target third pixel in the third image is updated using the target first pixel in the first image;

[0205] The preset gradient algorithm includes at least two gradient algorithms, and each iteration in the target iteration process uses any one of the at least two gradient algorithms.

[0206] Optionally, the image processing apparatus 300 further includes:

[0207] The adjustment module is used to adjust the first parameter when the fourth image does not match the preset color fault repair requirements.

[0208] The output module is used to repeatedly execute the first step based on the adjusted first parameter until the fourth image matches the preset color fault repair requirement information, and then output the fourth image.

[0209] The first step includes at least one of the following steps:

[0210] The first image is subjected to Gaussian filtering to obtain the second image;

[0211] Based on the first gradient information of the first image and a preset exponential function, the fusion coefficient between the first image and the second image is determined, and a third image is obtained based on the first image, the second image and the fusion coefficient.

[0212] A fourth image is obtained based on the second gradient information of the third image and the first image.

[0213] Optionally, the first parameter includes at least one of the following:

[0214] The kernel size of the Gaussian filter;

[0215] First threshold;

[0216] Preset maximum gradient value;

[0217] Preset minimum gradient value;

[0218] The parameters of the preset exponential function.

[0219] Optionally, the kernel size of the Gaussian filter is between 30 and 100.

[0220] The image processing device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television set (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.

[0221] The image processing device in this application embodiment can be a device with an operating system. The operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system.

[0222] The image processing apparatus provided in this application embodiment can achieve... Figure 1 or Figure 2 The illustrated method embodiment implements each process and is able to obtain the corresponding... Figure 1 or Figure 2 The same beneficial effects are achieved by the methods and embodiments shown, and will not be repeated here to avoid repetition.

[0223] Optionally, such as Figure 4 As shown, this application embodiment also provides an electronic device 400, including a processor 401 and a memory 402. The memory 402 stores a program or instructions that can run on the processor 401. When the program or instructions are executed by the processor 401, they implement the various steps of the above-described image processing method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.

[0224] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0225] Figure 5 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.

[0226] The electronic device 500 includes, but is not limited to, components such as: radio frequency unit 501, network module 502, audio output unit 503, input unit 504, sensor 505, display unit 506, user input unit 507, interface unit 508, memory 509, and processor 510.

[0227] Those skilled in the art will understand that the electronic device 500 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 510 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 5 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0228] The processor 510 is used to acquire a first image, in which color banding exists;

[0229] The processor 510 is also used for:

[0230] The first image is subjected to Gaussian filtering to obtain the second image;

[0231] Based on the first gradient information of the first image and a preset exponential function, a fusion coefficient between the first image and the second image is determined, and a third image is obtained based on the first image, the second image, and the fusion coefficient; wherein, the first gradient information includes the first gradient value corresponding to each pixel in the first image;

[0232] A fourth image is obtained based on the second gradient information of the third image and the first image, wherein the second gradient information includes the second gradient value corresponding to each pixel in the third image.

[0233] In some embodiments, the step of processor 510 performing the step of determining the fusion coefficient between the first image and the second image based on the first gradient information of the first image and a preset exponential function, and obtaining a third image based on the first image, the second image, and the fusion coefficient, includes:

[0234] Based on the target gradient algorithm, the first gradient value corresponding to each pixel in the first image is determined;

[0235] A set of fusion coefficients is determined based on the first gradient value corresponding to each first pixel in the first image and a preset exponential function, wherein the set of fusion coefficients includes fusion coefficients corresponding to each first pixel in the first image;

[0236] The first product is determined based on the first pixel and the corresponding fusion coefficient;

[0237] A second product is determined based on the second pixel in the second image and (1 - the fusion coefficient corresponding to the first pixel), wherein the second pixel is the pixel in the second image corresponding to the first pixel;

[0238] The third pixel in the third image is determined based on the sum of the first product and the second product.

[0239] In some embodiments, the step of determining the set of fusion coefficients based on the first gradient value corresponding to each first pixel in the first image and a preset exponential function, performed by the processor 510, includes:

[0240] Take the absolute value of each first gradient value in the first gradient information to obtain the third gradient information, which includes the third gradient value corresponding to each first pixel in the first image.

[0241] The target third gradient value in the third gradient information is modified to a preset maximum gradient value to obtain the fourth gradient information, wherein the target third gradient value is greater than the preset maximum gradient value or less than the preset minimum gradient value.

[0242] The first value corresponding to each gradient value in the fourth gradient information and the second value corresponding to the preset maximum gradient value are determined based on a preset exponential function.

[0243] The fusion coefficient corresponding to each first pixel in the first image is determined based on the ratio between the first value and the second value corresponding to each gradient value in the fourth gradient information.

[0244] In some embodiments, the processor 510 executes the second gradient information based on the third image and the first image to obtain a fourth image, including:

[0245] Based on the second gradient information of the third image, the target third pixel in the third image is updated using the target first pixel in the first image to obtain the fourth image;

[0246] Wherein, the absolute value of the second gradient value corresponding to the target third pixel is greater than the first threshold, and the target first pixel is the pixel in the first image that corresponds to the target third pixel.

[0247] In some embodiments, the processor 510 executes the second gradient information based on the third image to update the target third pixel in the third image using the target first pixel in the first image to obtain a fourth image, including:

[0248] Execute the target iterative process;

[0249] After the target iteration process has iterated a preset number of times, the fourth image is determined;

[0250] The target iteration process includes:

[0251] The second gradient information of the third image is determined based on a preset gradient algorithm;

[0252] Based on the second gradient information, the target third pixel in the third image is updated using the target first pixel in the first image;

[0253] The preset gradient algorithm includes at least two gradient algorithms, and each iteration in the target iteration process uses any one of the at least two gradient algorithms.

[0254] In some embodiments, the processor 510 is further configured to adjust the first parameter if the fourth image does not match the preset color fault repair requirement information, and to repeat the first step based on the adjusted first parameter.

[0255] The processor 510 is also configured to output the fourth image when the fourth image matches the preset color fault repair requirement information;

[0256] The first step includes at least one of the following steps:

[0257] The first image is subjected to Gaussian filtering to obtain the second image;

[0258] Based on the first gradient information of the first image and a preset exponential function, the fusion coefficient between the first image and the second image is determined, and a third image is obtained based on the first image, the second image and the fusion coefficient.

[0259] A fourth image is obtained based on the second gradient information of the third image and the first image.

[0260] In some embodiments, the first parameter includes at least one of the following:

[0261] The kernel size of the Gaussian filter processing;

[0262] First threshold;

[0263] Preset maximum gradient value;

[0264] Preset minimum gradient value;

[0265] The parameters of the preset exponential function.

[0266] In some embodiments, the kernel size of the Gaussian filter is between 30 and 100.

[0267] The electronic device 500 provided in this application embodiment can achieve the following: Figure 3 The image processing device embodiment shown illustrates the execution process of each model, and is able to obtain results similar to those described above. Figure 3 The beneficial effects of the device embodiments shown are the same or similar, and will not be repeated here to avoid repetition.

[0268] It should be understood that, in this embodiment, the input unit 504 may include a graphics processing unit (GPU) 5041 and a microphone 5042. The GPU 5041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 506 may include a display panel 5061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 507 includes at least one of a touch panel 5071 and other input devices 5072. The touch panel 5071 is also called a touch screen. The touch panel 5071 may include a touch detection device and a touch controller. Other input devices 5072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.

[0269] The memory 509 can be used to store software programs and various data. The memory 509 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 509 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 509 in this embodiment includes, but is not limited to, these and any other suitable types of memory.

[0270] Processor 510 may include one or more processing units; optionally, processor 510 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 510.

[0271] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described image processing method embodiments and achieve the same technical effects. To avoid repetition, they will not be described again here.

[0272] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0273] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described image processing method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0274] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0275] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above-described image processing method embodiments, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0276] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0277] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0278] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. An image processing method, characterized by, The method comprises: obtaining a first image, wherein color tomography exists in the first image; performing Gaussian filtering on the first image to obtain a second image; determining a fusion coefficient of the first image and the second image according to first gradient information of the first image and a preset exponential function, and obtaining a third image based on the first image, the second image and the fusion coefficient; wherein the first gradient information comprises a first gradient value corresponding to each pixel in the first image; obtaining a fourth image based on second gradient information of the third image and the first image, wherein the second gradient information comprises a second gradient value corresponding to each pixel in the third image; the method of determining the fusion coefficient of the first image and the second image according to the first gradient information of the first image and the preset exponential function, and obtaining the third image based on the first image, the second image and the fusion coefficient, comprises: determining the first gradient value corresponding to each pixel in the first image based on a target gradient algorithm; determining a fusion coefficient set according to the first gradient value corresponding to each first pixel in the first image and a preset exponential function, wherein the fusion coefficient set comprises a fusion coefficient corresponding to each first pixel in the first image; the method of determining the fusion coefficient set according to the first gradient value corresponding to each first pixel in the first image and the preset exponential function, comprises: taking an absolute value of each first gradient value in the first gradient information to obtain third gradient information, wherein the third gradient information comprises a third gradient value corresponding to each first pixel in the first image; modifying a target third gradient value in the third gradient information to a preset maximum gradient value to obtain fourth gradient information, wherein the target third gradient value is greater than the preset maximum gradient value or less than a preset minimum gradient value; determining a first value corresponding to each gradient value in the fourth gradient information based on a preset exponential function, and a second value corresponding to the preset maximum gradient value; determining the fusion coefficient corresponding to each first pixel in the first image according to a ratio between the first value and the second value corresponding to each gradient value in the fourth gradient information.

2. The method of claim 1, wherein, the method of determining the fusion coefficient of the first image and the second image according to the first gradient information of the first image and the preset exponential function, and obtaining the third image based on the first image, the second image and the fusion coefficient, further comprises: determining a first product based on the first pixel and the corresponding fusion coefficient; determining a second product based on a second pixel in the second image and (1-the fusion coefficient corresponding to the first pixel), wherein the second pixel is a pixel corresponding to the first pixel in the second image; determining a third pixel in the third image according to a sum of the first product and the second product.

3. The method of claim 1, wherein, the method of obtaining the fourth image based on the second gradient information of the third image and the first image, comprises: updating, based on second gradient information of the third image, a target third pixel in the third image by using a target first pixel in the first image, to obtain a fourth image; wherein the target third pixel corresponds to a second gradient value whose absolute value is greater than a first threshold, and the target first pixel is a pixel in the first image corresponding to the target third pixel.

4. The method of claim 3, wherein, The updating, based on the second gradient information of the third image, of the target third pixel in the third image by using the target first pixel in the first image, to obtain the fourth image, comprises: performing a target iteration process; determining a fourth image after the target iteration process is iterated for a preset number of times; wherein the target iteration process comprises: determining the second gradient information of the third image based on a preset gradient algorithm; updating, based on the second gradient information, the target third pixel in the third image by using the target first pixel in the first image; wherein the preset gradient algorithm comprises at least two gradient algorithms, and each iteration of the target iteration process uses any one of the at least two gradient algorithms.

5. The method according to any one of claims 1 to 4, characterized in that, The method further comprises: adjusting a first parameter in a case where the fourth image does not match preset color tomography repair requirement information; repeatedly performing the first step based on the adjusted first parameter until the fourth image matches the preset color tomography repair requirement information, and outputting the fourth image; wherein the first step comprises at least one of the following steps: performing Gaussian filtering processing on the first image to obtain a second image; determining a fusion coefficient of the first image and the second image according to first gradient information of the first image and a preset exponential function, and obtaining a third image based on the first image, the second image and the fusion coefficient; obtaining a fourth image based on second gradient information of the third image and the first image.

6. The method of claim 5, wherein, The first parameter comprises at least one of the following: a kernel size of the Gaussian filtering processing; a first threshold; a preset maximum gradient value; a preset minimum gradient value; a parameter of the preset exponential function.

7. The method of claim 6, wherein, The kernel size of the Gaussian filtering processing is between 30 and 100.

8. An image processing apparatus characterized by comprising: It comprises: an acquisition module configured to acquire a first image, wherein color tomography exists in the first image; a first processing module configured to perform Gaussian filtering processing on the first image to obtain a second image; a fusion module configured to determine a fusion coefficient of the first image and the second image according to first gradient information of the first image and a preset exponential function, and obtain a third image based on the first image, the second image and the fusion coefficient; wherein the first gradient information comprises a first gradient value corresponding to each pixel in the first image; a second processing module configured to obtain a fourth image based on second gradient information of the third image and the first image, wherein the second gradient information comprises a second gradient value corresponding to each pixel in the third image; the fusion module is specifically configured to: determine the first gradient value corresponding to each pixel in the first image based on a target gradient algorithm; determine a fusion coefficient set corresponding to each first pixel in the first image according to a first gradient value corresponding to each first pixel in the first image and a preset exponential function, wherein the fusion coefficient set comprises a fusion coefficient corresponding to each first pixel in the first image; the fusion module is specifically configured to: take an absolute value of each first gradient value in the first gradient information to obtain third gradient information, wherein the third gradient information comprises a third gradient value corresponding to each first pixel in the first image; modify a target third gradient value in the third gradient information to a preset maximum gradient value to obtain fourth gradient information, wherein the target third gradient value is greater than the preset maximum gradient value or less than a preset minimum gradient value; determine a first value corresponding to each gradient value in the fourth gradient information and a second value corresponding to the preset maximum gradient value based on a preset exponential function; determine the fusion coefficient corresponding to each first pixel in the first image according to a ratio between the first value corresponding to each gradient value in the fourth gradient information and the second value.

9. An electronic device, comprising: a processor and a memory, the memory stores programs or instructions executable on the processor, and the programs or instructions are executed by the processor to implement the steps of the image processing method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Image edge fusion processing system

    CN105578094A

  • Image enhancement method and device, equipment, medium and product

    CN114429438A

  • Image processing method and device, electronic equipment and readable storage medium

    CN114519675A