Image processing method and device, electronic equipment and readable storage medium
By extracting the chromaticity features of the UV components in the YUV color space, the gradient regions of the image are identified and processed, thus solving the problem of artifacts in image compression and achieving high-precision and efficient artifact elimination.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-18
- Publication Date
- 2026-06-30
AI Technical Summary
In existing technologies, the information loss introduced by quantization operations during image compression leads to obvious visual artifacts in the gradient region. Furthermore, traditional methods based on the luminance component have limited detection accuracy, making it difficult to effectively identify and eliminate artifact phenomena.
By analyzing the UV components in the YUV color space, chromaticity features such as variance, gradient, frequency domain energy, and saturation are extracted to form a comprehensive judgment, identify color gradient regions, and perform targeted processing to improve smoothness and eliminate artifacts.
It improves the detection accuracy and robustness of gradient regions, effectively reduces artifacts in images, is applicable to various types of images, and maintains high-efficiency detection and processing during multi-frame encoding and decoding.
Smart Images

Figure CN122312450A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computer technology, and specifically relates to an image processing method, apparatus, electronic device, and readable storage medium. Background Technology
[0002] In the process of acquiring, transmitting, and displaying digital images and videos, compression techniques are commonly used to save storage space and transmission bandwidth. However, the quantization operation in this compression process inevitably introduces information loss, especially in image areas containing large areas of color gradation, which can produce obvious visual artifacts.
[0003] Existing methods for detecting gradient regions prone to artifacts mainly rely on the analysis of image luminance components. However, in many typical color gradient regions, the spatial variation of luminance is very subtle, and in specific scenarios, small noise interference in the luminance components may lead to misjudgment. Therefore, the accuracy of detecting gradient regions is limited, which in turn affects the effect of subsequent targeted optimization processing.
[0004] Therefore, improving the detection accuracy of artifact-prone objects and further eliminating artifacts are important technical challenges for improving image compression quality. Summary of the Invention
[0005] The purpose of this application is to provide an image processing method, apparatus, electronic device, and readable storage medium that can improve the accuracy of detecting gradient regions and effectively reduce artifacts in images.
[0006] In a first aspect, embodiments of this application provide an image processing method, the method comprising: Based on the chromaticity information of the image to be processed, the chromaticity features of each of the multiple different image regions in the image to be processed are extracted; the chromaticity features are used to characterize the overall color distribution of the image regions. The image region whose chromaticity features satisfy the first determination condition is identified as the target region in the image to be processed; the target region includes the region in the image to be processed where the color gradually changes. The target area is processed to obtain a target image, which is then displayed; the processing is used to improve the smoothness of the color gradient in the target area.
[0007] Secondly, embodiments of this application provide an image processing apparatus, the apparatus comprising: The feature extraction module is used to extract the chromaticity features of multiple different image regions in the image to be processed based on the chromaticity information of the image to be processed; the chromaticity features are used to characterize the overall color distribution of the image regions; The region determination module is used to determine the image region whose color features satisfy the first determination condition as the target region in the image to be processed; the target region includes the region in the image to be processed where the color gradually changes; The processing module is used to process the target area to obtain a target image and display it; the processing is used to improve the smoothness of the color gradient in the target area.
[0008] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0009] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0010] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.
[0011] In this embodiment, artifacts are essentially interruptions in the color continuity of an image. By extracting features based on chromaticity information in the image, the limitations of traditional methods that rely solely on luminance information are overcome, improving the accuracy of detecting gradient regions. Furthermore, by extracting multiple features such as chromaticity variance, chromaticity gradient, frequency domain energy, and saturation, a comprehensive judgment can be formed, improving both the accuracy and robustness of gradient region detection. Moreover, in the detection method provided in this embodiment, the parameters in the feature extraction and judgment processes can be adaptively adjusted according to the image type, making the detection method applicable to various image types. This application not only provides a method for detecting gradient regions but also optimizes the subsequent processing of gradient regions. Through more refined quantization operations, filtering, and dithering, the gradient regions become smoother, effectively eliminating artifacts in the image. Attached Figure Description
[0012] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1This is a flowchart illustrating the steps of an embodiment of an image processing method provided in this application; Figure 2 This is a flowchart illustrating the steps of another embodiment of the image processing method provided in this application; Figure 3 This is a flowchart illustrating the steps of another embodiment of the image processing method provided in this application; Figure 4 This is a structural block diagram of an image processing apparatus provided in this application; Figure 5 This is a structural block diagram of an electronic device provided in this application. Detailed Implementation
[0014] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0015] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0016] The terms "first," "second," etc., used in the specification and claims of this invention are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, the first object can be one or more. Furthermore, the term "and / or" in the specification and claims is used to describe the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. In embodiments of this invention, the term "multiple" refers to two or more, and other quantifiers are similar.
[0017] Reference Figure 1 The flowchart illustrates the steps of an embodiment of the image processing method of the present invention, the method comprising: Step 101: Based on the chromaticity information of the image to be processed, extract the chromaticity features of each of the multiple different image regions in the image to be processed; the chromaticity features are used to characterize the overall color distribution of the image regions; Step 102: The image region whose chromaticity features satisfy the first determination condition is determined as the target region in the image to be processed; the target region includes the region in the image to be processed where the color gradually changes. Step 103: Process the target area to obtain a target image and display it; the processing is used to improve the smoothness of the color gradient in the target area.
[0018] For steps 101 to 103, the image processing method provided in this application embodiment can be applied to the entire processing chain of digital image and video acquisition, encoding, transmission, and display. Typically, to save storage space and transmission bandwidth, lossy compression techniques based on transform coding and quantization are commonly used in image processing. However, the quantization operation in this compression process inevitably introduces information loss. The quantization process reduces or significantly decreases the coefficients representing subtle color changes, causing the decoded and reconstructed image to fail to recover the original continuous color transitions in that area, resulting in obvious color banding artifacts. In many real-world scenarios, the chromaticity components of color gradient regions carry the main color transition information. Traditional methods typically rely on luminance components for detection, which has limited accuracy. This invention extends the analysis to chrominance components. Specifically, the core of this solution lies in fully utilizing the color information carried by the UV components in the YUV color space for detection. The YUV color space refers to a luminance-chrominance color space, where the Y component represents luminance information and the UV components specifically refer to the two chrominance components in the YUV color space. The U component represents blue chrominance information, and the V component represents red chrominance information.
[0019] It should be noted that the image to be processed refers to the original image data that needs to be detected and processed for color gradient regions. Its content includes, but is not limited to, natural scene images and computer-generated images. The image to be processed can be an independent image or a frame from a video stream. The image to be processed can be image data represented using the YUV color space or other color spaces, such as the Red-Green-Blue (RGB) color space. If the image to be processed is not a YUV image, a color space conversion is performed to convert it to a YUV image. A YUV image is an image using a color encoding method that separates luminance and chrominance. In the YUV color space, the Y component represents luminance information, and the UV components specifically refer to the two chrominance components in the YUV color space. The U component represents blue chrominance information, and the V component represents red chrominance information. The UV components together determine the color characteristics of the image. The U component is used to represent the color tendency of blue and yellow, and the V component is used to represent the color tendency of red and green. These two components are independent of luminance information and specifically describe color characteristics. By analyzing the statistical characteristics of UV components, we can more accurately capture the features of color gradation, thus providing a more reliable basis for subsequent processing.
[0020] Chromaticity information refers to the set of parameters describing color features in an image, specifically the numerical distribution of the U and V components in the YUV color space. Chromaticity information reflects the color attributes of each pixel in the image and is the fundamental data for analyzing color gradation features. An image region refers to a local image unit obtained by dividing the original image. Dividing methods include, but are not limited to, regular grid partitioning, adaptive region segmentation, and superpixel segmentation. Image region partitioning aims to transform global analysis into local feature extraction, improving the precision of detection. Color distribution refers to the statistical distribution characteristics of color values within an image region, including the central tendency, dispersion, and variation patterns of color values. Chromaticity features are feature parameters extracted from the chromaticity information of image regions that can quantitatively characterize the color distribution.
[0021] The first criterion refers to the set of discriminant standards used to determine whether an image region belongs to the target region. This criterion is based on the numerical characteristics of chromaticity features and uses logical judgment to determine whether a region conforms to a color gradation pattern. The target region refers to the set of image regions identified as containing color gradation characteristics after chromaticity feature analysis; visually, the target region exhibits a smooth color transition. Color gradation means that the color values within the image region show continuous spatial variation. This change is not an abrupt edge, but a gradual color distribution, exhibiting a specific statistical regularity in chromaticity features.
[0022] After detecting the target region, processing is applied to improve the smoothness of color gradients within that region. Specifically, this processing utilizes specialized image processing techniques to enhance the visual continuity of color transitions and reduce color banding caused by data inaccuracy. This process aims to improve the subjective visual quality of color gradient areas, making color transitions more natural and smooth.
[0023] It should be noted that existing detection and processing methods either have low detection accuracy and are only applicable to simple scenarios; for example, gradient analysis methods are highly complex, frequency domain analysis methods have poor real-time performance and high computational complexity, and deep learning methods also have a large computational load. In contrast, the image processing method provided in this application has high accuracy and fast detection and processing speed, and can be applied to various scenarios. For example, the MJPEG format in the image standard supports multi-frame encoding and decoding, and there is a frame rate concept in the encoding and decoding process. The image processing method provided in this application can support multi-frame loop pipelines.
[0024] In this embodiment, the solution provides a complete color gradient region detection and processing workflow. Specifically, it divides the YUV format image to be processed into regions, laying the foundation for local feature analysis. For each image region, chromaticity features that can effectively characterize the color distribution are extracted from the UV components. These features describe the characteristics of color from different dimensions. Based on the extracted chromaticity features, each image region is screened according to a preset first judgment condition, and regions that meet the color gradient characteristics are identified as target regions. This fully utilizes the advantages of UV components in color gradient characterization and overcomes the limitations of traditional analysis. Targeted enhancement processing is applied to the identified target regions, focusing on improving the smoothness of the color gradient. By improving the continuity of color transitions, the visual quality of the gradient region is effectively enhanced. Therefore, this embodiment achieves accurate detection and effective enhancement of color gradient regions through a complete workflow from chromaticity feature analysis to targeted processing.
[0025] Reference Figure 2 The diagram illustrates a flowchart of another embodiment of the image processing method of the present invention, the method comprising: Step 201: Determine the variance characteristics of the image region based on the variance between the two chromaticity components of all pixels in the image region; the two chromaticity components are used to characterize the color of the pixels.
[0026] It should be noted that an image region refers to a local area in the image to be processed, obtained through a specific partitioning method. This partitioning can be based on, but is not limited to, spatial continuity, feature similarity, and regular partitioning. Variance features characterize the dispersion of chromaticity values within this image region, reflecting the degree of color consistency. Specifically, low variance corresponds to regions with uniform color distribution; therefore, variance features can be used to identify regions with uniform color distribution. The variance features are obtained as follows: The UV component values of all pixels within the region are obtained, and the arithmetic mean of each chromaticity component for each pixel is calculated. The variance of the image region is obtained based on the deviation of each pixel value from the mean. After obtaining the variances corresponding to the two components of the image region, the final variance features of the image region can be determined based on the independent or overall characteristics of these two variances.
[0027] In this embodiment, at least one feature is used to detect the target region because different image scenes have varying sensitivity to features. A single feature cannot cover all application scenarios, and image content with varying complexity requires features of different dimensions for description and detection. Furthermore, systems with different real-time requirements can select feature combinations of varying complexity. Therefore, this embodiment provides a scalable feature framework that allows the system to dynamically adjust its feature extraction strategy based on computing resources, making it more versatile. The design of at least one feature allows for flexible selection of feature combinations according to actual needs. When computing resources are limited, basic features can be selected; when high accuracy is required, the entire feature set can be used; and in specific application scenarios, the most effective subset of features can be selected.
[0028] Optionally, step 201 may specifically include the following steps: Sub-step 2011: Calculate the first variance among the first color components of all the pixels; Sub-step 2012: Calculate the second variance between the second color components of all the pixels; Sub-step 2013: Based on the first variance and the second variance, obtain the variance features of the image region.
[0029] Regarding steps 2011 to 2013, it should be noted that the first color component refers to the U component, and the second color component refers to the V component. In the YUV color space, the U component specifically refers to the blue chromaticity component, used to describe the relative intensity of blue and yellow in a pixel's color. Its numerical range is typically 0-255, where 128 represents a neutral color, below 128 leans towards blue, and above 128 leans towards yellow. In the YUV color space, the V component specifically refers to the red chromaticity component, used to describe the relative intensity of red and green in a pixel's color. It also uses a numerical range of 0-255, with 128 being a neutral color, below 128 leaning towards red, and above 128 leaning towards green.
[0030] The first variance refers to the statistical variance calculated based on the U component values of all pixels within the image region, specifically characterizing the dispersion of the blue chromaticity component. This value reflects the consistency level of the blue color component within the region. The second variance refers to the statistical variance calculated based on the V component values of all pixels within the image region, specifically characterizing the dispersion of the red chromaticity component. This value reflects the consistency level of the red color component within the region. Specifically, the U component value of each pixel within the region is extracted to form a dataset U={ ... Extract the V component value of each pixel within the region to form a dataset V={ ... } Where n is the total number of pixels in the region. Based on datasets U and V, the mean of the U component and the mean of the V component are calculated. Based on these two means, the variance corresponding to each component is calculated, namely the first variance and the second variance. After obtaining the first variance and the second variance, they can be synthesized into the final variance feature through methods such as arithmetic mean, weighted fusion, maximum value selection, and geometric mean.
[0031] In this embodiment, the U component and V component represent different color dimensions in the color space. Calculating their variances separately allows for a more accurate capture of the color distribution characteristics of each dimension. This separate calculation method avoids confusion of color information and improves the representational ability of features.
[0032] Step 202: Calculate the gradient corresponding to each of the two chromaticity components of all pixels in the image region, and determine the gradient feature of the image region based on the gradient corresponding to each of the pixels; the gradient feature is used to characterize the smoothness of the gradient change in the image region.
[0033] Gradient features are used to characterize the variation characteristics of chromaticity values within an image region, reflecting the severity of color changes. Specifically, low gradients correspond to regions of gradual change, thus gradient features can be used to identify regions with smooth color transitions. Gradient features can be obtained through differential operator analysis. Specifically, the rate of change of each pixel in the spatial direction is calculated using a difference operator, and the rates of change in different directions are synthesized into a gradient vector. The gradients of all pixels within the region are statistically summarized, and finally, the overall variation characteristics of the image region are characterized by methods such as mean, variance, and distribution.
[0034] Optionally, step 202 may specifically include: Sub-step 2021: Calculate the first gradient corresponding to each pixel based on the first color component corresponding to all pixels; the first gradient is used to characterize the intensity and direction of the change of the first color component. Sub-step 2022: Calculate the second gradient corresponding to each pixel based on the second color component corresponding to all pixels; the second gradient is used to characterize the intensity and direction of the change of the second color component. Sub-step 2023: Determine the gradient features corresponding to the image region based on multiple first gradients and multiple second gradients.
[0035] For sub-steps 2021 to 2023, the first gradient refers to the gradient vector calculated based on the U component, which includes two components: gradient magnitude and direction. The gradient magnitude represents the intensity of change of the U component in space, and the gradient direction represents the direction of the fastest change of the U component. The second gradient refers to the gradient vector calculated based on the V component, which also includes two components: gradient magnitude and direction. The gradient magnitude represents the intensity of change of the V component in space, and the gradient direction represents the direction of the fastest change of the V component.
[0036] Gradient calculation employs differential operators, commonly including the Sobel, Prewitt, and Scharr operators. Taking the Sobel operator as an example, it contains two convolutional kernels, one horizontal and one vertical. The first gradient calculation process involves applying the horizontal Sobel operator to the U component image to obtain the horizontal gradient; applying the vertical Sobel operator to the U component image to obtain the vertical gradient; and then taking the square root of the sum of the squares of the vertical and horizontal gradients to obtain the gradient magnitude for each pixel. Similarly, the second gradient calculation process involves applying the horizontal Sobel operator to the V component image to obtain the horizontal gradient; applying the vertical Sobel operator to the V component image to obtain the vertical gradient; calculating the gradient magnitude and direction for each pixel; and finally, calculating the gradient magnitude and direction for each pixel. After obtaining the first and second gradients, they can be synthesized using methods such as average gradient magnitude, maximum gradient magnitude, variance of gradient magnitude, and weighted fusion to obtain the final gradient features of the image region.
[0037] In this design, the U and V components represent different color dimensions in the color space. Calculating their gradients separately allows for the accurate capture of the spatial variation characteristics of each dimension. This separate calculation method avoids confusion of color information and provides richer feature information.
[0038] Consistent gradient direction indicates ordered color gradations, while random directions indicate textured or noisy regions. Statistical distribution of directions can be used to distinguish different types of gradient patterns. Furthermore, different synthesis methods are suitable for different detection needs. For example, the average gradient magnitude can balance the intensity of changes in the two chromaticity components; the maximum gradient magnitude can focus on the color dimension with the most significant changes; and the gradient magnitude variance can characterize the degree of gradient consistency within a region. It should be noted that in color gradient regions, the U and V components typically exhibit low and consistent gradient characteristics. By comprehensively analyzing the gradient information of both components, true smooth color gradient regions can be identified more reliably, providing accurate region localization for subsequent image processing.
[0039] Step 203: After performing frequency domain transformation on the two chromaticity components of all pixels in the image region, calculate the frequency domain energy corresponding to each of the pixels, and determine the frequency domain energy characteristics of the image region based on the frequency domain energy corresponding to each of the pixels; the frequency domain energy characteristics are used to characterize the proportion of different frequency energies in the image region.
[0040] Frequency domain energy features are used to characterize the frequency distribution of chroma signals within an image region, reflecting the frequency components of color changes. Specifically, low-frequency energy dominates, corresponding to smooth regions. Therefore, the distribution of energy within an image region can distinguish between textured and smooth regions. It should be noted that frequency domain energy features are obtained through spectral analysis. First, the chroma signal from the spatial domain is converted to the frequency domain. The transform coefficients are grouped according to frequency, and the energy contribution of the coefficients within each frequency band is calculated. The proportion of energy distribution characterizes the texture properties of the image region.
[0041] Optionally, step 203 may specifically include: Sub-step 2031: Perform frequency domain transformation on the first color components corresponding to each of the pixels to obtain the first frequency domain coefficients corresponding to each of the pixels. Sub-step 2032: Squaring the first frequency domain coefficients corresponding to each pixel to obtain the first frequency domain energy corresponding to each pixel; Sub-step 2033: Perform frequency domain transformation on the second color components corresponding to each of the pixels to obtain the second frequency domain coefficients corresponding to each of the pixels. Sub-step 2034: Square the second frequency domain coefficients corresponding to each pixel to obtain the second frequency domain energy corresponding to each pixel. Sub-step 2035: Based on multiple first frequency domain energies and multiple second frequency domain energies, obtain the frequency domain energy features corresponding to the image region.
[0042] For steps 2031 to 2035, the first and second frequency domain coefficients are complex or real coefficients obtained after transforming the image signal from the spatial domain to the frequency domain, used to characterize the intensity distribution of the image signal at different frequency components. A Discrete Cosine Transform (DCT) is performed on the UV components, yielding real coefficients; a Fourier Transform is performed on the UV components, yielding complex coefficients. Low-frequency coefficients correspond to the overall contour and smooth changes of the image, while high-frequency coefficients correspond to details and edges. The frequency domain energy is the squared value of the frequency domain coefficients, characterizing the energy intensity of that frequency component and reflecting the image's energy contribution to that frequency component. For real coefficients, the square is directly applied; for complex coefficients, the square of the modulus is taken. The energy distribution reflects the texture complexity and smoothness of the image.
[0043] Specifically, the frequency domain coefficients are obtained by performing a discrete cosine transform on the U component. High-frequency energy extraction typically takes the lower right corner of the coefficient matrix; for example, for an 8×8 matrix, the lower right 4×4 region is taken as the high-frequency region. Exemplarily, the frequency domain energy characteristic can be the proportion of high-frequency energy. The relationship between high-frequency energy and texture is that high-frequency energy regions contain rich texture and detail; low-high frequency energy regions are smooth and lack detail variation, while color gradient regions are dominated by low frequencies in the frequency domain. In this embodiment, the frequency domain characteristics of both chromaticity components are analyzed simultaneously to ensure that both dimensions of color exhibit smooth characteristics, avoiding the limitations of single-component analysis.
[0044] Step 204: Calculate the saturation of each pixel in the image region based on the two chromaticity components of each pixel, and determine the saturation characteristics of the image region based on the saturation of each pixel.
[0045] Saturation characterizes the vividness of colors within an image region, representing the purity or vividness of a color. Higher saturation indicates a purer color; lower saturation indicates a color closer to gray. Saturation reflects the characteristics of color purity. Specifically, areas with moderate saturation are more sensitive to artifacts; therefore, saturation can be used to filter areas prone to visual artifacts. The saturation feature is calculated using color space. Specifically, based on the relative relationship between chroma and luminance components, the calculation results are mapped to a standard range, and the saturation values of all pixels within the region are statistically analyzed. The overall color vividness of the region is expressed through statistical measures.
[0046] It should be noted that after calculating the saturation of all pixels, the average saturation of all pixels can be used as the saturation feature of the image region, representing the average level of the overall color vibrancy of the region; or the maximum saturation of all pixels in the image region can be used as the saturation feature of the image region, representing the intensity of the most vibrant color in the region; or the range of saturation can be used as the saturation feature of the image region, such as the difference between the maximum and minimum saturation values in the region, representing the variation in color vibrancy within the region; or the saturation variance of the image region can be calculated as the saturation feature of the image region, representing the dispersion of saturation values within the region, that is, representing the uniformity of saturation within the region, and distinguishing between uniform color regions and texture regions; or the distribution feature of the saturation of all pixels can be calculated as the saturation feature of the image region, that is, the distribution ratio of all saturation values in different intervals, obtained by dividing the saturation range into multiple intervals and statistically analyzing the pixel ratio in each interval.
[0047] Step 205: The image region whose chromaticity features satisfy the first determination condition is determined as the target region in the image to be processed; the target region includes the region in the image to be processed where the color changes gradually.
[0048] Step 205 can be referred to step 102 above, and will not be repeated here.
[0049] Optionally, step 205 may specifically include the following steps: Step S11: Determine the preset range corresponding to each chromaticity feature; the preset range is used to characterize the range corresponding to each chromaticity feature in the target region; Step S12: When the number of chromaticity features is one, and the chromaticity feature is within its corresponding preset range, the image region is determined as the target region. Step S13: When the number of chromaticity features is at least two, and the at least two chromaticity features are simultaneously within their respective preset ranges, or when the first score obtained by weighted fusion of the at least two chromaticity features is greater than or equal to a preset score threshold, the image region is determined as the target region.
[0050] Regarding steps S11 to S13, it should be noted that the regions prone to artifacts, i.e., gradient regions, are characterized by extremely low variance, smooth gradient changes, energy mainly concentrated in the low-frequency part, and moderate saturation. Therefore, the ranges corresponding to various chromaticity features in the target region are preset, such as the range of extremely low variance, gradient change range, frequency domain energy proportion, and saturation range. When the chromaticity features of the image region are within the preset range, it indicates that the image region meets the conditions of the target region, and the image region is identified as the target region. When only one chromaticity feature is extracted, the image region is directly determined to belong to the target region by comparing the feature value with a preset single threshold range. When at least two chromaticity features are extracted, each feature can be judged to be within its respective preset range, or at least two chromaticity features can be fused to obtain an overall score, and the overall score is used to determine whether the entire image region is the target region. Specifically, when each feature is simultaneously within the preset range, the image region is identified as the target region; the preset range represents the characteristics of the target region. When the score after fusing at least two features is greater than or equal to a preset score threshold, the image region is determined as the target region. The preset threshold is the threshold for reaching the target region. When the score is greater than or equal to the preset threshold, it means that the overall characteristics of the image region meet the characteristics of the target region. Among them, the preset range of variance feature is used to limit the uniformity of color distribution; the preset range of gradient feature is used to limit the smoothness of color change; the preset range of frequency domain energy feature is used to limit the sparsity of texture; and the preset range of saturation feature is used to limit the range of color purity. The characteristics of an image region need to meet multiple dimensional conditions to be considered as a target region. When the type and complexity of the image to be processed are different, the chromaticity features that need to be extracted are different. For example, if the image to be processed has already met some of the criteria, it is not necessary to extract all chromaticity features.
[0051] Specifically, when extracting only one chromaticity feature, such as the variance feature of an image region, since low variance indicates that the color change within the region is gradual and conforms to the characteristics of a gradient, the preset range corresponding to the variance feature can be a low variance range, such as [0, 10]. If the variance feature value is less than or equal to 10, the image region is determined to be a uniform color region. When the variance value is 6.5, which is within the range of [0, 10], it indicates that the color distribution of the target region conforms to the uniformity of a gradient region, and the image region is determined to be the target region.
[0052] When only one chromaticity feature is extracted, for example, the gradient feature of an image region is extracted. Since a low gradient indicates a slow change in the color space, the preset range can be a low-gradient range, such as [0, 15]. If the gradient feature value is less than or equal to 15, it is determined as a region with smooth color transition. Or, based on the directly extracted gradient, a smoothness feature is obtained. There is an inverse correlation between smoothness and gradient. The preset range corresponding to smoothness should be a high-smoothness range. When the obtained smoothness is greater than or equal to the preset smoothness threshold, it indicates that the smoothness of the color change in the image region meets the smoothness of the target region, and the image region is determined as the target region.
[0053] When at least two features are extracted, it is required that multiple features simultaneously meet their respective conditions. For example, when extracting the variance feature and the gradient feature, the variance feature needs to be less than or equal to the preset variance threshold, and the gradient feature needs to be less than or equal to the preset gradient threshold. When both conditions are met, the image region is determined as the target region. Or extract the variance feature and the frequency-domain energy feature. The variance feature needs to be less than or equal to the preset variance threshold, and the frequency-domain energy feature also needs to be less than or equal to the preset energy threshold. For example, the proportion of high-frequency energy is less than the preset proportion. When both conditions are met, the variance feature needs to be less than or equal to the preset variance threshold, and it is determined as the target region. Or extract the saturation feature and the gradient feature. When the saturation is within the preset medium-saturation range, the gradient feature needs to be less than or equal to the preset gradient threshold, and when both conditions are met, the image region is determined as the target region. It is also possible to extract the variance feature, the gradient feature, and the frequency-domain energy feature. When the three features are simultaneously within their respective preset ranges, the image region is determined as the target region. For example, when there are four features, the variance feature of the UV component is less than the variance threshold: UV_variance < T1; the smoothness of the gradient change of the UV component is greater than the gradient threshold: UV_gradient_smoothness > T2; the saturation range is within the preset range: Chroma_saturation ∈ [T3, T4]; the proportion of high-energy in the UV component is less than the energy threshold: UV_high_freq_energy < T5.
[0054] Alternatively, at least two features can be weighted and fused to obtain a comprehensive score, which is then compared with an overall threshold. The first score is equal to the sum of each feature multiplied by its respective weight, with the sum of all weights being 1. First, each feature is normalized. For example, variance and gradient features are extracted, with a weight of 0.6 assigned to the variance feature and a weight of 0.4 assigned to the gradient feature. The preset threshold is 0.6, the variance feature is 15, and the gradient feature is 8. After normalizing the two features, they are multiplied by their respective weights and summed to obtain a first score of approximately 0.713. Since the first score is greater than or equal to the threshold, the image region is determined to be the target region. This score is used to determine whether the overall characteristics of the image region meet the conditions for the target region.
[0055] In this embodiment of the application, the determination by combining multiple features can improve the detection accuracy, reduce the false positive rate, and adapt to complex image scenes, providing more reliable detection results for complex image scenes.
[0056] Optionally, step S13 may specifically include the following steps: Sub-step S131: If the variance feature of the image region is less than or equal to a preset variance threshold, the gradient feature of the image region is less than or equal to a preset gradient threshold, the energy feature of the image region is less than or equal to a preset frequency domain energy threshold, and the saturation feature of the image region is within a preset saturation range, then the image region is determined as the target region.
[0057] Specifically, the overall characteristics of the gradient region are small variance, small gradient change, low proportion of high-frequency energy, and saturation within a medium saturation range. Therefore, when all four features simultaneously meet their respective ranges, the image region is determined as the target region. Specifically, the variance feature must be less than a preset variance threshold to ensure concentrated chromaticity values and smooth color changes within the region. The gradient feature must be less than or equal to a preset gradient threshold, or the gradient smoothness must be greater than or equal to a preset gradient smoothness threshold, ensuring a smooth color transition in spatial dimensions without drastic changes. The frequency domain energy feature must be less than or equal to a preset frequency domain energy threshold to ensure the region lacks high-frequency texture components and conforms to smoothness characteristics. The typical threshold value range is 0.05-0.15, and the energy feature refers to the proportion of high-frequency energy. Regions rich in texture are excluded by low- and high-frequency energy, while regions with smooth spectral distributions are retained. The saturation feature must be within a preset saturation range to ensure the region is within the saturation range to which the human eye is most sensitive for banding.
[0058] In this embodiment of the application, the reliability of the detection results can be ensured by verifying through multiple dimensions of features, and the complete characteristics of the color gradient area can be covered by various combinations of conditions.
[0059] Optionally, step S11 may specifically include the following steps: Step S21: Determine the first condition parameter according to the scene type of the image to be processed; Step S22: Adjust the first condition parameter according to the content complexity of the image to be processed to obtain the second condition parameter; the content complexity is used to characterize the complexity of the chromaticity information in the image to be processed. Step S23: Determine the preset range corresponding to each colorimetric feature based on the second condition parameter.
[0060] Regarding steps S21 to S23, it should be noted that the scene type is a semantic category based on global image features. These global features, such as color distribution, texture patterns, and object composition, reflect the semantic information of the image content. Scene types can include: sky scenes, water scenes, skin areas, architectural scenes, and natural landscapes. For example, sky scenes contain large areas of smooth gradients and are highly sensitive to artifacts. Water scenes contain ripples and reflections, requiring a balance between smoothness and texture; skin areas have medium saturation, requiring natural color transitions; architectural scenes contain numerous edges and textures, with a lower risk of artifacts; and natural landscapes have varying complexity, requiring dynamic adaptation. Therefore, the features extracted from images of different scene types can differ, and even for the same feature, the range set may vary depending on the image type.
[0061] Content complexity refers to a quantitative indicator of the richness and drastic changes in chromaticity information within an image, reflecting the computational difficulty of image processing. Image regions are detected using a second conditional parameter and a selected feature set; only regions that simultaneously satisfy all adjusted conditions are identified as target regions. The first and second conditional parameters include: the type of chromaticity feature, the threshold corresponding to the chromaticity feature, and the range corresponding to the chromaticity feature. When both the first and second conditional parameters are thresholds, a preset range corresponding to the chromaticity feature is determined based on the threshold.
[0062] For example, the conditional parameters set for a sky scene can be: sky_params = { 'uv_variance_threshold': 0.8, # Due to the small variation in sky UV components, the threshold for the variance feature is set to a low threshold. 'gradient_weight': 0.4, #The gradient weights are moderate 'saturation_range': [0.3, 0.7], # Medium saturation 'freq_threshold': 0.05, # Extremely low high-frequency energy 'area_filter': 500# Sets the area threshold to a larger area to filter out fragmented regions. } The conditions that can be set for a water scene are: water_params = { 'uv_variance_threshold': 1.2, # Considering water ripple texture, increase the threshold of variance features. 'gradient_weight': 0.3, # Due to the presence of water ripple texture, the gradient weight is reduced to avoid being primarily affected by the water ripples. 'saturation_range': [0.2, 0.6], # Low saturation 'freq_threshold': 0.08, # Allows a small number of high-frequency occurrences 'area_filter': 300 } The conditional parameters that can be set for skin scenes are: skin_params = { 'uv_variance_threshold': 1.5, #For skin with relatively rich texture, set a higher threshold for variance features. 'gradient_weight': 0.5, # Emphasize gradient continuity and increase gradient weights. 'saturation_range': [0.4, 0.8], # Higher saturation 'freq_threshold': 0.12, # Allow more frequent occurrences 'area_filter':100# Compared to scenes like sky or water, the skin area is smaller, so the area threshold is lowered. } Here, `uv_variance_threshold` is the threshold set for the variance feature; the variance feature to be extracted must be less than or equal to this threshold. `uv_variance_threshold` is the weight assigned to the gradient feature. `uv_variance_threshold` is a preset saturation range; the saturation to be extracted must be within this range. `area_filter` is a preset area threshold; the area of the gradient region to be extracted must be greater than or equal to this threshold. It should be noted that the conditional parameters are not limited to those illustrated in the examples above.
[0063] In this embodiment, the detection strategy is optimized according to different scene characteristics, and accuracy and efficiency are balanced according to content complexity, with dynamic adjustments to ensure optimal detection results. This adaptive adjustment mechanism based on scene type and content complexity ensures high accuracy and efficiency under various image conditions, providing a reliable technical foundation for high-quality image processing.
[0064] Optionally, step 205 may specifically include: Step S31: The image region whose chromaticity features satisfy the first determination condition is determined as the first candidate region; Step S32: Perform connectivity analysis on all the first candidate regions, merge the first candidate regions that are spatially connected, and obtain the target region.
[0065] Regarding steps S31 and S32, it should be noted that the image to be processed includes multiple image regions. The chromaticity features of each image region are analyzed independently in sequence. When the chromaticity features of an image region meet the first judgment condition, the image region is regarded as the first candidate region. Connectivity analysis is performed on all the determined first candidate regions, and the first candidate regions that are spatially connected in the image to be processed are merged to obtain the target region. Connectivity analysis is used to identify and merge spatially adjacent and feature-similar image regions to form a larger connected region. Adjacency relationship refers to the connectivity based on the spatial positional relationship of pixels or regions. Adjacent regions that meet the conditions are integrated into a larger semantic unit. For example, connectivity analysis based on the region growing algorithm: the first candidate region with the most typical features is selected as the seed, the feature similarity of adjacent regions is checked, and similar first candidate regions are merged into the seed region. This process is recursively expanded until there are no regions that can be merged. In this application, the similarity determination can be performed by setting a label for the first candidate region for identification when a first candidate region is detected. Alternatively, a hierarchical merging algorithm can be used for connectivity analysis, where each candidate region is independent, and the two most similar adjacent first candidate regions are merged each time to reach a preset number of regions or a similarity threshold.
[0066] In this embodiment, adjacent candidate regions are merged through connectivity analysis to expand the area of the region, eliminate candidate region fragmentation, restore the physical integrity of the gradient region, and then perform overall processing. The merged complete target region does not need to repeat the processing logic, thus improving image processing efficiency.
[0067] Optionally, step 205 may specifically include: Step S41: The image region whose chromaticity features satisfy the first determination condition is determined as the second candidate region; Step S42: Obtain the area of each of the second candidate regions, and determine the second candidate regions whose area is greater than or equal to a preset area threshold as target regions.
[0068] Regarding steps S41 and S42, since isolated small regions may exist in the image due to sensor noise, compression artifacts, etc., this embodiment uses a preset area threshold to eliminate noise interference, filter out candidate regions with excessively small areas, avoid unnecessary processing of noisy regions, improve the signal-to-noise ratio of the detection results, and reduce false positives. Furthermore, processing a large number of small regions significantly increases computational overhead; reducing the number of regions requiring special processing improves processing efficiency while maintaining quality.
[0069] It should be noted that the preset area threshold can also be set independently based on the scene type, content complexity, and visual requirements. For example, if the scene type is a sky scene, the sky area is usually large, so the area threshold can be set larger; if the scene type is a skin scene, the skin area is usually small, and the range needs to be more generous, so the area threshold can be set smaller. The preset area threshold can also be increased based on subjective visual requirements, as long as the final displayed image is smooth. In this embodiment, by using the preset area threshold, small areas generated by noise can be effectively filtered, ensuring that processing resources are concentrated on visually significant large areas.
[0070] Step 206: Process the target area to obtain a target image and display it; the processing is used to improve the smoothness of the color gradient in the target area.
[0071] Step 206 can be referred to step 103 above, and will not be repeated here.
[0072] Optionally, step 206 may specifically include: Step S51: During the encoding process of the image to be processed, the quantization step size is determined based on the chromaticity features of the target region; Step S52: Determine the quantization matrix based on the quantization step size; the quantization matrix includes multiple quantization step sizes; Step S53: Encode the target region using the quantization matrix; Step S54: During the decoding process of the encoded image to be processed, the target region is dequantized using the inverse quantization matrix corresponding to the quantization matrix.
[0073] Regarding steps S51 to S53, the quantization step size is a scalar value used in transform coding to divide the transform coefficients. It determines the quantization precision and controls the degree of data compression and precision loss. Specifically, the smaller the quantization step size, the finer the quantization and the more complete the data retention. The quantization matrix is a two-dimensional array containing multiple quantization step sizes. Different step sizes are set for different frequency components. Higher frequency components, which are less sensitive to the human eye, use larger step sizes, while lower frequency components, which are more sensitive, use smaller step sizes.
[0074] Encoding is the process of converting quantized coefficients into a compressed bitstream, digitally representing and compressing image data for storage. Encoding methods can include steps such as scanning and entropy coding, achieving data compression by eliminating statistical redundancy. Correspondingly, during decoding, the target region is dequantized using the inverse quantization matrix corresponding to the quantization matrix. Specifically, by reducing the quantization step size of the target region during encoding, a finer quantization matrix is obtained, preserving more information about the target region.
[0075] Optionally, step 206 may specifically include: Step S61: During the encoding process of the encoded image to be processed, the filtering parameters are determined based on the chromaticity characteristics of the target region; Step S62: Perform a first filtering process on the target region according to the filtering parameters; Step S63: During the decoding process of the encoded image to be processed, the target region is subjected to a second filtering process according to the filtering parameters.
[0076] Regarding steps S61 and S62, decoding refers to restoring the compressed bitstream to visible image data. Decoding is the reverse process of encoding, but the post-processing stage can enhance reconstruction quality. Filtering improves image quality by locally adjusting pixel values through mathematical operations, smoothing or enhancing the image signal in the spatial or frequency domain. Filtering algorithms can include linear filtering, nonlinear filtering, adaptive filtering, etc. During image encoding, the target region undergoes a first filtering process; correspondingly, during image decoding, the same second filtering process is performed.
[0077] In this context, filter parameters refer to the set of configurable variables that control the behavior of the filter, determining its strength, range, and characteristics. Specifically, filter parameters may include: filter strength, filter kernel size, and filter type. Filter strength is the core parameter controlling the smoothing effect. The filter kernel size determines the neighborhood range involved in the computation, and the filter type selects the specific filter algorithm. By combining these parameters, the filtering effect can be precisely controlled, balancing artifact removal and detail preservation.
[0078] For example, when the variance feature is less than or equal to a very low threshold, it indicates that the target region is extremely smooth and requires strong filtering; when the variance feature is less than a low variance threshold, it indicates that the target region is smooth and requires medium filtering. When the gradient feature is less than or equal to a low gradient threshold, it indicates that the target region is uniformly smooth and requires Gaussian filtering; when the gradient feature is less than or equal to a medium gradient threshold, it is necessary to maintain edge smoothness and requires a bilateral filtering algorithm. Alternatively, for complex regions, adaptive filtering can be used.
[0079] In this embodiment, the adaptive filtering method based on chroma features effectively compensates for the unavoidable information loss during the encoding stage by specifically eliminating artifacts in the decoding process. By performing specialized filtering on the target region during decoding, visual artifacts can be significantly reduced, resulting in more natural color transitions in the image.
[0080] Optionally, step 206 may specifically include: Step S71: During the display rendering of the image to be processed, the dithering parameters are determined based on the chromaticity features of the target region and a preset mapping relationship; the preset mapping relationship is used to characterize the correlation between the chromaticity features and the dithering parameters. Step S72: Add a jitter signal to the pixel values of the target area according to the jitter parameters.
[0081] Regarding steps S71 and S72, display refers to the process of converting digital image data into physical light signals and presenting them on the screen. Specifically, YUV and other formats are converted into the red, green, and blue formats (RGB format) of the display.
[0082] The dithering parameters refer to the set of configurable variables that control the behavior of the dithering algorithm. By precisely controlling the noise characteristics, it visually simulates higher bit depth color effects. The dithering signal is an added noise signal with specific statistical characteristics, which breaks the color dispersion by introducing controlled randomness. It should be noted that the preset mapping relationship is pre-set and is used to adaptively adjust the dithering parameters according to the chromaticity characteristics to improve the smoothness of the visual effect in the target area.
[0083] For example, spatially distributed noise can be added within the same frame, or temporally varied noise can be added between consecutive frames of the video stream. Dithering can also be performed by combining spatial and temporal dimensions. In this embodiment, by dithering the target region, regular color band boundaries are broken, and structured artifacts are weakened with noise.
[0084] For example, specific experimental data were also used in the embodiments of this application to verify the effect between the image processing method provided in the embodiments of this application and existing methods.
[0085] The specific experimental data and comparison results are as follows: Standard test sequence: Images containing a large number of gradient areas, such as sky scenes, dark scenes, and sunflower scenes.
[0086] Self-built dataset: 100 image fragments containing typical artifact scenes.
[0087] Resolution: 1080p, 4K.
[0088] Encoders: JPEG, PNG, GIF, BMP.
[0089] Reference software: JPEGsnoop, ACDSee, Photoshop, YUVView.
[0090] Evaluation metrics include objective and subjective metrics. Objective metrics include detection accuracy, detection recall, F1 score, peak signal-to-noise ratio (PSNR) improvement, and structural similarity index (SSIM) improvement. Specifically, the detection accuracy of this application is 95.2%, compared to 78.6% for traditional methods; the detection recall of this application is 92.8%, compared to 71.3% for traditional methods; the F1 score of this application is 94.0%, compared to 74.7% for traditional methods. The average PSNR improvement after processing is 2.3 dB, and the average SSIM improvement is 0.08. Subjective metrics include MOS score and user blind test preference rate. After image processing, the MOS score improved by 0.7 points, and the user blind test preference rate reached 82.4%. Based on the above metrics, it is clear that the image processing method provided in this application can improve detection accuracy and achieve a better subjective experience.
[0091] For example, Table 1 shows the application effects of the image processing method provided in this application on images in different scenes.
[0092] Table 1 Detection results in different scenarios
[0093] As shown in Table 1, the image processing method provided in this application embodiment can achieve a high accuracy rate for image detection and can improve subjective quality, that is, significantly reduce artifact phenomena.
[0094] For example, Table 2 presents comparative experimental results of image processing using the image processing method provided in this application and a general method.
[0095] Table 2 Performance Comparison with Existing Methods
[0096] According to Table 2, the image processing method provided in this application embodiment can significantly improve the detection accuracy of gradient regions, reduce bit rate overhead, and has a relatively high processing speed.
[0097] For example, after using different methods to detect 100 image segments that are prone to artifacts, the experimental results are shown in Table 3.
[0098] Table 3 Detection results of different methods
[0099] As shown in Table 3, the method provided in this application can significantly improve the accuracy of image detection, reduce the false detection rate, and achieve a better detection effect.
[0100] For example, based on the hardware platform: Intel i7-10700K, RTX 3080, the computational resource consumption results after different methods are used to detect images are shown in Table 4.
[0101] Table 4 Computational resource consumption of different methods
[0102] As shown in Table 4, the image processing method provided in this application reduces power consumption, memory usage, and processing speed.
[0103] For example, the improvement effect after different detection methods is shown in Table 5.
[0104] Table 5. Improvement effects of different methods
[0105] As shown in Table 5, the image processing method provided in this application significantly improves subjective quality and subjective score without significantly increasing the bit rate.
[0106] In summary, the image processing method provided in this application combines variance, gradient, frequency domain energy distribution, and saturation features for multi-dimensional feature analysis. Furthermore, it dynamically adjusts parameters based on scene type and complexity to adapt to various image content, making it suitable for typical scenes such as sky, water, and skin, and exhibiting high robustness. Through multi-feature fusion verification and region post-processing, it effectively eliminates interference from texture regions, reducing the false positive rate and improving detection accuracy. Moreover, the image processing in this application embodiment provides end-to-end quality assurance from encoding source prevention and decoding process repair to final display enhancement, significantly reducing artifact phenomena. Furthermore, the detection accuracy is improved by 10% compared to existing methods, effectively reducing banding artifacts without significantly increasing the bitrate, with moderate computational complexity, making it suitable for real-time processing.
[0107] Reference Figure 3 The diagram illustrates a flowchart of another embodiment of the image processing method of the present invention, the method comprising: Step A1: Input image frame; Step A2: Convert the image frame to YUV color space; Step A3: Extract UV components; Step A4: Perform block processing 16 16; Step A5: The feature extraction module extracts features from each block; Step A6: Calculate the UV variance; Step A7: Perform chromaticity gradient analysis; Step A8: Determine the frequency domain energy distribution; Step A9: Detect the saturation range; Step A10: Perform fusion and decision-making on multiple features; Step A11: Determine whether the block is an easy-to-banding area based on the judgment result; Step A12: If it is a banding region, then mark it as a candidate region; Step A13: Perform regional connectivity analysis; Step A14: Filter the analyzed areas according to the set area threshold to obtain the final banding-prone areas; Step A15, Subsequent processing strategy; Step A16: Perform fine quantization on the coding segment. Step A17: Perform specialized filtering at the decoding end; Step A18: Perform adaptive dithering on the display area; Step A19: If it is not a banding-prone area, mark it as a normal area; Step A20: Perform the standard processing procedure.
[0108] In this embodiment, the input image is converted to the YUV color space, and the UV chromaticity components are separated. A block-based processing strategy is adopted, transforming global analysis into local feature extraction. Four major chromaticity features are extracted in parallel for each image region after block generation: variance, gradient, frequency domain energy, and saturation. The variance of the UV components is calculated, the chromaticity gradient of the image region is analyzed, the frequency domain energy distribution of the image region is determined, and the saturation range of the image region is detected. An adaptive decision mechanism is established, dynamically adjusting the decision conditions based on scene type and content complexity. A multi-feature fusion strategy is adopted, supporting both hard condition judgment and weighted scoring judgment. Each image region is determined to be a banding region (i.e., a region prone to artifacts). If it is a banding region, it is marked as a candidate region; otherwise, it is considered a normal region. By performing connectivity analysis and area threshold filtering on the candidate regions, the final banding regions are accurately located. After detecting the final banding-prone areas, fine quantization is applied to the final areas to reduce information loss from the source. Specialized filtering is applied to eliminate the visual artifacts that have been generated. Through adaptive dithering technology, only the identified gradient areas are processed, while the other ordinary areas are processed using the conventional process to ensure overall efficiency and achieve precise allocation of computing resources and optimal balance of quality.
[0109] Reference Figure 4 The diagram illustrates a logic block diagram of an image processing apparatus 40 according to an embodiment of the present invention. The apparatus may include: The feature extraction module 401 is used to extract the chromaticity features of multiple different image regions in the image to be processed based on the chromaticity information of the image to be processed; the chromaticity features are used to characterize the overall color distribution of the image regions; The region determination module 402 is used to determine the image region whose chromaticity features satisfy the first determination condition as the target region in the image to be processed; the target region includes the region in the image to be processed where the color changes gradually; The processing module 403 is used to process the target area to obtain a target image and display it; the processing is used to improve the smoothness of the color gradient in the target area.
[0110] Optionally, the feature extraction module 401 includes: A variance determination module 4011 (not shown) is used to determine the variance characteristics of the image region based on the variance between the two chromaticity components of all pixels in the image region; the two chromaticity components are used to characterize the color of the pixels. The gradient determination module 4012 (not shown) is used to calculate the gradient corresponding to each of the two chromaticity components of all pixels in the image region, and to determine the gradient features of the image region based on the gradients corresponding to each of the pixels; the gradient features are used to characterize the smoothness of the gradient change in the image region. An energy determination module 4013 (not shown) is used to perform frequency domain transformation on the two chromaticity components of all pixels in the image region, calculate the frequency domain energy corresponding to each of the pixels, and determine the frequency domain energy characteristics of the image region based on the frequency domain energy corresponding to each of the pixels; the frequency domain energy characteristics are used to characterize the proportion of different frequency energies in the image region. The saturation determination module 4014 (not shown) is used to calculate the saturation of each pixel in the image region based on the two chromaticity components of each pixel, and to determine the saturation characteristics of the image region based on the saturation of each pixel.
[0111] Optionally, the region determination module 402 includes: A preset range determination module 11 (not shown) is used to determine the preset range corresponding to each chromaticity feature; the preset range is used to characterize the range corresponding to each chromaticity feature in the target region. The first region determination submodule 12 (not shown) is used to determine the image region as the target region when the number of chromaticity features is one and the chromaticity features are within their corresponding preset range; The second region determination submodule 13 (not shown) is used to determine the image region as the target region when the number of chromaticity features is at least two, the at least two chromaticity features are simultaneously within their respective preset ranges, or the first score obtained by weighted fusion of the at least two chromaticity features is greater than or equal to a preset score threshold.
[0112] Optionally, the second region determining submodule 13 includes: The first region determination unit 131 (not shown) is used to determine the image region as the target region when the variance feature of the image region is less than or equal to a preset variance threshold, the gradient feature of the image region is less than or equal to a preset gradient threshold, the energy feature of the image region is less than or equal to a preset frequency domain energy threshold, and the saturation feature of the image region is within a preset saturation range.
[0113] Optionally, the preset range determination module 11 includes: The parameter determination module 111 (not shown) is used to determine a first condition parameter based on the scene type of the image to be processed; The parameter adjustment module 112 (not shown) is used to adjust the first condition parameter according to the content complexity of the image to be processed to obtain the second condition parameter; the content complexity is used to characterize the complexity of the chromaticity information in the image to be processed. The second region determination unit 113 (not shown) is used to determine the preset range corresponding to each chromaticity feature according to the second condition parameter.
[0114] Optionally, the region determination module 402 includes: The first candidate determination module 21 (not shown) is used to determine each image region whose chromaticity features satisfy the first determination condition as a first candidate region. The third region determination submodule 22 (not shown) is used to perform connectivity analysis on each of the first candidate regions, merge the first candidate regions that are spatially connected, and obtain the target region.
[0115] Optionally, the region determination module 402 includes: The second candidate region determination module 31 (not shown) is used to determine the image region whose chromaticity features satisfy the first determination condition as the second candidate region; The filtering module 32 (not shown) is used to obtain the area of each of the second candidate regions and determine the second candidate regions whose area is greater than or equal to a preset area threshold as target regions.
[0116] Optionally, the variance determination module 4011 includes: First variance determination submodule 40111 (not shown) is used to calculate the first variance between the first color components of all the pixels; Second variance determination submodule 40112 (not shown) is used to calculate the second variance between the second color components of all the pixels; The third variance determination submodule 40113 (not shown) is used to obtain the variance features of the image region based on the first variance and the second variance.
[0117] Optionally, the gradient determination module 4012 includes: The first gradient determination submodule 40121 (not shown) is used to calculate the first gradient corresponding to each of all pixels based on the first color component corresponding to all pixels; the first gradient is used to characterize the intensity and direction of the change of the first color component. The second gradient determination submodule 40122 (not shown) is used to calculate the second gradient corresponding to each of all pixels based on the second color components corresponding to all pixels; the second gradient is used to characterize the intensity and direction of the change of the second color components. The third gradient determination submodule 40123 (not shown) is used to determine the gradient features corresponding to the image region based on multiple first gradients and multiple second gradients.
[0118] Optionally, the energy determination module 4013 includes: The first coefficient determination module 40131 (not shown) is used to perform frequency domain conversion on the first color component corresponding to each of all pixels to obtain the first frequency domain coefficient corresponding to each of all pixels. The first energy submodule 40132 (not shown) is used to determine the first frequency domain energy corresponding to each of all pixels by squaring the first frequency domain coefficients corresponding to each of all pixels. The second coefficient determination module 40133 (not shown) is used to perform frequency domain conversion on the second color components corresponding to each of all pixels to obtain the second frequency domain coefficients corresponding to each of all pixels. The second energy determination submodule 40134 (not shown) is used to square the second frequency domain coefficients corresponding to each of all pixels to obtain the second frequency domain energy corresponding to each of all pixels. The third energy determination submodule 40135 (not shown) is used to obtain the frequency domain energy features corresponding to the image region based on multiple first frequency domain energies and multiple second frequency domain energies.
[0119] Optionally, the processing module 403 includes: Step size determination module 41 (not shown) is used to determine the quantization step size based on the chromaticity features of the target region during the encoding process of the image to be processed; A matrix determination module 42 (not shown) is used to determine a quantization matrix based on the quantization step size; the quantization matrix includes multiple quantization step sizes. Quantization module 43 (not shown) is used to encode the target region using the quantization matrix; The dequantization processing module 44 (not shown) is used to perform dequantization processing on the target region using the dequantization matrix corresponding to the quantization matrix during the decoding process of the encoded image to be processed.
[0120] Optionally, the processing module 403 includes: The filter parameter determination module 51 (not shown) is used to determine the filter parameters based on the chromaticity characteristics of the target region during the decoding process of the encoded image to be processed. The first filtering module 52 (not shown) is used to perform a first filtering process on the target region according to the filtering parameters; The second filtering module 53 (not shown) is used to perform a second filtering process on the target region according to the filtering parameters during the decoding process of the encoded image to be processed.
[0121] Optionally, the processing module 403 includes: The jitter parameter module 61 (not shown) is used to determine jitter parameters based on the chromaticity features of the target region and a preset mapping relationship during the display rendering of the image to be processed; the preset mapping relationship is used to characterize the correlation between the chromaticity features and the jitter parameters. A jitter processing module 62 (not shown) is used to superimpose a jitter signal onto the pixel values of the target region according to the jitter parameters.
[0122] In summary, the image processing apparatus provided in this application combines variance, gradient, frequency domain energy distribution, and saturation features for multi-dimensional feature analysis. Furthermore, it dynamically adjusts parameters based on scene type and complexity to adapt to various image content, making it suitable for typical scenes such as sky, water surface, and skin, exhibiting high robustness. Through multi-feature fusion verification and region post-processing, interference from textured regions is effectively eliminated, reducing the false positive rate and improving detection accuracy. Moreover, the end-to-end quality assurance in image processing, from source prevention in encoding and decoding to final display enhancement, significantly reduces artifact phenomena. Additionally, the processing method provided in this application is lightweight and suitable for real-time processing applications.
[0123] As the apparatus embodiment is basically similar to the method embodiment, it is described in a relatively simple manner. For relevant details, please refer to the description of the method embodiment.
[0124] Reference Figure 5 This is a structural block diagram of an electronic device for image processing provided in an embodiment of this application. Figure 5 As shown, the electronic device includes: a processor, a memory, a communication interface, and a communication bus. The processor, the memory, and the communication interface communicate with each other through the communication bus. The memory is used to store executable instructions, which cause the processor to execute the method of the aforementioned embodiment.
[0125] The processor can be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable devices, transistor logic devices, hardware components, or any combination thereof. The processor can also be a combination that implements computational functions, such as a combination of one or more microprocessors, or a combination of a DSP and a microprocessor.
[0126] The communication bus may include a path for transmitting information between the memory and the communication interface. The communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 The symbol is represented by only one line, but this does not mean that there is only one bus or one type of bus.
[0127] The memory may be ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or it may be EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory), magnetic tape, floppy disk, and optical data storage devices, etc.
[0128] This application also provides a non-transitory computer-readable storage medium that, when the instructions in the storage medium are executed by a processor of an electronic device (server or terminal), enables the processor to perform the methods of the foregoing embodiments.
[0129] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0130] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0131] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0132] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0133] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0134] These computer program instructions may also be stored in a computer-readable storage medium capable of directing a computer or other programmable data processing terminal device to operate in a predictive manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0135] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0136] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.
[0137] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0138] The above provides a detailed description of an image processing method, apparatus, electronic device, and readable storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. An image processing method, characterized by, The method includes: Based on the chromaticity information of the image to be processed, the chromaticity features of each of the multiple different image regions in the image to be processed are extracted; the chromaticity features are used to characterize the overall color distribution of the image regions. The image region whose chromaticity features satisfy the first determination condition is identified as the target region in the image to be processed; the target region includes the region in the image to be processed where the color gradually changes. The target area is processed to obtain a target image, which is then displayed; the processing is used to improve the smoothness of the color gradient in the target area.
2. The method of claim 1, wherein, The chromaticity features include at least one of variance features, gradient features, frequency domain energy features, and saturation features; the step of extracting the chromaticity features of multiple different image regions in the image to be processed based on the chromaticity information of the image to be processed includes at least one of the following steps: The variance characteristics of the image region are determined based on the variance between the two chromaticity components of all pixels in the image region. The two chromaticity components are used to characterize the color of the pixel; The gradient corresponding to each of the pixels in the image region is calculated based on the two chromaticity components of each pixel, and the gradient feature of the image region is determined based on the gradient corresponding to each pixel; the gradient feature is used to characterize the smoothness of the gradient change in the image region. After performing frequency domain transformation on the two chromaticity components of all pixels in the image region, the frequency domain energy corresponding to each of the pixels is calculated, and the frequency domain energy characteristics of the image region are determined based on the frequency domain energy corresponding to each of the pixels. The frequency domain energy features are used to characterize the proportion of energy at different frequencies in the image region; The saturation of each pixel in the image region is calculated based on the two chromaticity components of each pixel, and the saturation characteristics of the image region are determined based on the saturation of each pixel.
3. The method of claim 2, wherein, The step of determining the target region in the image to be processed by identifying the image region whose chromaticity features satisfy the first determination condition includes: Determine the preset range corresponding to each chromaticity feature; the preset range is used to characterize the range corresponding to each chromaticity feature in the target region; When the number of chromaticity features is one, and the chromaticity feature is within its corresponding preset range, the image region is determined as the target region; When the number of chromaticity features is at least two, and the at least two chromaticity features are simultaneously within their respective preset ranges, or when the first score obtained by weighted fusion of the at least two chromaticity features is greater than or equal to a preset score threshold, the image region is determined as the target region.
4. The method of claim 3, wherein, When the number of chromaticity features is at least two, and the at least two chromaticity features are simultaneously within their respective preset ranges, determining the image region as the target region includes: If the variance feature of the image region is less than or equal to a preset variance threshold, the gradient feature of the image region is less than or equal to a preset gradient threshold, the energy feature of the image region is less than or equal to a preset frequency domain energy threshold, and the saturation feature of the image region is within a preset saturation range, then the image region is determined as the target region.
5. The method of claim 3, wherein, Determining the preset range corresponding to each chromaticity feature includes: The first condition parameter is determined based on the scene type of the image to be processed; The first condition parameter is adjusted according to the content complexity of the image to be processed to obtain the second condition parameter; the content complexity is used to characterize the complexity of the chromaticity information in the image to be processed. The preset range corresponding to each chromaticity feature is determined based on the second condition parameter.
6. The method of claim 1, wherein, The step of determining the target region in the image to be processed by identifying the image region whose chromaticity features satisfy the first determination condition includes: Image regions whose chromaticity features satisfy the first determination condition are identified as first candidate regions; Connectivity analysis is performed on all first candidate regions, and spatially connected first candidate regions are merged to obtain the target region.
7. The method of claim 1, wherein, The step of determining the target region in the image to be processed by identifying the image region whose chromaticity features satisfy the first determination condition includes: Image regions whose chromaticity features satisfy the first determination condition are identified as second candidate regions; Obtain the area of each of the second candidate regions, and determine the second candidate regions whose area is greater than or equal to a preset area threshold as target regions.
8. The method of claim 2, wherein, Determining the variance characteristics of the image region based on the variance between the two chromaticity components of all pixels in the image region includes: Calculate the first variance among the first color components of all the pixels; Calculate the second variance among the second color components of all the pixels; Based on the first variance and the second variance, the variance features of the image region are obtained.
9. The method of claim 2, wherein, The step of calculating the gradient corresponding to each of all pixels in the image region based on the two chromaticity components, and determining the gradient features of the image region based on the gradients corresponding to each of all pixels, includes: Based on the first color component corresponding to all pixels, calculate the first gradient corresponding to each of all pixels; the first gradient is used to characterize the intensity and direction of the change of the first color component. Based on the second color components corresponding to all pixels, calculate the second gradient corresponding to each of all pixels; the second gradient is used to characterize the intensity and direction of the change of the second color component. The gradient features corresponding to the image region are determined based on multiple first gradients and multiple second gradients.
10. The method of claim 2, wherein, After performing frequency domain transformation on the two chromaticity components of all pixels in the image region, the frequency domain energy corresponding to each of the pixels is calculated, and the frequency domain energy characteristics of the image region are determined based on the frequency domain energy corresponding to each of the pixels, including: Perform frequency domain transformation on the first color component corresponding to each of all pixels to obtain the first frequency domain coefficients corresponding to each of all pixels. Squaring the first frequency domain coefficients corresponding to each pixel yields the first frequency domain energy corresponding to each pixel. Perform frequency domain transformation on the second color components corresponding to each of all pixels to obtain the second frequency domain coefficients corresponding to each of all pixels. Squaring the second frequency domain coefficients corresponding to each pixel yields the second frequency domain energy corresponding to each pixel. Based on multiple first frequency domain energies and multiple second frequency domain energies, the frequency domain energy features corresponding to the image region are obtained.
11. The method according to any one of claims 1 to 10, characterized in that, The processing of the target region includes: During the encoding process of the image to be processed, the quantization step size is determined based on the chromaticity features of the target region; Based on the quantization step size, a quantization matrix is determined; the quantization matrix includes multiple quantization step sizes. The target region is encoded using the quantization matrix. During the decoding process of the encoded image to be processed, the target region is dequantized using the inverse quantization matrix corresponding to the quantization matrix.
12. The method according to any one of claims 1 to 10, characterized in that, The processing of the target region includes: During the encoding process of the encoded image to be processed, the filtering parameters are determined based on the chromaticity characteristics of the target region; The target region is subjected to a first filtering process according to the filtering parameters; During the decoding process of the encoded image to be processed, the target region is subjected to a second filtering process according to the filtering parameters.
13. The method according to any one of claims 1 to 10, characterized in that, The processing of the target region includes: During the display rendering of the image to be processed, dithering parameters are determined based on the chromaticity features of the target region and a preset mapping relationship; the preset mapping relationship is used to characterize the correlation between the chromaticity features and the dithering parameters. A jitter signal is superimposed onto the pixel values of the target region according to the jitter parameters.
14. An image processing apparatus, characterized in that, The device includes: The feature extraction module is used to extract the chromaticity features of multiple different image regions in the image to be processed based on the chromaticity information of the image to be processed; the chromaticity features are used to characterize the overall color distribution of the image regions; The region determination module is used to determine the image region whose color features satisfy the first determination condition as the target region in the image to be processed; the target region includes the region in the image to be processed where the color gradually changes; The processing module is used to process the target area to obtain a target image and display it; the processing is used to improve the smoothness of the color gradient in the target area.
15. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the method as described in any one of claims 1 to 13.
16. A readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the method as described in any one of claims 1 to 13.