An image compression method and system based on edge gradient adaptation

By using an image compression method based on edge gradient adaptation, the quantization strategy and iterative optimization process are dynamically adjusted, which solves the problems of unreasonable resource allocation, edge blurring and detail loss in the existing technology, and achieves efficient image compression and improved visual fidelity.

CN121284239BActive Publication Date: 2026-03-27HEFEI HEXAGON SEMICON CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-11
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing image compression technologies have shortcomings in terms of unreasonable resource allocation, blurred edges and loss of details, difficulty in balancing compression ratio and quality, and lack of adaptability, which limits the quality and efficiency of image reconstruction.

Method used

An image compression method based on adaptive edge gradient is adopted. By dividing the region through adaptive edge gradient threshold and dynamically adjusting the quantization strategy, the edge region and non-edge region are differentiated. Combined with the iterative optimization process, an adaptive quantization matrix is ​​generated and entropy encoding is performed.

Benefits of technology

It achieves an adaptive adjustment of the compression strategy based on the image content, maintaining high compression efficiency while accurately preserving visual details, thus improving the balance between visual fidelity and compression ratio in image reconstruction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121284239B_ABST
    Figure CN121284239B_ABST
Patent Text Reader

Abstract

The application discloses an image compression method and system based on edge gradient self-adaption, which converts the input image to YCbCr color space and calculates the edge gradient value of the brightness component, adopts an iterative processing containing a feedback mechanism: dividing the edge and non-edge area based on the current adaptive edge gradient threshold, and respectively blocking with different sizes; dynamically updating the edge gradient threshold according to the blocking statistical result, and adaptively optimizing the area division through multiple iterations; finally, based on the optimized blocking result, different quantization strategies are adopted to process the edge area and the non-edge area, and the quantization matrix is generated to output the compressed code stream through entropy coding. The application realizes the adaptive adjustment of the compression parameters through the iterative optimization mechanism, effectively preserves the image edge and texture details while ensuring the high compression rate, and significantly improves the subjective visual quality of the compressed image.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, and in particular to an image compression method and system based on edge gradient adaptation. BACKGROUND

[0002] With the rapid development of digital imaging technology and Internet applications, digital images are increasingly widely used in fields such as remote sensing, medical treatment, security, social media and mobile communication, resulting in a large amount of image data. Image compression technology, as a key to solving the bottleneck of image data storage and transmission, has always been the focus of attention. The core goal is to reduce the volume of image data as much as possible while ensuring a certain visual quality.

[0003] Existing image compression techniques can be mainly divided into two categories: lossless compression and lossy compression. Typical lossless compression methods, such as the LZW (Lempel-Ziv-Welch) algorithm and RLE (Run-Length Encoding) algorithm used in PNG and GIF formats, can completely reconstruct the original image, but the compression ratio is low, making it difficult to meet the requirements of applications with strict requirements on storage space and transmission bandwidth.

[0004] Therefore, in practical applications, lossy compression techniques that allow a certain degree of information loss dominate. Among them, the JPEG standard based on discrete cosine transform (DCT) is the most classic and widely used solution. It divides the image into 8x8 pixel blocks, performs DCT transform on each block to map spatial domain information to frequency domain, then quantizes the frequency domain coefficients, discards high-frequency information that is not sensitive to the human eye, and finally performs entropy coding on the quantized coefficients. The JPEG2000 standard that appeared later uses wavelet transform (DWT) instead of DCT, providing better compression performance and features such as lossless compression and progressive transmission. In recent years, the HEIC (HEIF) format based on the video coding framework HEVC has further improved compression efficiency using its advanced intra-frame prediction technology.

[0005] Despite the significant achievements of existing technologies, they still have several inherent technical defects in practical applications, mainly in the following aspects:

