Image compression method, device, equipment, medium, product and equipment

By using a preset compression algorithm library and a method of dynamically adjusting algorithm parameters in the image compression system, the complexity and adaptability problems of image compression algorithms in the prior art are solved, and an efficient and adaptable image compression effect is achieved.

CN119364006BActive Publication Date: 2025-05-13INFORMATION & COMM BRANCH OF STATE GRID JIANGSU ELECTRIC POWER
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411908356.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-05-13
Estimated Expiration
2044-12-24

AI Technical Summary

Technical Problem

Existing image compression algorithms are complex, requiring powerful computing power and storage resources, and are not adapted to different types of images, which increases the overall system overhead.

Method used

By obtaining the image to be compressed and the preset compression algorithm library, the target compression algorithm is determined and the image is compressed, the compression completion degree is evaluated. If the threshold is not reached, the algorithm parameters are corrected and the compression steps are repeated until the preset completion threshold is reached.

Benefits of technology

The compression algorithm adaptation of different images to be compressed is realized, which reduces the overall overhead of the system and improves the compression efficiency and image quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119364006B_ABST
    Figure CN119364006B_ABST
Patent Text Reader

Abstract

The present invention discloses an image compression method, device, equipment, medium, product and equipment, including: obtaining an image to be compressed and a preset compression algorithm library, determining a target compression algorithm and compressing the image to be compressed, obtaining an intermediate image and actual compression parameter information; determining the compression completion of the target compression algorithm under the current algorithm parameters according to the intermediate image and the actual compression parameter information; if the preset completion threshold is not reached, correcting the current algorithm parameters, and returning to execute the compression step of the image to be compressed; otherwise, using the intermediate image as the image compression result of the image to be compressed. By analyzing the matching degree between the image and each preset compression algorithm, the target compression algorithm is screened out, and the compression effect is evaluated to obtain the compression completion value, and then the current algorithm parameters are adjusted in combination with the preset completion threshold. Automatic matching of the compression algorithm is achieved, reducing problems such as image quality degradation or system crash caused by algorithm problems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to an image compression method, device, equipment, medium, product and equipment. Background Art

[0002] As a similarity and vivid description of objective things, images are the most important source of information for people. In the information age, people are increasingly relying on computers to obtain and use information, and image information, as one of the most important resources on computers, has a huge amount of data. Large amounts of image information have brought great pressure to the storage capacity of memory, the bandwidth of communication trunk channels, and the processing speed of computers.

[0003] The existing technology usually uses compression algorithms to compress and decompress images. For example, compressed sensing and DNA coding can be used to compress, encrypt and decrypt images. The image can also be compressed by extracting key points from the image and clustering the key points to obtain an image clustering matrix, so as to reduce storage space and improve transmission efficiency.

[0004] However, current image compression algorithms often require powerful computing power and storage resources to support them due to their high algorithm complexity. In addition, inappropriate compression methods for different types of images may increase the overall system overhead. Summary of the invention

[0005] The present invention provides an image compression method, device, equipment, medium, product and equipment to achieve adaptation of compression algorithms for different images to be compressed, thereby reducing the overall cost of the system.

[0006] According to a first aspect of the present invention, there is provided an image compression method, comprising:

[0007] Obtain the image to be compressed and the preset compression algorithm library;

[0008] According to the image to be compressed and the preset compression algorithm library, a target compression algorithm is determined and the image to be compressed is compressed to obtain an intermediate image and actual compression parameter information;

[0009] Determining the compression completion degree of the target compression algorithm under the current algorithm parameters according to the intermediate image and the actual compression parameter information;

[0010] If the compression completion degree does not reach the preset completion degree threshold, the current algorithm parameters are modified, and the compression step of the image to be compressed is returned to be executed;

[0011] If the compression completion degree reaches the preset completion degree threshold, the intermediate image is used as the image compression result of the image to be compressed.

[0012] According to a second aspect of the present invention, there is provided an image compression device, comprising:

[0013] An image acquisition module is used to acquire the image to be compressed and a preset compression algorithm library;

[0014] An information determination module, used to determine a target compression algorithm according to the image to be compressed and the preset compression algorithm library, and compress the image to be compressed to obtain an intermediate image and actual compression parameter information;

[0015] A completion degree determination module, used to determine the compression completion degree of the target compression algorithm under the current algorithm parameters according to the intermediate image and the actual compression parameter information;

[0016] A parameter correction module, configured to correct the current algorithm parameters and return to execute the compression step of the image to be compressed if the compression completion degree does not reach a preset completion degree threshold;

[0017] The image determination module is configured to use the intermediate image as the image compression result of the image to be compressed if the compression completion degree reaches the preset completion degree threshold.

[0018] According to a third aspect of the present invention, there is provided an electronic device, the electronic device comprising:

[0019] at least one processor; and

[0020] a memory communicatively connected to the at least one processor; wherein,

[0021] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the image compression method described in any embodiment of the present invention.

[0022] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the image compression method described in any embodiment of the present invention when executed.

[0023] According to a fifth aspect of the present invention, an embodiment of the present invention further provides a computer program product, the computer program product comprising a computer program, and when the computer program is executed by a processor, the image compression method of any embodiment of the present invention is implemented.

[0024] The technical solution of the embodiment of the present invention is to obtain the image to be compressed and the preset compression algorithm library; determine the target compression algorithm according to the image to be compressed and the preset compression algorithm library and compress the image to be compressed to obtain the intermediate image and actual compression parameter information; determine the compression completion of the target compression algorithm under the current algorithm parameters according to the intermediate image and the actual compression parameter information; if the compression completion does not reach the preset completion threshold, correct the current algorithm parameters and return to execute the compression step of the image to be compressed; otherwise, use the intermediate image as the image compression result of the image to be compressed. By analyzing the matching degree between the image and each preset compression algorithm, the target compression algorithm is screened out, and the compression effect is evaluated to obtain the compression completion value, and then the current algorithm parameters are adjusted in combination with the preset completion threshold. Automatic matching of the compression algorithm is achieved, reducing problems such as image quality degradation or system crash caused by algorithm problems, achieving the best compression effect, and meeting user needs.

[0025] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0027] Figure 1 is a flowchart of an image compression method provided according to Embodiment 1 of the present invention;

[0028] Figure 2 is an example structural diagram of an unstructured storage platform in an image compression method provided according to Embodiment 1 of the present invention;

[0029] Figure 3 is a flowchart of an image compression method provided according to Embodiment 2 of the present invention;

[0030] Figure 4 is a schematic diagram of a functional relationship between a compression quality value and a compression completion degree in an image compression method provided according to a second embodiment of the present invention;

[0031] Figure 5 is a structural schematic diagram of an image compression device provided according to Embodiment 3 of the present invention;

[0032] Figure 6 It is a schematic diagram of the structure of an electronic device implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0033] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0034] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0035] Embodiment 1

[0036] Figure 1 A flowchart of an image compression method is provided for the first embodiment of the present invention. This embodiment is applicable to compression situations of different images. The method can be executed by an image compression device. The image compression device can be implemented in the form of hardware and / or software. The image compression device can be configured in an electronic device.

[0037] like Figure 1 As shown, the method includes:

