Image banding artifact removal method, device, equipment and medium

By filtering and difference matrix processing on the image, the target pixel value is determined based on the preset threshold value, and the problem of edge blurring and slow speed during strip artifact removal in the prior art is solved, thereby achieving efficient image artifact removal processing.

CN113362246BActive Publication Date: 2024-11-22BIGO TECH PTE LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110647537.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-08
Publication Date
2024-11-22
Estimated Expiration
2041-06-08

AI Technical Summary

Technical Problem

The prior art is difficult to avoid blurring of image edges when removing ribbon artifacts, and the removal speed is slower.

Method used

By filtering the image to be processed, the difference matrix and the difference absolute value matrix of the filtered image and the original image are determined, the target pixel value is determined based on the preset threshold, and simple subtraction and multiplication operations are adopted to avoid edge blur and improve calculation efficiency.

Benefits of technology

Effectively removes ribbon artifacts, avoids blurring of image edges, and improves the speed of strip artifact removal.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113362246B_ABST
    Figure CN113362246B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, equipment and medium for removing image banding artifacts. In the method, a filtering operation is performed on an image to be processed, and a filtered image after removing banding artifacts is determined. According to the difference between the pixel values ​​of each corresponding pixel point in the filtered image and the image to be processed, a difference matrix and a difference absolute value matrix between the filtered image and the image to be processed are determined; for each element point in the difference absolute value matrix, a target size relationship between the element value and a first preset threshold and a second preset threshold is determined, and the second preset threshold is greater than the first preset threshold; and according to a value function of the pixel value corresponding to each size relationship stored in advance, a target pixel value of a target pixel point at a corresponding position of each element point in the target image is determined, and a target image after retaining edge texture is obtained; thereby, the target image removes banding artifacts and avoids image edge blur, and the speed of determining the target image is improved due to the low calculation complexity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method, device, equipment and medium for removing image banding artifacts. Background Art

[0002] Based on the current image coding standards and video coding standards, quantization methods are generally used when compressing images. The image coding standard is the Joint Photographic Experts Group (JPEG), and the video coding standard can be a compression standard based on digital storage media moving images and voice (Moving Picture Experts Group, MPEG-2), which can be a highly compressed digital video coding standard (H264), which can be a highly compressed digital video coding standard (H265), or a source coding standard (Audio Video Coding Standard, AVS).

[0003] Quantization is a method of compressing bits by quantizing a residual signal or a large-range input signal into a small-range output signal. Although quantization can effectively improve the compression efficiency of the image, it will also introduce artificial noise due to the existence of quantization errors, such as typical blocking effects and banding artifacts.

[0004] The main manifestation of the block effect in the image is the discontinuity of brightness at the edge of the coding block, and the block effect can appear anywhere in the entire image. Banding artifacts are mainly caused by the loss of low-amplitude detail information during the quantization process. Therefore, banding artifacts in the image mainly appear in areas with relatively gentle gradient changes, such as flat areas and areas with gradual brightness changes. In bandwidth-sensitive scenarios, the use of a large compression ratio will lead to more serious banding artifacts. In addition, after obtaining an image with banding artifacts, if contrast enhancement processing is continued, the banding artifacts will become more serious.

[0005] Figure 1 A schematic diagram of an image without quantization processing provided by the prior art, such as Figure 1 As shown, Figure 1 There are no banding artifacts in the Figure 2 A schematic diagram of an image after quantization processing provided by the prior art, such as Figure 2 As shown, the quantization parameter (Quantizer Parameter, QP) during quantization processing is 17, Figure 2 The banding artifact phenomenon is not obvious; Figure 3 A schematic diagram of an image after quantization processing provided by the prior art, such as Figure 3As shown, the quantization parameter (Quantizer Parameter, QP) during quantization processing is 20, Figure 3 There is a more obvious banding artifact phenomenon in the image. Figure 4 A schematic diagram of an image after quantization processing provided by the prior art, such as Figure 4 As shown, the quantization parameter (QuantizerParameter, QP) during quantization processing is 27, Figure 4 There are serious banding artifacts in the image.

[0006] Figure 5 A schematic diagram of a video frame image after quantization processing provided by the prior art, such as Figure 5 As shown, Figure 5 There is a more obvious banding artifact in the upper left area (upper, lower, left, and right in the figure). Figure 5 The upper left area in the video has a phenomenon of brightness step changes, and when the corresponding video of the video frame image is played, the brightness steps of the upper left area change with the video frame. The image in the video frame will show dynamic changes in circles of waves, resulting in a poor viewing experience for users.

[0007] In order to remove the banding artifacts in the image after quantization processing, the prior art includes a Dither error propagation method and a post-processing method.

[0008] The Dither error propagation method processes the banding artifacts by adding correlated noise to the image, but this method can only reduce the banding artifacts in the image, and the effect of removing the banding artifacts is not obvious.

[0009] The post-processing methods include using loop filtering to remove banding artifacts, using the gradfun plug-in in the multimedia video processing tool (FastForward Mpeg, FFMPEG) to remove banding artifacts, and using a deep learning model to remove banding artifacts.

[0010] The effect of using loop filtering to remove banding artifacts is not obvious, the effect of using the gradfun plug-in to remove banding artifacts is not obvious and will cause blurred image edges, and the computational complexity of using a deep learning model to remove banding artifacts is high, resulting in a slow speed in removing banding artifacts.

[0011] Therefore, how to avoid image edge blur when removing banding artifacts and improve the speed of removing image banding artifacts becomes an urgent problem to be solved. Summary of the invention

[0012] The present invention provides a method, device, equipment and medium for removing image banding artifacts, which are used to solve the problem in the prior art of how to avoid image edge blur when removing image banding artifacts and improve the speed of removing image banding artifacts.

[0013] The present invention provides a method for removing image banding artifacts, the method comprising:

[0014] Performing a filtering operation on the image to be processed, determining a filtered image after removing band artifacts from the image to be processed, and determining a difference matrix and a difference absolute value matrix between the filtered image and the image to be processed according to a difference between the pixel values ​​of each corresponding pixel point in the filtered image and the image to be processed;

[0015] For each element point in the absolute value matrix of the difference, determine a target size relationship between the element value and the first preset threshold and the second preset threshold according to the element value of the element point, the first preset threshold and the second preset threshold, wherein the second preset threshold is greater than the first preset threshold;

[0016] According to the target size relationship corresponding to the element value of each element point and the pre-saved value function of the pixel value corresponding to each size relationship, the target pixel value of the target pixel point at the corresponding position of each element point in the target image after the edge texture is retained is determined to obtain the target image after the edge texture is retained.

[0017] Accordingly, the present invention provides a device for removing image banding artifacts, the device comprising:

[0018] A first determination module is used to perform a filtering operation on the image to be processed, determine a filtered image after removing banding artifacts from the image to be processed, and determine a difference matrix and a difference absolute value matrix between the filtered image and the image to be processed according to a difference between the pixel values ​​of each corresponding pixel point in the filtered image and the image to be processed;

[0019] A second determination module is used to determine, for each element point in the difference absolute value matrix, a target size relationship between the element value and the first preset threshold and the second preset threshold according to the element value of the element point, a first preset threshold and a second preset threshold, wherein the second preset threshold is greater than the first preset threshold;

[0020] The third determination module is used to determine the target pixel value of the target pixel point at the corresponding position of each element point in the target image after the edge texture is preserved according to the target size relationship corresponding to the element value of each element point and the pre-saved value function of the pixel value corresponding to each size relationship, so as to obtain the target image after the edge texture is preserved.

[0021] Accordingly, the present invention provides an electronic device, comprising: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; a computer program is stored in the memory, and when the program is executed by the processor, the processor executes the steps of any one of the above-mentioned methods for removing image banding artifacts.

[0022] Accordingly, the present invention provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any one of the above-mentioned methods for removing image banding artifacts.

