Gray level image efficient compression method based on image processing
By segmenting grayscale images and performing feature analysis, single-peak and multi-peak image sub-blocks are divided according to the grayscale histogram features. Different compression methods are then used to solve the problem of balancing quality and compression ratio in grayscale image compression, thus achieving efficient image compression.
Patent Information
- Application Number
- CN202511386799.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-26
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2045-09-26
AI Technical Summary
Existing technologies struggle to improve the compression ratio while maintaining grayscale image quality. Direct lossless compression is computationally complex and has a low compression ratio, while direct lossy compression leads to a decrease in image quality.
By segmenting the grayscale image into blocks, single-peak and multi-peak feature image blocks are divided according to the grayscale histogram features of the image blocks, and different compression methods, including lossy compression and lossless compression, are used to perform grayscale mapping based on peak domain feature values and differences.
It achieves improved compression ratio, reduced computational complexity, and preservation of image detail information while maintaining image quality.
Smart Images

Figure CN120881279A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image compression technology, and more specifically to an efficient method for compressing grayscale images based on image processing. Background Technology
[0002] With the increasingly widespread application of digital imaging, the amount of image data is exploding. For example, a single high-resolution grayscale medical image can occupy several megabytes or tens of megabytes of storage space. Efficient compression processing can significantly reduce the size of image files, improve transmission speed, and save storage costs. For grayscale image compression, existing technologies are generally divided into two main processing methods: lossy compression and lossless compression. Direct lossless compression works by establishing a redundancy model between grayscale image data and using encoding techniques to remove redundant information without losing any original image data. However, due to the limited amount of redundant information in the image, lossless compression typically has a low compression ratio, and its computational complexity is too high, requiring more computing resources and time. Direct lossy compression, on the other hand, reduces data volume by discarding some minor information from the image. However, this method cannot avoid image quality degradation or even image distortion, limiting the image's reuse value.
[0003] Therefore, in the process of compressing grayscale images, both direct lossless compression and direct lossy compression are difficult to balance the relationship between the compressed image quality and the compression ratio, and cannot achieve the goal of improving the compression ratio while ensuring image quality. Summary of the Invention
[0004] To address the aforementioned technical problems, the present invention aims to provide a highly efficient grayscale image compression method based on image processing. The specific technical solution adopted is as follows: Obtain the grayscale image to be compressed; The image is divided into sub-blocks based on its size characteristics; a first peak feature value is obtained based on the difference in the number of pixels at each gray level in the gray-level histogram of the sub-blocks; and a second peak feature value is obtained based on the proportion of pixels at each gray level in the gray-level histogram. Single-peak feature image sub-blocks and multi-peak feature image sub-blocks are obtained based on the first peak state feature value and the second peak state feature value; different peak regions in the gray-level histogram are obtained based on the number of pixels at different gray levels of the multi-peak feature image sub-blocks; overlap feature values are obtained based on the peak spacing and distribution features between the peak regions; and peak difference degree is obtained based on the height difference features between the peak regions. The gray levels of pixels in the multi-peak feature image sub-block are mapped according to the overlapping feature value and the peak difference, and the peak state attribute of the multi-peak feature image sub-block is re-determined; the multi-peak feature image sub-block and the single-peak feature image sub-block are compressed using different compression methods.
[0005] Further, the step of dividing the image into sub-blocks based on the size features of the grayscale image includes: In the formula, n represents the side length of the image sub-block, a represents the preset first adjustment parameter, b represents the preset second adjustment parameter, and s represents the geometric mean of the grayscale image; the grayscale image is divided by the side length n to obtain different image sub-blocks.
[0006] Further, the step of obtaining the first peak state feature value based on the pixel number difference feature of each gray level in the gray-level histogram of the image sub-block includes: Calculate the kurtosis coefficients of the number of pixels corresponding to all gray levels in the gray-level histogram of the image sub-block and perform positive correlation mapping to obtain the first kurtosis feature value of the image sub-block.
[0007] Further, the step of obtaining the second peak state feature value based on the pixel quantity ratio feature of gray level in the gray-level histogram includes: The second peak state feature value of the image sub-block is obtained by calculating the ratio of the number of pixels at the gray level with the most pixels in the gray level histogram to the number of pixels at all gray levels.
[0008] Further, the step of obtaining single-peak feature image sub-blocks and multi-peak feature image sub-blocks based on the first peak state feature value and the second peak state feature value includes: When the first peak feature value exceeds a preset first threshold and the second peak feature value exceeds a preset second threshold, the image sub-block is a single-peak feature image sub-block; otherwise, it is a multi-peak feature image sub-block.
[0009] Further, the step of obtaining different peak regions in the gray-level histogram based on the pixel count features of different gray levels of the multi-peak feature image sub-blocks includes: Construct the envelope of the grayscale histogram of the multi-peak feature image sub-block and obtain the peak points in the envelope. Calculate the product of the peak points and a preset descent factor and round down to obtain the boundary corresponding to the peak points. Take the grayscale interval corresponding to the boundary as the peak region.
[0010] Furthermore, the step of obtaining the overlapping feature value based on the peak spacing characteristics and distribution characteristics between the peak regions includes: In the formula, The eigenvalues representing the overlap between peak regions x and y are given. This represents an exponential function with the natural constant as its base. This represents the average gray level of the peak region x. This represents the average gray level of the peak region y. Indicates the degree of difference. This represents the left boundary gray level formed by the peak region x and y. and the right boundary gray level The length of the interval between them This represents the width of the peak region x. This represents the width of the peak region y. Indicates the distribution interval.
[0011] Further, the step of obtaining the peak difference degree based on the height difference characteristics between the peak regions includes: The ratio of the maximum number of pixels in each peak region to the number of pixels in the multi-peak feature image sub-block is calculated to obtain the significance level; the difference between the maximum value of the significance level and the significance level corresponding to any other peak region is calculated and normalized to obtain the peak difference between peak regions.
[0012] Further, the step of mapping the gray levels of pixels in the multi-peak feature image sub-block according to the overlapping feature value and the peak difference degree, and re-determining the peak state attribute of the multi-peak feature image sub-block includes: When the peak difference exceeds a preset difference threshold, the gray levels of pixels in any other peak region are mapped to the median gray level of the peak region with the maximum saliency. When the overlap feature value of any two peak regions exceeds a preset overlap threshold, the gray levels of pixels in any two peak regions are mapped to the mean gray level of any two peak regions. When only one peak region exists in the multi-peak feature image sub-block after mapping, the peak state attribute of the multi-peak feature image sub-block is converted into a single-peak feature image sub-block.
[0013] Furthermore, the step of compressing the multi-peak feature image sub-block and the single-peak feature image sub-block using different compression methods includes: The single-peak feature image sub-blocks are compressed using a lossy compression method, while the multi-peak feature image sub-blocks are compressed using a lossless compression method.
[0014] The present invention has the following beneficial effects: In this invention, dividing the image into sub-blocks allows for compression using different methods, initially achieving improved compression ratio while maintaining image quality. Obtaining the first and second peak-state feature values determines the peak-state characteristics of pixel grayscale distribution in the grayscale histogram of the image sub-block. Based on these peak-state characteristics, single-peak and multi-peak feature image sub-blocks are obtained. Obtaining these sub-blocks determines the appropriate compression method for different sub-blocks, further improving compression ratio while maintaining image quality. Obtaining peak regions determines the grayscale range of a large number of pixels in the multi-peak feature image sub-block. Obtaining overlap feature values characterizes the degree of overlap between peak regions, and obtaining peak difference determines the degree of difference between peak regions. Based on the overlap feature values and peak difference, peak regions suitable for grayscale mapping are determined, further improving compression effect and preserving image detail as much as possible. Finally, applying different compression methods to multi-peak and single-peak feature image sub-blocks improves compression ratio while maintaining image quality. Attached Figure Description
[0015] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art 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.
[0016] Figure 1 The flowchart illustrates a method for efficient grayscale image compression based on image processing, as provided in one embodiment of the present invention. Detailed Implementation
[0017] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of an efficient grayscale image compression method based on image processing proposed according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0018] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0019] The following description, in conjunction with the accompanying drawings, details a specific scheme for an efficient grayscale image compression method based on image processing provided by the present invention.
[0020] Please see Figure 1 The diagram illustrates a flowchart of an efficient grayscale image compression method based on image processing, according to an embodiment of the present invention. The method includes the following steps: Step S1: Obtain the grayscale image to be compressed.
[0021] Before compressing a grayscale image, preprocessing is required. The purpose of preprocessing is to eliminate irrelevant information, enhance key features, and simplify the data structure, thereby improving the efficiency and reliability of subsequent processing. Specific steps include: geometric correction, which aims to correct geometric distortions caused by shooting angle, lens distortion, or equipment during image acquisition, ensuring that the image content is consistent with the real scene. Methods include affine transformation or projection transformation. After correction, image enhancement is performed to highlight key information, suppress noise or irrelevant details, and improve image contrast and clarity. Methods include histogram equalization, contrast stretching, mean filtering, median filtering, and Gaussian filtering algorithms. It should be noted that implementers can select different existing geometric correction and image enhancement algorithms for preprocessing based on the characteristics of the grayscale image, thereby improving the efficiency and reliability of subsequent compression processing. After preprocessing, the grayscale image to be compressed is obtained.
[0022] Step S2: Divide the image into sub-blocks based on the size characteristics of the grayscale image; obtain the first peak feature value based on the difference in the number of pixels at each gray level in the grayscale histogram of the sub-blocks; obtain the second peak feature value based on the proportion of pixels at each gray level in the grayscale histogram.
[0023] Existing technologies typically perform lossless or lossy compression on the entire grayscale image. However, because different regions of a grayscale image contain varying amounts of information, using the same compression method makes it difficult to achieve both high quality and a high compression ratio. This invention proposes an efficient and intelligent compression approach. First, the grayscale image is segmented to obtain different sub-blocks. Then, a compression strategy is dynamically selected based on the features within each sub-block. Feature analysis is primarily based on the kurtosis characteristics exhibited in the grayscale histogram corresponding to the sub-block. When the grayscale histogram displays multi-kurtosis characteristics, it means that there are multiple objects and regions with different grayscale levels in the image, theoretically requiring the retention of more grayscale levels to avoid information loss. Furthermore, based on this idea, the analysis is expanded to analyze the kurtosis characteristics in the histogram, and under specific conditions, grayscale levels are rationally quantized or discarded, achieving lossy but efficient compression.
[0024] First, the grayscale image is divided into sub-blocks of the same size using a basic uniform grid division method. Therefore, the image sub-blocks are divided based on the size characteristics of the grayscale image. Preferably, in this embodiment of the invention, the step of obtaining image sub-blocks includes: In the formula, n represents the side length of the image sub-block, a represents the preset first adjustment parameter, b represents the preset second adjustment parameter, and s represents the geometric mean of the grayscale image. The grayscale image is divided into different image sub-blocks by using side length n. The geometric mean s is... w and h represent the number of pixels on both sides of the grayscale image, respectively; s represents the equivalent size of the grayscale image, which can be calculated using geometric mean or arithmetic mean. Taking the geometric mean calculation in this embodiment as an example, adjusting the values of a and b can control the trend of image sub-blocks changing with the grayscale image size. If it is desired that the size of the image sub-blocks be more sensitive to changes in image size, the value of a can be increased; if it is desired that the size of the image sub-blocks is not too small when the image size is small, the value of b can be appropriately increased. The implementer can determine the values of a and b according to the implementation scenario. It should be noted that this uniform grid division method is existing technology, and the specific process will not be described in detail. Compared with dynamic division methods that combine features such as image internal edge texture and gradient, this uniform grid division method has the advantages of high computational efficiency, low algorithm complexity, and higher stability. At the same time, this division method can ensure that the entire image is uniformly divided, which is convenient for subsequent analysis and processing, thereby achieving efficient compression of grayscale images.
[0025] Furthermore, lossy compression can achieve high efficiency and real-time performance in image compression. Its core is to remove redundant information in the image by reducing the number of gray levels or frequency domain transformation while retaining as much visually important information as possible. The gray-level histogram of the image sub-block can intuitively reflect the redundant features and analyze the degree of compression distortion of the image sub-block by lossy compression. The more concentrated the gray levels of the pixels in the histogram, the smaller the impact of lossy compression on the visual effect. Therefore, the peak characteristics in the gray-level histogram of the image sub-block can be analyzed to select an appropriate compression strategy. Thus, the first peak feature value is obtained based on the difference in the number of pixels at each gray level in the gray-level histogram of the image sub-block.
[0026] Preferably, in this embodiment of the invention, the step of obtaining the first peak feature value includes: calculating the peak coefficient of the number of pixels corresponding to all gray levels in the gray-level histogram of the image sub-block and performing positive correlation mapping to obtain the first peak feature value of the image sub-block. In this embodiment of the invention, the tanh hyperbolic tangent function is used for positive correlation mapping. The peak coefficient is a prior art technology. When the peak coefficient is larger, the first peak feature value is larger, which means that the distribution characteristics of the pixel gray levels in the gray-level histogram are more obvious than the peak characteristics of the normal distribution, and the pixel gray values are highly concentrated, showing a single-peak feature; conversely, when the peak coefficient is smaller, the first peak feature value is smaller, which means that the distribution of the pixel gray levels is relatively flat or there are multiple peaks. The formula for obtaining the first peak feature value includes:
[0027] In the formula, Z represents the first peak eigenvalue, and N represents the number of gray levels in the histogram. This represents the number of pixels at the i-th gray level. This represents the average number of pixels in a grayscale level. This represents the standard deviation of the number of pixels in the grayscale level. Subtracting 3 is to make the kurtosis coefficient of the normal distribution zero. Represents the kurtosis coefficient. This represents the hyperbolic tangent function, which maps the range to -1 to 1. When the first peak eigenvalue is greater than 0, it means that the unimodal characteristic is more obvious.
[0028] Furthermore, if the proportion of pixels corresponding to a certain gray level in the gray-level histogram is higher, the single-peak feature of the histogram is more obvious. Therefore, the second peak feature value is obtained based on the proportion of pixels of gray levels in the gray-level histogram. Preferably, in this embodiment of the invention, the step of obtaining the second peak feature value includes: calculating the ratio of the gray level with the most pixels in the gray-level histogram to the number of pixels of all gray levels to obtain the second peak feature value of the image sub-block. The larger the second peak feature value, the more consistent the gray values of the pixels in the image sub-block are, and the more the gray-level histogram exhibits a single-peak feature.
[0029] Step S3: Obtain single-peak feature image sub-blocks and multi-peak feature image sub-blocks based on the first peak state feature value and the second peak state feature value; obtain different peak regions in the gray-level histogram based on the number of pixels at different gray levels of the multi-peak feature image sub-blocks; obtain overlapping feature values based on the peak spacing and distribution features between peak regions; and obtain peak difference degree based on the height difference features between peak regions.
[0030] After obtaining the first peak feature value and the second peak feature value, single-peak feature image sub-blocks and multi-peak feature image sub-blocks can be obtained based on the first peak feature value and the second peak feature value. Preferably, in this embodiment of the invention, when the first peak feature value exceeds a preset first threshold and the second peak feature value exceeds a preset second threshold, the image sub-block is a single-peak feature image sub-block; otherwise, it is a multi-peak feature image sub-block. In this embodiment of the invention, the preset first threshold is 0, and the preset second threshold is 0.8. This threshold setting can meet the robustness requirements under various image sub-block scenarios, and the implementer can determine it according to the implementation scenario. For single-peak feature image sub-blocks exhibiting obvious single-peak features, it means that there are a large number of similar gray values in the image. Efficient compression can be achieved through coarse quantization or entropy coding, such as reducing the number of gray levels or Huffman coding. This compression method can retain important information while improving the compression effect. For multi-peak feature image sub-blocks, it means that the pixels have multiple grayscale ranges. Coarse quantization can easily lead to the incorrect merging of grayscale levels between different peaks, resulting in loss of details such as blurred edges and texture distortion. Therefore, multi-peak feature image sub-blocks need further analysis to try to improve the compression effect while avoiding loss of details.
[0031] Furthermore, when the grayscale histogram exhibits multi-peak features, if the grayscale ranges of multiple peaks overlap or the peak spacing is small, it means that a large number of pixels have similar grayscale features. Therefore, by merging overlapping peaks, the grayscale levels of such peak regions can be mapped to the same representative value, thereby reducing the distribution of grayscale levels and improving the compression effect while minimizing the loss of image details. First, different peak regions in the grayscale histogram are obtained based on the number of pixels at different grayscale levels of the multi-peak feature image sub-blocks. Preferably, in this embodiment of the invention, obtaining different peak regions includes: constructing the envelope of the grayscale histogram of the multi-peak feature image sub-blocks and obtaining the peak points in the envelope. It should be noted that constructing the envelope is an existing technology, and the specific steps will not be elaborated here. The envelope can weaken the subtle changes in the number of grayscale pixels, making the selection of peak points more representative. Calculate the product of the peak point and a preset descent factor, and round down to obtain the boundary corresponding to the peak point. In this embodiment, the preset descent factor is 0.8. For example, if the peak point is 100, the boundary value is 80. Find gray levels with 80 pixels on both sides of the peak point as the boundary of the peak region. The implementer can determine the preset descent factor according to the implementation scenario. The gray level interval corresponding to the boundary is taken as the peak region. The peak region represents the gray level interval where a large number of pixels are concentrated in a multi-peak feature image sub-block. Then, the overlapping feature value can be obtained according to the peak spacing feature and distribution feature between peak regions. Preferably, in this embodiment, the step of obtaining the overlapping feature value includes:
[0032] In the formula, The eigenvalues representing the overlap between peak regions x and y are given. This represents an exponential function with the natural constant as its base. This represents the average gray level of the peak region x. This represents the average gray level of the peak region y. The difference value indicates the degree of difference. The closer the mean gray levels of two peak regions are, the smaller the difference value, which means that the peak spacing is closer and the gray-level features of the pixels are more similar. This represents the left boundary gray level formed by the peak region x and y. and the right boundary gray level The longer the distance between two peak regions, the greater the distance between the left boundary of the left peak region and the right boundary of the right peak region, and the longer the interval length. This represents the width of the peak region x. This represents the width of the peak region y. This represents the distribution interval. When two peak regions overlap, their widths exceed the interval length, resulting in a smaller distribution interval. Conversely, the greater the distance between two peak regions, the larger the interval length becomes due to the presence of gray levels outside the peak regions, leading to a larger distribution interval. Therefore, a larger overlap feature value indicates a greater degree of overlap between the two peak regions. This results in a closer approximation of the gray levels of many pixels in a multi-peak feature image sub-block, enabling the mapping of excessively overlapping gray levels to the same gray level. This improves compression efficiency without losing important image information.
[0033] Furthermore, if the height of the main peak in the grayscale histogram of a multi-peak feature image sub-block is significantly higher than that of the secondary peak, and the area corresponding to the secondary peak is small, it can be considered that the secondary peak is more likely caused by noise, reflection, or irrelevant details, and has limited impact on the overall visual effect. Therefore, the grayscale level corresponding to the secondary peak can be discarded and mapped to the vicinity of the main peak grayscale level, thereby improving the compression effect while ensuring image quality. Therefore, the peak difference degree is obtained based on the height difference characteristics between peak regions. Preferably, in this embodiment of the invention, the step of obtaining the peak difference degree includes: calculating the ratio of the maximum number of pixels in each peak region to the number of pixels in the multi-peak feature image sub-block to obtain the significance level; the greater the significance level, the more pixels there are in the grayscale level corresponding to that peak region. The difference between the maximum significance level and the significance level corresponding to any other peak region is calculated and normalized to obtain the peak difference degree between peak regions; the greater the peak difference degree, the greater the number of pixels in the largest peak region than the number of pixels in any other peak region; the fewer pixels there are in any other peak region, the more likely the corresponding grayscale level can be discarded.
[0034] Step S4: Map the gray levels of pixels in the multi-peak feature image sub-blocks according to the overlapping feature values and peak difference, and re-determine the peak state attributes of the multi-peak feature image sub-blocks; compress the multi-peak feature image sub-blocks and single-peak feature image sub-blocks using different compression methods.
[0035] After obtaining the overlapping feature values and peak difference of a multi-peak feature image sub-block, the gray levels of pixels in the multi-peak feature image sub-block can be mapped according to the overlapping feature values and peak difference, and the peak state attribute of the multi-peak feature image sub-block can be re-determined. Preferably, in this embodiment of the invention, when the peak difference exceeds a preset difference threshold, the gray levels of pixels in any other peak region are mapped to the median gray level of the peak region with the maximum saliency. The mapping step specifically includes: calculating the median gray level of the peak region with the maximum saliency, and replacing the gray level of pixels in any other peak with the median gray level. In this embodiment of the invention, the preset difference threshold is 0.7, which can be determined by the implementer according to the implementation scenario. Through this mapping, the gray level range of pixels in the image sub-block can be made more concentrated, improving the compression effect while reducing the loss of visual effect. When the overlap feature value of any two peak regions exceeds a preset overlap threshold, it means that the two peak regions have a high degree of overlap. In this embodiment of the invention, the preset overlap threshold is 0.5, which can be determined by the implementer according to the implementation scenario. The gray level of the pixels in the two peak regions is mapped to the mean gray level of the two peak regions. This makes the gray level of a large number of pixels with highly similar gray level distributions consistent, improving the compression effect without excessively affecting the image quality. The mapping step specifically includes: calculating the mean gray level of the pixels in the two peak regions, and replacing the gray level of the pixels in the two peak regions with the mean gray level. When there is only one peak region in the multi-peak feature image sub-block after mapping, the peak state attribute of the multi-peak feature image sub-block is converted to a single-peak feature image sub-block; otherwise, it remains a multi-peak feature image sub-block. The implementer can determine the value of the peak region gray level mapping according to the implementation scenario.
[0036] Furthermore, after mapping the multi-peak features of the multi-peak feature image sub-blocks and re-dividing the peak state attributes, different compression methods can be used to compress the multi-peak feature image sub-blocks and single-peak feature image sub-blocks. Preferably, in this embodiment of the invention, lossy compression is used for single-peak feature image sub-blocks, and lossless compression is used for multi-peak feature image sub-blocks. Since single-peak feature image sub-blocks contain a lot of redundant information, coarse quantization can be used, for example, compressing 256 levels to 32 levels to reduce the number of stored gray levels; or existing entropy coding algorithms can be used for compression, such as DPCM differential pulse code modulation, which utilizes the spatial correlation of pixels to store only the difference between the current pixel and the pixel to its left or above. By combining this algorithm with single-peak features, the number of bits for entropy coding can be reduced, and the compression effect can be improved. For multi-peak image sub-blocks, if the compression scenario requires high image quality, lossless compression can be performed directly. If the image quality requirement is lower, an adaptive lossy compression algorithm can be selected based on the peak characteristics. For peak regions with a high percentage of pixels, fine quantization can be used to reduce the grayscale compression level, for example, compressing 256 levels to 128 levels to preserve details. For peak regions with a low percentage of pixels, coarse quantization can be used, for example, compressing 256 levels to 32 levels to improve the compression effect. By applying different compression methods to different image sub-blocks, the compression effect can be improved while ensuring the display effect of important details in the entire grayscale image. Implementers can set the compression method according to the peak characteristics of the image sub-blocks, which is not limited here.
[0037] In summary, this invention provides an efficient grayscale image compression method based on image processing. The method involves dividing the grayscale image into sub-blocks based on its size characteristics; obtaining single-peak and multi-peak feature image sub-blocks based on the number of pixels at different gray levels in the grayscale histogram of each sub-block; obtaining different peak regions based on the number of pixels at different gray levels within the multi-peak feature image sub-blocks; obtaining overlap feature values based on the peak spacing and distribution characteristics between peak regions; obtaining peak difference degrees based on the height difference characteristics between peak regions; and mapping the gray levels of pixels in the multi-peak feature image sub-blocks based on the overlap feature values and peak difference degrees, and then re-evaluating the peak state attributes of the multi-peak feature image sub-blocks. This invention uses different compression methods for multi-peak and single-peak feature image sub-blocks, improving compression efficiency while maintaining image quality.
[0038] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0039] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
Claims
1. A method for efficient grayscale image compression based on image processing, characterized in that, The method includes the following steps: Obtain the grayscale image to be compressed; The image is divided into sub-blocks based on its size characteristics; a first peak feature value is obtained based on the difference in the number of pixels at each gray level in the gray-level histogram of the sub-blocks; and a second peak feature value is obtained based on the proportion of pixels at each gray level in the gray-level histogram. Single-peak feature image sub-blocks and multi-peak feature image sub-blocks are obtained based on the first peak state feature value and the second peak state feature value; different peak regions in the gray-level histogram are obtained based on the number of pixels at different gray levels of the multi-peak feature image sub-blocks; overlap feature values are obtained based on the peak spacing and distribution features between the peak regions; and peak difference degree is obtained based on the height difference features between the peak regions. The gray levels of pixels in the multi-peak feature image sub-block are mapped according to the overlapping feature value and the peak difference, and the peak state attribute of the multi-peak feature image sub-block is re-determined; the multi-peak feature image sub-block and the single-peak feature image sub-block are compressed using different compression methods.
2. The efficient grayscale image compression method based on image processing according to claim 1, characterized in that, The step of dividing the image into sub-blocks based on the size features of the grayscale image includes: In the formula, n represents the side length of the image sub-block, a represents the preset first adjustment parameter, b represents the preset second adjustment parameter, and s represents the geometric mean of the grayscale image; the grayscale image is divided by the side length n to obtain different image sub-blocks.
3. The efficient grayscale image compression method based on image processing according to claim 1, characterized in that, The step of obtaining the first kurtosis feature value based on the difference in the number of pixels at each gray level in the gray-level histogram of the image sub-block includes: Calculate the kurtosis coefficients of the number of pixels corresponding to all gray levels in the gray-level histogram of the image sub-block and perform positive correlation mapping to obtain the first kurtosis feature value of the image sub-block.
4. The efficient grayscale image compression method based on image processing according to claim 1, characterized in that, The step of obtaining the second peak state feature value based on the pixel quantity ratio feature of gray level in the gray-level histogram includes: The second peak state feature value of the image sub-block is obtained by calculating the ratio of the number of pixels at the gray level with the most pixels in the gray level histogram to the number of pixels at all gray levels.
5. The efficient grayscale image compression method based on image processing according to claim 1, characterized in that, The step of obtaining single-peak feature image sub-blocks and multi-peak feature image sub-blocks based on the first peak feature value and the second peak feature value includes: When the first peak feature value exceeds a preset first threshold and the second peak feature value exceeds a preset second threshold, the image sub-block is a single-peak feature image sub-block; otherwise, it is a multi-peak feature image sub-block.
6. The efficient grayscale image compression method based on image processing according to claim 1, characterized in that, The step of obtaining different peak regions in the gray-level histogram based on the number of pixels at different gray levels of the multi-peak feature image sub-blocks includes: Construct the envelope of the grayscale histogram of the multi-peak feature image sub-block and obtain the peak points in the envelope. Calculate the product of the peak points and a preset descent factor and round down to obtain the boundary corresponding to the peak points. Take the grayscale interval corresponding to the boundary as the peak region.
7. The efficient grayscale image compression method based on image processing according to claim 1, characterized in that, The step of obtaining the overlapping feature value based on the peak spacing characteristics and distribution characteristics between the peak regions includes: In the formula, The eigenvalues representing the overlap between peak regions x and y are given. This represents an exponential function with the natural constant as its base. This represents the average gray level of the peak region x. This represents the average gray level of the peak region y. Indicates the degree of difference. This represents the left boundary gray level formed by the peak region x and y. and the right boundary gray level The length of the interval between them This represents the width of the peak region x. This represents the width of the peak region y. Indicates the distribution interval.
8. The efficient grayscale image compression method based on image processing according to claim 1, characterized in that, The step of obtaining the peak difference degree based on the height difference characteristics between the peak regions includes: The ratio of the maximum number of pixels in each peak region to the number of pixels in the multi-peak feature image sub-block is calculated to obtain the significance level; the difference between the maximum value of the significance level and the significance level corresponding to any other peak region is calculated and normalized to obtain the peak difference between peak regions.
9. The efficient grayscale image compression method based on image processing according to claim 8, characterized in that, The step of mapping the gray levels of pixels in the multi-peak feature image sub-block according to the overlapping feature value and the peak difference degree, and re-determining the peak state attribute of the multi-peak feature image sub-block includes: When the peak difference exceeds a preset difference threshold, the gray levels of pixels in any other peak region are mapped to the median gray level of the peak region with the maximum saliency. When the overlap feature value of any two peak regions exceeds a preset overlap threshold, the gray levels of pixels in any two peak regions are mapped to the mean gray level of any two peak regions. When only one peak region exists in the multi-peak feature image sub-block after mapping, the peak state attribute of the multi-peak feature image sub-block is converted into a single-peak feature image sub-block.
10. The efficient grayscale image compression method based on image processing according to claim 1, characterized in that, The step of compressing the multi-peak feature image sub-blocks and the single-peak feature image sub-blocks using different compression methods includes: The single-peak feature image sub-blocks are compressed using a lossy compression method, while the multi-peak feature image sub-blocks are compressed using a lossless compression method.
Citation Information
Patent Citations
Infrared image enhancing method
CN103530847A
Image forensics method for natural image and compressed and tampered image based on DWT
CN103903271A
Grayscale image compression method and device based on approximate difference calculation and decompression method
CN116866603A
Audio and video media transmission method and system
CN119767009A
Method And Device For Texture Based Coding
US20080130759A1