[0038] S110, obtaining an image to be compressed and a preset compression algorithm library.

[0039] In this embodiment, the image to be compressed can be understood as an image that needs to be compressed. The preset compression algorithm library can be understood as a preset algorithm library containing multiple compression algorithms, which includes not only preset compression algorithms but also algorithm feature parameters corresponding to each preset compression algorithm.

[0040] Specifically, the processor can obtain the image to be compressed, perform characteristic analysis on the image to be compressed, obtain image characteristics, and determine corresponding preset requirement parameters according to the image characteristics. The processor can obtain a preset compression algorithm library from a storage medium.

[0041] As a concrete example, this method can be deployed on a pre-built unstructured platform. Figure 2 A structural example diagram of an image compression method is provided for the first embodiment of the present invention, such as Figure 2 As shown, the unstructured storage platform can be used as the execution subject of the present method, the drone can be used as the source of the image to be compressed, the gateway provides data transmission services between the drone and the channel visualization device, and the client displays the image results of the unstructured storage platform. In this embodiment, the image compression service can be deployed by building an unstructured storage platform, and the image compression program is called by the unstructured platform management end to compress and save the image to be compressed collected by the drone. Among them, the specific process of deploying the image compression service by building an unstructured platform is as follows: (1) The person in charge of the business system formulates the unstructured data to be compressed in the business system, including the time range and compression ratio, and compares the test environment to verify the image compression recovery quality of multiple levels of compression ratios, and reports to the business department to confirm the reasonable compression ratio. (2) The business system calls the unstructured file upload interface according to the unstructured platform interface specification, and feedbacks the compression time and compression ratio of the file to be compressed (optional). The compression ratio can be dynamically adjusted according to the compression service quality factor (different quality images guarantee 95% data quality, and the compression ratio is not uniform). (3) Unstructured platform: a) Upload compression. The unstructured platform adds input parameters based on the original upload interface: compression time and compression ratio. When uploading files, the business system needs to add additional parameters to determine the compression time and compression ratio. The platform first selects the image files that need to be compressed by file format, then executes the internal scheduled task to call the compression service to complete data compression, and finally stores the compressed images in the distributed storage system (CEPH) and keeps the UUID (Universally Unique Identifier) ​​unchanged. UUID is an identifier in a standard format. b) Download recovery. When the business system downloads a file, the unstructured platform determines whether the file is a compressed file based on the file UUID. For non-compressed files, the file download address or file stream is directly returned. For compressed files, the recovery interface is called to return the recovered file stream.

[0042] In a specific embodiment, the specific deployment method of building an unstructured platform to deploy an image compression service is that the image compression program runs the image compression container through Docker, is deployed to the intranet server of the unstructured platform, is connected with the unstructured file upload and download interface, and provides Http interface call and Post call methods. The interface content is shown in the following table:

[0043] Table 1 Interface content definition

[0044]

[0045] S120 , determining a target compression algorithm according to the image to be compressed and a preset compression algorithm library, and compressing the image to be compressed to obtain an intermediate image and actual compression parameter information.

[0046] In this embodiment, the target compression algorithm can be understood as a compression algorithm adapted to the image to be compressed. The intermediate image can be understood as a compressed image. The actual compression parameter information can be understood as the corresponding parameters in the actual compression process.

[0047] Specifically, the processor can calculate the matching value based on the preset requirement parameters and each algorithm parameter in the preset compression algorithm library, and use the matching value to characterize the matching degree between each preset compression algorithm and the preset requirement parameters of the image to be compressed, and then select the preset compression algorithm with the highest matching degree as the target compression algorithm, and set the initial preset compression parameters, process the image to be compressed through the target compression algorithm, obtain the intermediate image, and determine the actual compression parameter information.

[0048] S130. Determine the compression completion degree of the target compression algorithm under the current algorithm parameters according to the intermediate image and the actual compression parameter information.

[0049] In this embodiment, the current algorithm parameters can be understood as the algorithm parameters adopted for this compression. The compression completion degree can be understood as a value used to characterize the completion effect of this compression.

[0050] Specifically, the processor can determine the compression quality value of this compression through the compressed image quality of the intermediate image and the uncompressed image quality of the image to be compressed, and determine the compression performance value of this compression through the actual compression parameter information and the critical compression parameter information corresponding to the target compression algorithm, and then comprehensively determine the compression completion degree of the target compression algorithm under the current algorithm parameters through the compression quality value and the compression performance value.

[0051] S140: If the compression completion degree does not reach the preset completion degree threshold, the current algorithm parameters are modified, and the process returns to execute the compression step of the image to be compressed.

[0052] In this embodiment, the preset completion threshold can be understood as a threshold set for determining whether the compression meets the standard, wherein the preset completion threshold of the image to be compressed is obtained based on the image characteristics of the image to be compressed, including image type and image color depth matching.

[0053] Specifically, the processor can compare the compression completion with the preset completion threshold. If the compression completion does not reach the preset completion threshold, the processor can modify the current algorithm parameters, for example, the preset compression time can be adjusted: if the compression time is too long, the compression time can be appropriately shortened (for example, the time adjustment step can be set); the preset compression quality factor can be adjusted: if the compression quality does not meet the standard, the preset compression quality factor can be increased (for example, the quality factor adjustment step can be set); the preset compression ratio can be adjusted: if the compression ratio is too large, the compression ratio can be appropriately reduced (for example, the ratio adjustment step can be set). After the correction, the image to be compressed is compressed again using the corrected algorithm parameters, and the intermediate image and actual compression parameter information corresponding to the compression are determined, and the compression completion of the target compression algorithm under the algorithm parameters is continued to be determined, and compared with the preset completion threshold again, and the step is repeated until it is greater than or equal to the preset completion threshold.

[0054] S150: If the compression completion degree reaches a preset completion degree threshold, the intermediate image is used as the image compression result of the image to be compressed.

[0055] In this embodiment, the image compression result can be understood as an image result that meets the compression completion degree.

[0056] Specifically, when the compression completion degree reaches a preset completion degree threshold, the compression is completed, and the processor can use the intermediate image as the image compression result of the image to be compressed.

[0057] The technical solution of the embodiment of the present invention is to obtain the image to be compressed and the preset compression algorithm library; determine the target compression algorithm according to the image to be compressed and the preset compression algorithm library and compress the image to be compressed to obtain the intermediate image and actual compression parameter information; determine the compression completion of the target compression algorithm under the current algorithm parameters according to the intermediate image and the actual compression parameter information; if the compression completion does not reach the preset completion threshold, correct the current algorithm parameters and return to execute the compression step of the image to be compressed; otherwise, use the intermediate image as the image compression result of the image to be compressed. By analyzing the matching degree between the image and each preset compression algorithm, the target compression algorithm is screened out, and the compression effect is evaluated to obtain the compression completion value, and then the current algorithm parameters are adjusted in combination with the preset completion threshold. Automatic matching of the compression algorithm is achieved, reducing problems such as image quality degradation or system crash caused by algorithm problems, achieving the best compression effect, and meeting user needs.

[0058] Embodiment 2

[0059] Figure 3 This is a flowchart of an image compression method provided by Embodiment 2 of the present invention. This embodiment is a further refinement of the above embodiment. Figure 3 As shown, the method includes:

[0060] S301, obtaining an image to be compressed and a preset compression algorithm library.

[0061] S302: Determine image characteristic information according to the image to be compressed.

[0062] In this embodiment, the image characteristic information may be understood as characteristics that affect the selection of a compression algorithm, and may include, for example, image type and image color depth.

[0063] Specifically, the processor may perform characteristic analysis on the image to be compressed, determine the image type and image color depth to which the image to be compressed belongs, and obtain image characteristic information.

[0064] Exemplarily, image types are mainly divided into two categories: vector graphics and bitmap graphics. Vector graphics: described by algorithms and mathematical formulas, not dependent on pixels. Since vector graphics do not lose quality when scaled, compression processing is usually not required. However, if the file size needs to be reduced for easy transmission or storage, a lossless compression algorithm can be considered. Bitmap graphics: composed of pixels, each pixel contains color information. Bitmap graphics may lose quality when scaled, so compression processing is required according to specific needs. When compressing, a suitable compression algorithm can be selected according to the complexity and color depth of the image. Image color depth refers to the number of color information bits for each pixel in the image. High color depth image: can represent more color types and more delicate color transitions. High color depth images usually contain more color information, so when compressing, a suitable compression algorithm needs to be selected to retain this color information. Lossless compression algorithms can better retain color information, but lossy compression algorithms can also achieve better results when the compression ratio is appropriately increased. Low color depth image: can represent fewer color types and rougher color transitions. Low color depth images usually contain less color information, so a higher compression ratio can be selected when compressing to reduce file size. At the same time, due to the small amount of color information, even if a lossy compression algorithm is used, the loss of image quality is relatively small. You can choose a suitable compression algorithm according to the image type and color depth. For example, you can choose a lossless compression algorithm for vector images; for bitmap images, you can choose different compression algorithms such as JPEG, PNG, WebP, etc. according to the image complexity and color depth.

[0065] S303: Determine preset required parameters of the image to be compressed according to the image characteristic information.

[0066] In this embodiment, the preset requirement parameters can be understood as compression requirements set for the image to be compressed, which may include requirements such as a preset compression time, a preset compression quality factor, and a preset compression ratio.

[0067] Specifically, the correspondence between different image features and preset requirement parameters can be established through a preset preset requirement parameter table. The processor can determine the corresponding preset requirement parameter by searching the image feature information in the preset requirement parameter table.

[0068] S304: Determine a matching degree value between each preset compression algorithm and the image to be compressed according to preset demand parameters and preset compression parameters of each preset compression algorithm in a preset compression algorithm library.

[0069] In this embodiment, the preset compression parameters can be understood as parameters that characterize the compression performance of the preset compression algorithm, for example, they can include preset compression time, preset compression quality factor, preset compression ratio, etc. The matching degree value can be understood as a numerical representation of the matching degree between the preset requirement parameters of the image to be compressed and the preset compression parameters of the preset compression algorithm.

[0070] It is understandable that the basic principle, compression performance and parameter setting of the algorithm can be understood by consulting the official documentation or description of the compression algorithm. According to the algorithm documentation, the preset compression parameters of different compression algorithms are determined.

[0071] Specifically, the processor may determine the matching degree value between each preset compression algorithm and the image to be compressed according to the preset demand parameters and the preset compression parameters of each preset compression algorithm in the preset compression algorithm library.

[0072] Further, based on the above embodiment, the step of determining the matching degree value between each preset compression algorithm and the image to be compressed according to the preset demand parameters and the preset compression parameters of each preset compression algorithm in the preset compression algorithm library can be refined as follows:

[0073] Obtain allowable deviation parameter information that matches the image characteristic information, as well as the preset required compression time, preset required compression ratio and preset required compression quality factor in the preset required parameters; obtain the preset algorithm compression time, preset algorithm compression ratio and preset algorithm compression quality factor in each preset compression parameter; according to the preset required compression time, preset required compression ratio, preset required compression quality factor, preset algorithm compression time, preset algorithm compression ratio and preset algorithm compression quality factor; according to the allowable deviation parameter information, the preset required compression time, the preset required compression ratio, the preset required compression quality factor, the preset algorithm compression time, the preset algorithm compression ratio and the preset algorithm compression quality factor, determine the matching degree value between each preset compression algorithm and the image to be compressed.

[0074] In this embodiment, the allowable deviation parameter information can be understood as an allowable parameter error value.

[0075] It is understandable that the compression quality factor is usually used to quantify the degree of quality loss during the image compression process, and its value range is generally 0 to 100. 0 represents the lowest quality and the highest compression ratio, while 100 represents the highest quality and the lowest compression ratio. The compression ratio refers to the ratio between the original size of the image file and the size of the compressed image file. When the compression quality factor is larger, the image compression ratio is larger, which means that the image is more strongly compressed and occupies less storage space. However, at this time, due to the loss of high-frequency information, the image quality will be significantly reduced, and distortion phenomena such as block artifacts and ringing artifacts may appear. On the contrary, when the compression quality factor is smaller, the image compression ratio is smaller, the image quality is higher, and the details are more complete. However, at this time, the size of the image file will also increase accordingly, occupying more storage space. In general, the choice of compression quality factor will affect the compression time of the image. At a higher compression quality factor, the compression algorithm may take longer to process the image data because more image details need to be retained. Although the compression ratio itself does not directly determine the compression time, there is an indirect connection between the two. A higher compression ratio usually means a stronger compression process, which may lead to a longer compression time. However, this relationship is not absolute, because compression time is also affected by other factors, such as image content, efficiency of compression algorithm, etc. In practical applications, in order to optimize compression time, you can consider using a more efficient compression algorithm, preprocessing the image (such as reducing resolution, reducing color depth, etc.), or selecting an appropriate compression quality factor.

[0076] Specifically, the processor can extract the allowable deviation compression time, allowable deviation compression quality factor and allowable deviation compression ratio that match the image feature information from the corresponding storage medium (such as the compression system database), and obtain the matching degree value between each preset compression algorithm and the image to be compressed by comprehensive analysis based on the preset requirement parameters of the image to be compressed and the preset compression parameters of each preset compression algorithm, that is, through the allowable deviation parameter information, the preset requirement compression time, the preset requirement compression ratio, the preset requirement compression quality factor, the preset algorithm compression time, the preset algorithm compression ratio and the preset algorithm compression quality factor. The matching degree value of each compression algorithm is used to quantitatively evaluate the matching degree between each compression algorithm and the image to be compressed, and provide a basis for screening the target compression algorithm.

[0077] Exemplarily, the numerical expression of the matching degree value of each compression algorithm is:

[0078]

[0079] In the formula, represents the matching degree value of the rth preset compression algorithm, r represents the number of each preset compression algorithm, r=1,2,3,...,h, h represents the total number of preset compression algorithms, T 0Indicates the preset required compression time of the image to be compressed, Z 0 Indicates the preset required compression quality factor of the image to be compressed, B 0 Indicates the preset required compression ratio of the image to be compressed, T r represents the preset compression time of the rth preset compression algorithm, Z r represents the preset compression quality factor of the rth preset compression algorithm, B r represents the preset compression ratio of the rth preset compression algorithm, Indicates the allowable deviation compression time, represents the allowable deviation compression quality factor, Indicates the allowable deviation compression ratio, Indicates the matching degree influencing factor of the preset compression algorithm corresponding to the preset compression time, Indicates the matching degree influencing factor of the preset compression algorithm corresponding to the preset compression quality factor, Indicates the matching degree influencing factor of the preset compression algorithm corresponding to the preset compression ratio.