[0006] (1) Uniform quantization leads to unreasonable resource allocation: Traditional methods such as JPEG use a uniform set of quantization parameters (quantization table) for the entire image. This "one-size-fits-all" strategy cannot identify and distinguish the importance of different contents in the image. For images containing a large amount of smooth background and a small number of important edges, valuable code rate is evenly distributed to all regions, resulting in insufficient bits for fine description of important information under limited code rate budget.

[0007] (2) Edge blurring and detail loss under high compression ratio: Edges and texture details are key elements that constitute the visual quality of an image. Under high compression ratio settings, the quantization process becomes coarser in pursuit of higher compression rates. Due to the global averaging nature of transforms such as DCT, high-frequency coefficients (which usually correspond to edges and textures) are discarded in large quantities, leading to significant edge blurring, ringing artifacts, and blocking artifacts in the reconstructed image, severely compromising the subjective quality of the image.

[0008] (3) Balance dilemma between compression ratio and image quality: Users often face a dilemma in practical applications: if they pursue a high compression ratio, the reconstructed image quality will decrease significantly, especially in areas with rich details; if they want to maintain a high image quality, the compression rate often fails to meet the expected target. Existing technologies lack an intelligent mechanism to dynamically and finely adjust the compression strategy based on image content, to achieve the optimal balance between compression ratio and quality in different areas.

[0009] (4) Lack of adaptive ability to image content: Different types of images (such as portraits, landscapes, and text) have vastly different content characteristics. Most existing compression algorithms lack the ability to perceive and analyze image content. In order to achieve ideal results on different types of images, users or developers often need to manually adjust compression parameters (such as quantization strength), a process that is not only inefficient and low in automation, but also relies on the user's experience, making it difficult to be widely applied.

[0010] Therefore, there is an urgent need in the art for a new image compression method that can automatically perceive the importance of edges and texture details in image content and adaptively allocate coding resources accordingly, to maximize the preservation of key visual information while maintaining high compression efficiency. SUMMARY

[0011] To solve the technical problems in the background art, the present application proposes an image compression method and system based on adaptive edge gradient.

[0012] The image compression method based on adaptive edge gradient proposed by the present application comprises the following steps:

[0013] S1, obtaining the original pixel data of the input image, and converting the original pixel data from the RGB color space to the YCbCr color space to obtain the luminance component and the chrominance component corresponding to the original pixel data;

[0014] S2, dividing the luminance component into edge regions and non-edge regions based on the current adaptive edge gradient threshold;

[0015] S3, dividing the edge region into blocks with a first size and dividing the non-edge region into blocks with a second size larger than the first size, and counting to obtain a number of edge region blocks and a number of non-edge region blocks;

[0016] S4, dynamically feeding back and updating the adaptive edge gradient threshold according to the number of edge region blocks and the number of non-edge region blocks;

[0017] S5, judging whether an iteration termination condition is met; if not, returning to step S2 for continuous execution to perform region division and block division in the next round using the updated adaptive edge gradient threshold; if yes, performing step S6;

[0018] S6, performing adaptive quantization on the edge region and the non-edge region using different quantization strategies according to the final block result to generate a quantization matrix;

[0019] S7, performing entropy coding on the quantization matrix to generate and output a compressed bitstream of the input image.

[0020] Preferably, the strategy of dynamically feeding back and updating the adaptive edge gradient threshold in step S4 is: when the number of non-edge region blocks increases, the adaptive edge gradient threshold is lowered; when the number of edge region blocks increases, the adaptive edge gradient threshold is raised.

[0021] Preferably, the strategy of updating the adaptive edge gradient threshold is specifically:

[0022] wherein, is a compression rate parameter, the larger the edge gradient threshold is, the higher the compression rate is; is an initial threshold parameter, which is generally a constant; is a block coefficient, the larger the block coefficient is, the more blocks there are, which is a constant after initialization; is the number of blocks in the non-edge region divided with the second size; is the number of blocks in the edge region divided with the first size; is the adaptive edge gradient threshold.