[0023] The present invention provides a method, device, equipment and medium for removing image banding artifacts. In the method, a filtering operation is performed on an image to be processed to determine a filtered image after removing banding artifacts from the image to be processed. In order to solve the problem of edge blur of the filtered image, a difference matrix and a difference absolute value matrix between the filtered image and the image to be processed are determined according to the difference between the pixel values ​​of each corresponding position pixel point in the filtered image and the image to be processed; for each element point in the difference absolute value matrix, a target size relationship between the element value and the first preset threshold and the second preset threshold is determined according to the element value of the element point, a first preset threshold and a second preset threshold, wherein the second preset threshold is greater than the first preset threshold; according to the target size relationship corresponding to the element value of each element point and a value function of the pixel value corresponding to each size relationship stored in advance, a target pixel value of a target pixel point at a corresponding position of each element point in the target image after edge texture is retained is determined to obtain the target image after edge texture is retained; thereby, banding artifacts are removed from the target image and image edge blur is avoided, and in the method, only simple subtraction and multiplication are used, so the calculation complexity is low, thereby improving the speed of determining the target image. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0025] Figure 1 A schematic diagram of an image without quantization processing provided by the prior art;

[0026] Figure 2 A schematic diagram of an image after quantization processing provided by the prior art;

[0027] Figure 3A schematic diagram of an image after quantization processing provided by the prior art;

[0028] Figure 4 A schematic diagram of an image after quantization processing provided by the prior art;

[0029] Figure 5 A schematic diagram of a video frame image after quantization processing provided by the prior art;

[0030] Figure 6 A schematic diagram of a process of removing image banding artifacts provided by an embodiment of the present invention;

[0031] Figure 7 A schematic diagram of a preset error transfer matrix provided in an embodiment of the present invention;

[0032] Figure 8 A schematic diagram of removing banding artifacts from a video frame image provided by an embodiment of the present invention;

[0033] Fig. 9 A schematic diagram of a process of removing image banding artifacts provided by an embodiment of the present invention;

[0034] Fig.10 A schematic diagram of a process of removing image banding artifacts provided by an embodiment of the present invention;

[0035] Fig.11 A schematic diagram of the structure of an image banding artifact removal device provided by an embodiment of the present invention;

[0036] Fig.12 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0037] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0038] In order to remove banding artifacts and avoid image edge blurring, and to improve the speed of removing image banding artifacts, embodiments of the present invention provide an image banding artifact removal method, apparatus, device, and medium.

[0039] Embodiment 1:

[0040] Figure 6 A schematic diagram of a process of removing image banding artifacts provided by an embodiment of the present invention, the process includes the following steps:

[0041] S601: Perform a filtering operation on the image to be processed to determine a filtered image after removing band artifacts from the image to be processed, and determine a difference matrix and a difference absolute value matrix between the filtered image and the image to be processed based on the difference in pixel values ​​of each corresponding pixel point in the filtered image and the image to be processed.

[0042] An image banding artifact removal method provided by an embodiment of the present invention is applied to an electronic device, wherein the electronic device may be an intelligent terminal device such as a PC, a tablet computer, a smart phone, or a local server or a cloud server.

[0043] Banding artifacts in the image to be processed are caused by encoder coding quantization. For example, in the field of short videos, the videos uploaded by users may be compressed by other third-party encoders, or compressed with a high compression ratio, resulting in the video frame images in the video including banding artifacts.

[0044] In order to remove banding artifacts in an image to be processed, the electronic device performs a filtering operation on the image to be processed, wherein the image to be processed refers to an image with banding artifacts. The image to be processed may be a separate image or a video frame image after video data is decoded. The image to be processed is not limited to a color space and may be a red green blue color space (RGB) image, a luminance chrominance color space (YUV) image, or a color model (Lab) image. The filtering operation may be a low-pass filter or an edge-preserving filter, which is not limited in the embodiment of the present invention.

[0045] Specifically, the existing box filter, Gaussian filter, etc. can be used to perform low-pass filtering operations, and the existing bilateral filter, non-local mean filter, guided filter, side window filter, etc. can be used to perform bilateral filtering operations. Specifically, the method for the electronic device to perform filtering operations belongs to the prior art, and the embodiments of the present invention will not be described in detail.

[0046] After filtering the image to be processed, the filtered image after removing the banding artifacts from the image to be processed can be determined, wherein the number of pixels of the filtered image is the same as that of the image to be processed. Since the edge of the image to be processed will have edge blurring after the filtering operation, in order to solve the problem of image edge blurring, the difference matrix and the difference absolute value matrix between the filtered image and the image to be processed can also be determined.

[0047] Specifically, for each pixel point at each position in the filtered image, the difference in pixel value is determined based on the pixel value of the pixel point and the pixel value of the pixel point at the corresponding position in the image to be processed; based on the difference in pixel value of the pixel point at each position, the difference matrix between the filtered image and the image to be processed can be determined; wherein the number of columns of the difference matrix is ​​the number of pixels of the width of the image to be processed, and the number of rows of the difference matrix is ​​the number of pixels of the height of the image to be processed; based on the determined difference matrix, the electronic device also determines a difference absolute value matrix, specifically, the difference absolute value matrix is ​​determined using an existing absolute value function.

[0048] S602: For each element point in the difference absolute value matrix, determine the target size relationship between the element value and the first preset threshold and the second preset threshold according to the element value of the element point, the first preset threshold and the second preset threshold, wherein the second preset threshold is greater than the first preset threshold.

[0049] In order to make the edge of the filtered image clear, the electronic device also stores a first preset threshold and a second preset threshold, wherein the first preset threshold and the second preset threshold are both preset, and the second preset threshold is greater than the first preset threshold.

[0050] Since the element value of each element point of the difference absolute value matrix is ​​different from the first preset threshold and the second preset threshold, the method for determining the pixel value at the position corresponding to the element point is also different, so for each element point in the difference absolute value matrix, according to the element value of the element point, the first preset threshold and the second preset threshold, the target size relationship between the element value and the first preset threshold and the second preset threshold is determined. The element value may be less than the first preset threshold, may be greater than the first preset threshold, and may also be greater than the second preset threshold.

[0051] S603: According to the target size relationship corresponding to the element value of each element point and the pre-saved value function of the pixel value corresponding to each size relationship, determine the target pixel value of the target pixel point at the corresponding position of each element point in the target image after the edge texture is preserved, and obtain the target image after the edge texture is preserved.

[0052] In order to determine the target pixel value of the target pixel point at the corresponding position of each element point, in an embodiment of the present invention, a value function of the pixel value corresponding to each size relationship is also pre-saved, wherein the size relationship includes the element value not greater than the first preset threshold, the element value greater than the first preset threshold and less than the second preset threshold, and the element value not less than the second preset threshold.

[0053] According to the pre-saved pixel value value function corresponding to each size relationship and the target size relationship corresponding to the element value of each element point, the target value function of the pixel value at the corresponding position of each element point is determined, and according to the target value function of the pixel point at the corresponding position of each element point, the target pixel value of the target pixel point at the corresponding position of each element point in the target image after edge texture preservation is determined, so that according to the target pixel value of each target pixel point, the target image after edge texture preservation is obtained.

[0054] Since a filtering operation is performed on the image to be processed in the embodiment of the present invention, a filtered image after the stripe-shaped artifacts are removed from the image to be processed is determined. In order to solve the problem of blurred edges of the filtered image, a difference matrix and a difference absolute value matrix between the filtered image and the image to be processed are determined according to the difference between the pixel values ​​of each corresponding pixel point in the filtered image and the image to be processed; for each element point in the difference absolute value matrix, a target size relationship between the element value and the first preset threshold and the second preset threshold is determined according to the element value of the element point, the first preset threshold and the second preset threshold, wherein the second preset threshold is greater than the first preset threshold; according to the target size relationship corresponding to the element value of each element point and the value function of the pixel value corresponding to each size relationship saved in advance, a target pixel value of a target pixel point at a corresponding position of each element point in the target image after edge texture is retained is determined, and the target image after edge texture is retained is obtained; thereby, the target image removes stripe-shaped artifacts and avoids blurred edges of the image, and the method only uses simple subtraction and multiplication, and the calculation complexity is low, thereby improving the speed of determining the target image.

[0055] Embodiment 2:

[0056] In order to determine the target pixel value of the target pixel point at the corresponding position of each element point in the target image after the edge texture is retained, on the basis of the above embodiment, in the embodiment of the present invention, the size relationship includes that the element value is not greater than the first preset threshold, the element value is greater than the first preset threshold and less than the second preset threshold, and the element value is not less than the second preset threshold. The target size relationship corresponding to the element value of each element point and the pre-saved value function of the pixel value corresponding to each size relationship determine the target pixel value of the target pixel point at the corresponding position of each element point in the target image after the edge texture is retained. The value function includes:

[0057] For the target size relationship corresponding to the element value of each element point, if the target size relationship is that the element value of the element point is not greater than the first preset threshold or not less than the second preset threshold, respectively, the pixel value of the pixel point at the corresponding position of the element point in the filtered image or the image to be processed is determined, and the pixel value is determined as the target pixel value of the target pixel point at the corresponding position of the element point in the target image; if the target size relationship is also that the element value of the element point is greater than the first preset threshold and less than the second preset threshold, a first difference between the second preset threshold and the element value of the element point, a second difference between the second preset threshold and the first preset threshold, and a ratio value corresponding to the first difference and the second difference are determined, a product value of the element value at the corresponding position of the element point in the difference matrix and the ratio value is determined, and a sum value of the product value and the pixel value of the pixel point at the corresponding position of the element point in the image to be processed is determined, and the sum value is determined as the target pixel value of the target pixel point at the corresponding position of the element point in the target image.

[0058] In order to determine the target pixel value of each target pixel point in the target image, in an embodiment of the present invention, for the target size relationship corresponding to the element value of each element point, the target pixel value of the target pixel point at the corresponding position of the element point in the target image is determined according to the target size relationship corresponding to the element value of the element point and the image to be processed and the filtered image.

[0059] Specifically, according to the target size relationship corresponding to the element value of the element point, if the target size relationship is that the element value of the element point is not greater than the first preset threshold, the pixel value of the pixel point at the corresponding position of the element point in the filtered image is determined according to the predetermined filtered image.

[0060] For example, if the position of the element point in the absolute value difference matrix is ​​the first row and second column, then the pixel value of the pixel point in the first row and second column is determined in the filtered image, where the number of rows and columns of the absolute value difference matrix is ​​the same as the number of rows and columns of the filtered image. Therefore, according to the position of the element point in the absolute value difference matrix, the pixel value of the pixel point at the corresponding position can be found in the filtered image.

[0061] If the target size relationship is that the element value of the element point is not less than the second preset threshold, the pixel value of the pixel point at the corresponding position of the element point in the image to be processed is determined according to the predetermined image to be processed. The number of rows and columns of the difference absolute value matrix is ​​the same as the number of rows and columns of the image to be processed, so according to the position of the element point in the difference absolute value matrix, the pixel value of the pixel point at the corresponding position can be found in the image to be processed.

[0062] After determining the pixel value of the pixel point at the position corresponding to the element point in the filtered image or the image to be processed, the pixel value is determined as the target pixel value of the target pixel point at the position corresponding to the element point in the target image.

[0063] If the target size relationship is that the element value of the element point is greater than the first preset threshold and less than the second preset threshold, determine the first difference between the second preset threshold and the element value of the element point according to the element value of the element point and the second preset threshold, determine the second difference between the second preset threshold and the first preset threshold according to the second preset threshold and the first preset threshold, determine the ratio of the first difference to the second difference according to the first difference and the second difference, and multiply the ratio with the element value of the corresponding position of the element point in the difference matrix according to the determined ratio and the element value of the corresponding position of the element point in the difference matrix to obtain the product value. Determine the sum of the product value and the pixel value of the pixel point at the corresponding position of the element point in the image to be processed, and determine the sum as the target pixel value of the target pixel point at the corresponding position of the element point in the target image.

[0064] Specifically, in the embodiment of the present invention, according to the image to be processed Img and the filtered image blurFilterImg after removing the banding artifacts from the image to be processed, the difference matrix textDiff between the filtered image blurFilterImg and the image to be processed Img is determined, wherein textDiff=blurFilterImg-Img, that is, the difference between the element value of each element point in the difference matrix and the element value of the element point at the corresponding position in the image to be processed is determined, and the difference matrix textDiff is determined according to the difference corresponding to each element point. The difference absolute value matrix textDiffAbs corresponding to the difference matrix textDiff is determined by using the existing absolute value function, that is, textDiffAbs=abs(textDiff).

[0065] Specifically, according to the determined difference matrix textDiff and the difference absolute value matrix textDiffAbs, the target image textPresImg after edge texture preservation can be determined. The determination formula of the target image textPresImg is:

[0066]

[0067] According to the element value of each element point in the difference absolute value matrix textDiffAbs, the first preset threshold thrLow and the second preset threshold thrHigh, if the element value is not greater than the first preset threshold thrLow, that is, the element value ≤thrLow, then the pixel value of the pixel point at the position corresponding to the element point in the filtered image is obtained, and the pixel value is determined as the target pixel value of the target pixel point at the position corresponding to the element point in the target image textPresImg after edge texture retention.

[0068] If the element value is not less than the second preset threshold thrHigh, that is, the element value ≥ thrHigh, then the pixel value of the pixel point corresponding to the element point in the image to be processed is obtained, and the pixel value is determined as the target pixel value of the target pixel point corresponding to the element point in the target image textPresImg after edge texture retention.

[0069] If the element value is greater than the first preset threshold and less than the second preset threshold, then determine the first difference between the second preset threshold thrHigh and the element value of the element point, the first difference is expressed as thrHigh-textDiffAbs in the above formula, determine the second difference between the second preset threshold thrHigh and the first preset threshold thrLow, that is, the second difference is expressed as thrHigh-thrLow in the above formula, determine the ratio value corresponding to the first difference and the second difference, and the ratio value is expressed as in the above formula Wherein eps is a preset very small positive number. When the second difference between the second preset threshold thrHigh and the first preset threshold thrLow is 0, the second difference is updated by the sum of eps and the second difference, and the product value of the element value and the proportion value at the position corresponding to the element point in the difference matrix is ​​determined. The product value is expressed in the above formula as And determine the sum of the product value and the pixel value of the pixel point corresponding to the element point in the image to be processed, which is expressed in the above formula as The sum value is determined as the target pixel value of the target pixel point at the position corresponding to the element point in the target image textPresImg.

[0070] Embodiment 3:

[0071] In order to make the target image more realistic, based on the above embodiments, in an embodiment of the present invention, the method further includes:

[0072] Detect and determine the band artifact edge image and the non-flat area image corresponding to the image to be processed;

[0073] Performing edge-preserving filtering operations on the band-shaped artifact edge image and the non-flat region image, determining a band-shaped artifact region weight matrix and a non-flat region weight matrix, and determining a fusion weight matrix according to a pre-saved fusion formula;

[0074] Determine a first product matrix of the fusion weight matrix and a first matrix consisting of pixel values ​​of each pixel in the image to be processed;

[0075] Determine a second product matrix of the first difference matrix and the second matrix composed of the pixel value of each pixel point in the target image according to a first difference matrix determined by the difference between a preset value and the element value of each element point in the fusion weight matrix;

[0076] A sum matrix of the first product matrix and the second product matrix is ​​determined, and the target image is updated according to the element value of each element point in the sum matrix.

[0077] In the embodiment of the present invention, in order to make the target image more realistic, the electronic device may also retain the texture of the original banded artifact area on the basis of the target image to update the target image, thereby making the updated target image more realistic.

[0078] In order to retain the texture of the original banded artifact area on the basis of the target image, the electronic device also detects and determines the banded artifact edge image and the non-flat area image corresponding to the image to be processed, wherein when detecting the banded artifact edge area image and the non-flat area image, the image to be processed can be an image with original resolution, a downsampled image, or an upsampled image, and the embodiment of the present invention does not limit this.

[0079] An edge detection algorithm may be used to determine the band artifact edge area image corresponding to the image to be processed, for example, it may be a canny-based edge detection algorithm, a Sobel-based edge detection algorithm, or a Laplacian-based edge detection algorithm; a variance may be used to determine the non-flat area image corresponding to the image to be processed, or the non-flat area image may be determined based on a gradient.

[0080] As a possible implementation, before detection, the image to be processed may be subjected to denoising, for example, by using mean filtering, edge-preserving filtering, etc., so as to improve the accuracy of subsequent detection.

[0081] Specifically, when the canny-based edge detection algorithm is used to determine the band artifact edge area image of the image to be processed, thresholds are preset, namely cannyThLow, cannyThMid and cannyThHigh, wherein cannyThLow is less than cannyThMid, and cannyThMid is less than cannyThHigh.

[0082] The threshold values ​​cannyThLow and cannyThMid are used to form a threshold range, and edge detection is performed on the image to be processed to obtain a first edge map edgeMapLow. The threshold values ​​cannyThMid and cannyThHigh are used to form a threshold range, and edge detection is performed on the image to be processed to obtain a second edge map edgeMapHigh. Specifically, the gradient value of each pixel of the image to be processed is calculated, and the pixel points within the threshold range are determined according to the gradient value and the threshold range, thereby determining the first edge map edgeMapLow and the second edge map edgeMapHigh.