[0080] Table 2 Data example of matching degree values ​​of preset compression algorithms

[0081]

[0082] It should be explained that, in this embodiment, the allowable deviation compression time is set to 1 second, the allowable deviation compression quality factor is set to 5, the allowable deviation compression ratio is set to 0.05, the preset required compression time of the image to be compressed is set to 10 seconds, the preset required compression quality factor is set to 80, the preset required compression ratio is set to 0.50, the matching degree influence factor of the compression algorithm corresponding to the compression time is set to 0.5, the matching degree influence factor of the compression algorithm corresponding to the compression quality factor is set to 0.3, and the matching degree influence factor of the compression algorithm corresponding to the compression ratio is set to 0.2.

[0083] It should be explained that, when the difference between the preset required compression time, preset required compression quality factor and preset required compression ratio of the image to be compressed and the preset compression time, preset compression quality factor and preset compression ratio of the compression algorithm is smaller, the matching degree value of the corresponding compression algorithm is larger, indicating that the matching degree between the compression algorithm and the image to be compressed is higher. Indicates the matching degree influencing factor of the compression algorithm corresponding to the preset compression time. Indicates the matching degree influencing factor of the compression algorithm corresponding to the preset compression quality factor. The matching degree influencing factors of the compression algorithm corresponding to the preset compression ratio respectively represent the numerical values ​​of the influence of the compression time, the compression quality factor and the compression ratio unit values ​​on the matching degree of the compression algorithm. When used, the matching degree influencing factors of the compression algorithm corresponding to the compression time, the matching degree influencing factors of the compression algorithm corresponding to the compression quality factor and the matching degree influencing factors of the compression algorithm corresponding to the compression ratio can be directly obtained from the compression system database. The corresponding relationship can be a pre-set mapping relationship. For example, the compression time, the compression quality factor and the compression ratio respectively form a mapping set with the matching degree influencing factors of the compression algorithm corresponding to the preset compression time, the compression quality factor and the compression ratio in the compression system database. The real-time compression time, the compression quality factor and the compression ratio are input into the mapping set to obtain the matching degree influencing factors of the compression algorithm corresponding to the compression time, the matching degree influencing factors of the compression algorithm corresponding to the compression quality factor and the matching degree influencing factors of the compression algorithm corresponding to the compression ratio. The mapping relationship can be one-to-one or many-to-one. The above-mentioned influencing factors are all extracted from the encryption system database, and the value range is between 0 and 1.

[0084] It should be explained that relevant personnel can set different scenario requirements under different scenarios. The processor can adjust the preset compression time, preset compression quality factor, preset compression ratio and its matching degree influencing factor of the compression algorithm based on the scenario requirements to effectively balance the relationship between compression time, quality, and compression ratio, so as to find the compression algorithm that best suits the specific application scenario. This comprehensive evaluation method helps to achieve smarter compression algorithm selection, ensuring that the final result is both efficient and meets user needs. For example, for application scenarios that require fast response, reducing and increase When quality is more important than compression time and ratio, reduce and increase The weight of helps select compression algorithms that provide high-quality output. For situations where storage space is limited, reducing and increase The weights can help find algorithms that can save data in a smaller storage space.

[0085] S305: Determine a target compression algorithm according to each matching degree value.

[0086] Specifically, the processor may arrange the matching degree values ​​from small to large to obtain serialized matching degree values, and the processor may extract the preset compression algorithm with the maximum matching degree value and mark it as the target compression algorithm.

[0087] S306 , compress the image to be compressed by using a target compression algorithm to obtain an intermediate image and actual compression parameter information.

[0088] S307: Obtain critical parameter information of the target compression algorithm.

[0089] In this embodiment, the critical parameter information may be understood as the maximum or minimum parameter value of the target compression algorithm.

[0090] Specifically, the processor may obtain critical parameter information of the target compression algorithm from a preset compression algorithm library or a storage medium.

[0091] S308: Determine the compression performance value of the target compression algorithm according to the critical parameter information and the actual compression parameter information.

[0092] In this embodiment, the compression performance value is used to quantitatively evaluate the efficiency of the target compression algorithm in compressing the image to be compressed, and provides a basis for evaluating the compression completion evaluation value of the image to be compressed.

[0093] Specifically, the processor may perform a comprehensive analysis through the critical parameter information and the actual compression parameter information to determine the compression performance value of the target compression algorithm.

[0094] Further, based on the above embodiment, the step of determining the compression performance value of the target compression algorithm according to the critical parameter information and the actual compression parameter information can be refined as follows:

[0095] Obtain actual compression time, actual computing resource amount, actual bit rate, actual compression efficiency and actual algorithm complexity from actual compression parameter information; obtain critical compression time, critical computing resource amount, critical bit rate, critical compression efficiency and critical algorithm complexity from critical parameter information; determine a first compression performance based on the actual compression time, critical compression time, actual bit rate, critical bit rate, actual algorithm complexity and critical algorithm complexity; determine a second compression performance based on the actual computing resource amount and the critical computing resource amount; determine the compression performance value of the target compression algorithm based on the first compression performance and the second compression performance.

[0096] In this embodiment, the actual bit rate refers to the number of bits transmitted per second for the compressed image, which reflects the data transmission efficiency of the compressed image. The actual computing resource amount is the computing resource amount required by the target algorithm to compress the image to be compressed. Under the condition of keeping the image quality unchanged, the lower the bit rate, the higher the compression efficiency, because the amount of data required to be transmitted is reduced.

[0097] In this embodiment, the actual compression efficiency specifically refers to the peak signal-to-noise ratio of the target image before and after compression, and its acquisition method mainly relies on the quantitative analysis of the image signal and noise. The specific calculation formula is: , where MSE is the mean square error between the compressed image signal and the pre-compression image signal. MSE is obtained by calculating the square of the difference between each pixel value in the compressed image and the pixel value at the corresponding position in the pre-compression image, and then taking the average of these square values. MAX refers to the maximum value of the image pixel value. Refers to the peak signal-to-noise ratio. The larger the ratio, the higher the ratio of image signal to noise, and the better the image quality. You can also use the functions for calculating PSNR provided by image processing software or libraries (such as OpenCV). Input and load the two images to be compared, and call these functions to directly obtain the PSNR value between them.

[0098] In this embodiment, the actual algorithm complexity refers to the time complexity of the algorithm, which reflects the time required for the algorithm to execute. Professional algorithm analysis tools or software can be used to automatically calculate the time complexity of the algorithm, for example, the time complexity calculator of Savvy Calculator. The time complexity of an algorithm is a theoretical concept used to describe the relationship between the running time of the algorithm and the amount of input data. It usually describes the performance of the algorithm in the worst case, without considering the specific hardware environment or implementation details. The actual compression time is the actual time spent on actually executing a specific algorithm to compress image data. It is an actual measurement value and will be affected by multiple factors such as specific hardware (such as CPU, memory), software implementation, image size and image content.