[0023] Preferably, the iteration termination condition in step S5 is that a variation of the adaptive edge gradient threshold is less than a preset convergence threshold, or the number of iterations reaches a preset maximum number.

[0024] Preferably, the step S2 of dividing the luminance component into the edge region and the non-edge region specifically includes:

[0025] ​comparing the edge gradient value of each pixel in the luminance component with the current adaptive edge gradient threshold value;

[0026] If the edge gradient value of a pixel is greater than or equal to the current adaptive edge gradient threshold value, the pixel is marked as an edge point, and a continuous region formed by edge points is an edge region.

[0027] If the edge gradient value of a pixel is less than the current adaptive edge gradient threshold value, the pixel is marked as a non-edge point, and a continuous region formed by non-edge points is a non-edge region.

[0028] Preferably, before step S2, the method further comprises a step of calculating the edge gradient value of each pixel in the luminance component, specifically comprising:

[0029] convolving the luminance component using a Sobel operator to obtain the horizontal direction gradient and the vertical direction gradient of each pixel;

[0030] calculating the gradient amplitude of each pixel as its edge gradient value according to the horizontal direction gradient and the vertical direction gradient.

[0031] Preferably, the step of convolving the luminance component using a Sobel operator to obtain the horizontal direction gradient and the vertical direction gradient of each pixel specifically comprises:

[0032] horizontal direction gradient is calculated by a convolution kernel , and the calculation formula is as follows: ;

[0033] wherein the convolution kernel is specifically ; is the luminance value of the pixel at the current position;

[0034] vertical direction gradient is calculated by a convolution kernel , and the calculation formula is as follows: ;

[0035] wherein the convolution kernel is specifically ; is the luminance value of the pixel at the current position.

[0036] Preferably, the first size is 8x8 pixels, and the second size is 16x16 pixels.

[0037] Preferably, step S6 specifically comprises:

[0038] According to the final block result, a luminance data matrix is generated for each block of the luminance component, wherein each element in the luminance data matrix is the luminance value of the pixel at the corresponding position in the block; and a edge gradient coefficient matrix of the same size is generated for each block, wherein each element in the edge gradient coefficient matrix is the calculated edge gradient value of the pixel at the corresponding position in the block;

[0039] For the blocks in the non-edge region, the edge gradient coefficient matrix thereof is modified: the average value of the luminance values of all pixels in the corresponding luminance data matrix of the block is calculated, and the ratio of the average value to the element in the upper left corner of the luminance data matrix is taken as the coefficient in the upper left corner of the modified edge gradient coefficient matrix, and the coefficients of all other positions in the matrix are set to zero;

[0040] For the blocks in the edge region, the edge gradient coefficient matrix thereof remains unchanged, and the coefficient of each position in the matrix is the edge gradient value of the pixel at the position;

[0041] The luminance data matrix of each block is multiplied by the element at the corresponding position in the corresponding edge gradient coefficient matrix to obtain the final quantization matrix of the block.

[0042] The application provides an image compression system based on adaptive edge gradient, which comprises:

[0043] An image acquisition and preprocessing module is configured to acquire original pixel data of an input image, and convert the original pixel data from an RGB color space to a YCbCr color space to obtain a luminance component and a chrominance component corresponding to the original pixel data;

[0044] A region division module is configured to divide the luminance component into an edge region and a non-edge region based on a current adaptive edge gradient threshold value;

[0045] A block statistics module is configured to divide the edge region into blocks with a first size, divide the non-edge region into blocks with a second size larger than the first size, and obtain the number of blocks in the edge region and the number of blocks in the non-edge region;

[0046] A threshold value updating module is configured to dynamically feedback and update the adaptive edge gradient threshold value according to the number of blocks in the edge region and the number of blocks in the non-edge region;

