Image compression method, device, electronic device and storage medium
By blocking the remote sensing image and dynamically adjusting the compression ratio, combined with the LZW compression algorithm, the contradiction between the compression efficiency and quality of the remote sensing image is solved, and efficient and high-quality image compression is achieved.
Patent Information
- Application Number
- CN202411877019.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-12-19
AI Technical Summary
When compressing remote sensing images, how can we ensure high quality of compressed images while improving compression efficiency?
By blocking the remote sensing image, each image block is compressed and decompressed according to the target compression ratio, and the compression ratio is adjusted based on the peak signal-to-noise ratio until the preset compression ratio is reached, and finally further compression is used using the LZW compression algorithm.
It achieves the high quality of compressed images while improving compression efficiency. By processing image blocks in parallel and dynamically adjusting the compression ratio, the compression efficiency and image quality are effectively improved.
Smart Images

Figure CN119324989B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image compression method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of satellite remote sensing technology in my country, considering the huge amount of remote sensing image data, which puts great pressure on the limited on-board storage and satellite-to-ground link bandwidth, it is crucial to compress remote sensing images.
[0003] Since satellite remote sensing imaging is expensive, the generated remote sensing images are extremely valuable. Therefore, when compressing remote sensing images, it is necessary to ensure the quality of the compressed images, that is, to obtain high-quality compressed images. However, high-quality compressed images are usually accompanied by the problem of low compression efficiency. Therefore, how to obtain high-quality compressed images while improving compression efficiency is an urgent problem to be solved by those skilled in the art. Summary of the invention
[0004] The present application provides an image compression method, device, electronic device and storage medium, which can improve the compression efficiency while ensuring the image quality of the compressed image when compressing a remote sensing image.
[0005] The present application provides an image compression method, comprising:
[0006] The remote sensing image to be processed is processed into blocks to obtain a plurality of image blocks;
[0007] For each of the image blocks, compress the image block according to a target compression ratio to obtain a first compressed image block, and decompress the first compressed image block to obtain a first decompressed image block;
[0008] synthesizing a plurality of first decompressed image blocks to obtain a first synthesized image;
[0009] Based on a peak signal-to-noise ratio between the first synthetic image and the remote sensing image, an image compression result of the remote sensing image is determined; wherein the peak signal-to-noise ratio is used to characterize the compression quality of each of the first compressed image blocks.
[0010] According to an image compression method provided by the present application, determining an image compression result of the remote sensing image based on a peak signal-to-noise ratio between the first synthetic image and the remote sensing image includes:
[0011] When the peak signal-to-noise ratio is less than a peak signal-to-noise ratio threshold, reducing the target compression ratio;
[0012] For each of the image blocks, compress the image block based on the reduced target compression ratio to obtain a second compressed image block; and decompress the second compressed image block to obtain a second decompressed image block;
[0013] synthesizing the plurality of second decompressed image blocks to obtain a new first synthesized image;
[0014] When a new peak signal-to-noise ratio between the new first synthetic image and the remote sensing image is less than the peak signal-to-noise ratio threshold, continue to reduce the target compression ratio, and repeat the above steps until the target compression ratio is reduced to a preset compression ratio;
[0015] Based on the preset compression ratio, the image compression result is determined.
[0016] According to an image compression method provided by the present application, determining the image compression result based on the preset compression ratio includes:
[0017] For each of the image blocks, compress the image block according to the preset compression ratio to obtain a third compressed image block; and decompress the third compressed image block to obtain a third decompressed image block;
[0018] synthesizing the plurality of third decompressed image blocks to obtain a second synthesized image;
[0019] When the peak signal-to-noise ratio between the second synthetic image and the remote sensing image is less than the peak signal-to-noise ratio threshold, compressing each of the image blocks using an LZW compression algorithm to obtain a fourth compressed image block corresponding to each of the image blocks;
[0020] The plurality of fourth decompressed image blocks are synthesized, and the synthesized image is determined as the image compression result.
[0021] According to an image compression method provided by the present application, the method further includes:
[0022] When the peak signal-to-noise ratio between the second synthesized image and the remote sensing image is greater than or equal to the peak signal-to-noise ratio threshold, a plurality of third compressed image blocks are synthesized, and the synthesized image is determined as the image compression result.
[0023] According to an image compression method provided by the present application, determining an image compression result of the remote sensing image based on a peak signal-to-noise ratio between the first synthetic image and the remote sensing image includes:
[0024] When the peak signal-to-noise ratio is greater than or equal to the peak signal-to-noise ratio threshold, a plurality of first compressed image blocks are synthesized, and the synthesized image is determined as the image compression result.
[0025] According to an image compression method provided by the present application, the method further includes:
[0026] Determining an image mean square error based on a grayscale value of each pixel in the first synthetic image and a grayscale value of each pixel in the remote sensing image;
[0027] The peak signal-to-noise ratio is determined based on the image mean square error and the maximum grayscale value; wherein the maximum grayscale value is the maximum grayscale value among the grayscale values corresponding to each pixel in the remote sensing image.
[0028] The present application also provides an image compression device, comprising:
[0029] A block division unit is used to divide the remote sensing image to be processed into blocks to obtain a plurality of image blocks;
[0030] A compression and decompression unit, configured to compress each of the image blocks according to a target compression ratio to obtain a first compressed image block, and decompress the first compressed image block to obtain a first decompressed image block;
[0031] A first synthesis unit, used for synthesizing a plurality of first decompressed image blocks to obtain a first synthesized image;
[0032] A processing unit is used to determine an image compression result of the remote sensing image based on a peak signal-to-noise ratio between the first synthetic image and the remote sensing image; wherein the peak signal-to-noise ratio is used to characterize the compression quality of each of the first compressed image blocks.
[0033] According to an image compression device provided by the present application, the processing unit is used to determine the image compression result of the remote sensing image based on the peak signal-to-noise ratio between the first synthetic image and the remote sensing image, including:
[0034] When the peak signal-to-noise ratio is less than a peak signal-to-noise ratio threshold, reducing the target compression ratio;
[0035] For each of the image blocks, compress the image block based on the reduced target compression ratio to obtain a second compressed image block; and decompress the second compressed image block to obtain a second decompressed image block;
[0036] synthesizing the plurality of second decompressed image blocks to obtain a new first synthesized image;
[0037] When a new peak signal-to-noise ratio between the new first synthetic image and the remote sensing image is less than the peak signal-to-noise ratio threshold, continue to reduce the target compression ratio, and repeat the above steps until the target compression ratio is reduced to a preset compression ratio;
[0038] Based on the preset compression ratio, the image compression result is determined.
[0039] According to an image compression device provided by the present application, the processing unit is used to determine the image compression result based on the preset compression ratio, including:
[0040] For each of the image blocks, compress the image block according to the preset compression ratio to obtain a third compressed image block; and decompress the third compressed image block to obtain a third decompressed image block;
[0041] synthesizing the plurality of third decompressed image blocks to obtain a second synthesized image;
[0042] When the peak signal-to-noise ratio between the second synthetic image and the remote sensing image is less than the peak signal-to-noise ratio threshold, compressing each of the image blocks using an LZW compression algorithm to obtain a fourth compressed image block corresponding to each of the image blocks;
[0043] The plurality of fourth decompressed image blocks are synthesized, and the synthesized image is determined as the image compression result.
[0044] According to an image compression device provided by the present application, the device also includes:
[0045] The second synthesis unit is used to synthesize multiple third compressed image blocks when the peak signal-to-noise ratio between the second synthesized image and the remote sensing image is greater than or equal to the peak signal-to-noise ratio threshold, and determine the synthesized image as the image compression result.
[0046] According to an image compression device provided by the present application, the device also includes:
[0047] The third synthesis unit is used to synthesize the multiple first compressed image blocks when the peak signal-to-noise ratio is greater than or equal to the peak signal-to-noise ratio threshold, and determine the synthesized image as the image compression result.
[0048] According to an image compression device provided by the present application, the device also includes:
[0049] A first determining unit, configured to determine an image mean square error based on a grayscale value of each pixel in the first synthetic image and a grayscale value of each pixel in the remote sensing image;
[0050] The second determination unit is used to determine the peak signal-to-noise ratio based on the image mean square error and the maximum grayscale value; wherein the maximum grayscale value is the maximum grayscale value among the grayscale values corresponding to each pixel in the remote sensing image.
[0051] The present application also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-described image compression methods when executing the computer program.
[0052] The present application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the image compression method as described in any one of the above is implemented.
[0053] The present application also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the image compression method as described above is implemented.
[0054] The image compression method, device, electronic device and storage medium provided by the present application can first process the remote sensing image into blocks to obtain multiple image blocks when compressing the remote sensing image; for each image block, compress the image block according to the target compression ratio to obtain a first compressed image block, and decompress the first compressed image block to obtain a first decompressed image block; synthesize multiple first decompressed image blocks to obtain a first synthesized image; determine the image compression result of the remote sensing image based on the peak signal-to-noise ratio between the first synthesized image and the remote sensing image; wherein the peak signal-to-noise ratio is used to characterize the compression quality of each first compressed image block. In this way, the remote sensing image is first processed into blocks, and multiple image blocks are compressed and decompressed in parallel, which can effectively improve the compression efficiency compared with directly compressing the entire remote sensing image; in addition, considering that the peak signal-to-noise ratio can be well used to evaluate the compression quality of the remote sensing image after compression, therefore, the image compression result of the remote sensing image is determined based on the peak signal-to-noise ratio between the first synthesized image and the remote sensing image, which can ensure the image quality of the compressed image, thereby ensuring the image quality of the compressed image while improving the compression efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0056] Figure 1 A flowchart of an image compression method provided in an embodiment of the present application.
[0057] Figure 2 A schematic diagram of a framework for determining an image compression result of a remote sensing image provided in an embodiment of the present application.
[0058] Figure 3A schematic diagram of the structure of an image compression device provided in an embodiment of the present application.
[0059] Figure 4 A schematic diagram of the physical structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0061] In the embodiments of the present application, "at least one" means one or more, and "more" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. In the text description of the present application, the character " / " generally indicates that the associated objects before and after are in an "or" relationship.
[0062] The technical solution provided in the embodiments of the present application can be adapted to image compression scenarios. Taking remote sensing image compression scenarios as an example, since satellite remote sensing imaging is costly and the generated remote sensing images are extremely valuable, when compressing remote sensing images, it is necessary to ensure the quality of the compressed images, that is, to obtain high-quality compressed images.
[0063] However, high-quality compressed images are usually accompanied by the problem of low compression efficiency. Therefore, when compressing remote sensing images, in order to improve the compression efficiency while ensuring the image quality of the compressed image, an embodiment of the present application provides an image compression method. The executor of the method can be an electronic device such as a computer or a server, or it can be an image compression device set in the electronic device. The image compression device can be implemented by software, hardware, or a combination of both.
[0064] The image compression method provided by the present application will be described in detail below through the following specific embodiments. It is understandable that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0065] Figure 1 A flowchart of an image compression method provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the image compression method may include:
[0066] S101, performing block processing on a remote sensing image to be processed to obtain a plurality of image blocks.
[0067] For example, in the embodiment of the present application, in order to effectively improve the compression efficiency of remote sensing images, a multi-core architecture can be used for parallel processing. The multi-core architecture implements a "divide and conquer" strategy. By dividing tasks, thread applications can make full use of multiple execution cores and execute more tasks within a specific time.
[0068] In an embodiment of the present application, a process-thread model in a multi-core architecture can be adopted, where the main process reads the remote sensing image to be processed and processes the remote sensing image in blocks according to the number of multiple threads it includes to obtain multiple image blocks.
[0069] For example, the number of image blocks may be equal to the number of threads, or may be less than the number of sub-threads, to ensure that one image block corresponds to one thread. In an embodiment of the present application, the number of image blocks may be equal to the number of threads, so that by processing the remote sensing image in blocks and compressing the multiple image blocks in parallel through the threads corresponding to the multiple image blocks, the compression efficiency can be effectively improved compared to directly compressing the entire remote sensing image.
[0070] S102 . For each image block, compress the image block according to a target compression ratio to obtain a first compressed image block, and decompress the first compressed image block to obtain a first decompressed image block.
[0071] For example, the target compression ratio may be 20, or 25, or other values, and may be set according to actual needs.
[0072] When compressing image blocks, considering that the JPEG2000 compression algorithm has good low-bit rate compression performance, can be transmitted progressively according to pixel accuracy and resolution, supports lossless compression and lossy compression, and has access and processing of region of interest coding and random code streams, for example, in an embodiment of the present application, the JPEG2000 compression algorithm can be used to compress image blocks, which can effectively reduce the data volume of the compressed image blocks while ensuring the compression quality of the image blocks.
[0073] Among them, the JPEG2000 compression algorithm abandons the block coding method based on discrete cosine transform and instead uses a multi-resolution coding method based on discrete wavelet transform DWT algorithm. It can be applied to coding scenarios of different types (such as grayscale images, color images and multi-component images), different properties (such as natural images, remote sensing images and drawn graphics) and different imaging models (such as real-time transmission, limited cache and bandwidth resources).
[0074] After the image block is compressed by using the JPEG2000 compression algorithm to obtain the first compressed image block, the first compressed image block may be decompressed by using a decompression method corresponding to the JPEG2000 compression algorithm to obtain the corresponding first decompressed image block.
[0075] S103: Synthesize multiple first decompressed image blocks to obtain a first synthesized image.
[0076] For example, in an embodiment of the present application, a plurality of first decompressed image blocks may be synthesized by a direct pixel operation method, or by a feature matching and fusion-based method, or by a deep learning method. The specific settings may be made according to actual needs.
[0077] After synthesizing the plurality of first decompressed image blocks to obtain a first synthesized image, the following S104 may be performed:
[0078] S104. Determine an image compression result of the remote sensing image based on a peak signal-to-noise ratio between the first synthetic image and the remote sensing image; wherein the peak signal-to-noise ratio is used to characterize the compression quality of each first compressed image block.
[0079] Considering that the peak signal-to-noise ratio can be monitored in real time, and when the peak signal-to-noise ratio value exceeds 30dB, it is difficult for human vision to distinguish the difference between the original image and the compressed image. Therefore, in an embodiment of the present application, the compression quality of the remote sensing image after compression is evaluated based on the peak signal-to-noise ratio between the first synthetic image and the remote sensing image.
[0080] It can be seen that in the embodiment of the present application, when compressing the remote sensing image, the remote sensing image can be first processed into blocks to obtain multiple image blocks; for each image block, the image block is compressed according to the target compression ratio to obtain a first compressed image block, and the first compressed image block is decompressed to obtain a first decompressed image block; multiple first decompressed image blocks are synthesized to obtain a first synthesized image; based on the peak signal-to-noise ratio between the first synthesized image and the remote sensing image, the image compression result of the remote sensing image is determined; wherein the peak signal-to-noise ratio is used to characterize the compression quality of each first compressed image block. In this way, the remote sensing image is first processed into blocks, and multiple image blocks are compressed and decompressed in parallel, which can effectively improve the compression efficiency compared to directly compressing the entire remote sensing image; in addition, considering that the peak signal-to-noise ratio can be well used to evaluate the compression quality of the remote sensing image after compression, therefore, based on the peak signal-to-noise ratio between the first synthesized image and the remote sensing image, the image compression result of the remote sensing image is determined, which can ensure the image quality of the compressed image, thereby ensuring the image quality of the compressed image while improving the compression efficiency.
[0081] Based on the above Figure 1 The embodiment shown, for example, in the embodiment of the present application, when determining the peak signal-to-noise ratio between the first synthetic image and the remote sensing image, the image mean square error can be first determined based on the grayscale value of each pixel in the first synthetic image and the grayscale value of each pixel in the remote sensing image; and the peak signal-to-noise ratio can be determined based on the image mean square error and the maximum grayscale value.
[0082] The maximum grayscale value is the maximum grayscale value among the grayscale values corresponding to each pixel in the remote sensing image.
[0083] The remote sensing image corresponds to a two-dimensional matrix, each pixel is a sample point, and the number of rows and columns of the pixel is the coordinate position (i, j) of the pixel in the remote sensing image, where i represents the number of rows of the pixel in the remote sensing image, and j represents the number of columns of the pixel in the remote sensing image. , , M represents the total number of rows of pixels in the remote sensing image, and N represents the total number of columns of pixels in the remote sensing image.
[0084] For example, when determining the image mean square error based on the grayscale value of each pixel in the first synthetic image and the grayscale value of each pixel in the remote sensing image, the following formula 1 may be referred to.
[0085] Formula 1
[0086] in, represents the mean square error of the image, represents the gray value of the pixel in the i-th row and j-th column in the remote sensing image, Represents the grayscale value of the pixel in the i-th row and j-th column in the first synthetic image.
[0087] For example, when determining the peak signal-to-noise ratio based on the image mean square error and the maximum grayscale value, refer to the following formula 2.
[0088] Formula 2
[0089] Among them, PSNR means peak signal-to-noise ratio, Indicates the maximum grayscale value among the grayscale values corresponding to each pixel in the remote sensing image. Generally, the larger the PSNR, the higher the consistency between the first synthetic image and the remote sensing image, and the better the quality of the corresponding compressed image; on the contrary, the smaller the PSNR, the lower the consistency between the first synthetic image and the remote sensing image, the greater the distortion of the corresponding compressed image, and the worse the image quality.
[0090] In combination with the above description, after determining the peak signal-to-noise ratio between the first synthetic image and the remote sensing image, the above S104 can be executed to determine the image compression result of the remote sensing image based on the peak signal-to-noise ratio between the first synthetic image and the remote sensing image. Figure 2 As shown, Figure 2 A framework schematic diagram for determining an image compression result of a remote sensing image provided in an embodiment of the present application can provide a detailed description of how to determine the image compression result of the remote sensing image based on the peak signal-to-noise ratio between the first synthetic image and the remote sensing image.
[0091] For example, in an embodiment of the present application, when determining the image compression result of the remote sensing image based on the peak signal-to-noise ratio between the first synthetic image and the remote sensing image, at least the following two possible scenarios may be included.
[0092] In one scenario, a peak signal-to-noise ratio between the first synthetic image and the remote sensing image is greater than or equal to a peak signal-to-noise ratio threshold.
[0093] When the peak signal-to-noise ratio is greater than or equal to the peak signal-to-noise ratio threshold, it indicates that the compression quality of the plurality of first compressed image blocks is good. In this case, the plurality of first compressed image blocks can be directly synthesized, and the synthesized image is determined as the image compression result. After the image compression result is obtained, the image compression result can be stored in a disk file, and all threads can be closed, thereby realizing thread resources.
[0094] In another scenario, a peak signal-to-noise ratio between the first synthetic image and the remote sensing image is less than a peak signal-to-noise ratio threshold.
[0095] When the peak signal-to-noise ratio is less than the peak signal-to-noise ratio threshold, it indicates that the compression quality of the multiple first compressed image blocks is poor. In this case, the target compression ratio can be reduced. For example, taking the target compression ratio of 20 as an example, the target compression ratio can be reduced to 10, that is, the reduced target compression ratio is 10. For each image block, the image block is compressed based on the reduced target compression ratio to obtain a second compressed image block. The second compressed image block is decompressed to obtain a second decompressed image block. Multiple second decompressed image blocks are synthesized to obtain a new first synthesized image. When the new peak signal-to-noise ratio between the new first synthesized image and the remote sensing image is greater than or equal to the peak signal-to-noise ratio threshold, it indicates that the compression quality of multiple second compressed image blocks is good. In this case, the multiple second compressed image blocks can be directly synthesized, and the synthesized image is determined as the image compression result. In this way, after obtaining the image compression result, the image compression result can be stored in a disk file, and all threads can be closed, thereby realizing thread resources.
[0096] On the contrary, when the new peak signal-to-noise ratio between the new first synthetic image and the remote sensing image is less than the peak signal-to-noise ratio threshold, it indicates that the compression quality of the plurality of second compressed block image blocks is poor. In this case, the target compression ratio may be further reduced. For example, taking the reduced target compression ratio as 10 as an example, the target compression ratio may be further reduced to 5, and the above steps may be repeated until the target compression ratio is reduced to the preset compression ratio. Based on the preset compression ratio, the image compression result is determined.
[0097] For example, the preset compression ratio may be 5, or 6, etc., and may be set according to actual needs.
[0098] For example, in the embodiment of the present application, when determining the image compression result based on the preset compression ratio, it may include:
[0099] For each image block, the image block is compressed according to a preset compression ratio to obtain a third compressed image block; the third compressed image block is decompressed to obtain a third decompressed image block; multiple third decompressed image blocks are synthesized to obtain a second synthesized image; when the peak signal-to-noise ratio between the second synthesized image and the remote sensing image is greater than or equal to the peak signal-to-noise ratio threshold, it means that the compression quality of multiple third compressed image blocks is good. In this case, the multiple third compressed image blocks can be directly synthesized, and the synthesized image is determined as the image compression result. In this way, after obtaining the image compression result, the image compression result can be stored in a disk file, and all threads can be closed, thereby realizing thread resources.
[0100] On the contrary, when the peak signal-to-noise ratio between the second synthetic image and the remote sensing image is less than the peak signal-to-noise ratio threshold, it indicates that the compression quality of the plurality of second compressed image blocks is poor. In this case, the LZW compression algorithm can be used to compress each image block to obtain a fourth compressed image block corresponding to each image block; and the plurality of fourth decompressed image blocks are synthesized, and the synthesized image is determined as the image compression result.
[0101] Among them, the LZW compression algorithm is a dictionary-based compression algorithm. It regards the information sequence output by the source as various entries in the dictionary. Its basic idea is to establish a dictionary and map the input string into a fixed-length codeword for output. The dictionary is dynamically established according to the data characteristics of the source, and the encoding process is the process of establishing the dictionary. During the compression process, new strings are constantly generated in the dictionary, and the codewords corresponding to the prefix of the new string are also saved when the new string is stored. The advantage of the LZW compression algorithm is that it dynamically marks repeated data strings that appear in the data stream. It records the string encountered during the compression process in the dictionary, and when it encounters this string again next time, it uses a code to represent the string. By using a short code to represent a relatively long string to compress the data volume, it is currently widely used. Data compression software such as Pkzip, Winzip, and WinRAR all contain the LZW data compression algorithm, and have a good compression effect.
[0102] It can be seen that in the embodiment of the present application, when compressing the remote sensing image, the remote sensing image is first processed by dividing it into blocks, and for each image block, the image block is compressed according to the target compression ratio to obtain a first compressed image block, and the first compressed image block is decompressed to obtain a first decompressed image block; multiple first decompressed image blocks are synthesized to obtain a first synthesized image; based on the peak signal-to-noise ratio between the first synthesized image and the remote sensing image, the image compression result of the remote sensing image is determined. In this way, the remote sensing image is first processed by dividing it into blocks, and multiple image blocks are compressed and decompressed in parallel, which can effectively improve the compression efficiency compared to directly compressing the entire remote sensing image; in addition, considering that the peak signal-to-noise ratio can be well used to evaluate the compression quality of the remote sensing image after compression, therefore, based on the peak signal-to-noise ratio between the first synthesized image and the remote sensing image, the image compression result of the remote sensing image is determined, which can ensure the image quality of the compressed image, thereby improving the compression efficiency while ensuring the image quality of the compressed image.
[0103] The image compression device provided by the present application is described below. The image compression device described below and the image compression method described above can be referenced to each other.
[0104] Figure 3 This is a structural diagram of an image compression device provided in an embodiment of the present application. For example, see Figure 3 As shown, the image compression device 30 may include:
[0105] A block division unit 301 is used to perform block processing on the remote sensing image to be processed to obtain multiple image blocks;
[0106] A compression and decompression unit 302, configured to compress each of the image blocks according to a target compression ratio to obtain a first compressed image block, and decompress the first compressed image block to obtain a first decompressed image block;
[0107] A first synthesis unit 303, configured to synthesize a plurality of first decompressed image blocks to obtain a first synthesized image;
[0108] The processing unit 304 is used to determine the image compression result of the remote sensing image based on the peak signal-to-noise ratio between the first synthetic image and the remote sensing image; wherein the peak signal-to-noise ratio is used to characterize the compression quality of each of the first compressed image blocks.
[0109] For example, in the embodiment of the present application, the processing unit 304 is used to determine the image compression result of the remote sensing image based on the peak signal-to-noise ratio between the first synthetic image and the remote sensing image, including:
[0110] When the peak signal-to-noise ratio is less than a peak signal-to-noise ratio threshold, reducing the target compression ratio;
[0111] For each of the image blocks, compress the image block based on the reduced target compression ratio to obtain a second compressed image block; and decompress the second compressed image block to obtain a second decompressed image block;
[0112] synthesizing the plurality of second decompressed image blocks to obtain a new first synthesized image;
[0113] When a new peak signal-to-noise ratio between the new first synthetic image and the remote sensing image is less than the peak signal-to-noise ratio threshold, continue to reduce the target compression ratio, and repeat the above steps until the target compression ratio is reduced to a preset compression ratio;
[0114] Based on the preset compression ratio, the image compression result is determined.
[0115] For example, in the embodiment of the present application, the processing unit 304 is used to determine the image compression result based on the preset compression ratio, including:
[0116] For each of the image blocks, compress the image block according to the preset compression ratio to obtain a third compressed image block; and decompress the third compressed image block to obtain a third decompressed image block;
[0117] synthesizing the plurality of third decompressed image blocks to obtain a second synthesized image;
[0118] When the peak signal-to-noise ratio between the second synthetic image and the remote sensing image is less than the peak signal-to-noise ratio threshold, compressing each of the image blocks using an LZW compression algorithm to obtain a fourth compressed image block corresponding to each of the image blocks;
[0119] The plurality of fourth decompressed image blocks are synthesized, and the synthesized image is determined as the image compression result.
[0120] For example, in the embodiment of the present application, the image compression device 30 further includes:
[0121] The second synthesis unit is used to synthesize multiple third compressed image blocks when the peak signal-to-noise ratio between the second synthesized image and the remote sensing image is greater than or equal to the peak signal-to-noise ratio threshold, and determine the synthesized image as the image compression result.
[0122] For example, in the embodiment of the present application, the image compression device 30 further includes:
[0123] The third synthesis unit is used to synthesize the multiple first compressed image blocks when the peak signal-to-noise ratio is greater than or equal to the peak signal-to-noise ratio threshold, and determine the synthesized image as the image compression result.
[0124] For example, in the embodiment of the present application, the image compression device 30 further includes:
[0125] A first determining unit, configured to determine an image mean square error based on a grayscale value of each pixel in the first synthetic image and a grayscale value of each pixel in the remote sensing image;
[0126] The second determination unit is used to determine the peak signal-to-noise ratio based on the image mean square error and the maximum grayscale value; wherein the maximum grayscale value is the maximum grayscale value among the grayscale values corresponding to each pixel in the remote sensing image.
[0127] The image compression device 30 provided in the embodiment of the present application can execute the technical solution of the image compression method in any of the above-mentioned embodiments. Its implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the image compression method. Please refer to the implementation principle and beneficial effects of the image compression method, and no further details will be given here.
[0128] Figure 4 A schematic diagram of the physical structure of an electronic device provided in an embodiment of the present application, such as Figure 4As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420 and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute the image compression method, which includes: performing block processing on the remote sensing image to be processed to obtain multiple image blocks; for each of the image blocks, compressing the image block according to the target compression ratio to obtain a first compressed image block, and decompressing the first compressed image block to obtain a first decompressed image block; synthesizing multiple first decompressed image blocks to obtain a first synthesized image; and determining the image compression result of the remote sensing image based on the peak signal-to-noise ratio between the first synthesized image and the remote sensing image; wherein the peak signal-to-noise ratio is used to characterize the compression quality of each of the first compressed image blocks.
[0129] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0130] On the other hand, the present application also provides a computer program product, which includes a computer program, and the computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the image compression method provided by the above-mentioned methods, and the method includes: performing block processing on the remote sensing image to be processed to obtain multiple image blocks; for each of the image blocks, compressing the image block according to a target compression ratio to obtain a first compressed image block, and decompressing the first compressed image block to obtain a first decompressed image block; synthesizing multiple first decompressed image blocks to obtain a first synthesized image; based on the peak signal-to-noise ratio between the first synthesized image and the remote sensing image, determining the image compression result of the remote sensing image; wherein the peak signal-to-noise ratio is used to characterize the compression quality of each of the first compressed image blocks.
[0131] On the other hand, the present application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the image compression method provided by the above-mentioned methods, the method comprising: performing block processing on the remote sensing image to be processed to obtain multiple image blocks; for each of the image blocks, compressing the image block according to a target compression ratio to obtain a first compressed image block, and decompressing the first compressed image block to obtain a first decompressed image block; synthesizing the multiple first decompressed image blocks to obtain a first synthesized image; determining the image compression result of the remote sensing image based on the peak signal-to-noise ratio between the first synthesized image and the remote sensing image; wherein the peak signal-to-noise ratio is used to characterize the compression quality of each of the first compressed image blocks.
[0132] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0133] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0134] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. An image compression method, characterized in that: include: The remote sensing image to be processed is processed into blocks to obtain a plurality of image blocks; For each of the image blocks, compress the image block according to a target compression ratio to obtain a first compressed image block, and decompress the first compressed image block to obtain a first decompressed image block; synthesizing a plurality of first decompressed image blocks to obtain a first synthesized image; Determining an image compression result of the remote sensing image based on a peak signal-to-noise ratio between the first synthetic image and the remote sensing image; wherein the peak signal-to-noise ratio is used to characterize the compression quality of each of the first compressed image blocks; The step of determining an image compression result of the remote sensing image based on a peak signal-to-noise ratio between the first synthetic image and the remote sensing image comprises: When the peak signal-to-noise ratio is less than a peak signal-to-noise ratio threshold, reducing the target compression ratio; For each of the image blocks, compress the image block based on the reduced target compression ratio to obtain a second compressed image block; and decompress the second compressed image block to obtain a second decompressed image block; synthesizing the plurality of second decompressed image blocks to obtain a new first synthesized image; When a new peak signal-to-noise ratio between the new first synthetic image and the remote sensing image is less than the peak signal-to-noise ratio threshold, continue to reduce the target compression ratio, and repeat the above steps until the target compression ratio is reduced to a preset compression ratio; Based on the preset compression ratio, the image compression result is determined.
2. The image compression method according to claim 1, characterized in that: The step of determining the image compression result based on the preset compression ratio includes: For each of the image blocks, compress the image block according to the preset compression ratio to obtain a third compressed image block; and decompress the third compressed image block to obtain a third decompressed image block; synthesizing the plurality of third decompressed image blocks to obtain a second synthesized image; When the peak signal-to-noise ratio between the second synthetic image and the remote sensing image is less than the peak signal-to-noise ratio threshold, compressing each of the image blocks using an LZW compression algorithm to obtain a fourth compressed image block corresponding to each of the image blocks; The plurality of fourth decompressed image blocks are synthesized, and the synthesized image is determined as the image compression result.
3. The image compression method according to claim 2, characterized in that: The method further comprises: When the peak signal-to-noise ratio between the second synthesized image and the remote sensing image is greater than or equal to the peak signal-to-noise ratio threshold, a plurality of third compressed image blocks are synthesized, and the synthesized image is determined as the image compression result.
4. The image compression method according to any one of claims 1 to 3, characterized in that: The method further comprises: When the peak signal-to-noise ratio is greater than or equal to the peak signal-to-noise ratio threshold, a plurality of first compressed image blocks are synthesized, and the synthesized image is determined as the image compression result.
5. The image compression method according to any one of claims 1 to 3, characterized in that: The method further comprises: Determining an image mean square error based on a grayscale value of each pixel in the first synthetic image and a grayscale value of each pixel in the remote sensing image; The peak signal-to-noise ratio is determined based on the image mean square error and the maximum grayscale value; wherein the maximum grayscale value is the maximum grayscale value among the grayscale values corresponding to each pixel in the remote sensing image.
6. An image compression device, characterized in that: include: A block division unit is used to divide the remote sensing image to be processed into blocks to obtain a plurality of image blocks; A compression and decompression unit, configured to compress each of the image blocks according to a target compression ratio to obtain a first compressed image block, and decompress the first compressed image block to obtain a first decompressed image block; A first synthesis unit, used for synthesizing a plurality of first decompressed image blocks to obtain a first synthesized image; a processing unit, configured to determine an image compression result of the remote sensing image based on a peak signal-to-noise ratio between the first synthetic image and the remote sensing image; wherein the peak signal-to-noise ratio is used to characterize a compression quality of each of the first compressed image blocks; The processing unit, for determining an image compression result of the remote sensing image based on a peak signal-to-noise ratio between the first synthetic image and the remote sensing image, comprises: When the peak signal-to-noise ratio is less than a peak signal-to-noise ratio threshold, reducing the target compression ratio; For each of the image blocks, compress the image block based on the reduced target compression ratio to obtain a second compressed image block; and decompress the second compressed image block to obtain a second decompressed image block; synthesizing the plurality of second decompressed image blocks to obtain a new first synthesized image; When a new peak signal-to-noise ratio between the new first synthetic image and the remote sensing image is less than the peak signal-to-noise ratio threshold, continue to reduce the target compression ratio, and repeat the above steps until the target compression ratio is reduced to a preset compression ratio; Based on the preset compression ratio, the image compression result is determined.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the image compression method according to any one of claims 1 to 5 is implemented.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image compression method according to any one of claims 1 to 5 is implemented.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the image compression method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Method for reconstructing image based on blind compressed sensing module
CN103400349A
Image compression method and device and electronic equipment
CN117939128A