[0099] In this embodiment, the first compression performance reflects the algorithm performance, and the second compression performance reflects the resource usage.

[0100] Specifically, the processor can obtain the actual compression time, actual computing resources, actual bit rate, actual compression efficiency and actual algorithm complexity in the actual compression parameter information; obtain the critical compression time, critical computing resources, critical bit rate, critical compression efficiency and critical algorithm complexity in the critical parameter information; determine the first compression performance based on the actual compression time, critical compression time, actual bit rate, critical bit rate, actual algorithm complexity and critical algorithm complexity; determine the second compression performance based on the actual computing resources and the critical computing resources; determine the compression performance value of the target compression algorithm based on the first compression performance and the second compression performance.

[0101] Exemplarily, in a specific embodiment, the numerical expression of the image compression performance evaluation value is:

[0102]

[0103] In the formula, represents the image compression performance evaluation value, represents the first compression performance, represents the second compression performance. e represents the natural constant, T represents the actual compression time, L represents the actual bit rate, actual X represents the compression efficiency, U represents the actual algorithm complexity, t represents the time variable, , t1 represents the current time point, t0 represents the compression start time point, represents the actual computing resources of the target compression algorithm at time t, represents the critical compression time, represents the critical computing resource amount, represents the critical bit rate, represents the critical compression efficiency, represents the critical algorithm complexity, Indicates the image compression performance impact factor corresponding to the preset compression time, Indicates the image compression performance impact factor corresponding to the preset bit rate, Indicates the image compression performance impact factor corresponding to the preset computing resource amount, Indicates the image compression performance impact factor corresponding to the preset compression efficiency, Indicates the image compression performance impact factor corresponding to the preset algorithm complexity.

[0104] It should be explained that when the actual compression time, actual computing resources, actual bit rate and actual algorithm complexity are smaller, and the actual compression efficiency is greater, the corresponding image compression performance evaluation value is larger, indicating that the target compression algorithm is more efficient in compressing the image to be compressed and the compression performance is better. The more complex the compression algorithm is, the greater the amount of computing resources required, which leads to an increase in the actual compression time. This is because complex algorithms may require more computing steps and higher processing power to execute. The efficiency of the algorithm is also a key factor affecting the actual compression time and computing resources. Efficient algorithms can achieve faster compression speeds with fewer computing resources. The input of computing resources is often proportional to the compression efficiency. More computing resources can be used for more sophisticated data processing, thereby achieving a higher compression ratio (i.e., a lower bit rate). If a fast compression process is pursued, a certain compression efficiency may be sacrificed, resulting in a higher output bit rate. This is because a fast compression algorithm may not be able to fully remove redundant information in the data. On the contrary, if a longer compression time is allowed, the algorithm can analyze the data more deeply and remove redundancy, thereby achieving a lower bit rate. However, this may also mean that more computing resources need to be invested.

[0105] It should be explained that, in the present embodiment, each performance influencing factor represents a numerical value of the degree of influence of the unit numerical value of compression time, bit rate, amount of computing resources, compression efficiency and algorithm complexity on the image compression performance. When used, the image compression performance influencing factor corresponding to the compression time, the image compression performance influencing factor corresponding to the bit rate, the image compression performance influencing factor corresponding to the computing resources, the image compression performance influencing factor corresponding to the compression efficiency and the image compression performance influencing factor corresponding to the algorithm complexity can be directly obtained from the compression system database, and the corresponding relationship can be a pre-set mapping relationship. For example, the compression time, bit rate, amount of computing resources, compression efficiency and algorithm complexity are respectively mapped with the image compression performance influencing factors corresponding to the compression time, bit rate, amount of computing resources, compression efficiency and algorithm complexity preset in the compression system database to form a mapping set, and the real-time compression time, bit rate, amount of computing resources, compression efficiency and algorithm complexity are input into the mapping set to obtain the image compression performance influencing factor corresponding to the compression time, the image compression performance influencing factor corresponding to the bit rate, the image compression performance influencing factor corresponding to the computing resources, the image compression performance influencing factor corresponding to the compression efficiency and the image compression performance influencing factor corresponding to the algorithm complexity, wherein the mapping relationship can be one-to-one or a many-to-one relationship. The above impact factors are all extracted from the encryption system database, and the value range is between 0 and 1.

[0106] It should be explained that comprehensive analysis of the actual compression time, computing resources, bit rate, compression efficiency and algorithm complexity can make the evaluation of image compression performance more comprehensive and accurate. In practical applications, it is necessary to weigh and optimize the relationship between these parameters according to specific application scenarios and requirements to achieve the best image compression effect. For example, in some cases, it may be necessary to sacrifice a certain amount of compression time to obtain a lower bit rate and better image quality. Or, in a resource-constrained environment, it may be necessary to select an algorithm with less computing resources but acceptable compression effect.

[0107] S309: Determine a compression quality value of a target compression algorithm according to original image parameters of the image to be compressed, intermediate image parameters of the intermediate image, and preset influencing factor information.

[0108] In this embodiment, the original image parameters can be understood as parameters that characterize the quality of the original image. The intermediate image parameters can be understood as parameters that characterize the quality of the compressed image. The preset influencing factor information can be understood as factors that are pre-set to balance the degree of influence of different parameters. The compression quality value can be understood as the quality of the compression of the image to be compressed by the target compression algorithm to be evaluated quantitatively, providing a basis for evaluating the compression completion evaluation value of the image to be compressed.

[0109] Specifically, the processor extracts the critical file size after compression and the allowable deviation resolution from the storage medium, and obtains the compression quality value of the image through comprehensive analysis based on the pre-compression quality data and the post-compression quality data of the image to be compressed.

[0110] Further, based on the above embodiment, the step of determining the compression quality value of the target compression algorithm according to the original image parameters of the image to be compressed, the intermediate image parameters of the intermediate image and the preset influencing factor information can be refined as follows:

[0111] Obtain original image resolution, original image file size and original image signal-to-noise ratio from original image parameters; obtain intermediate image resolution, intermediate image file size and intermediate image signal-to-noise ratio from intermediate image parameters; determine the compression quality value of the target compression algorithm according to the original image resolution, original image file size, original image signal-to-noise ratio, intermediate image resolution, intermediate image file size and intermediate image signal-to-noise ratio.

[0112] In this embodiment, the resolution of the image refers to the number of pixels per inch in the image, which determines the clarity and detail expression ability of the image. The difference in file size before and after compression, i.e., the compression ratio, is usually negatively correlated with the image compression quality evaluation index. In other words, the higher the compression ratio (i.e., the smaller the file after compression), the lower the image quality evaluation index may be, because some information may be lost during the compression process. The signal-to-noise ratio is the ratio of signal to noise, which is used to measure the relative level of useful signal and introduced noise in the image. A high signal-to-noise ratio indicates that there is less noise in the image, clear signal, and high image quality. A low signal-to-noise ratio indicates that there is more noise in the image, which may obscure image details and reduce image quality. During the compression process, if the resolution remains unchanged or is reduced by a small amount, the image compression quality evaluation index may be higher. Because the reduction in resolution usually leads to the loss of image details and the decrease in clarity, thereby affecting the image quality. A comprehensive analysis of image resolution, image file size, and image signal-to-noise ratio helps to more accurately evaluate the compression quality of the image.