[0047] A loop control module is configured to determine whether an iteration termination condition is met; if not, the region division module is returned to continue execution, so that the next round of region division and block division is performed by using the updated adaptive edge gradient threshold value; if yes, an adaptive quantization module is executed;

[0048] An adaptive quantization module is configured to perform adaptive quantization on the edge region and the non-edge region by using different quantization strategies according to the final block result, and generate a quantization matrix.

[0049] An encoding output module is configured to perform entropy encoding on the quantization matrix, and generate and output a compressed code stream of the input image.

[0050] In the present application, the proposed image compression method and system based on edge gradient adaptation realize adaptive adjustment of compression parameters according to image content by introducing an edge gradient adaptive mechanism and an iterative optimization process, can realize efficient compression in smooth regions, and accurately preserve visual details in edge and texture complex regions, so as to achieve a more optimal balance between compression ratio and image quality in subjective visual experience. The method has high adaptability and intelligent level, and can adapt to diversified image content without human intervention, effectively solves the inherent contradiction that compression ratio and quality are difficult to balance in traditional methods, and significantly improves the overall efficiency of image compression and the visual fidelity of the reconstructed picture. BRIEF DESCRIPTION OF DRAWINGS

[0051] Figure 1 A working flow diagram of the image compression method based on edge gradient adaptation proposed in the present application;

[0052] Figure 2 A processing flow diagram of an embodiment of the image compression method based on edge gradient adaptation proposed in the present application;

[0053] Figure 3 A Zigzag scanning order diagram of an embodiment of the image compression method based on edge gradient adaptation proposed in the present application;

[0054] Figure 4 A system architecture diagram of the image compression system based on edge gradient adaptation proposed in the present application. DETAILED DESCRIPTION

[0055] Reference Figures 1-4 The image compression method based on edge gradient adaptation proposed in the present application includes the following steps:

[0056] S1, obtaining original pixel data of an input image, and converting the original pixel data from an RGB color space to a YCbCr color space to obtain a luminance component and a chrominance component corresponding to the original pixel data.

[0057] In the present embodiment, the original pixel data is converted from the RGB color space to the YCbCr color space, and the specific conversion formula is as follows: ;

[0058] Y, Cb, Cr = YR, YG, YB, wherein Y is a luminance component; Cb is a blue chroma component in a chroma component; Cr is a red chroma component in the chroma component; R is a red component in a pixel; G is a green component in the pixel; and B is a blue component in the pixel.

[0059] S2, divide the luminance component into an edge region and a non-edge region based on a current adaptive edge gradient threshold.

[0060] Specifically, the current adaptive edge gradient threshold is a preset initial threshold when first executed.

[0061] In the embodiment, the step S2 of dividing the luminance component into the edge region and the non-edge region specifically includes:

[0062] comparing the edge gradient value of each pixel point in the luminance component with the current adaptive edge gradient threshold;

[0063] if the edge gradient value of a pixel point is greater than or equal to the current adaptive edge gradient threshold, marking the pixel point as an edge point, and a continuous region composed of the edge points is the edge region;

[0064] if the edge gradient value of a pixel point is less than the current adaptive edge gradient threshold, marking the pixel point as a non-edge point, and a continuous region composed of the non-edge points is the non-edge region.

[0065] In the embodiment, before the step S2, the method further includes a step of calculating the edge gradient value of each pixel point in the luminance component, specifically including:

[0066] convolving the luminance component by using a Sobel operator to obtain a horizontal direction gradient and a vertical direction gradient of each pixel point;

[0067] calculating a gradient amplitude of each pixel point as the edge gradient value of the pixel point according to the horizontal direction gradient and the vertical direction gradient.

[0068] Specifically, the step of convolving the luminance component by using the Sobel operator to obtain the horizontal direction gradient and the vertical direction gradient of each pixel point specifically includes:

[0069] the horizontal direction gradient is calculated by a convolution kernel , and a calculation formula is as follows: ;