[0083] Specifically, edgeMapLow=canny(Img, [cannyThLow, cannyThMid]), edgeMapHigh=canny(Img, [cannyThMid, cannyThHigh]), wherein the above formulas identify the pixel points in the edge map as pixel points whose gradient values ​​in the image to be processed are within the threshold range.

[0084] The first edge map edgeMapLow and the second edge map edgeMapHigh are used to obtain the band artifact edge map bandEdgeMapRough corresponding to the image to be processed. Specifically, the band artifact edge map bandEdgeMapRough corresponding to the processed image is determined according to the difference between the pixel value of each pixel point in the first edge map edgeMapLow and the pixel value of the pixel point at the corresponding position in the second edge map edgeMapHigh, that is, bandEdgeMapRough = edgeMapLow-edgeMapHigh.

[0085] After detecting and determining the banded artifact edge image and the non-flat area image corresponding to the image to be processed, an edge-preserving filtering operation is performed on the banded artifact edge image to determine the banded artifact weight matrix of the banded artifact edge image, and an edge-preserving filtering operation is performed on the non-flat area image to determine the non-flat area weight matrix of the non-flat area image.

[0086] Specifically, a joint bilateral filter, a guided filter, a guide side window filter and any one of the improved filters in the prior art are used to perform an edge-preserving filtering operation on a banded artifact edge image and a non-flat area image, and a banded artifact weight matrix of the banded artifact edge image and a non-flat area weight matrix of the non-flat area image are determined.

[0087] According to the banding artifact weight matrix and the non-flat area weight matrix, according to the pre-saved fusion formula, the banding artifact weight matrix and the non-flat area weight matrix are substituted into the fusion formula to determine the fusion weight matrix of the banding artifact weight matrix and the non-flat area weight matrix.

[0088] According to the pixel value of each pixel in the image to be processed, a first matrix is ​​formed, wherein the number of columns of the first matrix is ​​the number of pixels of the width of the image to be processed, and the number of rows of the first matrix is ​​the number of pixels of the height of the image to be processed; according to the fusion weight matrix and the first matrix of the image to be processed, the fusion weight matrix is ​​multiplied by the first matrix to determine a first product matrix of the fusion weight matrix and the first matrix.

[0089] According to the preset value and the element value of each element point in the fusion weight matrix, each difference is obtained by subtracting the preset value from the element value of each element point, and the first difference matrix is ​​determined according to the difference at the corresponding position of each element point.

[0090] According to the pixel value of each pixel in the target image, the pixel value of each pixel is formed into a second matrix, wherein the number of columns of the second matrix is ​​the number of pixels of the width of the target image, and the number of rows of the second matrix is ​​the number of pixels of the height of the target image.

[0091] According to the first difference matrix and the second matrix, the first difference matrix is ​​multiplied with the second matrix to obtain a second product matrix of the first difference matrix and the second matrix, wherein the matrix multiplication is a prior art and will not be elaborated in the embodiment of the present invention.

[0092] The first product matrix is ​​added to the second product matrix to obtain a sum matrix of the first product matrix and the second product matrix. According to the element value of each element point in the sum matrix, the pixel value of the pixel point at the corresponding position in the target image is replaced by the element value, thereby realizing the update of the target image.

[0093] In order to determine the fusion weight matrix, based on the above embodiments, in an embodiment of the present invention, the fusion weight matrix is ​​determined according to a pre-stored fusion formula, including:

[0094] Determine a second difference matrix according to a difference between a first preset value and an element value of each element point in the band artifact area weight matrix;

[0095] A product matrix of the second difference matrix and the non-flat area weight matrix is ​​determined as a fusion weight matrix.

[0096] In order to accurately determine the fusion weight matrix, in the embodiment of the present invention, according to the pre-stored strip area weight matrix, the first preset value is subtracted from the element value of each element point in the strip area weight, and the difference of the corresponding position of each element point is determined, and the second difference matrix is ​​determined according to the difference of the corresponding position of each element point. The first preset value is a positive integer value, and preferably, the first preset value is 1.

[0097] The second difference matrix is ​​multiplied by the non-flat area weight matrix to obtain a product matrix of the second difference matrix and the non-flat area weight matrix, and the product matrix is ​​determined as a fusion weight matrix.

[0098] Specifically, guided edge-preserving filtering is performed on the band artifact edge image to obtain the band artifact area weight matrix bandEdgeWeight, and guided edge-preserving filtering is performed on the non-flat area image to obtain the non-flat area weight matrix notFlatWeight. According to the band artifact area weight matrix bandEdgeWeight and the non-flat area weight matrix notFlatWeight, as well as a pre-saved fusion formula, the final fusion weight matrix blendWeight is generated, where the fusion formula is blendWeight = (1-bandEdgeWeight) × notFlatWeight.

[0099] Wherein (1-bandEdgeWeight) is represented as a second difference matrix obtained by the difference between 1 and the element value of each element point in the band artifact area weight matrix bandEdgeWeight. For edge-preserving filtering, a joint bilateral filter, a guided filter, a guide side window filter, and an improved filter thereof in the prior art can be used.

[0100] Embodiment 4:

[0101] In order to make the detected band artifact edge image more accurate, based on the above embodiments, in an embodiment of the present invention, after the detection determines the band artifact edge image corresponding to the image to be processed, the method further includes:

[0102] A filtering operation is performed on the band-shaped artifact edge image to determine that an image after removing target edges whose edge lengths are less than a preset length threshold is an updated image of the band-shaped artifact edge image.

[0103] In order to make the detected banded artifact edge image more accurate, in an embodiment of the present invention, the electronic device performs a filtering operation on the banded artifact edge image, removes the target edges in the banded artifact edge image whose edge length is less than a preset length threshold, obtains an image after removing the target edges, and uses the image after removing the target edges as an updated image of the banded artifact edge image.

[0104] Specifically, for each band-shaped artifact edge in the band-shaped artifact edge image, if there is a pixel point of another band-shaped artifact edge within an area with a radius centered on any pixel point on the band-shaped artifact edge, the two band-shaped artifact edges are considered to be the same band-shaped artifact edge, and independent band-shaped artifact edges in the band-shaped artifact edge image are determined and marked as i, where i={0,1,...,n}, and n is the number of band-shaped artifact edges.

[0105] According to the length of each band-shaped artifact edge in the band-shaped artifact edge image and a preset length threshold, a target edge in the band-shaped artifact edge mark image whose edge length is less than the preset length threshold is determined.

[0106] For example, taking any pixel point Ap1 on the band artifact edge A in the band artifact edge image bandEdgeMapRough as the center, in the area win with a fixed radius r, if there is a pixel point Bp1 on another band artifact edge B, it is determined that edge A and edge B are the same edge, and the above operation is performed on all pixels on the band artifact edge to determine the band artifact edge labeling image bandEdgeLabelMap. Compared with the band artifact edge image bandEdgeMapRough, the band artifact edge labeling image bandEdgeLabelMap adds a label i for each band artifact edge.

[0107] A target edge whose edge length is less than a preset length threshold in the band artifact edge marker image bandEdgeLabelMap is determined, and pixel points in other edges except the target edge are used as pixel points in the image bandEdge after the target edge is removed.

[0108] Wherein, x and y refer to the x-axis coordinate and y-axis coordinate of the pixel point respectively, len[] represents length statistics, edgeLenTh represents a preset length threshold, bandEdge(x, y)=1 indicates that the pixel point corresponding to the position in the band artifact edge map is on a band artifact edge whose length is greater than the preset length threshold, bandEdge(x, y)=0 indicates that the pixel point corresponding to the position in the band artifact edge map is on a band artifact edge whose length is not greater than the preset length threshold, or the pixel point is on a non-band artifact edge.

[0109] As a possible implementation, in the embodiment of the present invention, the image bandEdge after removing the target edge can also be region expanded to obtain the band artifact region image bandEdgeMap. Specifically, the region expansion method includes dilation method and post-filter binarization processing method.

[0110] Embodiment 5:

[0111] In order to determine the non-flat area image corresponding to the image to be processed, on the basis of the above embodiments, in an embodiment of the present invention, the determining the non-flat area image corresponding to the image to be processed includes:

[0112] Performing a dilation operation and an erosion operation on the image to be processed to determine a dilated image and an eroded image;

[0113] Determine a difference image between the dilated image and the eroded image according to a difference in pixel values ​​of each corresponding pixel point in the dilated image and the eroded image;

[0114] A binarization filtering operation is performed on the difference image to determine a binary difference image of the difference image, and an area filtering operation is performed on the binary difference image to determine that the image after removing the area whose area is smaller than a preset area threshold is a non-flat area image.

[0115] In order to determine the non-flat area image corresponding to the image to be processed, in an embodiment of the present invention, the image to be processed is subjected to dilation and erosion operations to obtain a dilated image and an eroded image. The method of dilating the image can use the existing imdilate function to perform the image dilation operation, and use the existing imerode function to perform the image erosion operation.

[0116] According to the determined dilated image and eroded image, the pixel values ​​of each corresponding position in the dilated image and the eroded image are subtracted to determine the difference in the pixel values ​​of each corresponding position, and according to the difference in the pixel values ​​of each corresponding position, a difference image between the dilated image and the eroded image is determined.

[0117] A binarization filtering operation is performed on the difference image to determine a binary difference image of the difference image. Specifically, according to the pixel value of each pixel in the difference image and the determined preset texture difference threshold, the pixel points whose pixel values ​​are not less than the preset texture difference threshold are determined, and their pixel values ​​are set to 255, and the pixel points whose pixel values ​​are less than the preset texture difference threshold are determined, and their pixel values ​​are set to 0.

[0118] The determined binary difference image is subjected to area filtering, and the target area whose area in the binary difference image is smaller than a preset area threshold is removed to obtain an image after the target area is removed, and the image after the target area is removed is used as a non-flat area image.

[0119] Specifically, a dilation operation is performed on the image to be processed to obtain a dilated image dilateImg, and an erosion operation is performed on the image to be processed to obtain an eroded image erodeImg. A difference image diffImg is determined based on the dilated image dilateImg and the eroded image erodeImg, wherein diffImg=dilateImg-erodeImg, which is represented by taking the difference value obtained by subtracting the pixel values ​​of the pixel points at each corresponding position in the dilated image dilateImg and the eroded image erodeImg as the pixel value of the pixel point at the corresponding position in the difference image diffImg.

[0120] The difference image diffImg is binarized to obtain a binary difference image binaryDiffImg, where Wherein, textThLow represents the preset texture difference threshold.

[0121] Perform area filtering on the binary difference image binaryDiffImg to obtain the non-flat area map notFlatMap. Wherein, j={0, 1, 2, ..., m} is the region identifier of the binary difference image binaryDiffImg, m represents the number of regions in the binary difference image binaryDiffImg, x and y respectively refer to the x-axis coordinate and y-axis coordinate of the pixel point, S() represents the function for calculating the area of ​​the region, and areaTh is the preset area threshold.

[0122] Embodiment 6:

[0123] In order to make the determined target image more realistic, based on the above embodiments, in an embodiment of the present invention, the method further includes:

[0124] For each pixel in the target image, a bitwise AND operation is performed on the horizontal coordinate value of the pixel and the difference between the width of the preset error transfer matrix and the second preset value to determine the target horizontal coordinate value corresponding to the pixel, and a bitwise AND operation is performed on the vertical coordinate value of the pixel and the difference between the height of the preset error transfer matrix and the second preset value to determine the target vertical coordinate value corresponding to the pixel, and according to the target horizontal coordinate value and the target vertical coordinate value corresponding to the pixel, the element value of the element point corresponding to the target horizontal coordinate value and the target vertical coordinate value is determined from the error transfer matrix, and according to the element value, horizontal coordinate value and vertical coordinate value of the element point corresponding to each pixel, a third matrix is ​​determined;

[0125] Determine a fourth product matrix of the first difference matrix and the third matrix, and determine a third sum matrix of a fourth matrix composed of the fourth product matrix and the pixel value of each pixel in the target image, and determine the pixel value of the pixel at the corresponding position of the updated target image according to the element value of each element in the third sum matrix.

[0126] In order to make the determined target image more realistic, in an embodiment of the present invention, the electronic device also stores a preset error transfer matrix, which is used to pass errors in the target image so that the target image will not be too smooth, thereby making the target image more realistic.

[0127] For each pixel point of the target image, the horizontal coordinate value is determined according to the horizontal coordinate value of the pixel point and the width of the error transfer matrix, and the difference between the width of the error transfer matrix and a second preset value is determined, and the horizontal coordinate value and the difference are bitwise ANDed; wherein the second preset value can be any positive integer value, preferably, the second preset value is 1.

[0128] According to the ordinate value of the pixel point and the height of the error transfer matrix, the ordinate value is determined, and the difference between the height of the error transfer matrix and the second preset value is determined, and the ordinate value and the difference are bitwise ANDed to determine the target horizontal coordinate value and the target total coordinate value corresponding to each pixel point, and according to the target horizontal coordinate value and the target total coordinate value corresponding to each pixel point position, the pixel value of the pixel point of the third matrix corresponding to each pixel point position is determined, thereby determining the third matrix.

[0129] For example, Figure 7 A schematic diagram of a preset error transfer matrix provided by an embodiment of the present invention is shown in FIG. Figure 7 As shown, the width dw of the error transfer matrix is ​​8, and the height dh is also 8.

[0130] According to the determined third matrix and the first difference matrix, the third matrix is ​​multiplied by the first difference matrix to obtain a fourth product matrix of the first difference matrix and the third matrix, and according to the pixel value of each pixel point in the target image, the fourth matrix is ​​determined, and the fourth matrix is ​​added to the third product matrix to obtain a third sum matrix of the fourth matrix and the third product matrix. According to the element value of each element point in the third sum matrix, the target image is updated, and the pixel value of the pixel point at each position in the updated target image is the element value of the element point at the corresponding position in the third sum matrix.

[0131] Specifically, according to the preset Figure 7 The error transfer matrix shown performs a mask dither operation on the target image blendImgOut to obtain an updated target image ImgOut, ImgOut=blendImgOut+(1-blendWeight)×ditherMatrix[x&(dw-1), y&(dh-1)].

[0132] Figure 8 A schematic diagram of removing banding artifacts from a video frame image provided by an embodiment of the present invention is shown in FIG. Figure 8 As shown, the method in the embodiment of the present invention can effectively remove or alleviate the banding artifacts in the flat area. At the same time, it can also play a good role in protecting the edge of the image. In the texture-rich area, the image details are hardly affected much.

[0133] Embodiment 7:

[0134] The image banding artifact removal method of the present invention is described below through a specific embodiment, where the image to be processed is a video frame image. Fig. 9 A schematic diagram of a process of removing image banding artifacts provided by an embodiment of the present invention is shown in FIG. Fig. 9 As shown, the process includes the following steps:

[0135] S901: Obtain the video frame image after decoding the video data as the image to be processed, and perform S902, S903 and S904 in parallel.

[0136] S902: Perform a filtering operation on the image to be processed to determine a filtered image after removing banding artifacts from the image to be processed, perform an edge texture preserving filtering operation on the filtered image and the image to be processed to determine a target image after edge texture preservation, and proceed to S906.

[0137] S903: Detect and determine the band artifact edge image corresponding to the image to be processed, and proceed to S905.

[0138] S904: Detect and determine the non-flat area image corresponding to the image to be processed, and proceed to S905.

[0139] S905: Perform edge-preserving filtering operations on the band artifact edge image and the non-flat area image, determine the band artifact area weight matrix and the non-flat area weight matrix, and determine the fusion weight matrix according to the pre-saved fusion formula, and proceed to S906.

[0140] S906: Determine a first product matrix of the fusion weight matrix and the first matrix based on a first matrix composed of the fusion weight matrix and the pixel value of each pixel point in the image to be processed; determine a second product matrix of the first difference matrix and the second matrix based on a first difference matrix determined by a difference between a first preset value and the element value of each element point in the fusion weight matrix and a second matrix composed of the pixel value of each pixel point in the target image; determine a sum matrix of the first product matrix and the second product matrix, and update the target image based on the element value of each element point in the sum matrix.

[0141] S907: Perform a Dither operation on the target image to determine a target image that is finally output after removing the banding artifacts.