[0113] In this embodiment, the image resolution directly determines the size of the image file. The higher the resolution, the more pixels are contained in the image, so the required storage space is larger, that is, the image file size is proportional to the square of its image resolution. The image resolution does not directly determine the signal-to-noise ratio of the image, but high-resolution images usually contain more details and color information, which makes the image visually clearer and more realistic. In practical applications, high resolution and high signal-to-noise ratio are usually important evaluation indicators of image quality. High-resolution images can provide more details, while high-signal-to-noise ratio images can reduce noise interference and provide a purer image. Although there is no direct relationship between file size and signal-to-noise ratio, both are affected by the image quality requirements. For example, in a scene where high-quality images are required, it may be necessary to increase both resolution and signal-to-noise ratio, which may lead to an increase in file size.

[0114] Specifically, the processor can obtain the resolution information and file size of the image through image editing software, such as Photoshop, GIMP, etc., or file property viewers, such as Windows Explorer, macOS Preview application, etc. Furthermore, when using image compression software or libraries (such as Pillow, OpenCV, ImageMagick, etc.) for compression, these tools usually provide a comparison of image quality parameters before and after compression, that is, obtaining intermediate image parameters and original image parameters, where image parameters may include file size, resolution, and signal-to-noise ratio.

[0115] Exemplarily, the numerical expression of the compression quality value is:

[0116]

[0117] In the formula, Represents the image compression quality evaluation value, F 0 represents the original image resolution before compression, K 0 Indicates the original image file size before compression, W 0 Indicates the signal-to-noise ratio of the original image before compression, F 1 represents the compressed intermediate image resolution, K 1 Represents the size of the compressed intermediate image file, W 1 represents the signal-to-noise ratio of the compressed intermediate image, Indicates the allowable deviation resolution, Indicates the image compression quality impact factor corresponding to the preset file size. Indicates the image compression quality impact factor corresponding to the preset resolution, Indicates the image compression quality impact factor corresponding to the preset signal-to-noise ratio.

[0118] It should be explained that when the compressed file size is smaller, the image resolution change before and after compression is smaller, and the compressed image signal-to-noise ratio is greater, the corresponding image compression quality evaluation value is greater, indicating that the target compression algorithm has higher compression quality for the compressed image.

[0119] It should be explained that each quality impact factor in this embodiment represents the numerical value of the degree of influence of the unit numerical value of file size, resolution and signal-to-noise ratio on the image compression quality. When used, the image compression quality impact factor corresponding to the file size, the image compression quality impact factor corresponding to the resolution and the image compression quality impact factor corresponding to the signal-to-noise ratio can be directly obtained from the compression system database. The corresponding relationship can be a pre-set mapping relationship. For example, the file size, resolution and signal-to-noise ratio form a mapping set with the image compression quality impact factors corresponding to the file size, resolution and signal-to-noise ratio preset in the compression system database, respectively. The real-time file size, resolution and signal-to-noise ratio are input into the mapping set to obtain the image compression quality impact factor corresponding to the file size, the image compression quality impact factor corresponding to the resolution and the image compression quality impact factor corresponding to the signal-to-noise ratio. The mapping relationship can be one-to-one or many-to-one. The above impact factors are all extracted from the encryption system database, and the value range is between 0 and 1.

[0120] S310. Determine the compression completion degree of the target compression algorithm under the current algorithm parameters according to the compression performance value and the compression quality value.

[0121] Specifically, the processor may determine the compression completion of the target compression algorithm through the following formula according to the matching degree value, compression performance value, and compression quality value of the target compression algorithm:

[0122]

[0123] In the formula, Indicates the degree of compression of the image to be compressed. Indicates the compression performance value, Indicates the compression quality value, Indicates the matching degree value of the target compression algorithm. Indicates the image compression completion factor corresponding to the preset image compression performance evaluation value, Indicates the image compression completion factor corresponding to the preset image compression quality assessment value, Indicates the image compression completion factor corresponding to the matching degree value of the preset target compression algorithm.

[0124] It should be explained that, when the compression performance value, compression quality value and matching degree value of the target compression algorithm are greater, the corresponding evaluation value of the compression completion of the image to be compressed is greater, indicating that the compression completion of the image to be compressed is higher.

[0125] It should be explained that, in the present embodiment, each compression completion influencing factor represents the numerical value of the influence of the image compression performance evaluation value, the image compression quality evaluation value, and the matching degree value of the target compression algorithm on the compression completion of the image to be compressed. When used, the image compression completion influencing factor corresponding to the image compression performance evaluation value, the image compression completion influencing factor corresponding to the image compression quality evaluation value, and the image compression completion influencing factor corresponding to the matching degree value of the target compression algorithm can be directly obtained from the compression system database. The corresponding relationship can be a pre-set mapping relationship. For example, the image compression performance evaluation value, the image compression quality evaluation value, and the matching degree value of the target compression algorithm are respectively mapped with the image compression performance evaluation value, the image compression quality evaluation value, and the matching degree value of the target compression algorithm preset in the compression system database to form a mapping set. The real-time image compression performance evaluation value, the image compression quality evaluation value, and the matching degree value of the target compression algorithm are input into the mapping set to obtain the image compression completion influencing factor corresponding to the image compression performance evaluation value, the image compression completion influencing factor corresponding to the image compression quality evaluation value, and the image compression completion influencing factor corresponding to the matching degree value of the target compression algorithm. The mapping relationship can be one-to-one or a many-to-one relationship. The above impact factors are all extracted from the encryption system database, and the value range is between 0 and 1.

[0126] For example, in order to characterize the relationship between the compression quality value, the compression completion degree and the matching degree value, a specific example is used for demonstration. Figure 4 A schematic diagram of the functional relationship between the compression quality value and the compression completion degree in an image compression method provided in the second embodiment of the present invention. Figure 4 As shown, curve a represents the relationship between the corresponding compression quality value and the compression completion degree of the image to be compressed when the image compression performance evaluation value is 0.8 and the matching degree value of the target compression algorithm is 0.95. Curve b represents the relationship between the corresponding compression quality value and the compression completion degree of the image to be compressed when the image compression performance evaluation value is 0.6 and the matching degree value of the target compression algorithm is 0.95. Curve c represents the relationship between the corresponding compression quality value and the compression completion degree of the image to be compressed when the image compression performance evaluation value is 0.8 and the matching degree value of the target compression algorithm is 0.85.

[0127] It should be explained that, in this embodiment, the image compression completion impact factor corresponding to the image compression performance evaluation value is set to 0.3, the image compression completion impact factor corresponding to the image compression quality evaluation value is set to 0.4, and the image compression completion impact factor corresponding to the matching degree value of the target compression algorithm is set to 0.3.

[0128] S311: If the compression completion degree does not reach the preset completion degree threshold, the current algorithm parameters are modified, and the process returns to execute the compression step of the image to be compressed.

[0129] S312: If the compression completion degree reaches a preset completion degree threshold, the intermediate image is used as the image compression result of the image to be compressed.