[0070] wherein the convolution kernel is specifically ; Y is a luminance value of a pixel point at a current position;

[0071] the vertical direction gradient is calculated by a convolution kernel The calculation is as follows:

[0072] ;

[0073] Among them, convolution kernel Specifically ; This represents the brightness value of the pixel at the current position.

[0074] In this embodiment, the first size is 8×8 pixels and the second size is 16×16 pixels.

[0075] Specifically, the gradient magnitude calculation process for the current pixel is as follows:

[0076] ;

[0077] in, This represents the gradient magnitude of the current pixel.

[0078] In this embodiment, the edge gradient threshold is specifically:

[0079] ;

[0080] in, For compression ratio parameters, The larger the value, the larger the edge gradient threshold, and the higher the compression ratio. This is the initial threshold parameter, which is generally a constant; This is the segmentation coefficient, which depends on the image size. The more segments there are, the better. The larger the value, the more constant it becomes after initialization; The number of blocks that are divided into non-edge regions using the second size; The number of blocks used to divide the edge region using the first size; This is the edge gradient threshold.

[0081] Specifically, the determination of the edge gradient threshold is further dynamically adjusted based on the number of blocks in the non-edge region and the number of blocks in the edge region; when the number of blocks in the non-edge region increases, the edge gradient threshold is adaptively lowered; when the number of blocks in the edge region increases, the edge gradient threshold is adaptively raised.

[0082] Specifically, when the number of blocks in the non-edge region increases, it indicates that the current edge gradient threshold is set too high, causing some edges to be lost. In this case, the edge gradient threshold will be adaptively adjusted. This reduces the size of the edge gradient threshold; when the number of blocks in the edge region increases, it indicates that the current edge gradient threshold is decreasing. If the threshold is set too low, the compression ratio will be insufficient. In this case, the system will adaptively adjust the edge gradient threshold. , so that it is enlarged. In this way, the relationship between the image compression ratio and the quality can be self-adaptively balanced according to the picture content, and the image quality is maintained while the compression ratio is maintained.

[0083] S3, according to the edge gradient threshold and the edge gradient value of each pixel point in the luminance component, the edge region and the non-edge region are divided in the luminance component.

[0084] In the embodiment, the step S3 specifically comprises:

[0085] comparing the edge gradient value of each pixel point in the luminance component with the edge gradient threshold;

[0086] if the edge gradient value of a pixel point is greater than or equal to the edge gradient threshold, the pixel point is marked as an edge point, and the continuous region composed of the edge points is the edge region;

[0087] if the edge gradient value of a pixel point is less than the edge gradient threshold, the pixel point is marked as a non-edge point, and the edge gradient value of the pixel point is set to zero, and the continuous region composed of the non-edge points is the non-edge region.

[0088] S4, according to the number of blocks in the edge region and the number of blocks in the non-edge region, the adaptive edge gradient threshold is dynamically fed back and updated.

[0089] In the embodiment, the strategy of dynamically feeding back and updating the adaptive edge gradient threshold in the step S4 is: when the number of blocks in the non-edge region increases, the adaptive edge gradient threshold is lowered; when the number of blocks in the edge region increases, the adaptive edge gradient threshold is raised.

[0090] In the embodiment, the strategy of updating the adaptive edge gradient threshold is specifically:

[0091] ;

[0092] wherein, is a compression rate parameter, the greater the corresponding edge gradient threshold is, the higher the compression rate is; is an initial threshold parameter, which is generally a constant; is a block coefficient, according to the size of the image size, the more the number of blocks is, the greater the constant is after initialization; is the number of blocks in the non-edge region using the second size for block division; is the number of blocks in the edge region using the first size for block division; is the adaptive edge gradient threshold.

[0093] In the embodiment, in step S4, the first size is 8x8 pixels and the second size is 16x16 pixels.