[0142] In order to increase the speed of determining the final output target image after removing the banding artifacts, Fig.10 A schematic diagram of a process of removing image banding artifacts provided by an embodiment of the present invention is shown in FIG. Fig.10 As shown, the process includes the following steps:

[0143] S1001: Obtain the video frame image after decoding the video data, and perform S1002 and S1003 in parallel.

[0144] S1002: Perform a filtering operation on the image to be processed to determine a filtered image after removing banding artifacts from the image to be processed, perform an edge texture preserving filtering operation on the filtered image and the image to be processed to determine a target image after edge texture preservation, and proceed to S1008.

[0145] S1003: Down-sample the image to be processed, and perform S1004 and S1005 in parallel.

[0146] S1004: Detect and determine the band artifact edge image corresponding to the image to be processed, and proceed to S1006.

[0147] S1005: Detect and determine the non-flat area image corresponding to the image to be processed, and proceed to S1006.

[0148] S1006: Perform edge-preserving filtering operations on the band artifact edge image and the non-flat region image, determine the band artifact region weight matrix and the non-flat region weight matrix, and determine the fusion weight matrix according to a pre-saved fusion formula.

[0149] S1007: Perform upsampling processing on the fusion weight matrix and proceed to S1008.

[0150] S1008: Determine a first product matrix of the fusion weight matrix and the first matrix based on a first matrix composed of the fusion weight matrix and the pixel value of each pixel point in the image to be processed; determine a second product matrix of the first difference matrix and the second matrix based on a first difference matrix determined by a difference between a first preset value and the element value of each element point in the fusion weight matrix and a second matrix composed of the pixel value of each pixel point in the target image; determine a sum matrix of the first product matrix and the second product matrix, and update the target image based on the element value of each element point in the sum matrix.

[0151] S1009: Perform a Dither operation on the target image to determine a target image that is finally output after removing the banding artifacts.

[0152] Embodiment 8:

[0153] Based on the above embodiments, Fig.11 A schematic diagram of the structure of a device for removing image banding artifacts provided by an embodiment of the present invention, the device comprising:

[0154] The first determination module 1101 is used to perform a filtering operation on the image to be processed, determine a filtered image after removing banding artifacts from the image to be processed, and determine a difference matrix and a difference absolute value matrix between the filtered image and the image to be processed according to the difference between the pixel values ​​of each corresponding pixel point in the filtered image and the image to be processed;

[0155] A second determination module 1102 is used to determine, for each element point in the difference absolute value matrix, a target size relationship between the element value and the first preset threshold and the second preset threshold according to the element value of the element point, the first preset threshold and the second preset threshold, wherein the second preset threshold is greater than the first preset threshold;

[0156] The third determination module 1103 is used to determine the target pixel value of the target pixel point at the corresponding position of each element point in the target image after the edge texture is preserved according to the target size relationship corresponding to the element value of each element point and the pre-saved value function of the pixel value corresponding to each size relationship, so as to obtain the target image after the edge texture is preserved.

[0157] Further, the size relationship includes that the element value is not greater than the first preset threshold, the element value is greater than the first preset threshold and less than the second preset threshold, and the element value is not less than the second preset threshold. The third determination module is specifically used to determine the target size relationship corresponding to the element value of each element point, if the target size relationship is that the element value of the element point is not greater than the first preset threshold or not less than the second preset threshold, respectively, and determine the pixel value of the pixel point at the corresponding position of the element point in the filtered image or the image to be processed as the target pixel point at the corresponding position of the element point in the target image. if the target size relationship is that the element value of the element point is greater than the first preset threshold and less than the second preset threshold, determine the first difference between the second preset threshold and the element value of the element point, the second difference between the second preset threshold and the first preset threshold, and determine the ratio value corresponding to the first difference and the second difference, determine the product value of the element value at the corresponding position of the element point in the difference matrix and the ratio value, and determine the sum value of the product value and the pixel value of the pixel point at the corresponding position of the element point in the image to be processed, and determine the sum value as the target pixel value of the target pixel point at the corresponding position of the element point in the target image.

[0158] Furthermore, the device also includes:

[0159] A detection module, used for detecting and determining the band artifact edge image and the non-flat area image corresponding to the image to be processed;

[0160] A fusion module, used for performing edge-preserving filtering operation on the band artifact edge image and the non-flat area image, determining a band artifact area weight matrix and a non-flat area weight matrix, and determining a fusion weight matrix according to a pre-saved fusion formula;

[0161] A fourth determination module is used to determine a first product matrix of the fusion weight matrix and a first matrix composed of the pixel value of each pixel point in the image to be processed; a second product matrix of the first difference matrix and the second matrix composed of the pixel value of each pixel point in the target image is determined based on a first difference matrix determined by a difference between a first preset value and an element value of each element point in the fusion weight matrix and a second matrix composed of the pixel value of each pixel point in the target image;

[0162] An updating module is used to determine a sum matrix of the first product matrix and the second product matrix, and to update the target image according to the element value of each element point in the sum matrix.

[0163] Furthermore, the fusion module is specifically used to determine a second difference matrix based on the difference between the first preset value and the element value of each element point in the band artifact area weight matrix; and determine the product matrix of the second difference matrix and the non-flat area weight matrix as the fusion weight matrix.

[0164] Furthermore, the updating module is further used to perform a filtering operation on the band-shaped artifact edge image, and determine that an image after removing target edges whose edge lengths are less than a preset length threshold is an updated image of the band-shaped artifact edge image.

[0165] Furthermore, the detection module is specifically used to perform dilation and erosion operations on the image to be processed to determine a dilated image and an eroded image; determine a difference image between the dilated image and the eroded image based on the difference in pixel values ​​of each corresponding position pixel point in the dilated image and the eroded image; perform a binarization filtering operation on the difference image to determine a binary difference image of the difference image; perform area filtering on the binary difference image to determine that the image after removing the area whose area is less than a preset area threshold is a non-flat area image.

[0166] Further, the fourth determination module is also used to, for each pixel point in the target image, perform a bitwise AND operation on the horizontal coordinate value of the pixel point and the difference between the width of the preset error transfer matrix and the second preset value to determine the target horizontal coordinate value corresponding to the pixel point, perform a bitwise AND operation on the vertical coordinate value of the pixel point and the difference between the height of the preset error transfer matrix and the second preset value to determine the target vertical coordinate value corresponding to the pixel point, determine the element value of the element point corresponding to the target horizontal coordinate value and the target vertical coordinate value from the error transfer matrix according to the target horizontal coordinate value and the target vertical coordinate value corresponding to the pixel point, and determine the third matrix according to the element value, horizontal coordinate value and vertical coordinate value of the element point corresponding to each pixel point;

[0167] The update module is also used to determine a fourth product matrix of the first difference matrix and the third matrix, and to determine a third sum matrix of a fourth matrix composed of the fourth product matrix and the pixel value of each pixel point in the target image, and to determine the pixel value of the pixel point at the corresponding position of the updated target image according to the element value of each element point in the third sum matrix.

[0168] Embodiment 9:

[0169] Fig.12A schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. On the basis of the above embodiments, an electronic device is further provided in an embodiment of the present invention, including a processor 1201, a communication interface 1202, a memory 1203 and a communication bus 1204, wherein the processor 1201, the communication interface 1202, and the memory 1203 communicate with each other through the communication bus 1204;

[0170] The memory 1203 stores a computer program. When the program is executed by the processor 1201, the processor 1201 performs the following steps:

[0171] Performing a filtering operation on the image to be processed, determining a filtered image after removing band artifacts from the image to be processed, and determining a difference matrix and a difference absolute value matrix between the filtered image and the image to be processed according to a difference between the pixel values ​​of each corresponding pixel point in the filtered image and the image to be processed;

[0172] For each element point in the absolute value matrix of the difference, determine a target size relationship between the element value and the first preset threshold and the second preset threshold according to the element value of the element point, the first preset threshold and the second preset threshold, wherein the second preset threshold is greater than the first preset threshold;

[0173] According to the target size relationship corresponding to the element value of each element point and the pre-saved value function of the pixel value corresponding to each size relationship, the target pixel value of the target pixel point at the corresponding position of each element point in the target image after the edge texture is retained is determined to obtain the target image after the edge texture is retained.