[0130] The technical solution of the embodiment of the present invention determines the image characteristic information by analyzing the characteristics of the image to be compressed, and determines the corresponding preset requirement parameters based on the image characteristic information, and determines the matching degree values ​​of each preset compression algorithm based on the preset requirement parameters. The matching degree value reflects the degree of fit between the algorithm and the specific application scenario or requirement, and the one with the highest matching degree value is used as the target compression algorithm. The appropriate compression algorithm is selected according to the specific application requirements, thereby ensuring the completeness of image compression and the actual application effect. The image to be compressed is compressed by the target compression algorithm to obtain the compressed intermediate image and the actual compression parameter information of the compression. The compression performance value and compression quality value obtained by evaluation are determined by the image parameters before and after compression and the actual compression parameter information. These evaluation values ​​not only help to understand the performance and quality performance of the compression algorithm, but also guide the selection of the appropriate compression algorithm according to the specific application requirements, thereby ensuring the completeness of image compression and the actual application effect. The compression completion degree is determined by the compression quality value, compression performance value and matching degree value. The current algorithm parameters are corrected based on the compression completion degree and the preset completion degree threshold, and the parameter settings of the compression algorithm are optimized. By adjusting the algorithm parameters, the best balance point can be found between different compression rates and qualities, which helps to reduce problems such as image quality degradation or system crashes caused by algorithm problems, so as to ensure the high efficiency of compression and that the compressed intermediate images can meet user needs.

[0131] Embodiment 3

[0132] Figure 5 This is a schematic diagram of the structure of an image compression device provided by Embodiment 3 of the present invention. Figure 5 As shown, the device comprises:

[0133] An image acquisition module 51 is used to acquire an image to be compressed and a preset compression algorithm library;

[0134] An information determination module 52 is used to determine a target compression algorithm according to the image to be compressed and the preset compression algorithm library, and compress the image to be compressed to obtain an intermediate image and actual compression parameter information;

[0135] A completion degree determination module 53, used to determine the compression completion degree of the target compression algorithm under the current algorithm parameters according to the intermediate image and the actual compression parameter information;

[0136] A parameter correction module 54 is used to correct the current algorithm parameters and return to execute the compression step of the image to be compressed if the compression completion degree does not reach a preset completion degree threshold;

[0137] The image determination module 55 is configured to use the intermediate image as the image compression result of the image to be compressed if the compression completion degree reaches the preset completion degree threshold.

[0138] The technical solution of the embodiment of the present invention is to obtain the image to be compressed and the preset compression algorithm library; determine the target compression algorithm according to the image to be compressed and the preset compression algorithm library and compress the image to be compressed to obtain the intermediate image and actual compression parameter information; determine the compression completion of the target compression algorithm under the current algorithm parameters according to the intermediate image and the actual compression parameter information; if the compression completion does not reach the preset completion threshold, correct the current algorithm parameters and return to execute the compression step of the image to be compressed; otherwise, use the intermediate image as the image compression result of the image to be compressed. By analyzing the matching degree between the image and each preset compression algorithm, the target compression algorithm is screened out, and the compression effect is evaluated to obtain the compression completion value, and then the current algorithm parameters are adjusted in combination with the preset completion threshold. Automatic matching of the compression algorithm is achieved, reducing problems such as image quality degradation or system crash caused by algorithm problems, achieving the best compression effect, and meeting user needs.

[0139] Furthermore, the information determination module 52 includes:

[0140] A characteristic determination unit, used for determining image characteristic information according to the image to be compressed;

[0141] A parameter determination unit, used to determine preset required parameters of the image to be compressed according to the image characteristic information;

[0142] A first determining unit, configured to determine a matching degree value between each of the preset compression algorithms and the image to be compressed according to the preset requirement parameters and preset compression parameters of each of the preset compression algorithms in the preset compression algorithm library;

[0143] A second determining unit, configured to determine a target compression algorithm according to each of the matching degree values;

[0144] The third determining unit is used to compress the image to be compressed by using the target compression algorithm to obtain an intermediate image and actual compression parameter information.

[0145] Wherein, the first determining unit is specifically used for:

[0146] Acquire the allowable deviation parameter information matching the image characteristic information, and the preset required compression time, the preset required compression ratio and the preset required compression quality factor in the preset required parameters;

[0147] Obtaining a preset algorithm compression time, a preset algorithm compression ratio, and a preset algorithm compression quality factor from among the preset compression parameters;

[0148] According to the preset required compression time, the preset required compression ratio, the preset required compression quality factor, the preset algorithm compression time, the preset algorithm compression ratio and the preset algorithm compression quality factor;

[0149] According to the allowable deviation parameter information, the preset required compression time, the preset required compression ratio, the preset required compression quality factor, the preset algorithm compression time, the preset algorithm compression ratio and the preset algorithm compression quality factor, the matching degree value between each of the preset compression algorithms and the image to be compressed is determined.

[0150] Furthermore, the completion degree determination module 53 includes:

[0151] An information acquisition unit, used to acquire critical parameter information of the target compression algorithm;

[0152] a fourth determining unit, configured to determine a compression performance value of the target compression algorithm according to the critical parameter information and the actual compression parameter information;

[0153] a fifth determining unit, configured to determine a compression quality value of the target compression algorithm according to original image parameters of the image to be compressed, intermediate image parameters of the intermediate image, and preset influencing factor information;

[0154] The sixth determination unit is used to determine the compression completion degree of the target compression algorithm under the current algorithm parameters according to the compression performance value and the compression quality value.

[0155] The fourth determining unit is specifically configured to:

[0156] Obtaining actual compression time, actual computing resource amount, actual bit rate, actual compression efficiency and actual algorithm complexity from the actual compression parameter information;

[0157] Acquire the critical compression time, critical computing resource amount, critical bit rate, critical compression efficiency and critical algorithm complexity in the critical parameter information;

[0158] Determining a first compression performance according to the actual compression time, the critical compression time, the actual bit rate, the critical bit rate, the actual algorithm complexity, and the critical algorithm complexity;

[0159] Determining a second compression performance according to the actual computing resource amount and the critical computing resource amount;

[0160] A compression performance value of the target compression algorithm is determined according to the first compression performance and the second compression performance.

[0161] Wherein, the fifth determining unit is specifically used for:

[0162] Obtaining original image resolution, original image file size and original image signal-to-noise ratio from the original image parameters;

[0163] Obtaining intermediate image resolution, intermediate image file size and intermediate image signal-to-noise ratio of the intermediate image parameters;

[0164] The compression quality value of the target compression algorithm is determined according to the original image resolution, the original image file size, the original image signal-to-noise ratio, the intermediate image resolution, the intermediate image file size and the intermediate image signal-to-noise ratio.

[0165] The image compression device provided by the embodiment of the present invention can execute the image compression method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0166] Embodiment 4

[0167] Figure 6 A schematic diagram of an electronic device 60 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0168] like Figure 6As shown, the electronic device 60 includes at least one processor 61, and a memory connected to the at least one processor 61 in communication, such as a read-only memory (ROM) 62, a random access memory (RAM) 63, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 61 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 62 or the computer program loaded from the storage unit 68 to the random access memory (RAM) 63. In the RAM 63, various programs and data required for the operation of the electronic device 60 can also be stored. The processor 61, the ROM 62, and the RAM 63 are connected to each other via a bus 64. An input / output (I / O) interface 65 is also connected to the bus 64.

