Image compression method and system based on edge gradient self-adaption
By using an image compression method based on edge gradient adaptation and dynamically adjusting the quantization strategy, the problems of unreasonable resource allocation and visual quality loss in image compression are solved, achieving both efficient image compression and high quality.
Patent Information
- Application Number
- CN202511861008.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-11
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2045-12-11
AI Technical Summary
Existing technologies for image compression suffer from problems such as unreasonable resource allocation, blurred edges and loss of details, limited parameter settings, and insufficient adaptability to image content, making it difficult to achieve both compression ratio and quality.
An image compression method based on edge gradient adaptation is adopted. By dividing the region through adaptive edge gradient threshold and dynamically adjusting the quantization strategy, the method achieves differentiated processing of edge and non-edge regions, generates a quantization matrix, and performs entropy encoding.
It achieves a balance between maintaining high compression efficiency and accurately preserving image visual details, improving the image reconstruction quality and compression ratio. It is highly adaptive and intelligent, and can adapt to diverse image content.
Smart Images

Figure CN121284239A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to an image compression method and system based on edge gradient adaptation. Background Technology
[0002] With the rapid development of digital imaging technology and internet applications, digital images are increasingly used in remote sensing, healthcare, security, social media, and mobile communications, resulting in massive amounts of image data. Image compression technology, as a key solution to the bottlenecks in image data storage and transmission, has always received considerable attention. Its core objective is to reduce the size of image data as much as possible while maintaining a certain level of visual quality.
[0003] Existing image compression technologies 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 application scenarios with stringent requirements for storage space and transmission bandwidth.
[0004] Therefore, in practical applications, lossy compression techniques that allow for a certain degree of information loss have become dominant. Among them, the JPEG standard based on Discrete Cosine Transform (DCT) is the most classic and widely used scheme. It divides the image into 8×8 pixel blocks, performs DCT transformation on each block to map spatial information to the frequency domain, then quantizes the frequency domain coefficients, discarding high-frequency information that is insensitive to the human eye, and finally entropy-encoded the quantized coefficients. The subsequent JPEG2000 standard 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 HEVC video coding framework has further improved compression efficiency by utilizing its advanced intra-frame prediction technology.
[0005] Despite the significant achievements of existing technologies, they still have several inherent technical shortcomings in practical applications, mainly reflected in the following aspects: (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 content in the image. For images containing a large amount of smooth background and a few important edges, the precious bitrate is evenly allocated to all regions, resulting in insufficient bits for fine description of important information under a limited bitrate budget.
[0006] (2) Edge blurring and detail loss under high compression ratio: Edge and texture details are key elements constituting the visual quality of an image. Under high compression ratio settings, in order to pursue a higher compression rate, the quantization process becomes coarser. Due to the global averaging characteristics of transforms such as DCT, a large number of high-frequency coefficients (usually corresponding to edges and textures) are discarded, resulting in obvious edge blurring, ringing artifacts, and blocking artifacts in the reconstructed image, which seriously impairs the subjective quality of the image.
[0007] (3) The dilemma of balancing compression ratio and image quality: Users often face a dilemma in practical applications: if a high compression ratio is pursued, the quality of the reconstructed image will be significantly reduced, especially in areas with rich details; if a high image quality is desired, the compression ratio often fails to meet the expected target. Existing technologies lack an intelligent mechanism that can dynamically and finely adjust the compression strategy according to the image content to achieve the optimal balance between compression ratio and quality in different regions.
[0008] (4) Lack of adaptability 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 usually need to manually adjust compression parameters (such as quantization intensity). This process is not only inefficient and lacks automation, but also depends on the user's experience, making it difficult to promote and apply on a large scale.
[0009] Therefore, there is an urgent need in the field for a novel image compression method that can automatically perceive the importance of image content, especially edge and texture details, and adaptively allocate coding resources accordingly, so as to retain key visual information to the maximum extent while maintaining high compression efficiency. Summary of the Invention
[0010] To address the technical problems existing in the background art, this invention proposes an image compression method and system based on edge gradient adaptation.
[0011] This invention proposes an image compression method based on edge gradient adaptation, comprising the following steps: S1. Obtain the original pixel data of the input image, and convert the original pixel data from the RGB color space to the YCbCr color space to obtain the luminance component and chrominance component corresponding to the original pixel data; S2. Based on the current adaptive edge gradient threshold, the brightness component is divided into edge regions and non-edge regions; S3. Divide the edge region into blocks using the first size, and divide the non-edge region into blocks using the second size, which is larger than the first size, and count the number of edge region blocks and the number of non-edge region blocks. S4. Dynamically feed back and update the adaptive edge gradient threshold based on the number of edge region blocks and the number of non-edge region blocks; S5. Determine whether the iteration termination condition is met; if not, return to step S2 to continue execution, so as to use the updated adaptive edge gradient threshold for the next round of region division and block segmentation; if yes, execute step S6. S6. Based on the final block division results, adaptive quantization is performed on edge regions and non-edge regions using different quantization strategies to generate a quantization matrix; S7. Perform entropy encoding on the quantization matrix to generate and output the compressed bitstream of the input image.
[0012] Preferably, the strategy for dynamically feeding back and updating the adaptive edge gradient threshold in step S4 is as follows: 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.
[0013] Preferably, the strategy for updating the adaptive edge gradient threshold is as follows: ; 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 an adaptive edge gradient threshold.
[0014] Preferably, the iteration termination condition in step S5 is that the change in the adaptive edge gradient threshold is less than a preset convergence threshold, or the number of iterations reaches a preset maximum number.
[0015] Preferably, the division of the luminance component into edge regions and non-edge regions in step S2 specifically includes: Compare the edge gradient value of each pixel in the brightness component with the current adaptive edge gradient threshold; If the edge gradient value of a pixel is greater than or equal to the current adaptive edge gradient threshold, then the pixel 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 is less than the current adaptive edge gradient threshold, then the pixel is marked as a non-edge point, and the continuous region formed by non-edge points is the non-edge region.
[0016] Preferably, before step S2, the method further includes a step of calculating the edge gradient value of each pixel in the luminance component, specifically including: The brightness components are convolved using the Sobel operator to obtain the horizontal and vertical gradients of each pixel. The gradient magnitude of each pixel is calculated based on the horizontal and vertical gradients, and used as its edge gradient value.
[0017] Preferably, the step of using the Sobel operator to convolve the luminance components to obtain the horizontal and vertical gradients of each pixel specifically includes: Horizontal gradient Through convolution kernel The calculation is as follows: ; Among them, convolution kernel Specifically ; This represents the brightness value of the pixel at the current location. Vertical gradient Through convolution kernel The calculation is as follows: ; Among them, convolution kernel Specifically ; This represents the brightness value of the pixel at the current position.
[0018] Preferably, the first size is 8×8 pixels and the second size is 16×16 pixels.
[0019] Preferably, step S6 specifically includes: Based on the final block division result, a luminance data matrix is generated for each block of the luminance component, where each element in the luminance data matrix is the luminance value of the corresponding pixel in the block; at the same time, an edge gradient coefficient matrix of the same size is generated for each block, where each element in the edge gradient coefficient matrix is the edge gradient value calculated for the corresponding pixel in the block. For the blocks in the non-edge region, their edge gradient coefficient matrix is corrected: the average value of all pixel brightness values in the brightness data matrix corresponding to the block is calculated, the ratio of the average value to the top left element in the brightness data matrix is used as the coefficient of the top left corner in the corrected 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 remains unchanged, and the coefficient at each position in the matrix is the edge gradient value of the pixel at that position. Multiply the brightness data matrix of each block by the corresponding element in its edge gradient coefficient matrix to obtain the final quantization matrix of that block.
[0020] This invention proposes an image compression system based on edge gradient adaptation, comprising: The image acquisition and preprocessing module is used to acquire the raw pixel data of the input image and convert the raw pixel data from the RGB color space to the YCbCr color space to obtain the luminance component and chrominance component corresponding to the raw pixel data. The region segmentation module is used to divide the brightness components into edge regions and non-edge regions based on the current adaptive edge gradient threshold. The block statistics module is used to divide the edge region into blocks using a first size and the non-edge region into blocks using a second size larger than the first size, and to count the number of edge region blocks and the number of non-edge region blocks. The threshold update module is used to dynamically feed back and update the adaptive edge gradient threshold based on the number of edge region blocks and the number of non-edge region blocks; The loop control module is used to determine whether the iteration termination condition is met; if not, it returns to the region partitioning module to continue execution, so as to use the updated adaptive edge gradient threshold for the next round of region partitioning and block division; if yes, it executes the adaptive quantization module. The adaptive quantization module is used to adaptively quantize edge regions and non-edge regions using different quantization strategies based on the final block results, and generate a quantization matrix. The encoding output module is used to perform entropy encoding on the quantization matrix to generate and output a compressed bitstream of the input image.
[0021] The proposed image compression method and system based on edge gradient adaptation in this invention achieves adaptive adjustment of compression parameters according to image content by introducing an edge gradient adaptation mechanism and iterative optimization process. It can achieve efficient compression in smooth areas while accurately preserving visual details in edge and textured areas, thus achieving a better balance between compression ratio and image quality in subjective visual experience. The method has a high degree of adaptability and intelligence, and can adapt to diverse image content without human intervention. It effectively solves the inherent contradiction of difficulty in balancing compression ratio and quality in traditional methods, and significantly improves the overall efficiency of image compression and the visual fidelity of reconstructed images. Attached Figure Description
[0022] Figure 1 This is a schematic diagram illustrating the workflow of an image compression method based on edge gradient adaptation proposed in this invention. Figure 2 This is a schematic diagram of the processing flow of one embodiment of the image compression method based on edge gradient adaptation proposed in this invention; Figure 3 This is a schematic diagram of Zigzag scanning sorting for one embodiment of an image compression method based on edge gradient adaptation proposed in this invention; Figure 4 This is a schematic diagram of the system architecture of an image compression system based on edge gradient adaptation proposed in this invention. Detailed Implementation
[0023] Reference Figures 1-4 The present invention proposes an image compression method based on edge gradient adaptation, comprising the following steps: S1. Obtain the original pixel data of the input image and convert the original pixel data from the RGB color space to the YCbCr color space to obtain the luminance component and chrominance component corresponding to the original pixel data.
[0024] In this embodiment, the original pixel data is converted from the RGB color space to the YCbCr color space. The specific conversion formula is as follows: ; Where Y is the luminance component; Cb is the blue chrominance component; Cr is the red chrominance component; R is the red component of the pixel; G is the green component of the pixel; and B is the blue component of the pixel.
[0025] S2. Based on the current adaptive edge gradient threshold, the brightness component is divided into edge regions and non-edge regions.
[0026] Specifically, during the first execution, the current adaptive edge gradient threshold is a preset initial threshold.
[0027] In this embodiment, step S2, which divides the luminance component into edge regions and non-edge regions, specifically includes: Compare the edge gradient value of each pixel in the brightness component with the current adaptive edge gradient threshold; If the edge gradient value of a pixel is greater than or equal to the current adaptive edge gradient threshold, then the pixel 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 is less than the current adaptive edge gradient threshold, then the pixel is marked as a non-edge point, and the continuous region formed by non-edge points is the non-edge region.
[0028] In this embodiment, before step S2, a step of calculating the edge gradient value of each pixel in the luminance component is further included, specifically including: The Sobel operator is used to perform convolution calculation on the luminance component to obtain the horizontal and vertical gradients of each pixel. The gradient magnitude of each pixel is calculated based on the horizontal and vertical gradients, and used as its edge gradient value.
[0029] Specifically, the Sobel operator is used to convolve the luminance components to obtain the horizontal and vertical gradients of each pixel, including: Horizontal gradient Through convolution kernel The calculation is as follows: ; Among them, convolution kernel Specifically ; This represents the brightness value of the pixel at the current location. Vertical gradient Through convolution kernel The calculation is as follows: ; Among them, convolution kernel Specifically ; This represents the brightness value of the pixel at the current position.
[0030] In this embodiment, the first size is 8×8 pixels and the second size is 16×16 pixels.
[0031] Specifically, the gradient magnitude calculation process for the current pixel is as follows: ; in, This represents the gradient magnitude of the current pixel.
[0032] In this embodiment, the edge gradient threshold is specifically: ; 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.
[0033] 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.
[0034] 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. This increases the image size. This allows for an adaptive balance between image compression ratio and quality based on the image content, maintaining a high compression ratio while preserving image quality.
[0035] S3. Based on the edge gradient threshold and the edge gradient value of each pixel in the brightness component, divide the brightness component into edge regions and non-edge regions.
[0036] In this embodiment, step S3 specifically includes: Compare the edge gradient value of each pixel in the brightness component with the edge gradient threshold; If the edge gradient value of a pixel is greater than or equal to the edge gradient threshold, then the pixel 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 is less than the edge gradient threshold, the pixel is marked as a non-edge point and its edge gradient value is set to zero. The continuous area formed by non-edge points is the non-edge region.
[0037] S4. Based on the number of edge region blocks and the number of non-edge region blocks, dynamically feed back and update the adaptive edge gradient threshold.
[0038] In this embodiment, the strategy for dynamically feeding back and updating the adaptive edge gradient threshold in step S4 is as follows: 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.
[0039] In this embodiment, the strategy for updating the adaptive edge gradient threshold is as follows: ; 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 an adaptive edge gradient threshold.
[0040] In this embodiment, in step S4, the first size is 8×8 pixels and the second size is 16×16 pixels.
[0041] S5. Determine whether the iteration termination condition is met; if not, return to step S2 to continue execution, so as to use the updated adaptive edge gradient threshold for the next round of region division and block segmentation; if yes, execute step S6.
[0042] In this embodiment, the iteration termination condition in step S5 is that the change in the adaptive edge gradient threshold is less than the preset convergence threshold, or the number of iterations reaches the preset maximum number.
[0043] S6. Based on the final block division results, different quantization strategies are applied to the edge regions and non-edge regions for adaptive quantization to generate a quantization matrix.
[0044] In this embodiment, step S6 specifically includes: Based on the final block division results, a luminance data matrix is generated for each block of the luminance component, where each element in the luminance data matrix is the luminance value of the corresponding pixel in the block; at the same time, an edge gradient coefficient matrix of the same size is generated for each block, where each element in the edge gradient coefficient matrix is the edge gradient value calculated for the corresponding pixel in the block. For blocks in non-edge regions, their edge gradient coefficient matrix is corrected: the average value of all pixel brightness values in the brightness data matrix corresponding to the block is calculated, and the ratio of the average value to the top-left element in the brightness data matrix is used as the coefficient of the top-left corner in the corrected edge gradient coefficient matrix, and the coefficients of all other positions in the matrix are set to zero. For blocks in the edge region, the edge gradient coefficient matrix remains unchanged, and the coefficient at each position in the matrix is the edge gradient value of the pixel at that position. Multiply the brightness data matrix of each block by the corresponding element in its edge gradient coefficient matrix to obtain the final quantization matrix of that block.
[0045] In this embodiment, the quantization is specifically implemented as follows: ; ; ; Where matrix Y represents the data matrix of the grayscale image after region segmentation, where The matrix S represents the grayscale value of the pixel; matrix S represents the coefficient matrix after image edge correction, i.e., the edge gradient coefficient matrix; where Based on the block division, there are two cases. When processing non-edge regions, the first coefficient in the top left corner of the coefficient matrix is the average value of matrix Y divided by the first number in the top left corner of matrix Y, and the coefficients in other positions are 0. The purpose of this setting is to retain the mean data of the background and padding while reducing these unimportant information, which greatly improves the compression ratio. When processing edge regions, ... To calculate the edge gradient value of edge pixels, the edge gradient value is used as part of the quantization coefficient; then the quantization matrix C is obtained by multiplying the coefficient matrix with each element in the data matrix.
[0046] It should be noted that the quantization matrix C obtained in this way can handle different types of images, adaptively quantizing the data based on edge gradients and block divisions; finally, the quantization matrix C is converted into a one-dimensional array, and sorted by Zigzag scanning, as shown below. Figure 3 As shown, the principle is to start from the top left corner of the matrix and scan in the shape of the letter Z. After scanning, the data in the non-edge areas can be easily obtained. The first element retains the pixel average of the block, while the subsequent elements are quantized to 0, providing more regular data for subsequent encoding.
[0047] S7. Perform entropy encoding on the quantization matrix to generate and output the compressed bitstream of the input image.
[0048] In this embodiment, before entropy encoding, the quantization matrix is subjected to a Zigzag scan to convert it from a two-dimensional matrix into a one-dimensional data sequence.
[0049] Specifically, Huffman coding and run-length coding are performed on the quantization matrix to compress the repetitive data in the quantization matrix, generating and outputting a compressed bitstream of the input image.
[0050] Reference Figures 1-4 The present invention proposes an image compression system based on edge gradient adaptation, comprising: The image acquisition and preprocessing module is used to acquire the raw pixel data of the input image and convert the raw pixel data from the RGB color space to the YCbCr color space to obtain the luminance component and chrominance component corresponding to the raw pixel data. The region segmentation module is used to divide the brightness components into edge regions and non-edge regions based on the current adaptive edge gradient threshold. The block statistics module is used to divide the edge region into blocks using a first size and the non-edge region into blocks using a second size larger than the first size, and to count the number of edge region blocks and the number of non-edge region blocks. The threshold update module is used to dynamically feed back and update the adaptive edge gradient threshold based on the number of edge region blocks and the number of non-edge region blocks; The loop control module is used to determine whether the iteration termination condition is met; if not, it returns to the region partitioning module to continue execution, so as to use the updated adaptive edge gradient threshold for the next round of region partitioning and block division; if yes, it executes the adaptive quantization module. The adaptive quantization module is used to adaptively quantize edge regions and non-edge regions using different quantization strategies based on the final block results, and generate a quantization matrix. The encoding output module is used to entropy encode the quantization matrix to generate and output a compressed bitstream of the input image.
[0051] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
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 generally 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 edge gradient adaptive based image compression method of claim 1, wherein, 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
Block division method, inter prediction method, video coding method and related devices
CN113099229A
Video coding method and apparatus, computer device, and storage medium
US20220053198A1
Method and apparatus for image encoding / decoding
US20240414326A1
Cited By
Remote data transmission method and system based on deep sea detection sonar
CN121842337A