[0174] Further, the processor 1201 is specifically used for the size relationship including that the element value is not greater than the first preset threshold, the element value is greater than the first preset threshold and less than the second preset threshold, and the element value is not less than the second preset threshold, and the target size relationship corresponding to the element value of each element point and the pre-saved value function of the pixel value corresponding to each size relationship are determined according to the target size relationship, and the target pixel value of the target pixel point corresponding to the position of each element point in the target image after the edge texture is retained includes:

[0175] For the target size relationship corresponding to the element value of each element point, if the target size relationship is that the element value of the element point is not greater than the first preset threshold or not less than the second preset threshold, respectively, the pixel value of the pixel point at the corresponding position of the element point in the filtered image or the image to be processed is determined, and the pixel value is determined as the target pixel value of the target pixel point at the corresponding position of the element point in the target image; if the target size relationship is also that the element value of the element point is greater than the first preset threshold and less than the second preset threshold, a first difference between the second preset threshold and the element value of the element point, a second difference between the second preset threshold and the first preset threshold, and a ratio value corresponding to the first difference and the second difference are determined, a product value of the element value at the corresponding position of the element point in the difference matrix and the ratio value is determined, and a sum value of the product value and the pixel value of the pixel point at the corresponding position of the element point in the image to be processed is determined, and the sum value is determined as the target pixel value of the target pixel point at the corresponding position of the element point in the target image.

[0176] Furthermore, the processor 1201 is further configured to detect and determine a band artifact edge image and a non-flat area image corresponding to the image to be processed;

[0177] Performing edge-preserving filtering operations on the band-shaped artifact edge image and the non-flat region image, determining a band-shaped artifact region weight matrix and a non-flat region weight matrix, and determining a fusion weight matrix according to a pre-saved fusion formula;

[0178] Determine a first product matrix of the fusion weight matrix and a first matrix consisting of pixel values ​​of each pixel in the image to be processed;

[0179] Determine a second product matrix of the first difference matrix and the second matrix based on a first difference matrix determined by a difference between a first preset value and an element value of each element point in the fusion weight matrix and a second matrix composed of a pixel value of each pixel point in the target image;

[0180] A sum matrix of the first product matrix and the second product matrix is ​​determined, and the target image is updated according to the element value of each element point in the sum matrix.

[0181] Further, the processor 1201 is specifically configured to determine a second difference matrix according to a difference between the first preset value and an element value of each element point in the band artifact area weight matrix;

[0182] A product matrix of the second difference matrix and the non-flat area weight matrix is ​​determined as a fusion weight matrix.

[0183] Furthermore, the processor 1201 is also used to perform a filtering operation on the band-like artifact edge image after detecting and determining that the band-like artifact edge image corresponds to the image to be processed, and determine that the image after removing the target edge whose edge length is less than a preset length threshold is an updated image of the band-like artifact edge image.

[0184] Further, the processor 1201 is specifically used to perform a dilation operation and an erosion operation on the image to be processed to determine a dilated image and an eroded image;

[0185] Determine a difference image between the dilated image and the eroded image according to a difference in pixel values ​​of each corresponding pixel point in the dilated image and the eroded image;

[0186] A binarization filtering operation is performed on the difference image to determine a binary difference image of the difference image, and an area filtering operation is performed on the binary difference image to determine that the image after removing the area whose area is smaller than a preset area threshold is a non-flat area image.

[0187] Further, the processor 1201 is also used to, for each pixel in the target image, perform a bitwise AND operation on the horizontal coordinate value of the pixel and the difference between the width of the preset error transfer matrix and the second preset value to determine the target horizontal coordinate value corresponding to the pixel, perform a bitwise AND operation on the vertical coordinate value of the pixel and the difference between the height of the preset error transfer matrix and the second preset value to determine the target vertical coordinate value corresponding to the pixel, determine the element value of the element point corresponding to the target horizontal coordinate value and the target vertical coordinate value from the error transfer matrix according to the target horizontal coordinate value and the target vertical coordinate value corresponding to the pixel, and determine a third matrix according to the element value, horizontal coordinate value and vertical coordinate value of the element point corresponding to each pixel;

[0188] Determine a fourth product matrix of the first difference matrix and the third matrix, and determine a third sum matrix of a fourth matrix composed of the fourth product matrix and the pixel value of each pixel in the target image, and determine the pixel value of the pixel at the corresponding position of the updated target image according to the element value of each element in the third sum matrix.

[0189] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0190] The communication interface 1202 is used for communication between the above electronic device and other devices.

[0191] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0192] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (Network Processor, NP), etc.; it can also be a digital signal processing processor (Digital Signal Processing, DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.

[0193] Embodiment 10:

[0194] On the basis of the above embodiments, an embodiment of the present invention further provides a computer-readable storage medium storing a computer program, wherein the computer program is executed by a processor to perform the following steps:

[0195] Performing a filtering operation on the image to be processed, determining a filtered image after removing band artifacts from the image to be processed, and determining a difference matrix and a difference absolute value matrix between the filtered image and the image to be processed according to a difference between the pixel values ​​of each corresponding pixel point in the filtered image and the image to be processed;

[0196] For each element point in the absolute value matrix of the difference, determine a target size relationship between the element value and the first preset threshold and the second preset threshold according to the element value of the element point, the first preset threshold and the second preset threshold, wherein the second preset threshold is greater than the first preset threshold;

[0197] According to the target size relationship corresponding to the element value of each element point and the pre-saved value function of the pixel value corresponding to each size relationship, the target pixel value of the target pixel point at the corresponding position of each element point in the target image after the edge texture is retained is determined to obtain the target image after the edge texture is retained.

[0198] Further, the size relationship includes that the element value is not greater than the first preset threshold, the element value is greater than the first preset threshold and less than the second preset threshold, and the element value is not less than the second preset threshold, and the target size relationship corresponding to the element value of each element point and the pre-saved value function of the pixel value corresponding to each size relationship are determined according to the target pixel value of the target pixel point corresponding to the position of each element point in the target image after the edge texture is retained, including:

[0199] For the target size relationship corresponding to the element value of each element point, if the target size relationship is that the element value of the element point is not greater than the first preset threshold or not less than the second preset threshold, respectively, the pixel value of the pixel point at the corresponding position of the element point in the filtered image or the image to be processed is determined, and the pixel value is determined as the target pixel value of the target pixel point at the corresponding position of the element point in the target image; if the target size relationship is also that the element value of the element point is greater than the first preset threshold and less than the second preset threshold, a first difference between the second preset threshold and the element value of the element point, a second difference between the second preset threshold and the first preset threshold, and a ratio value corresponding to the first difference and the second difference are determined, a product value of the element value at the corresponding position of the element point in the difference matrix and the ratio value is determined, and a sum value of the product value and the pixel value of the pixel point at the corresponding position of the element point in the image to be processed is determined, and the sum value is determined as the target pixel value of the target pixel point at the corresponding position of the element point in the target image.

[0200] Furthermore, the method further comprises:

[0201] Detect and determine the band artifact edge image and the non-flat area image corresponding to the image to be processed;

[0202] Performing edge-preserving filtering operations on the band-shaped artifact edge image and the non-flat region image, determining a band-shaped artifact region weight matrix and a non-flat region weight matrix, and determining a fusion weight matrix according to a pre-saved fusion formula;

[0203] Determine a first product matrix of the fusion weight matrix and a first matrix consisting of pixel values ​​of each pixel in the image to be processed;

[0204] Determine a second product matrix of the first difference matrix and the second matrix based on a first difference matrix determined by a difference between a first preset value and an element value of each element point in the fusion weight matrix and a second matrix composed of a pixel value of each pixel point in the target image;

[0205] A sum matrix of the first product matrix and the second product matrix is ​​determined, and the target image is updated according to the element value of each element point in the sum matrix.

[0206] Furthermore, determining the fusion weight matrix according to the pre-saved fusion formula includes:

[0207] Determine a second difference matrix according to a difference between a first preset value and an element value of each element point in the band artifact area weight matrix;

[0208] A product matrix of the second difference matrix and the non-flat area weight matrix is ​​determined as a fusion weight matrix.

[0209] Furthermore, after the detection determines the band artifact edge image corresponding to the image to be processed, the method further includes:

[0210] A filtering operation is performed on the band-shaped artifact edge image to determine that an image after removing target edges whose edge lengths are less than a preset length threshold is an updated image of the band-shaped artifact edge image.

[0211] Further, the determining the non-flat area image corresponding to the image to be processed includes:

[0212] Performing a dilation operation and an erosion operation on the image to be processed to determine a dilated image and an eroded image;

[0213] Determine a difference image between the dilated image and the eroded image according to a difference in pixel values ​​of each corresponding pixel point in the dilated image and the eroded image;

[0214] A binarization filtering operation is performed on the difference image to determine a binary difference image of the difference image, and an area filtering operation is performed on the binary difference image to determine that the image after removing the area whose area is smaller than a preset area threshold is a non-flat area image.

[0215] Furthermore, the method further comprises:

[0216] For each pixel in the target image, a bitwise AND operation is performed on the horizontal coordinate value of the pixel and the difference between the width of the preset error transfer matrix and the second preset value to determine the target horizontal coordinate value corresponding to the pixel, and a bitwise AND operation is performed on the vertical coordinate value of the pixel and the difference between the height of the preset error transfer matrix and the second preset value to determine the target vertical coordinate value corresponding to the pixel, and according to the target horizontal coordinate value and the target vertical coordinate value corresponding to the pixel, the element value of the element point corresponding to the target horizontal coordinate value and the target vertical coordinate value is determined from the error transfer matrix, and according to the element value, horizontal coordinate value and vertical coordinate value of the element point corresponding to each pixel, a third matrix is ​​determined;

[0217] Determine a fourth product matrix of the first difference matrix and the third matrix, and determine a third sum matrix of a fourth matrix composed of the fourth product matrix and the pixel value of each pixel in the target image, and determine the pixel value of the pixel at the corresponding position of the updated target image according to the element value of each element in the third sum matrix.

[0218] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0219] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0220] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0221] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0222] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for removing image banding artifacts, characterized in that: The method comprises: Performing a filtering operation on the image to be processed, determining a filtered image after removing band artifacts from the image to be processed, and determining a difference matrix and a difference absolute value matrix between the filtered image and the image to be processed according to a difference between the pixel values ​​of each corresponding pixel point in the filtered image and the image to be processed; For each element point in the absolute value matrix of the difference, determine a target size relationship between the element value and the first preset threshold and the second preset threshold according to the element value of the element point, the first preset threshold and the second preset threshold, wherein the second preset threshold is greater than the first preset threshold; According to the target size relationship corresponding to the element value of each element point and the pre-stored value function of the pixel value corresponding to each size relationship, the target pixel value of the target pixel point at the corresponding position of each element point in the target image after edge texture preservation is determined to obtain the target image after edge texture preservation; Wherein, determining the target pixel value of the target pixel point at the corresponding position of each element point in the target image after retaining the edge texture according to the target size relationship corresponding to the element value of each element point and the pre-stored value function of the pixel value corresponding to each size relationship includes: For the target size relationship corresponding to the element value of each element point, if the target size relationship is that the element value of the element point is not greater than the first preset threshold or not less than the second preset threshold, the pixel value of the pixel point at the corresponding position of the element point in the filtered image or the image to be processed is determined respectively, and the pixel value is determined as the target pixel value of the target pixel point at the corresponding position of the element point in the target image.