[0169] A number of components in the electronic device 60 are connected to the I / O interface 65, including: an input unit 66, such as a keyboard, a mouse, etc.; an output unit 67, such as various types of displays, speakers, etc.; a storage unit 68, such as a disk, an optical disk, etc.; and a communication unit 69, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 69 allows the electronic device 60 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0170] The processor 61 may be a variety of general and / or dedicated processing components with processing and computing capabilities. Some examples of the processor 61 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 61 performs the various methods and processes described above, such as an image compression method.

[0171] In some embodiments, the image compression method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 68. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 60 via the ROM 62 and / or the communication unit 69. When the computer program is loaded into the RAM 63 and executed by the processor 61, one or more steps of the image compression method described above may be performed. Alternatively, in other embodiments, the processor 61 may be configured to perform the image compression method in any other appropriate manner (e.g., by means of firmware).

[0172] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0173] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0174] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0175] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0176] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0177] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0178] In one embodiment, the present invention further includes a computer program product, the computer program product includes a computer program, and when the computer program is executed by a processor, the image compression method of any embodiment of the present invention is implemented.

[0179] In the process of implementation, the computer program product can be written in one or more programming languages ​​or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0180] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0181] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. An image compression method, characterized in that: include: Obtain the image to be compressed and the preset compression algorithm library; According to the image to be compressed and the preset compression algorithm library, a target compression algorithm is determined and the image to be compressed is compressed to obtain an intermediate image and actual compression parameter information; Determining the compression completion degree of the target compression algorithm under the current algorithm parameters according to the intermediate image and the actual compression parameter information; If the compression completion degree does not reach the preset completion degree threshold, the current algorithm parameters are modified, and the compression step of the image to be compressed is returned to be executed; If the compression completion degree reaches the preset completion degree threshold, taking the intermediate image as the image compression result of the image to be compressed; The step of determining the compression completion degree of the target compression algorithm under the current algorithm parameters according to the intermediate image and the actual compression parameter information includes: Obtaining critical parameter information of the target compression algorithm; Determining a compression performance value of the target compression algorithm according to the critical parameter information and the actual compression parameter information; Determining a compression quality value of the target compression algorithm according to original image parameters of the image to be compressed, intermediate image parameters of the intermediate image, and preset influencing factor information; Determining the compression completion degree of the target compression algorithm under current algorithm parameters according to the compression performance value and the compression quality value; The original image parameters include original image resolution, original image file size and original image signal-to-noise ratio; the intermediate image parameters include intermediate image resolution, intermediate image file size and intermediate image signal-to-noise ratio.

2. The method according to claim 1, characterized in that: The step of determining a target compression algorithm according to the image to be compressed and the preset compression algorithm library and compressing the image to be compressed to obtain an intermediate image and actual compression parameter information includes: Determining image characteristic information according to the image to be compressed; Determining preset required parameters of the image to be compressed according to the image characteristic information; Determining a matching degree value between each of the preset compression algorithms and the image to be compressed according to the preset requirement parameters and the preset compression parameters of each of the preset compression algorithms in the preset compression algorithm library; Determining a target compression algorithm according to each of the matching degree values; The image to be compressed is compressed by using the target compression algorithm to obtain an intermediate image and actual compression parameter information.

3. The method according to claim 2, characterized in that The step of determining the matching degree value between each of the preset compression algorithms and the image to be compressed according to the preset requirement parameters and the preset compression parameters of each of the preset compression algorithms in the preset compression algorithm library comprises: Acquire the allowable deviation parameter information matching the image characteristic information, and the preset required compression time, the preset required compression ratio and the preset required compression quality factor in the preset required parameters; Obtaining a preset algorithm compression time, a preset algorithm compression ratio, and a preset algorithm compression quality factor from among the preset compression parameters; According to the preset required compression time, the preset required compression ratio, the preset required compression quality factor, the preset algorithm compression time, the preset algorithm compression ratio and the preset algorithm compression quality factor; According to the allowable deviation parameter information, the preset required compression time, the preset required compression ratio, the preset required compression quality factor, the preset algorithm compression time, the preset algorithm compression ratio and the preset algorithm compression quality factor, the matching degree value between each of the preset compression algorithms and the image to be compressed is determined.

4. The method according to claim 1, characterized in that: The step of determining the compression performance value of the target compression algorithm according to the critical parameter information and the actual compression parameter information includes: Obtaining actual compression time, actual computing resource amount, actual bit rate, actual compression efficiency and actual algorithm complexity from the actual compression parameter information; Acquire the critical compression time, critical computing resource amount, critical bit rate, critical compression efficiency and critical algorithm complexity in the critical parameter information; Determining a first compression performance according to the actual compression time, the critical compression time, the actual bit rate, the critical bit rate, the actual algorithm complexity, and the critical algorithm complexity; Determining a second compression performance according to the actual computing resource amount and the critical computing resource amount; A compression performance value of the target compression algorithm is determined according to the first compression performance and the second compression performance.

5. The method according to claim 1, characterized in that The step of determining the compression quality value of the target compression algorithm according to the original image parameters of the image to be compressed, the intermediate image parameters of the intermediate image, and the preset influencing factor information includes: The compression quality value of the target compression algorithm is determined according to the original image resolution, the original image file size, the original image signal-to-noise ratio, the intermediate image resolution, the intermediate image file size and the intermediate image signal-to-noise ratio.

6. An image compression device, characterized in that: include: An image acquisition module is used to acquire the image to be compressed and a preset compression algorithm library; An information determination module, used to determine a target compression algorithm according to the image to be compressed and the preset compression algorithm library, and compress the image to be compressed to obtain an intermediate image and actual compression parameter information; A completion degree determination module, used to determine the compression completion degree of the target compression algorithm under the current algorithm parameters according to the intermediate image and the actual compression parameter information; A parameter correction module, configured to correct the current algorithm parameters and return to execute the compression step of the image to be compressed if the compression completion degree does not reach a preset completion degree threshold; An image determination module, configured to use the intermediate image as the image compression result of the image to be compressed if the compression completion degree reaches the preset completion degree threshold; Wherein, the completion degree determination module includes: An information acquisition unit, used to acquire critical parameter information of the target compression algorithm; a fourth determining unit, configured to determine a compression performance value of the target compression algorithm according to the critical parameter information and the actual compression parameter information; a fifth determining unit, configured to determine a compression quality value of the target compression algorithm according to original image parameters of the image to be compressed, intermediate image parameters of the intermediate image, and preset influencing factor information; The sixth determination unit is used to determine the compression completion degree of the target compression algorithm under the current algorithm parameters according to the compression performance value and the compression quality value; wherein the original image parameters include the original image resolution, the original image file size and the original image signal-to-noise ratio; the intermediate image parameters include the intermediate image resolution, the intermediate image file size and the intermediate image signal-to-noise ratio.

7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the image compression method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the image compression method according to any one of claims 1 to 5 when executed.

9. A computer program product, characterized in that The computer program product comprises a computer program, which, when executed by a processor, implements the image compression method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Picture compression method and device, computer equipment and storage medium

    CN108399052A

  • Image compression method and device, electronic device and storage medium

    CN112102320A