[0094] S5, judging whether an iteration termination condition is met; if not, returning to step S2 for continuous execution to perform region division and block division in the next round by using the updated adaptive edge gradient threshold; if yes, performing step S6.

[0095] In the embodiment, the iteration termination condition in step S5 is that a variation of the adaptive edge gradient threshold is less than a preset convergence threshold or an iteration number reaches a preset maximum number.

[0096] S6, generating a quantization matrix by using different quantization strategies for adaptive quantization of the edge region and the non-edge region according to the final block result.

[0097] In the embodiment, step S6 specifically includes:

[0098] According to the final block result, a luminance data matrix is generated for each block of the luminance component, wherein each element in the luminance data matrix is a luminance value of a pixel at a corresponding position in the block; and a same-size edge gradient coefficient matrix is generated for each block, wherein each element in the edge gradient coefficient matrix is an edge gradient value calculated for a pixel at a corresponding position in the block.

[0099] For a block in the non-edge region, the edge gradient coefficient matrix of the block is modified: an average value of luminance values of all pixels in the corresponding luminance data matrix of the block is calculated, a ratio of the average value to an element at a top-left corner of the luminance data matrix is taken as a coefficient at the top-left corner of the modified edge gradient coefficient matrix, and all other coefficients in the matrix are set to zero.

[0100] For a block in the edge region, the edge gradient coefficient matrix of the block remains unchanged, and each coefficient at each position in the matrix is an edge gradient value of a pixel at the position.

[0101] The luminance data matrix of each block is multiplied by elements at corresponding positions in the corresponding edge gradient coefficient matrix to obtain a final quantization matrix of the block.

[0102] In the embodiment, the specific quantization is implemented as follows:

[0103] wherein matrix Y represents a data matrix of a gray-scale image after region division, wherein Y(i,j) represents a pixel value at a position (i,j) in the matrix; matrix S represents a coefficient matrix of the image after edge processing, i.e., an edge gradient coefficient matrix; wherein S(i,j) represents an edge gradient value of a pixel at a position (i,j) in the matrix; and matrix Q represents a final quantization matrix of the image. ​​​​According to the block, there are two cases, when processing the non-edge area, the first coefficient in the upper left corner of the coefficient matrix is the average value of the matrix Y divided by the first number in the upper left corner of the matrix Y, and the coefficients in the remaining positions are 0, the purpose of setting is to retain the background, fill the average data, and reduce these unimportant information, greatly improve the compression ratio; when processing the edge area, For calculating the edge gradient value of the edge pixel point, the edge gradient value is taken as part of the quantization coefficient; then the coefficient matrix is multiplied with each element in the data matrix to obtain the quantization matrix C.

[0104] It should be noted that the quantization matrix C obtained in this way can process different types of pictures, and the edge gradient and the block are adaptively completed to quantize the data; finally, the quantization matrix C is converted into a one-dimensional array, and is sorted by Zigzag scanning, as shown in Figure 3 The principle is to start from the upper left corner of the matrix and scan according to the shape of the letter Z, so that the data in the non-edge area is easily obtained after scanning, the first element retains the pixel mean value of the block, and the subsequent elements are quantized to 0, which provides more regular data for subsequent encoding.

[0105] S7, entropy encoding the quantization matrix to generate and output the compressed code stream of the input image.

[0106] In this embodiment, before entropy encoding, the quantization matrix is Zigzag scanned to convert it from a two-dimensional matrix to a one-dimensional data sequence.

[0107] Specifically, the quantization matrix is Huffman encoded and run-length encoded to compress repeated data in the quantization matrix, and the compressed code stream of the input image is generated and output.

[0108] Referring to Figures 1-4 , the application provides an image compression system based on adaptive edge gradient, comprising:

[0109] An image acquisition and preprocessing module is configured to acquire original pixel data of an input image, and convert the original pixel data from an RGB color space to a YCbCr color space to obtain a luminance component and a chrominance component corresponding to the original pixel data.

