Disclosure of Invention
The application provides an image compression method, an image compression device, electronic equipment and a storage medium, which can improve the compression efficiency and ensure the image quality of a compressed image when the remote sensing image is compressed.
The application provides an image compression method, which comprises the following steps:
performing blocking processing on a remote sensing image to be processed to obtain a plurality of image blocks;
compressing the image blocks according to a target compression ratio for each image block to obtain a first compressed image block, and decompressing the first compressed image block to obtain a first decompressed image block;
synthesizing the plurality of first decompressed image blocks to obtain a first synthesized image;
and determining an image compression result of the remote sensing image based on a peak signal-to-noise ratio between the first synthesized image and the remote sensing image, wherein the peak signal-to-noise ratio is used for representing the compression quality of each first compressed image block.
According to the image compression method provided by the application, 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, and the method comprises the following steps:
Reducing the target compression ratio under the condition that the peak signal-to-noise ratio is smaller than a peak signal-to-noise ratio threshold;
Compressing the image blocks based on the reduced target compression ratio for each image block to obtain a second compressed image block, decompressing 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;
continuing to reduce the target compression ratio under the condition that the new peak signal-to-noise ratio between the new first synthesized image and the remote sensing image is smaller than the peak signal-to-noise ratio threshold value, and repeatedly executing the steps until the target compression ratio is reduced to a preset compression ratio;
And determining the image compression result based on the preset compression ratio.
According to the image compression method provided by the application, the image compression result is determined based on the preset compression ratio, and the method comprises the following steps:
compressing the image blocks according to the preset compression ratio for each image block to obtain a third compressed image block, and decompressing 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;
Under the condition that the peak signal-to-noise ratio between the second synthesized image and the remote sensing image is smaller than the peak signal-to-noise ratio threshold, compressing each image block by adopting an LZW compression algorithm to obtain a fourth compressed image block corresponding to each image block;
And synthesizing the fourth decompressed image blocks, and determining the synthesized image as the image compression result.
According to the image compression method provided by the application, the method further comprises the following steps:
And synthesizing a plurality of third compressed image blocks under the condition that 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 determining the synthesized image as the image compression result.
According to the image compression method provided by the application, 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, and the method comprises the following steps:
and under the condition that the peak signal-to-noise ratio is greater than or equal to a peak signal-to-noise ratio threshold, synthesizing a plurality of first compressed image blocks, and determining the synthesized image as the image compression result.
According to the image compression method provided by the application, the method further comprises the following steps:
Determining an image mean square error based on the gray value of each pixel point in the first composite image and the gray value of each pixel point in the remote sensing image;
And determining the peak signal-to-noise ratio based on the image mean square error and a maximum gray value, wherein the maximum gray value is the maximum gray value in gray values corresponding to all pixel points in the remote sensing image.
The present application also provides an image compression apparatus including:
The blocking unit is used for carrying out blocking processing on the remote sensing image to be processed to obtain a plurality of image blocks;
The compression and decompression unit is used for compressing the image blocks 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;
A first synthesizing unit, configured to synthesize a plurality of first decompressed image blocks to obtain a first synthesized image;
And the processing unit is used for determining an image compression result of the remote sensing image based on a peak signal-to-noise ratio between the first synthesized image and the remote sensing image, wherein the peak signal-to-noise ratio is used for representing the compression quality of each first compressed image block.
According to the image compression device provided by the application, the processing unit is used for determining an image compression result of the remote sensing image based on a peak signal-to-noise ratio between the first synthesized image and the remote sensing image, and comprises the following steps:
Reducing the target compression ratio under the condition that the peak signal-to-noise ratio is smaller than a peak signal-to-noise ratio threshold;
Compressing the image blocks based on the reduced target compression ratio for each image block to obtain a second compressed image block, decompressing 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;
continuing to reduce the target compression ratio under the condition that the new peak signal-to-noise ratio between the new first synthesized image and the remote sensing image is smaller than the peak signal-to-noise ratio threshold value, and repeatedly executing the steps until the target compression ratio is reduced to a preset compression ratio;
And determining the image compression result based on the preset compression ratio.
According to the image compression device provided by the application, the processing unit is used for determining the image compression result based on the preset compression ratio, and comprises the following steps:
compressing the image blocks according to the preset compression ratio for each image block to obtain a third compressed image block, and decompressing 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;
Under the condition that the peak signal-to-noise ratio between the second synthesized image and the remote sensing image is smaller than the peak signal-to-noise ratio threshold, compressing each image block by adopting an LZW compression algorithm to obtain a fourth compressed image block corresponding to each image block;
And synthesizing the fourth decompressed image blocks, and determining the synthesized image as the image compression result.
According to the present application, there is provided an image compression apparatus, the apparatus further comprising:
And the second synthesis unit is used for synthesizing the plurality of third compressed image blocks under the condition that 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 value, and determining the synthesized image as the image compression result.
According to the present application, there is provided an image compression apparatus, the apparatus further comprising:
and the third synthesis unit is used for synthesizing the plurality of first compressed image blocks under the condition that the peak signal-to-noise ratio is greater than or equal to the peak signal-to-noise ratio threshold value, and determining the synthesized image as the image compression result.
According to the present application, there is provided an image compression apparatus, the apparatus further comprising:
The first determining unit is used for determining an image mean square error based on the gray value of each pixel point in the first composite image and the gray value of each pixel point in the remote sensing image;
And the second determining unit is used for determining the peak signal-to-noise ratio based on the image mean square error and the maximum gray value, wherein the maximum gray value is the maximum gray value in gray values corresponding to all pixel points in the remote sensing image.
The application also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the image compression method as described in any one of the above when executing the computer program.
The present application also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements an image compression method as described in any of the above.
The application also provides a computer program product comprising a computer program which, when executed by a processor, implements the image compression method as described in any one of the above.
The image compression method, the device, the electronic equipment and the storage medium can firstly carry out block division processing on the remote sensing image to obtain a plurality of image blocks when the remote sensing image is compressed, compress the image blocks according to a target compression ratio for each image block to obtain a first compressed image block, decompress the first compressed image block to obtain a first decompressed image block, synthesize the plurality of first decompressed image blocks to obtain a first synthesized image, and determine an image compression result of the remote sensing image based on a peak signal-to-noise ratio between the first synthesized image and the remote sensing image, wherein the peak signal-to-noise ratio is used for representing compression quality of each first compressed image block. In addition, the peak signal-to-noise ratio is considered to be better used for evaluating the compression quality of the remote sensing image after compression, so that the image compression result of the remote sensing image is determined based on the peak signal-to-noise ratio between the first composite image and the remote sensing image, the image quality of the compressed image can be ensured, and the image quality of the compressed image can be ensured while the compression efficiency is improved.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
In embodiments of the present application, "at least one" means one or more, and "a plurality" means two or more. "and/or" describes an association relationship of associated objects, meaning that there may be three relationships, e.g., A and/or B, and that there may be three cases where A exists alone, while A exists with B, and B exists alone, where A and B may be singular or plural. In the text description of the present application, the character "/" generally indicates that the front-rear associated object is an or relationship.
The technical scheme provided by the embodiment of the application can be suitable for an image compression scene, taking a remote sensing image compression scene as an example, because the satellite remote sensing imaging cost is high, the generated remote sensing image is extremely precious, and therefore, when the remote sensing image is compressed, the quality of the compressed image needs to be ensured, namely, a compressed image with high quality needs to be obtained.
However, since a high-quality compressed image is generally associated with a problem of low compression efficiency, in order to improve the compression efficiency and ensure the image quality of the compressed image when the remote sensing image is compressed, the embodiment of the application provides an image compression method, and an execution subject of the method may be electronic equipment such as a computer or a server, or an image compression device provided in the electronic equipment, and the image compression device may be implemented by software, hardware or a combination of the two.
Hereinafter, the image compression method provided by the present application will be described in detail by the following several specific examples. It is to be understood that the following embodiments may be combined with each other and that some embodiments may not be repeated for the same or similar concepts or processes.
Fig. 1 is a flowchart of an image compression method according to an embodiment of the present application, for example, please refer to fig. 1, the image compression method may include:
S101, performing blocking processing on the remote sensing image to be processed to obtain a plurality of image blocks.
Illustratively, in the embodiment of the present application, in order to effectively improve the compression efficiency of the remote sensing image, a multi-core architecture parallelization process may be adopted. The multi-core architecture realizes a divide-and-conquer strategy, and by dividing tasks, the thread application can fully utilize a plurality of execution cores and execute more tasks in a specific time.
In the embodiment of the application, a process-thread model in a multi-core architecture can be adopted, and a main process reads a remote sensing image to be processed and carries out blocking processing on the remote sensing image according to the number of a plurality of threads included in the remote sensing image to obtain a plurality of image blocks.
For example, the number of image blocks may be equal to the number of threads or may be smaller than the number of sub-threads, so as to ensure that one image block corresponds to one thread. In the embodiment of the application, the number of the image blocks can be equal to the number of threads, so that the compression efficiency can be effectively improved compared with the compression of the whole remote sensing image by carrying out the blocking processing on the remote sensing image and carrying out the parallel compression on the image blocks through the threads corresponding to the image blocks.
S102, compressing the image blocks according to a target compression ratio for each image block to obtain a first compressed image block, and decompressing the first compressed image block to obtain a first decompressed image block.
The target compression ratio may be 20, 25, or other values, for example, and may be specifically set according to actual needs.
When the image block is compressed, considering that the JPEG2000 compression algorithm has good low bit rate compression performance, can progressively transmit according to pixel precision 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 the embodiment of the present application, the image block can be compressed by adopting the JPEG2000 compression algorithm, so that the data volume of the compressed image block can be effectively reduced under the condition of ensuring the compression quality of the image block.
The JPEG2000 compression algorithm discards a block coding mode mainly based on discrete cosine transform, changes a multi-resolution coding mode mainly based on discrete wavelet transform DWT algorithm, and can be applied to coding scenes of different types (such as gray level images, color images, multi-component images, etc.), different properties (such as natural images, remote sensing images, drawing graphics, etc.), and different imaging models (such as real-time transmission, limited buffering, bandwidth resources, etc.).
After the image blocks are compressed by adopting a JPEG2000 compression algorithm to obtain first compressed image blocks, the first compressed image blocks can be decompressed by adopting a decompression method corresponding to the JPEG2000 compression algorithm to obtain corresponding first decompressed image blocks.
S103, synthesizing the plurality of first decompressed image blocks to obtain a first synthesized image.
In the embodiment of the present application, a method of direct pixel operation may be used to synthesize the plurality of first decompressed image blocks, a method based on feature matching and fusion may be used to synthesize the plurality of first decompressed image blocks, or a deep learning manner may be used to synthesize the plurality of first decompressed image blocks, which may be specifically set according to actual needs.
After synthesizing the plurality of first decompressed image blocks to obtain a first synthesized image, the following S104 may be performed:
S104, determining an image compression result of the remote sensing image based on a peak signal-to-noise ratio between the first synthesized image and the remote sensing image, wherein the peak signal-to-noise ratio is used for representing compression quality of each first compressed image block.
Considering that the peak signal-to-noise ratio can be monitored in real time, and when the peak signal-to-noise ratio exceeds 30dB, the difference between the original image and the compressed image is difficult to distinguish by human vision, so in the embodiment of the application, the compressed quality of the remote sensing image after compression is evaluated based on the peak signal-to-noise ratio between the first synthesized image and the remote sensing image.
According to the embodiment of the application, when the remote sensing image is compressed, the remote sensing image can be firstly subjected to block division processing to obtain a plurality of image blocks, the image blocks are compressed according to the target compression ratio for each image block to obtain a first compressed image block, the first compressed image block is decompressed to obtain a first decompressed image block, the plurality of first decompressed image blocks are synthesized to obtain a first synthesized image, and 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, wherein the peak signal-to-noise ratio is used for representing the compression quality of each first compressed image block. In addition, the peak signal-to-noise ratio is considered to be better used for evaluating the compression quality of the remote sensing image after compression, so that the image compression result of the remote sensing image is determined based on the peak signal-to-noise ratio between the first composite image and the remote sensing image, the image quality of the compressed image can be ensured, and the image quality of the compressed image can be ensured while the compression efficiency is improved.
Based on the embodiment shown in fig. 1, for example, in the embodiment of the present application, when determining the peak signal-to-noise ratio between the first composite image and the remote sensing image, the image mean square error may be determined based on the gray value of each pixel point in the first composite image and the gray value of each pixel point in the remote sensing image, and the peak signal-to-noise ratio may be determined based on the image mean square error and the maximum gray value.
The maximum gray value is the maximum gray value in the gray values corresponding to the pixel points in the remote sensing image.
The remote sensing image corresponds to a two-dimensional matrix, each pixel point is a sample point, the row number of the pixel point is the coordinate position (i, j) of the pixel point in the remote sensing image, wherein i represents the row number of the pixel point in the remote sensing image, j represents the column number of the pixel point in the remote sensing image, and,M represents the total line number of the pixel points in the remote sensing image, and N represents the total column number of the pixel points in the remote sensing image.
For example, when determining the mean square error of an image based on the gray value of each pixel in the first composite image and the gray value of each pixel in the remote sensing image, the following equation 1 may be referred to.
Equation 1
Wherein, Representing the mean square error of the image,Representing the gray value of the pixel point of the ith row and the jth column in the remote sensing image,And representing the gray value of the pixel point of the ith row and the jth column in the first composite image.
For example, when determining the peak signal-to-noise ratio based on the image mean square error and the maximum gray value, see equation 2 below.
Equation 2
Where PSNR represents the peak signal-to-noise ratio,And representing the maximum gray value in the gray values corresponding to the pixel points in the remote sensing image. In general, the larger the PSNR, the higher the consistency of the first composite image and the remote sensing image is represented, and the better the corresponding compressed image quality is, and conversely, the smaller the PSNR, the lower the consistency of the first composite image and the remote sensing image is represented, the larger the corresponding compressed image distortion degree is, and the worse the image quality is.
In combination with the above description, after determining the peak signal-to-noise ratio between the first composite image and the remote sensing image, the step S104 may be performed to determine the image compression result of the remote sensing image based on the peak signal-to-noise ratio between the first composite image and the remote sensing image. Referring to fig. 2, fig. 2 is a schematic diagram of a framework for determining an image compression result of a remote sensing image according to an embodiment of the present application, and detailed description can be made on how to determine the image compression result of the remote sensing image based on a peak signal-to-noise ratio between a first composite image and the remote sensing image.
Illustratively, in the 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 composite image and the remote sensing image, at least two possible scenarios may be included as follows.
In one scenario, a peak signal-to-noise ratio between the first composite image and the remote sensing image is greater than or equal to a peak signal-to-noise ratio threshold.
Under the condition that the peak signal-to-noise ratio is greater than or equal to the peak signal-to-noise ratio threshold, the compression quality of the plurality of first compressed image blocks is better, in this case, the plurality of first compressed image blocks can be directly synthesized, and the synthesized image is determined as an image compression result. After the image compression result is obtained, the image compression result can be stored in the disk file, and all threads are closed, so that thread resources are realized.
In another scenario, a peak signal-to-noise ratio between the first composite image and the remote sensing image is less than a peak signal-to-noise ratio threshold.
Under the condition that the peak signal-to-noise ratio is smaller than the peak signal-to-noise ratio threshold, the compression quality of the image blocks of the plurality of first compression blocks is poor, and under the condition, the target compression ratio can be reduced; taking the target compression ratio as 20 as an example, the target compression ratio may 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, the plurality of second decompressed image blocks are synthesized to obtain a new first synthesized image, and 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 is indicated that the compression quality of the plurality of second compressed image blocks is better, in this case, the plurality of second compressed image blocks may be directly synthesized, and the synthesized image is determined as an image compression result. After the image compression result is obtained, the image compression result can be stored in the disk file, and all threads are closed, so that thread resources are realized.
In contrast, in the case that the new peak signal-to-noise ratio between the new first composite image and the remote sensing image is smaller than the peak signal-to-noise ratio threshold, it is indicated that the compression quality of the plurality of second compressed block image blocks is poor, in this case, the target compression ratio may be continuously reduced, for example, taking the reduced target compression ratio as 10 as an example, the target compression ratio may be continuously reduced as 5, and the above steps are repeatedly performed until the target compression ratio is reduced to the preset compression ratio, and the image compression result is determined based on the preset compression ratio.
The preset compression ratio may be 5, 6, etc. as an example, and may be specifically set according to actual needs.
Illustratively, in the embodiment of the present application, when determining the image compression result based on the preset compression ratio, it may include:
The method comprises the steps of compressing image blocks according to a preset compression ratio to obtain third compressed image blocks, decompressing the third compressed image blocks to obtain third decompressed image blocks, synthesizing the plurality of third decompressed image blocks to obtain a second synthesized image, and under the condition that the peak signal-to-noise ratio between the second synthesized image and a remote sensing image is greater than or equal to a peak signal-to-noise ratio threshold value, indicating that the compression quality of the plurality of third compressed image blocks is good, and under the condition, directly synthesizing the plurality of third compressed image blocks, and determining the synthesized image as an image compression result. After the image compression result is obtained, the image compression result can be stored in the disk file, and all threads are closed, so that thread resources are realized.
In contrast, when the peak signal-to-noise ratio between the second synthesized image and the remote sensing image is smaller than the peak signal-to-noise ratio threshold, the compression quality of the image blocks of the plurality of second compression blocks is poor, in this case, the LZW compression algorithm may be adopted to compress each image block to obtain a fourth compression image block corresponding to each image block, and the plurality of fourth decompression image blocks are synthesized, and the synthesized image is determined as an image compression result.
The LZW compression algorithm is a dictionary-based compression algorithm, the information sequence output by the information source is regarded as various entries in the dictionary, and the basic idea is to build the dictionary, map the input character string into a codeword with a fixed length and output the codeword. The dictionary is dynamically established according to the data characteristics of the information source, and the coding process is the process of establishing the dictionary. In the compression process, new character strings are continuously generated in the dictionary, and codewords corresponding to prefixes of the new character strings are also stored when the new character strings are stored. The advantage of the LZW compression algorithm is to dynamically label repeated data strings that occur in the data stream. The character string encountered in the compression process is recorded in a dictionary, and when the character string is encountered next time, the character string is represented by a code, and the data volume is compressed by representing a relatively long character string by a short code, so that the data compression software such as Pkzip, winzip, winRAR has the LZW data compression algorithm and has better compression effect.
It can be seen that, in the embodiment of the application, when the remote sensing image is compressed, the remote sensing image is firstly subjected to block division processing, and the image blocks are compressed according to the target compression ratio for each image block to obtain a first compressed image block, the first compressed image block is decompressed to obtain a first decompressed image block, a plurality of first decompressed image blocks are synthesized to obtain a first synthesized image, and 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. In addition, the peak signal-to-noise ratio is considered to be better used for evaluating the compression quality of the remote sensing image after compression, so that the image compression result of the remote sensing image is determined based on the peak signal-to-noise ratio between the first composite image and the remote sensing image, the image quality of the compressed image can be ensured, and the image quality of the compressed image can be ensured while the compression efficiency is improved.
The image compression apparatus provided by the present application will be described below, and the image compression apparatus described below and the image compression method described above may be referred to correspondingly to each other.
Fig. 3 is a schematic structural diagram of an image compression apparatus according to an embodiment of the present application, for example, referring to fig. 3, the image compression apparatus 30 may include:
The blocking unit 301 is configured to perform blocking processing on a remote sensing image to be processed, so as to obtain a plurality of image blocks;
A compression and decompression unit 302, configured to compress the image blocks according to a target compression ratio for each image block to obtain a first compressed image block, and decompress the first compressed image block to obtain a first decompressed image block;
a first synthesizing unit 303, configured to synthesize a plurality of first decompressed image blocks to obtain a first synthesized image;
The processing unit 304 is configured to determine an image compression result of the remote sensing image based on a peak signal-to-noise ratio between the first composite image and the remote sensing image, where the peak signal-to-noise ratio is used to characterize compression quality of each of the first compressed image blocks.
Illustratively, in the embodiment of the present application, the processing unit 304 is configured to determine, based on a peak signal-to-noise ratio between the first composite image and the remote sensing image, an image compression result of the remote sensing image, including:
Reducing the target compression ratio under the condition that the peak signal-to-noise ratio is smaller than a peak signal-to-noise ratio threshold;
Compressing the image blocks based on the reduced target compression ratio for each image block to obtain a second compressed image block, decompressing 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;
continuing to reduce the target compression ratio under the condition that the new peak signal-to-noise ratio between the new first synthesized image and the remote sensing image is smaller than the peak signal-to-noise ratio threshold value, and repeatedly executing the steps until the target compression ratio is reduced to a preset compression ratio;
And determining the image compression result based on the preset compression ratio.
Illustratively, in the embodiment of the present application, the processing unit 304 is configured to determine the image compression result based on the preset compression ratio, including:
compressing the image blocks according to the preset compression ratio for each image block to obtain a third compressed image block, and decompressing 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;
Under the condition that the peak signal-to-noise ratio between the second synthesized image and the remote sensing image is smaller than the peak signal-to-noise ratio threshold, compressing each image block by adopting an LZW compression algorithm to obtain a fourth compressed image block corresponding to each image block;
And synthesizing the fourth decompressed image blocks, and determining the synthesized image as the image compression result.
Illustratively, in an embodiment of the present application, the image compression apparatus 30 further includes:
And the second synthesis unit is used for synthesizing the plurality of third compressed image blocks under the condition that 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 value, and determining the synthesized image as the image compression result.
Illustratively, in an embodiment of the present application, the image compression apparatus 30 further includes:
and the third synthesis unit is used for synthesizing the plurality of first compressed image blocks under the condition that the peak signal-to-noise ratio is greater than or equal to the peak signal-to-noise ratio threshold value, and determining the synthesized image as the image compression result.
Illustratively, in an embodiment of the present application, the image compression apparatus 30 further includes:
The first determining unit is used for determining an image mean square error based on the gray value of each pixel point in the first composite image and the gray value of each pixel point in the remote sensing image;
And the second determining unit is used for determining the peak signal-to-noise ratio based on the image mean square error and the maximum gray value, wherein the maximum gray value is the maximum gray value in gray values corresponding to all pixel points in the remote sensing image.
The image compression apparatus 30 provided in the embodiment of the present application may execute the technical scheme of the image compression method in any of the embodiments, and the implementation principle and beneficial effects of the image compression method are similar to those of the image compression method, and reference may be made to the implementation principle and beneficial effects of the image compression method, and no further description is given here.
Fig. 4 is a schematic physical structure of an electronic device according to an embodiment of the present application, as shown in fig. 4, the electronic device may include a processor (processor) 410, a communication interface (Communications Interface) 420, a memory (memory) 430, and a communication bus 440, where the processor 410, the communication interface 420, and the memory 430 complete communication with each other through the communication bus 440. The processor 410 may invoke logic instructions in the memory 430 to perform an image compression method, where the method includes performing a blocking process on a remote sensing image to be processed to obtain a plurality of image blocks, compressing the image blocks according to a target compression ratio for each of the image blocks to obtain a first compressed image block, decompressing the first compressed image block to obtain a first decompressed image block, synthesizing the plurality of first decompressed image blocks to obtain a first synthesized image, and determining an image compression result of the remote sensing image based on a peak signal-to-noise ratio between the first synthesized image and the remote sensing image, where the peak signal-to-noise ratio is used to characterize compression quality of each of the first compressed image blocks.
Further, the logic instructions in the memory 430 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. The storage medium includes a U disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, an optical disk, or other various media capable of storing program codes.
In another aspect, the present application further provides a computer program product, where the computer program product includes a computer program, where the computer program is capable of being stored on a non-transitory computer readable storage medium, and where the computer program, when executed by a processor, is capable of executing an image compression method provided by the above methods, where the method includes performing a blocking process on a remote sensing image to be processed to obtain a plurality of image blocks, compressing the image blocks according to a target compression ratio for each of the image blocks to obtain a first compressed image block, decompressing the first compressed image block to obtain a first decompressed image block, synthesizing the plurality of first decompressed image blocks to obtain a first synthesized image, and determining an image compression result of the remote sensing image based on a peak signal-to-noise ratio between the first synthesized image and the remote sensing image, where the peak signal-to-noise ratio is used to characterize a compression quality of each of the first compressed image block.
In yet another aspect, the present application further provides a non-transitory computer readable storage medium, on which a computer program is stored, the computer program being implemented when executed by a processor to perform the image compression method provided by the above methods, the method comprising performing a blocking process on a remote sensing image to be processed to obtain a plurality of image blocks, compressing the image blocks according to a target compression ratio for each of the image blocks to obtain a first compressed image block, decompressing the first compressed image block to obtain a first decompressed image block, synthesizing the 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 synthesized 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 apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
It should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present application, and not for limiting the same, and although the present application has been described in detail with reference to the above-mentioned embodiments, it should be understood by those skilled in the art that the technical solution described in the above-mentioned embodiments may be modified or some technical features may be equivalently replaced, and these modifications or substitutions do not make the essence of the corresponding technical solution deviate from the spirit and scope of the technical solution of the embodiments of the present application.