2. The method according to claim 1, characterized in that The size relationship also includes that the element value is greater than the first preset threshold and less than the second preset threshold, and the target size relationship corresponding to the element value of each element point and the pre-stored value function of the pixel value corresponding to each size relationship are determined according to which the target pixel value of each element point at the corresponding position of the target image after the edge texture is retained includes: For the target size relationship corresponding to the element value of each element point, if the target size relationship is that the element value of the element point is greater than the first preset threshold and less than the second preset threshold, determine the first difference between the second preset threshold and the element value of the element point, the second difference between the second preset threshold and the first preset threshold, and determine the ratio value corresponding to the first difference and the second difference, determine the product value of the element value at the corresponding position of the element point in the difference matrix and the ratio value, and determine the sum value of the product value and the pixel value of the pixel point at the corresponding position of the element point in the image to be processed, and determine the sum value as the target pixel value of the target pixel point at the corresponding position of the element point in the target image.

3. The method according to claim 2, characterized in that The method further comprises: Detect and determine the band artifact edge image and the non-flat area image corresponding to the image to be processed; Performing edge-preserving filtering operations on the band-shaped artifact edge image and the non-flat region image, determining a band-shaped artifact region weight matrix and a non-flat region weight matrix, and determining a fusion weight matrix according to a pre-saved fusion formula; Determine a first product matrix of the fusion weight matrix and a first matrix consisting of pixel values ​​of each pixel in the image to be processed; Determine a second product matrix of the first difference matrix and the second matrix based on a first difference matrix determined by a difference between a first preset value and an element value of each element point in the fusion weight matrix and a second matrix composed of a pixel value of each pixel point in the target image; A sum matrix of the first product matrix and the second product matrix is ​​determined, and the target image is updated according to the element value of each element point in the sum matrix.

4. The method according to claim 3, characterized in that Determining the fusion weight matrix according to the pre-saved fusion formula includes: Determine a second difference matrix according to a difference between a first preset value and an element value of each element point in the band artifact area weight matrix; A product matrix of the second difference matrix and the non-flat area weight matrix is ​​determined as a fusion weight matrix.

5. The method according to claim 3, characterized in that: After the detection determines the band artifact edge image corresponding to the image to be processed, the method further includes: A filtering operation is performed on the band-shaped artifact edge image to determine that an image after removing target edges whose edge lengths are less than a preset length threshold is an updated image of the band-shaped artifact edge image.

6. The method according to claim 3, characterized in that The determining of the non-flat area image corresponding to the image to be processed comprises: Performing a dilation operation and an erosion operation on the image to be processed to determine a dilated image and an eroded image; Determine a difference image between the dilated image and the eroded image according to a difference in pixel values ​​of each corresponding pixel point in the dilated image and the eroded image; A binarization filtering operation is performed on the difference image to determine a binary difference image of the difference image, and an area filtering operation is performed on the binary difference image to determine that the image after removing the area whose area is smaller than a preset area threshold is a non-flat area image.

7. The method according to claim 3, characterized in that The method further comprises: For each pixel in the target image, a bitwise AND operation is performed on the horizontal coordinate value of the pixel and the difference between the width of the preset error transfer matrix and the second preset value to determine the target horizontal coordinate value corresponding to the pixel, and a bitwise AND operation is performed on the vertical coordinate value of the pixel and the difference between the height of the preset error transfer matrix and the second preset value to determine the target vertical coordinate value corresponding to the pixel, and according to the target horizontal coordinate value and the target vertical coordinate value corresponding to the pixel, the element value of the element point corresponding to the target horizontal coordinate value and the target vertical coordinate value is determined from the error transfer matrix, and according to the element value, horizontal coordinate value and vertical coordinate value of the element point corresponding to each pixel, a third matrix is ​​determined; Determine a fourth product matrix of the first difference matrix and the third matrix, and determine a third sum matrix of a fourth matrix composed of the fourth product matrix and the pixel value of each pixel in the target image, and determine the pixel value of the pixel at the corresponding position of the updated target image according to the element value of each element in the third sum matrix.

8. An image banding artifact removal device, characterized in that: The device comprises: A first determination module is used to perform a filtering operation on the image to be processed, determine a filtered image after removing banding artifacts from the image to be processed, and determine a difference matrix and a difference absolute value matrix between the filtered image and the image to be processed according to a difference between the pixel values ​​of each corresponding pixel point in the filtered image and the image to be processed; A second determination module is used to determine, for each element point in the difference absolute value matrix, a target size relationship between the element value and the first preset threshold and the second preset threshold according to the element value of the element point, a first preset threshold and a second preset threshold, wherein the second preset threshold is greater than the first preset threshold; A third determination module is used to determine the target pixel value of the target pixel point at the corresponding position of each element point in the target image after edge texture preservation according to the target size relationship corresponding to the element value of each element point and the pre-saved value function of the pixel value corresponding to each size relationship, so as to obtain the target image after edge texture preservation; The third determination module is specifically used to determine the target size relationship corresponding to the element value of each element point. If the target size relationship is that the element value of the element point is not greater than the first preset threshold or not less than the second preset threshold, the pixel value of the pixel point at the corresponding position of the element point in the filtered image or the image to be processed is determined as the target pixel value of the target pixel point at the corresponding position of the element point in the target image.

9. An electronic device, characterized in that: include: A processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; A computer program is stored in the memory, and when the program is executed by the processor, the processor executes the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer program executable by a processor is stored therein, and when the program runs on the processor, the processor is enabled to execute the method according to any one of claims 1 to 7.