[0110] A region division module is configured to divide the luminance component into an edge region and a non-edge region based on a current adaptive edge gradient threshold.

[0111] A block statistics module is configured to divide the edge region by a first size, divide the non-edge region by a second size greater than the first size, and obtain a number of edge region blocks and a number of non-edge region blocks.

[0112] A threshold updating module is configured to dynamically feedback and update the adaptive edge gradient threshold according to the number of edge region blocks and the number of non-edge region blocks.

[0113] A loop control module is configured to determine whether an iteration termination condition is met; if not, return to the region division module to continue execution, and perform the next round of region division and block division using the updated adaptive edge gradient threshold; if yes, execute the adaptive quantization module.

[0114] The adaptive quantization module is configured to perform adaptive quantization on the edge region and the non-edge region using different quantization strategies according to the final block result, and generate a quantization matrix.

[0115] An encoding output module is configured to perform entropy encoding on the quantization matrix, and generate and output a compressed code stream of the input image.

[0116] The above is only a preferred specific implementation of the present application, but the protection scope of the present application is not limited to this. Any person skilled in the art, according to the technical solution and the inventive concept of the present application, can make equivalent replacements or changes within the technical range disclosed by the present application, which should be covered within the protection scope of the present application.

Claims

1. An image compression method based on edge gradient adaptation, characterized by, The method comprises the following steps: S1, obtaining original pixel data of an input image, and converting the original pixel data from an RGB color space to a YCbCr color space to obtain a luminance component and a chrominance component corresponding to the original pixel data; S2, dividing the luminance component into an edge region and a non-edge region based on a current adaptive edge gradient threshold value; S3, dividing the edge region into blocks with a first size and dividing the non-edge region into blocks with a second size larger than the first size, and counting the number of blocks in the edge region and the number of blocks in the non-edge region; S4, dynamically feeding back and updating the adaptive edge gradient threshold value according to the number of blocks in the edge region and the number of blocks in the non-edge region; S5, judging whether an iteration termination condition is met; if not, returning to step S2 for continuous execution using the updated adaptive edge gradient threshold value for the next round of region division and block division; if yes, executing step S6; S6, performing adaptive quantization on the edge region and the non-edge region using different quantization strategies according to the final block result to generate a quantization matrix; S7, performing entropy coding on the quantization matrix to generate and output a compressed code stream of the input image.

2. The image compression method based on edge gradient adaptation according to claim 1, characterized in that, The strategy for dynamically feeding back and updating the adaptive edge gradient threshold value in step S4 is: when the number of blocks in the non-edge region increases, the adaptive edge gradient threshold value is lowered; when the number of blocks in the edge region increases, the adaptive edge gradient threshold value is raised.

3. The image compression method based on edge gradient adaptation according to claim 2, characterized in that, The strategy of updating the adaptive edge gradient threshold is specifically as follows: ; wherein, is a compression rate parameter, The greater the corresponding edge gradient threshold value, the higher the compression rate; is an initial threshold parameter, which is a constant; is a block coefficient, according to the size of the image size, the more the number of blocks, The greater, the constant after initialization; is the number of blocks of the second size for the non-edge region; is the number of blocks of the first size for the edge region; is an adaptive edge gradient threshold value.

4. The image compression method based on edge gradient adaptation according to claim 1, characterized in that, The iteration termination condition in step S5 is that the change of the adaptive edge gradient threshold value is less than a preset convergence threshold value, or the number of iterations reaches a preset maximum number.

5. The edge gradient adaptive based image compression method of claim 1, wherein, The division of the luminance component into the edge region and the non-edge region in step S2 specifically comprises: comparing the edge gradient value of each pixel point in the luminance component with the current adaptive edge gradient threshold value; if the edge gradient value of a pixel point is greater than or equal to the current adaptive edge gradient threshold value, the pixel point is marked as an edge point, and the continuous region formed by the edge points is the edge region; if the edge gradient value of a pixel point is less than the current adaptive edge gradient threshold value, the pixel point is marked as a non-edge point, and the continuous region formed by the non-edge points is the non-edge region.

