Method, apparatus and electronic device for image compression
By performing pixel block quantization and discrete cosine transform on the image, combining a probability model to select a compression algorithm and performing adaptive entropy coding, the problem of low image transmission efficiency in satellite communication is solved, achieving efficient and high-quality image compression.
Patent Information
- Application Number
- CN202410833827.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2044-06-25
AI Technical Summary
Existing image compression algorithms cannot effectively reduce data volume in satellite communications, resulting in low transmission efficiency and poor communication quality.
By dividing the original image into multiple pixel blocks, performing quantization and discrete cosine transform, combining a probability model to select the most suitable compression algorithm, and then performing adaptive entropy coding, a compressed image is finally generated.
It achieves efficient image compression, reduces data volume, improves transmission efficiency, and ensures image quality, adapting to different image characteristics and transmission needs.
Smart Images

Figure CN118646891B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of image processing, in particular to an image compression method and device and electronic equipment. BACKGROUND
[0002] The Tianhong satellite mobile communication system is the first satellite mobile communication system independently constructed by China. The Tianhong terminal refers to a terminal device based on the Tianhong satellite communication system, which is used to implement satellite communication. In particular, in areas where the ground communication network cannot cover or the signal is poor, the requirement for communication quality is higher when using the Tianhong satellite mobile communication system for communication.
[0003] Image compression algorithm is a key technology in the field of computer science and information technology, which is used to reduce the size of image data for more efficient storage and transmission. Image compression can greatly reduce the required storage space or transmission bandwidth while maintaining image quality. However, in satellite communication, traditional image compression algorithms cannot well perform image compression and cannot guarantee communication quality, resulting in large amount of data transmission, large data transmission error rate, and low transmission efficiency.
[0004] At present, there is no effective solution to the above problems. SUMMARY
[0005] The embodiments of the present application provide an image compression method, device and electronic equipment to at least solve the technical problems of large amount of data and low transmission efficiency in related art when transmitting images through satellites.
[0006] According to an aspect of an embodiment of the present application, an image compression method is provided, including: obtaining an original image to be compressed; dividing the original image into a plurality of pixel blocks, and performing quantization processing on the pixel points in each pixel block to obtain quantization coefficients corresponding to each pixel point; determining a probability value corresponding to each pixel point in the original image using a probability model, and determining a target compression algorithm from a plurality of compression algorithms according to the probability value, wherein the probability value is used to represent the gray level corresponding to the pixel point, and the encoding efficiency of different types of compression algorithms in the plurality of compression algorithms is different; and performing compression processing on the quantization coefficients corresponding to each pixel point according to the target compression algorithm to obtain a compressed image.
[0007] Optionally, the quantization processing on the pixel points in each pixel block to obtain the quantization coefficients corresponding to each pixel point includes: performing discrete cosine transform on the pixel points in each pixel block to obtain transform coefficients corresponding to the pixel points in each pixel block; and performing quantization processing on the transform coefficients to obtain the quantization coefficients.
[0008] Optionally, the discrete cosine transform is performed on the pixel points in each pixel block to obtain a transform coefficient corresponding to each pixel point in each pixel block, including: obtaining a target pixel point in each pixel block, wherein the target pixel point is a pixel point corresponding to a target row and a target column in each pixel block, the target row is any row in each pixel block, and the target column is any column in each pixel block; determining a total number of pixel blocks corresponding to the plurality of pixel blocks; and determining a transform coefficient corresponding to the target pixel point after the discrete cosine transform is performed on the target pixel point according to the target pixel point and the total number of pixel blocks.
[0009] Optionally, the transform coefficient is quantized to obtain a quantized coefficient, including: performing smoothing processing on the transform coefficient to obtain a first intermediate value; determining a quantization step according to the transform coefficient, wherein the transform coefficient and the quantization step are negatively correlated; and determining the quantized coefficient according to the first intermediate value and the quantization step.
[0010] Optionally, the smoothing processing is performed on the transform coefficient to obtain a first intermediate value, including: determining a quantization matrix when the quantization processing is performed on the transform coefficient; determining a quantized element corresponding to the transform coefficient from the quantization matrix; and performing the smoothing processing on a ratio of the transform coefficient and the quantized element to obtain the first intermediate value.
[0011] Optionally, the target compression algorithm is determined from the plurality of compression algorithms according to the probability value, including: in a case where the probability value is greater than a preset threshold, determining the target compression algorithm from a first type of compression algorithm in the plurality of compression algorithms; and in a case where the probability value is less than or equal to the preset threshold, determining the target compression algorithm from a second type of compression algorithm in the plurality of compression algorithms, wherein the encoding efficiency of the first type of compression algorithm is greater than the encoding efficiency of the second type of compression algorithm.
[0012] Optionally, the method further includes: determining a transmission format required by a target satellite to transmit the compressed image; and performing format conversion on the compressed image according to the transmission format, and sending the compressed image after the format conversion to a receiving end by the target satellite.
[0013] According to another aspect of the embodiments of the present application, an image compression device is also provided, including: an acquisition module configured to acquire an original image to be compressed; a processing module configured to divide the original image into a plurality of pixel blocks, and perform quantization processing on pixel points in each pixel block to obtain a quantized coefficient corresponding to each pixel point; a determination module configured to determine a probability value corresponding to each pixel point in the original image by using a probability model, and determine a target compression algorithm from a plurality of compression algorithms according to the probability value, wherein the probability value is used to represent a gray level corresponding to the pixel point, and the encoding efficiency of different types of compression algorithms in the plurality of compression algorithms is different; and a compression module configured to perform compression processing on the quantized coefficient corresponding to each pixel point according to the target compression algorithm to obtain a compressed image.
[0014] According to a further aspect of the embodiments of the present application, an electronic device is also provided, comprising: a memory for storing program instructions; a processor connected with the memory, for executing the program instructions to realize the following functions: obtaining an original image to be compressed; dividing the original image into a plurality of pixel blocks, and performing quantization processing on the pixel points in each pixel block to obtain quantization coefficients corresponding to each pixel point; determining a probability value corresponding to each pixel point in the original image by using a probability model, and determining a target compression algorithm from a plurality of compression algorithms according to the probability value, wherein the probability value is used to represent a gray level corresponding to the pixel point, and the coding efficiency of different types of compression algorithms in the plurality of compression algorithms is different; and performing compression processing on the quantization coefficients corresponding to each pixel point according to the target compression algorithm to obtain a compressed image.
[0015] According to a further aspect of the embodiments of the present application, a non-volatile storage medium is also provided, comprising a stored computer program, wherein a device in which the non-volatile storage medium is located executes the above-mentioned image compression method by running the computer program.
[0016] According to a further aspect of the embodiments of the present application, a computer program product is also provided, comprising computer instructions which, when executed by a processor, realize the above-mentioned image compression method.
[0017] In the embodiments of the present application, by obtaining an original image to be compressed; dividing the original image into a plurality of pixel blocks, and performing quantization processing on the pixel points in each pixel block to obtain quantization coefficients corresponding to each pixel point; determining a probability value corresponding to each pixel point in the original image by using a probability model, and determining a target compression algorithm from a plurality of compression algorithms according to the probability value, wherein the probability value is used to represent a gray level corresponding to the pixel point, and the coding efficiency of different types of compression algorithms in the plurality of compression algorithms is different; and performing compression processing on the quantization coefficients corresponding to each pixel point according to the target compression algorithm to obtain a compressed image, the purpose of optimizing image storage and transmission efficiency is achieved, thereby realizing the technical effect of efficient image compression, and further solving the technical problems of large data volume and low transmission efficiency in the related art when transmitting images by satellite. BRIEF DESCRIPTION OF DRAWINGS
[0018] The accompanying drawings, which are included to provide a further understanding of the present application, form a part of the present application and illustrate the illustrative embodiments of the present application and the explanation of the present application, and do not constitute improper limitations on the present application. In the drawings:
[0019] Figure 1 is a hardware structure block diagram of a computer terminal for realizing the image compression method according to the embodiments of the present application;
[0020] Figure 2is a flow chart of a method for image compression according to an embodiment of the present application;
[0021] Figure 3 is a structural diagram of a device for image compression according to an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to make the personnel in the art better understand the scheme of the present application, the technical scheme in the embodiments of the present application will be clearly and completely described below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should fall within the scope of protection of the present application.
[0023] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0024] First, some nouns or terms appearing in the process of explaining the embodiments of the present application are applicable to the following explanations:
[0025] Tiantong terminal: Tiantong terminal refers to a terminal device using Tiantong satellite communication system, used to realize the transmission of text, voice, image, video and other information.
[0026] Image compression algorithm: an algorithm for reducing the size of image data without losing too much image quality, aiming to improve the storage and transmission efficiency of images.
[0027] Lossy compression: a compression method that loses part of the image information in the compression process, which can usually achieve a higher compression ratio, but may result in a decrease in image quality.
[0028] Lossless Compression: A compression method that does not lose any image information during compression, which can maintain the quality of the original image, but usually has lower compression.
[0029] Discrete Cosine Transform (DCT): Mainly used for data or image compression, which can convert spatial signals to frequency domain and has good decorrelation performance. DCT transformation itself is lossless, but it creates good conditions for subsequent quantization, Huffman coding, etc. in image coding and other fields. At the same time, since DCT transformation is symmetrical, it can use DCT inverse transformation after quantization coding to restore the original image information at the receiving end. DCT transformation has a very wide range of applications in current image analysis and compression fields. Common JPEG static image encoding and MJPEG, MPEG dynamic encoding standards all use DCT transformation.
[0030] Quantization: In image compression, the coefficients after DCT transformation are mapped to a set of discrete values. In the quantization process, the precision of low-frequency coefficients (representing image detail information) is usually reduced, while the precision of high-frequency coefficients (representing image outline and noise) remains relatively high, thereby achieving compression.
[0031] Entropy Coding: A method of encoding according to the probability of data occurrence, used for further lossless compression of quantized data. Common entropy coding methods include Huffman coding and arithmetic coding.
[0032] JPEG (Joint Photographic Experts Group): A widely used image compression standard, using lossy compression method, suitable for compression of static images.
[0033] ROI (Region of Interest): Region of interest, i.e. important part of image that needs to be preserved or specially processed. The overall image quality can be optimized by higher quality compression or special processing of ROI.
[0034] Adaptive Compression: A compression method that automatically adjusts compression parameters according to image content or application requirements to achieve optimal compression effect and image quality.
[0035] In order to solve the problems in the related art, the embodiments of the present application provide a method for image compression, which can run in Figure 1 The computer terminal is illustrated as follows.
[0036] The image compression method embodiments provided in this application can be executed on mobile terminals, computer terminals, or similar computing devices. Figure 1 A hardware block diagram of a computer terminal for implementing an image compression method is shown. Figure 1 As shown, the computer terminal 10 may include one or more processors (shown as 102a, 102b, ..., 102n in the figure) (the processor may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission module 106 for communication functions connected via wired and / or wireless networks. In addition, it may also include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, and a BUS bus. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0037] It should be noted that the aforementioned one or more processors and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be implemented wholly or partially as software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be wholly or partially integrated into any other element in the computer terminal 10. As involved in the embodiments of this application, the data processing circuits serve as processor control (e.g., selection of a variable resistor termination path connected to an interface).
[0038] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the image compression method in this embodiment. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the image compression method described above. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0039] The transmission module 106 is configured to receive or send data via a network. The network can include, for example, a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission module 106 includes a network interface controller (NIC) that can connect to other network devices through a base station to communicate with the Internet. In one example, the transmission module 106 can be a radio frequency (RF) module that is configured to communicate with the Internet wirelessly.
[0040] The display can be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10.
[0041] It is noted that in some alternative embodiments, the above Figure 1 The computer terminal can include hardware elements (including circuitry), software elements (including computer code stored on a computer readable medium), or a combination of both hardware and software elements. It should be noted that in some embodiments, the computer terminal can be comprised of a plurality of computer terminals that are connected together in a networked environment. Figure 1 is merely one example of a particular implementation and is intended to illustrate the types of components that can be present in the computer terminal.
[0042] In the above operating environment, the present embodiment provides a method for image compression. It is noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown.
[0043] Figure 2 is a flowchart of a method for image compression according to the present embodiment. As shown in the flowchart, the method includes the following steps: Figure 2
[0044] Step S202: obtaining an original image to be compressed.
[0045] In step S202, the original image to be compressed can be obtained by a camera or other device.
[0046] Step S204: dividing the original image into a plurality of pixel blocks, and quantizing the pixels in each pixel block to obtain a quantization coefficient corresponding to each pixel.
[0047] In step S204, the size of the pixel blocks can be fixed, such as 8x8, 16x16, etc., or dynamically determined according to the image content or algorithm requirements. The division of the pixel blocks helps to divide the image into smaller and more manageable regions. In each pixel block, the pixels are quantized. Quantization is a step in image processing used to reduce the amount of data, which involves mapping the pixel's gray value or color value to fewer possible values. In the quantization process, a quantization level is usually set. For example, if the quantization level is 64, the pixel's gray value will be rounded to the nearest multiple of 64 (i.e. 0, 64, 128,..., 255). This process is equivalent to reducing the original gray value range (0-255) to a smaller range, thereby reducing the data precision and storage requirements. Quantization can be implemented by different methods, such as uniform quantization, non-uniform quantization, etc. Uniform quantization uniformly divides the original gray value range into several levels, while non-uniform quantization divides the range with unequal intervals according to the distribution of pixel values. After quantization, each pixel has a corresponding quantization value, which is the quantization coefficient mentioned above.
[0048] In step S206, a probability model is used to determine the probability value of each pixel in the original image, and the target compression algorithm is determined from the multiple compression algorithms according to the probability value. The probability value represents the gray level of the pixel, and the encoding efficiency of different types of compression algorithms in the multiple compression algorithms is different.
[0049] In step S206, a probability model needs to be established for the gray levels of the original image, i.e. analyzing the frequency of each gray level in the image. For each possible gray level (usually 0 to 255), the number of times it appears in the image is calculated and divided by the total number of pixels in the image, thereby obtaining the probability value of the gray level. The probability value represents the likelihood of the gray level appearing in the image. The more common the gray level, the higher the probability value of the pixel corresponding to it. These probability values help to understand the distribution of gray levels in the image, so that the most effective compression algorithm can be selected according to this information.
[0050] With the probability values of each gray level, the encoding efficiency of different compression algorithms on the original image can be evaluated. Different compression algorithms may have different performance on images with different gray level distributions. For example, some algorithms may be more suitable for handling images with a large number of similar gray levels, while others may be more suitable for handling images with a wide range of gray level distributions. To select the best compression algorithm, use these probability values to simulate the compression effect of different algorithms on the image, and compare their compression rates and the quality of the reconstructed image. Encoding efficiency is one of the key factors in evaluating the performance of compression algorithms, which represents how much redundant information the algorithm can remove when compressing the image while maintaining the quality of the reconstructed image. The higher the encoding efficiency, the higher the compression rate that can be achieved while maintaining the same reconstruction quality, or the better the reconstruction quality that can be provided when achieving the same compression rate.
[0051] By using the probability model to determine the probability value corresponding to each pixel point in the original image, and selecting the target compression algorithm from multiple compression algorithms according to these probability values, an intelligent image compression strategy can be implemented. This strategy can fully utilize the distribution information of the gray levels in the image, thereby selecting the most suitable compression algorithm for the image, improving the compression efficiency and maintaining the quality of the reconstructed image.
[0052] Step S208, according to the target compression algorithm, the quantization coefficients corresponding to each pixel point are compressed to obtain a compressed image.
[0053] In the above step S208, the selected target compression algorithm is used to compress the quantization coefficients. It can include the following encoding methods: (1) when performing predictive encoding, the prediction value is obtained according to the statistical characteristics of the data, and then the difference signal between the image pixel and its prediction value is transmitted, so that the code rate of transmission is reduced to achieve the purpose of compression; (2) when performing statistical encoding, it is mainly aimed at non-memory sources, and the compression encoding is performed according to the distribution characteristics of the information code word appearance probability, such as Huffman encoding and arithmetic encoding. These encoding methods use short codes to represent quantization coefficients with higher probability of occurrence, and use long codes to represent quantization coefficients with lower probability of occurrence; (3) when performing transform encoding, the correlation between pixels within an image block is utilized to transform the image to a new basis (such as frequency domain), so that the energy is concentrated, facilitating subsequent compression processing.
[0054] In the above process, the compression algorithm will select the optimal encoding method according to the probability distribution and characteristics of the quantization coefficients, in order to maximize the reduction of data redundancy while maintaining the visual quality of the image. Through effective compression processing of the quantization coefficients, the storage space of the image and the network transmission bandwidth requirement can be significantly reduced, and the efficiency and performance of image processing can be improved. After compression processing, the obtained compressed data is encoded according to the selected image format to generate the final compressed image file.
[0055] Through the steps S202 to S208, the purpose of optimizing the image storage and transmission efficiency is achieved, thereby realizing the technical effect of efficient image compression, and further solving the technical problems of large data volume and low transmission efficiency in related art when transmitting images through satellites. The following is described.
[0056] In the step S204 of the image compression method, the pixel points in each pixel block are quantized to obtain the quantization coefficients corresponding to each pixel point, including: performing discrete cosine transform on the pixel points in each pixel block to obtain the transform coefficients corresponding to the pixel points in each pixel block; and performing quantization processing on the transform coefficients to obtain the quantization coefficients.
[0057] In the embodiment of the present application, the input image block (for example, an n x n pixel block) is subjected to DCT transform to convert the image from the spatial domain to the frequency domain. The DCT transform can effectively concentrate the energy of the image in the low frequency part, facilitating subsequent quantization processing. Specifically, the DCT transform decomposes the image block into a series of frequency components, wherein the low frequency components represent the smooth changes in the image, and the high frequency components represent the details and textures in the image. The result of the DCT transform is to generate a coefficient block of the same size as the original image block, and each coefficient corresponds to a pixel point in the original image block. DCT can better concentrate the frequency domain information and concentrate the more important information of the image together. The coefficients after DCT transform are subjected to quantization processing to reduce the data volume. In the quantization process, different quantization steps are set according to the importance of the transform coefficients and the degree of influence on the image quality. For example, the larger the transform coefficient D is, the more important it is, and the smaller the step is. Specifically, the transform coefficients in the low frequency part use a smaller quantization step to retain more information; the transform coefficients in the high frequency part use a larger quantization step to reduce the data volume. In quantization, a quantization matrix Q is usually used to complete the quantization. The elements in the matrix determine the degree of quantization of each transform coefficient.
[0058] In the above step, the pixel points in each pixel block are subjected to discrete cosine transform to obtain the transform coefficients corresponding to the pixel points in each pixel block, including: obtaining a target pixel point in each pixel block, wherein the target pixel point is a pixel point corresponding to a target row and a target column in each pixel block, the target row is any row in each pixel block, and the target column is any column in each pixel block; determining a total number of pixel blocks corresponding to the plurality of pixel blocks; and determining the transform coefficients corresponding to the target pixel point after the discrete cosine transform on the target pixel point according to the target pixel point and the total number of pixel blocks.
[0059] In the embodiments of the present application, it is assumed that F(i, j) is a target pixel point in a pixel block, i and j respectively represent the i-th row and the j-th column of the pixel block, D(u, v) is a coefficient after two-dimensional discrete cosine transformation, i.e., the above-mentioned transformation coefficient, wherein u represents the result of i mapping, and v represents the result of j mapping, and the formula is as follows:
[0060]
[0061] In the above formula, u, v = 0, 1, …, N-1, C(u) and C(v) are normalization coefficients, C(u) and C(v) are 0 when u = 0 or v = 0, and 1 otherwise, and N is the total number of the pixel block.
[0062] In the above step, the transformation coefficient is quantized to obtain a quantized coefficient, including: smoothing the transformation coefficient to obtain a first intermediate value; determining a quantization step according to the transformation coefficient, wherein the transformation coefficient and the quantization step are negatively correlated; and determining the quantized coefficient according to the first intermediate value and the quantization step.
[0063] In the above step, the transformation coefficient is smoothed to obtain a first intermediate value, including: determining a quantization matrix when the transformation coefficient is quantized; determining a quantization element corresponding to the transformation coefficient from the quantization matrix; and smoothing the ratio of the transformation coefficient and the quantization element to obtain the first intermediate value.
[0064] In the embodiments of the present application, the quantization formula is as follows:
[0065]
[0066] Wherein L(u, v) is a DCT coefficient after quantization, i.e., the above-mentioned quantized coefficient, L(u, v) step is a corresponding quantization step, the result of using the round function for smoothing is the above-mentioned first intermediate value, and Q(u, v) is a quantization element in the quantization matrix Q.
[0067] In step S206 of the above-mentioned image compression method, the target compression algorithm is determined from the plurality of compression algorithms according to the probability value, including: in the case that the probability value is greater than a preset threshold, the target compression algorithm is determined from a first type of compression algorithm in the plurality of compression algorithms; and in the case that the probability value is less than or equal to the preset threshold, the target compression algorithm is determined from a second type of compression algorithm in the plurality of compression algorithms, wherein the encoding efficiency of the first type of compression algorithm is greater than the encoding efficiency of the second type of compression algorithm.
[0068] In the embodiments of the present application, different compression algorithms may differ in encoding efficiency, compression ratio, computational complexity, etc. For the first type of compression algorithm, generally has a high encoding efficiency, that is, under the same compression ratio, they can produce smaller file size, or under the same file size, they can provide higher compression ratio, such as Huffman coding, run-length encoding, etc. The encoding efficiency of the second type of compression algorithm is generally lower than that of the first type of algorithm, such as variable-length coding, arithmetic coding, etc.
[0069] By collecting and analyzing the statistical characteristics of the original image, such as the distribution of pixel values, texture direction, etc., the statistical results are obtained, based on which the probability model is constructed to determine the gray level corresponding to the pixel points in the original image, i.e. the above-mentioned probability value is obtained, based on which the probability distribution corresponding to the original image can be determined, and according to the probability distribution, a suitable entropy coding method is determined for compression, i.e. the target compression algorithm such as Huffman coding or arithmetic coding is determined. Specifically, according to the probability distribution, code words of different lengths are allocated, so as to more effectively utilize the storage space. For the probability value with high frequency of occurrence, Huffman coding, run-length encoding, etc. are used for encoding; for the probability value with low frequency of occurrence, variable-length coding, arithmetic coding, etc. are used for encoding. In the encoding process, the probability distribution and the encoding strategy are dynamically adjusted according to the statistical results of different original images to adapt to the changes of image data, so as to realize efficient image compression in different scenarios, and further reduce the data amount under the premise of ensuring the image quality. In the compression process, noise reduction and enhancement techniques can also be used to ensure that the compressed image has high clarity and visual effect, and the encoded data is output as a compressed code stream for storage or transmission.
[0070] In the above-mentioned image compression method, the method further comprises: determining a transmission format required by a target satellite to transmit the compressed image; and performing format conversion on the compressed image according to the transmission format, and sending the compressed image after format conversion to a receiving end through the target satellite.
[0071] In the embodiments of the present application, when using a target satellite for image or data transmission, the target satellite may be, for example, a Tianhong satellite, and the image transmission format supported by the target satellite needs to be known, and the requirements of the receiving end for the image format also need to be known. Common satellite image transmission formats include GeoTIFF, JPEG2000, BigTIFF, etc. According to the requirements and the support of the satellite and the receiving end, a suitable image transmission format is selected. For example, the GeoTIFF format is often used for transmission of geographic information images because of its feature of combining image data with geospatial information; and the JPEG2000 format is suitable for transmission of high image quality at a smaller file size because of its efficient image compression performance. According to the selected transmission format, a corresponding image format conversion tool is selected, including an online webpage tool, professional image processing software, a command line tool or a terminal application, etc., and the selected tool is used to convert the compressed image from the current format to the selected transmission format. After confirming that the format conversion is completed, the converted image file is prepared for transmission. In order to ensure the safety and identifiability of the file during transmission, some file naming, organization or encryption operations are needed, and the prepared image file is sent to the receiving end by using the transmission system or equipment of the target satellite. The receiving end restores the compressed image to the original image by decompression after receiving the compressed image.
[0072] The method for image compression provided in the embodiments of the present application has the following advantages: (1) efficient compression: by combining DCT transformation, quantization and adaptive entropy coding technology, efficient image compression is realized, the data volume is effectively reduced, the satellite communication bandwidth occupation is reduced, the storage cost is saved, the image transmission speed is accelerated, and the transmission time delay is reduced; (2) high-quality image: in the compression process, by reasonably setting the quantization step and using the adaptive entropy coding strategy, the quality of the compressed image is guaranteed, and the actual application requirements are met; (3) flexibility: the embodiments of the present application can be adjusted and optimized according to different image characteristics and transmission requirements, and have strong flexibility and adaptability.
[0073] The image compression method can be used to reduce the bandwidth required for the image data transmission of the sky terminal, improve the communication efficiency, and save more image data in limited storage space, which has important application value in the fields of emergency communication, remote area communication and the like. The specific application scenarios are as follows: 1. In areas where the ground mobile network and fixed network cannot cover or the signal is poor, such as the deep sea, desert, deep mountain and the like, a reliable data communication can be provided, so as to solve the problems of bandwidth limitation and transmission speed in the image transmission process of the sky terminal; 2. The method can be used in a high-speed running environment, in which the change of the image will be very dramatic, which puts higher requirements on the operation processing capacity of the codec, and the method can realize the image transmission in the high-speed running environment; 3. The method can be used in a vehicle-mounted environment, in which the temperature is high and the electromagnetic interference is strong, and the adaptability and anti-interference performance of the codec are required to be higher, and the method can realize the image transmission in the vehicle-mounted environment.
[0074] The image compression method provided by the embodiment of the present application can be implemented through the following optional steps:
[0075] (1) The original image to be compressed is divided into a plurality of 8x8 pixel blocks;
[0076] (2) DCT transformation is performed on each pixel block;
[0077] (3) Quantization processing is performed on the DCT transformed coefficients;
[0078] (4) According to the characteristics of the quantized coefficients, an adaptive entropy coding strategy is used for compression;
[0079] (5) The compressed data is packaged into a format suitable for the transmission of the sky terminal, and is transmitted through the satellite communication link.
[0080] Through the combination of DCT transformation, quantization and adaptive entropy coding technology, efficient image compression and high-quality image transmission are realized. The image compression method has a wide application prospect in the field of satellite communication, and has important significance for improving the image transmission efficiency of the sky terminal.
[0081] Figure 3 is a structural diagram of an image compression device according to an embodiment of the present application, as shown in Figure 3 The device comprises:
[0082] An acquisition module 30 is configured to acquire an original image to be compressed;
[0083] A processing module 32 is configured to divide the original image into a plurality of pixel blocks, and perform quantization processing on the pixel points in each pixel block to obtain quantized coefficients corresponding to each pixel point;
[0084] The determining module 34 is configured to determine a probability value corresponding to each pixel in the original image by using a probability model, and determine a target compression algorithm from a plurality of compression algorithms according to the probability value, wherein the probability value is used to represent a gray level corresponding to the pixel, and the coding efficiency of different types of compression algorithms in the plurality of compression algorithms is different.
[0085] The compression module 36 is configured to compress the quantization coefficient corresponding to each pixel according to the target compression algorithm to obtain a compressed image.
[0086] The acquisition module 30, the processing module 32, the determining module 34 and the compression module 36 in the image compression device achieve the purpose of optimizing the image storage and transmission efficiency, thereby realizing the technical effect of efficient image compression, and further solving the technical problems of large data volume and low transmission efficiency in the related art when transmitting images by satellite.
[0087] In the processing module in the image compression device, the processing module is further configured to perform discrete cosine transform on the pixels in each pixel block to obtain a transform coefficient corresponding to each pixel in each pixel block, and perform quantization processing on the transform coefficient to obtain a quantization coefficient.
[0088] In the processing module in the image compression device, the processing module is further configured to obtain a target pixel in each pixel block, wherein the target pixel is a pixel corresponding to a target row and a target column in each pixel block, the target row is any row in each pixel block, and the target column is any column in each pixel block; determine a total number of pixel blocks corresponding to the plurality of pixel blocks; and determine a transform coefficient corresponding to the target pixel after performing discrete cosine transform on the target pixel according to the target pixel and the total number of pixel blocks.
[0089] In the processing module in the image compression device, the processing module is further configured to perform smoothing processing on the transform coefficient to obtain a first intermediate value; determine a quantization step according to the transform coefficient, wherein the transform coefficient and the quantization step are negatively correlated; and determine the quantization coefficient according to the first intermediate value and the quantization step.
[0090] In the processing module in the image compression device, the processing module is further configured to determine a quantization matrix when performing quantization processing on the transform coefficient; determine a quantization element corresponding to the transform coefficient from the quantization matrix; and perform smoothing processing on a ratio of the transform coefficient and the quantization element to obtain a first intermediate value.
[0091] In the determining module of the image compression device, the determining module is further configured to determine the target compression algorithm from a first type of compression algorithm in the plurality of compression algorithms when the probability value is greater than a preset threshold; and determine the target compression algorithm from a second type of compression algorithm in the plurality of compression algorithms when the probability value is less than or equal to the preset threshold, wherein the encoding efficiency of the first type of compression algorithm is greater than the encoding efficiency of the second type of compression algorithm.
[0092] In the image compression device, a sending module 38 is further included, and the sending module is configured to determine a transmission format required by a target satellite for transmitting the compressed image; and perform format conversion on the compressed image according to the transmission format, and send the compressed image after the format conversion to a receiving end through the target satellite.
[0093] It should be noted that, Figure 3 The image compression device is configured to perform the image compression method as shown in Figure 2 Therefore, the related explanations in the image compression method are also applicable to the image compression device, and will not be repeated here.
[0094] The electronic device includes a memory and a processor, wherein the memory is configured to store program instructions; the processor is connected with the memory and is configured to execute the program instructions to realize the following functions: obtaining an original image to be compressed; dividing the original image into a plurality of pixel blocks, and performing quantization processing on each pixel point in each pixel block to obtain a quantization coefficient corresponding to each pixel point; determining a probability value corresponding to each pixel point in the original image by using a probability model, and determining a target compression algorithm from a plurality of compression algorithms according to the probability value, wherein the probability value is used to represent a gray level corresponding to the pixel point, and the encoding efficiency of different types of compression algorithms in the plurality of compression algorithms is different; and performing compression processing on the quantization coefficient corresponding to each pixel point according to the target compression algorithm to obtain a compressed image.
[0095] It should be noted that, Figure 2 The electronic device is configured to perform the image compression method as shown in
[0096] The embodiment of the present application further provides a nonvolatile storage medium comprising a stored computer program, wherein a device in which the nonvolatile storage medium is located executes the following image compression method by running the computer program: obtaining an original image to be compressed; dividing the original image into a plurality of pixel blocks and performing quantization processing on pixel points in each pixel block to obtain quantization coefficients corresponding to each pixel point; determining a probability value corresponding to each pixel point in the original image by using a probability model, and determining a target compression algorithm from a plurality of compression algorithms according to the probability value, wherein the probability value is used to represent a gray level corresponding to the pixel point, and the coding efficiency of different types of compression algorithms in the plurality of compression algorithms is different; and performing compression processing on the quantization coefficients corresponding to each pixel point according to the target compression algorithm to obtain a compressed image.
[0097] It should be noted that the nonvolatile storage medium is used to execute the image compression method shown in the above description, and therefore the related explanations in the image compression method also apply to the nonvolatile storage medium, which will not be described here again. Figure 2
[0098] The embodiment of the present application further provides a computer program product comprising computer instructions, which, when executed by a processor, implement the steps of the image compression method in the embodiment of the present application.
[0099] The serial numbers of the embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0100] In the above embodiments of the present application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0101] In the several embodiments provided by the present application, it should be understood that the disclosed technology can be implemented in other ways. Of course, the unit described as the division herein is only a logical function division, and there can be other division manners in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, units or modules, and can be electrical or other forms.
[0102] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on multiple units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0103] In addition, each function unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software function unit.
[0104] When the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application, essentially or in part, or all or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The foregoing storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.
[0105] The above is only the preferred embodiment of the present application, and it should be pointed out that, for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be considered as the protection scope of the present application.
Claims
1. A method of image compression, characterized by, The method comprises: obtaining an original image to be compressed; dividing the original image into a plurality of pixel blocks, and quantizing the pixels in each pixel block to obtain quantization coefficients corresponding to each pixel; determining a probability value corresponding to each pixel in the original image by using a probability model, and determining a target compression algorithm from a plurality of compression algorithms according to the probability value, including: comparing the compression rate of the compression algorithm and the quality of the reconstructed image corresponding to the compression algorithm, wherein the probability value is used to simulate the compression effect of the plurality of different compression algorithms on the image, and the probability value is also used to represent the gray scale corresponding to the pixel, and the encoding efficiency of different types of compression algorithms in the plurality of compression algorithms is different; compressing the quantization coefficients corresponding to each pixel according to the target compression algorithm to obtain a compressed image.
2. The method of claim 1, wherein, The quantization of the pixels in each pixel block to obtain quantization coefficients corresponding to each pixel comprises: performing discrete cosine transform on the pixels in each pixel block to obtain transform coefficients corresponding to the pixels in each pixel block; quantizing the transform coefficients to obtain the quantization coefficients.
3. The method of claim 2, wherein, The discrete cosine transform of the pixels in each pixel block to obtain transform coefficients corresponding to the pixels in each pixel block comprises: obtaining a target pixel in each pixel block, wherein the target pixel is a pixel corresponding to a target row and a target column in each pixel block, the target row is any row in each pixel block, and the target column is any column in each pixel block; determining a total number of pixel blocks corresponding to the plurality of pixel blocks; determining transform coefficients corresponding to the target pixel after the discrete cosine transform of the target pixel according to the target pixel and the total number of pixel blocks.
4. The method of claim 2, wherein, The quantization of the transform coefficients to obtain the quantization coefficients comprises: smoothing the transform coefficients to obtain a first intermediate value; determining a quantization step according to the transform coefficients, wherein the transform coefficients and the quantization step are negatively correlated; determining the quantization coefficients according to the first intermediate value and the quantization step.
5. The method of claim 4, wherein, The smoothing of the transform coefficients to obtain a first intermediate value comprises: determining a quantization matrix for quantizing the transform coefficients; determining a quantization element corresponding to the transform coefficients from the quantization matrix; smoothing the ratio of the transform coefficients to the quantization element to obtain the first intermediate value.
6. The method of claim 1, wherein, The determination of the target compression algorithm from the plurality of compression algorithms according to the probability value comprises: in a case where the probability value is greater than a preset threshold, determining the target compression algorithm from a first type of compression algorithm in the plurality of compression algorithms; in a case where the probability value is less than or equal to the preset threshold, determining the target compression algorithm from a second type of compression algorithm in the plurality of compression algorithms, wherein the encoding efficiency of the first type of compression algorithm is greater than the encoding efficiency of the second type of compression algorithm.
7. The method of claim 1, wherein, The method further comprises: determining a transmission format required by a target satellite to transmit the compressed image; The compressed image is format-converted according to the transmission format, and the format-converted compressed image is transmitted to a receiving end by the target satellite.
8. An apparatus for image compression, characterized by The method comprises the steps of: an acquisition module, configured to acquire an original image to be compressed; a processing module, configured to divide the original image into a plurality of pixel blocks, and quantize each pixel point in each pixel block to obtain a quantization coefficient corresponding to each pixel point; a determination module, configured to determine a probability value corresponding to each pixel point in the original image by using a probability model, and determine a target compression algorithm from a plurality of compression algorithms according to the probability value, wherein the probability value is used to simulate compression effects of the plurality of different compression algorithms on the image, and the probability value is also used to represent a gray scale corresponding to the pixel point, and different types of compression algorithms in the plurality of compression algorithms have different encoding efficiencies; a compression module, configured to compress the quantization coefficient corresponding to each pixel point according to the target compression algorithm to obtain a compressed image.
9. An electronic device, comprising: The method comprises the steps of: a memory, configured to store program instructions; a processor, connected to the memory, configured to execute the program instructions to realize the following functions: acquiring an original image to be compressed; dividing the original image into a plurality of pixel blocks, and quantizing each pixel point in each pixel block to obtain a quantization coefficient corresponding to each pixel point; determining a probability value corresponding to each pixel point in the original image by using a probability model, and determining a target compression algorithm from a plurality of compression algorithms according to the probability value, wherein the probability value is used to simulate compression effects of the plurality of different compression algorithms on the image, and the probability value is also used to represent a gray scale corresponding to the pixel point, and different types of compression algorithms in the plurality of compression algorithms have different encoding efficiencies; and compressing the quantization coefficient corresponding to each pixel point according to the target compression algorithm to obtain a compressed image.
10. A non-volatile storage medium, comprising: The non-volatile storage medium comprises a stored computer program, wherein a device in which the non-volatile storage medium is located executes the method for image compression of any one of claims 1 to 7 by running the computer program.
11. A computer program product comprising computer instructions, characterized in that, The computer instructions are executed by the processor to realize the method for image compression of any one of claims 1 to 7.
Citation Information
Patent Citations
Audio and video file storage and transmission method
CN113949866A
Star map compression method based on target detection
CN115022635A