6. The image compression method based on edge gradient adaptation according to claim 5, characterized in that, Before step S2, there is also a step of calculating the edge gradient value of each pixel point in the luminance component, which specifically comprises: performing convolution calculation on the luminance component using a Sobel operator to obtain the horizontal direction gradient and the vertical direction gradient of each pixel point; calculating the gradient amplitude of each pixel point as its edge gradient value according to the horizontal direction gradient and the vertical direction gradient.

7. The image compression method based on edge gradient adaptation according to claim 6, characterized in that, The convolution calculation on the luminance component using the Sobel operator to obtain the horizontal direction gradient and the vertical direction gradient of each pixel point specifically comprises: horizontal gradient by a convolution kernel , which is calculated as follows: ; Wherein, the convolution kernel Specifically ; is the luminance value of the current position pixel point; vertical direction gradient The calculation is performed by a convolution kernel B, and the calculation formula is as follows: ; Wherein, the convolution kernel Specifically ; is the luminance value of the current position pixel point.

8. The edge gradient adaptive based image compression method of claim 1, wherein, the first size is 8x8 pixels, and the second size is 16x16 pixels.

9. The edge gradient adaptive based image compression method of claim 1, wherein, Step S6 specifically comprises: According to the final block result, a luminance data matrix is generated for each block of the luminance component, wherein each element in the luminance data matrix is the luminance value of the pixel at the corresponding position in the block; meanwhile, an edge gradient coefficient matrix of the same size is generated for each block, wherein each element in the edge gradient coefficient matrix is the calculated edge gradient value of the pixel at the corresponding position in the block; For the blocks in the non-edge region, the edge gradient coefficient matrix thereof is modified: the average value of the luminance values of all pixels in the corresponding luminance data matrix of the block is calculated, and the ratio of the average value to the element in the top-left corner of the luminance data matrix is taken as the coefficient in the top-left corner of the modified edge gradient coefficient matrix, and the coefficients of all other positions in the matrix are set to zero; For the blocks in the edge region, the edge gradient coefficient matrix thereof remains unchanged, and the coefficient of each position in the matrix is the edge gradient value of the pixel at the position; The luminance data matrix of each block is multiplied by the element at the corresponding position in the corresponding edge gradient coefficient matrix to obtain the final quantization matrix of the block.

10. An image compression system based on edge gradient adaptation, characterized by, Comprise: An image acquisition and preprocessing module, configured to acquire original pixel data of an input image, and convert the original pixel data from an RGB color space to a YCbCr color space to obtain a luminance component and a chrominance component corresponding to the original pixel data; A region division module, configured to divide the luminance component into an edge region and a non-edge region based on a current adaptive edge gradient threshold value; A block statistics module, configured to divide the edge region into blocks with a first size, divide the non-edge region into blocks with a second size greater than the first size, and obtain a number of blocks in the edge region and a number of blocks in the non-edge region; A threshold value updating module, configured to dynamically feedback and update the adaptive edge gradient threshold value according to the number of blocks in the edge region and the number of blocks in the non-edge region; A loop control module, configured to determine whether an iteration termination condition is met; if not, return to the region division module to continue execution to perform region division and block division in the next round using the updated adaptive edge gradient threshold value; if yes, execute an adaptive quantization module; The adaptive quantization module is configured to perform adaptive quantization on the edge region and the non-edge region using different quantization strategies according to the final block result to generate a quantization matrix; An encoding output module, configured to perform entropy encoding on the quantization matrix to generate and output a compressed code stream of the input image.

Citation Information

Patent Citations

  • Adaptive multi-scale partitioning compression sensing sampling method

    CN105761290A

  • Video coding method and video coding device

    CN108337515A