An image compression method, an image decompression method, and an image processing apparatus.
By performing linear regression calculations and finite state entropy encoding on the neighboring pixel values of remote sensing images, the problem of slow compression speed in the CCSDS method is solved, achieving faster image compression speed and higher compression efficiency.
Patent Information
- Application Number
- CN202210289919.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-23
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2042-03-23
AI Technical Summary
The existing CCSDS method has low throughput and slow compression speed in the process of remote sensing image compression, which makes it difficult to meet practical needs.
Model parameter values are generated by performing linear regression operations on multiple neighboring pixel values and pixel values. By using linear regression operations and finite state entropy encoding, computation time is reduced and compression efficiency is improved.
It improves image compression speed and efficiency, and achieves lossless compression.
Smart Images

Figure CN116847095B_ABST
Abstract
Description
[0001] Technology Neighborhood
[0002] This application relates to the field of image processing, and more particularly to an image compression method, an image decompression method, and an image processing apparatus. Background Technology
[0003] Remote sensing technology is a technique that uses high-altitude multispectral image sensors to detect objects and generate multispectral images. With technological advancements, massive amounts of remote sensing image data have been generated. Existing aerial data storage systems and ground-to-air transmission bandwidth are insufficient to meet practical needs, making the compression of remote sensing data an important research topic.
[0004] Currently, there is a satellite remote sensing data compression method called CCSDS, designed by the Space Information Systems Advisory Committee. This method inputs images from multiple bands into an empirical model, predicts the pixel value of each pixel based on the empirical model, calculates the pixel residual for each pixel, recursively updates the model parameters based on the pixel residuals until the pixel residuals are less than a preset threshold, then entropy-encodes the pixel residuals, and generates a compressed file based on the encoded data.
[0005] The throughput of the CCSDS method is 10 megabytes per second (MBps), which is slow and therefore has limited application scenarios. Summary of the Invention
[0006] This application provides an image compression method that can perform linear regression operations on multiple neighboring pixel values and pixel values to obtain model parameter values for each band of the image. Compared with recursive methods for calculating model parameter values, this method can reduce computation time and thus improve compression efficiency. This application also provides a corresponding image decompression method and image processing apparatus.
[0007] A first aspect provides an image compression method, comprising: acquiring a remote sensing image, selecting multiple pixels from the p-th band of the remote sensing image, determining the neighborhood vector of each pixel in the p-th band image based on a compression level identifier and p, generating a pixel value matrix based on the neighborhood vectors of the multiple pixels, performing a linear regression operation on the pixel value matrix, the transpose of the pixel value matrix, and the pixel values of the multiple pixels, the result of the linear regression operation being the model parameter values of the p-th band image, calculating the predicted pixel value of each pixel in the p-th band image based on the model parameter values of the p-th band image and the neighborhood vectors of each pixel in the p-th band image; determining the pixel residual of each pixel in the p-th band image based on all pixel values and all predicted pixel values of the p-th band image; generating a pixel residual set based on the pixel residuals of each pixel in all band images; encoding the pixel residual set to obtain residual encoded data; and generating a compressed file based on the residual encoded data, the compression level identifier, and the model parameter values of all band images. Remote sensing images comprise image data across multiple bands. A pixel's neighborhood vector includes the values of its neighboring pixels and a bias term. The neighboring pixel values can be from the current band or adjacent bands. Thus, model parameter values for a band can be determined based on pixel values from one or two bands without recursive computation, thereby increasing the speed of calculating model parameter values and consequently improving image compression speed.
[0008] In one possible implementation, selecting multiple pixel values from the p-th band image includes: selecting multiple pixel squares from the p-th band image, and then selecting one pixel from the same position of each of the multiple pixel squares to obtain multiple pixels. This provides a method for selecting pixels at intervals.
[0009] In another possible implementation, determining the neighborhood vector of each pixel in the p-th band image based on the compression level identifier and p includes: when p equals 1, sequentially selecting target pixels from the p-th band image, determining the first pixel square containing the target pixel based on the compression level identifier and the target pixel's position, and then determining the neighboring pixels of the target pixel, including all pixels in the first pixel square except the target pixel; when p is greater than 1, sequentially selecting target pixels from the p-th band image, determining the first pixel square and the second pixel square based on the compression level identifier and the target pixel's position, and then determining the neighboring pixels of the target pixel, including the second pixel square and all pixels in the first pixel square except the target pixel, and generating the neighborhood vector of each pixel based on the neighboring pixel values and a bias term. The neighboring pixel value refers to the pixel value of the neighboring pixels. The first pixel square and the second pixel square are the same size, and the position of the first pixel square in the p-th band image is the same as the position of the second pixel square in the (p-1)-th band image. For a pixel in the first band, its neighboring pixels include pixels within the band. For pixels in other bands, their neighboring pixels include pixels in two bands, thus providing a method for obtaining neighboring pixels and neighborhood vectors.
[0010] In another possible implementation, the compression level is identified by a compression level number, which is linearly related to the number of rows in the first pixel square. Optionally, the compression level number is linearly positively related to the number of rows in the first pixel square. Alternatively, the compression level number is linearly negatively related to the number of rows in the first pixel square.
[0011] In another possible implementation, calculating the predicted pixel value of each pixel in the p-th band image based on the model parameter values of the p-th band image and the neighborhood vector of each pixel in the p-th band image includes: multiplying the model parameter values of the p-th band image by 2 raised to the power of k, rounding the result, performing matrix multiplication on the neighborhood vector of each pixel in the p-th band image and the rounded result, and finally shifting the result of the matrix multiplication to the right by k bits to obtain the predicted pixel value of each pixel in the p-th band image. k is a positive integer. k is greater than or equal to the number of decimal places in the pixel value, which can be, but is not limited to, 8. This method converts the pixel value to an integer and then performs integer operations. Compared with floating-point operations, the above method reduces the computational load of predicting pixel values and improves computation speed.
[0012] In another possible implementation, encoding the pixel residual set to obtain residual encoded data includes: selecting a target value greater than the median from a preset sequence based on the median of the pixel residual set; determining that the target difference equals the target value minus the median; adding each pixel residual in the pixel residual set to the target difference, then dividing each addition result into a high-order part and a low-order part; next, using a finite-state entropy encoding algorithm to encode the low-order parts of all addition results into low-order residual encoded data; using a finite-state entropy encoding algorithm to encode the high-order parts of all addition results into high-order residual encoded data; and finally, combining the low-order and high-order residual encoded data to form the residual encoded data. Each value in the preset sequence is an odd multiple of 128, which shifts the center of the residual distribution from the median to an odd multiple of 128. When the high-order and low-order parts each occupy one byte, since the same high-order part has lower entropy than different high-order parts, finite-state entropy encoding of the high-order part can improve the compression ratio.
[0013] The second aspect provides an image decompression method, which includes: after obtaining a compressed file, retrieving residual encoded data, a compression level identifier, and model parameter values of all band images from the compressed file according to decompression instructions; decoding the residual encoded data into a set of pixel residuals; selecting pixels to be processed according to band order and pixel order; obtaining the neighborhood vector of the pixel to be processed according to the compression level identifier and the band number of the pixel to be processed; determining the predicted pixel value of the pixel to be processed according to the neighborhood vector and the model parameter values of the p-th band image; determining the pixel value of the pixel to be processed according to the predicted pixel value and the pixel residual; and finally generating a remote sensing image based on the pixel values of all band images. The neighborhood vector includes neighborhood pixel values and a bias term. This image decompression method can reconstruct pixels based on model prediction results and pixel residuals, thus providing a lossless decompression method.
[0014] In one possible implementation, decoding the residual encoded data into a set of pixel residuals includes: splitting the residual encoded data into high-order residual encoded data and low-order residual encoded data; then decoding the high-order residual encoded data into a high-order portion set using a finite-state entropy encoding algorithm, and decoding the low-order residual encoded data into a low-order portion set using the same algorithm; finally, generating a target value set based on the high-order and low-order portion sets; and subtracting a target difference from each value in the target value set to obtain the set of pixel residuals. The sum of the median of the pixel residual set and the target difference is an odd multiple of 128. For pixel residuals with the target difference added, this method can reconstruct the actual pixel residuals.
[0015] A third aspect provides an image processing apparatus that can implement the image compression method of the first aspect. This function can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the aforementioned function.
[0016] A fourth aspect provides an image processing apparatus that can implement the image decompression method of the second aspect. This function can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-described function.
[0017] A fifth aspect provides an image processing apparatus comprising a processor and a memory for storing a program; the processor executes the program to implement the methods of the above aspects.
[0018] The sixth aspect provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the methods of the above aspects.
[0019] The seventh aspect provides a computer program product containing instructions that, when run on a computer, cause the computer to perform the methods described above.
[0020] The eighth aspect provides a chip system including at least one processor coupled to a memory for storing computer programs or instructions, and the processor for executing the computer programs or instructions to implement the methods of the above aspects. Attached Figure Description
[0021] Figure 1 This is a schematic diagram of an image processing system in an embodiment of this application;
[0022] Figure 2 This is a schematic diagram of the image compression process in an embodiment of this application;
[0023] Figure 3 This is a flowchart of an image compression method in an embodiment of this application;
[0024] Figure 4 This is a histogram showing the pixel value distribution of one band in an embodiment of this application.
[0025] Figure 5 This is a histogram of pixel residual distribution for one band in an embodiment of this application;
[0026] Figure 6 This is a schematic diagram of the pixels and neighboring pixels of the first band in an embodiment of this application;
[0027] Figure 7This is a schematic diagram of the pixels and neighboring pixels of the second band in an embodiment of this application;
[0028] Figure 8 This is another schematic diagram of the pixels and neighboring pixels of the first band in the embodiments of this application;
[0029] Figure 9 This is another schematic diagram of the pixels and neighboring pixels of the second band in an embodiment of this application;
[0030] Figure 10 This is a flowchart of a residual coding method in an embodiment of this application;
[0031] Figure 11 This is a flowchart of an image decompression method in an embodiment of this application;
[0032] Figure 12 This is another flowchart of the image compression method in the embodiments of this application;
[0033] Figure 13 This is a flowchart of an image decompression method in an embodiment of this application;
[0034] Figure 14 This is a structural diagram of an image processing apparatus in an embodiment of this application;
[0035] Figure 15 This is another structural diagram of the image processing apparatus in the embodiments of this application;
[0036] Figure 16 This is another structural diagram of the image processing apparatus in the embodiments of this application. Detailed Implementation
[0037] The image compression and decompression methods of this application can be applied to scenarios including remote sensing images, such as weather forecasting, geological exploration, and map surveying.
[0038] See Figure 1 In one embodiment, the image processing system of this application includes a function as a service (FaaS) platform 10, a storage system 20, an image reduction main control module 30, a file format plug-in module 40, a compressor plug-in module 50, a video storage common module 60, etc.
[0039] The Function as a Service platform 10 can execute corresponding functions based on the operation instructions input by the user. The operation instructions can be, but are not limited to, creation instructions, reading instructions, update instructions, and deletion instructions.
[0040] Storage system 20 may be, but is not limited to, a distributed storage system.
[0041] The image reduction main control module 30 may include command line service, FaaS service, dynamic plugin loading, task execution, KPI statistics, index serialization, multi-threaded concurrency and other functional modules.
[0042] The compressor plugin module 30 includes plugins such as Fractal-CM, HZRA, Fractal RS, deflate, bz2, webp, zstd, lzw, jpegls, jpegxl, magicCube, jpeg2000, flif, ccsds, and fpzip.
[0043] File format plugin module 40 can perform file format conversion. File format plugin module 40 can be, but is not limited to, an MRC file format plugin, a tag image file format (TIFF) plugin, or a raw (RAW) file format plugin. The MRC file format plugin can convert images of other formats to MRC file format, a commonly used data file format in electron microscopy imaging. Both MRC and TIFF file format plugins can include functions such as metadata parsing, file slicing, and multi-frame aggregation. The RAW file format plugin can include metadata parsing, file slicing, and multi-channel aggregation functions.
[0044] The video storage public module 60 includes interface classes, utility classes, data preprocessing classes, and third-party libraries. Interface classes include file format interfaces and compressor interfaces. Utility classes include thread pools, I / O read / write, logging, and timers. Data preprocessing classes include bit-depth segmentation, channel segmentation, endianness conversion, band sequential (BSQ) format conversion, band interleaved by pixel (BIP) conversion, and multi-channel redundancy removal. Third-party libraries include data serialization, logging, JSON parsing, general compression (such as zlib or zstd), and image compression (such as charls / webp / jpegxl).
[0045] In one example, when a user logs into the Function as a Service platform 10, an event can be triggered that the platform retrieves satellite remote sensing images from the storage system 20. Based on this event, the satellite remote sensing images can be read from the storage system 20. The satellite remote sensing images can be input into the image reduction master control module 30. The dynamic file format loading plugin module 40 can dynamically load satellite remote sensing images from the image reduction master control module 30 and perform image format conversion. The compressor plugin module 30 can dynamically load satellite remote sensing images from the image reduction master control module 30 and compress them. The video storage common module 60 can store user-uploaded satellite remote sensing images, converted images, or compressed files. The video storage common module 60 can store the images or files in the storage system 20 or read data from the storage system 20.
[0046] The following is based on Figure 1 The image processing system shown describes the image compression process of this application; see reference. Figure 2 After a user acquires satellite remote sensing images from storage system 20 via a third-party application, the user inputs these images into image reduction control module 30. Image reduction control module 30 includes a reduction task management unit, a file format analysis unit, a data preprocessing unit, a data segmentation unit, and a data compression unit. After processing by these units, the satellite remote sensing images generate compressed files. Image reduction control module 30 may also include, but is not limited to, a resource scheduling unit, a plug-in management unit, or designs for non-functional product attributes (design for X, DFX).
[0047] Because the existing CCSDS method's empirical model is generated based on historical remote sensing images, this model requires a recursive approach to update its parameters when processing new remote sensing images to ensure that pixel residuals do not exceed a preset threshold. However, the recursive approach involves many steps, resulting in low efficiency in updating the empirical model. To address this, this application provides a faster image compression method, see [reference needed]. Figure 3 One embodiment of the image compression method of this application includes:
[0048] Step 301: Acquire remote sensing images. The remote sensing images can be in BSQ format, BIP format, or band-interleaved-by-line (BIL) format. Each remote sensing image comprises P bands, where P is a positive integer. p is a variable and p∈[1, P]. The remote sensing images can be spaceborne remote sensing images, aerial remote sensing images (such as satellite remote sensing images), or ground-based remote sensing images.
[0049] Step 302: Select M pixels from the p-th band of the remote sensing image. M is a positive integer.
[0050] Step 303: Determine the neighborhood vector of each pixel in the p-th band image based on the compression level identifier and p.
[0051] In one example, when the compression level is set to 1 and p = 1, The neighboring pixels include and When the compression level is 1 and p > 1, determine The neighboring pixels include and This represents the pixel in the i-th row and j-th column of the p-th band. This represents the pixel in the i-th row and j-th column of the p-1-th band, and other pixels can be deduced in the same way.
[0052] In another example, when the compression level is set to 2 and p = 1, the number of neighboring pixels is 15. When the compression level is set to 2 and p > 1, the number of neighboring pixels is 31. The neighboring pixels of the target pixel belong to the same band of the image as the target pixel or the previous band of the image, and the distance between the neighboring pixels and the target pixel is less than a preset distance value. For each pixel, a neighborhood vector can be generated based on the pixel values of the neighboring pixels and the bias term.
[0053] Step 304: Generate a pixel value matrix based on the neighborhood vectors of the M pixels.
[0054] Optionally, the pixel value matrix A can be:
[0055]
[0056] N is the number of neighboring pixels corresponding to a single pixel. P′ i,j This represents the value of the j-th neighboring pixel of the i-th pixel.
[0057] [P′ 1,1 ... P′ 1,N [1] is the neighborhood vector of the first pixel out of M pixels.
[0058] [P′ M,1 ... P′ M,N [1] is the neighborhood vector of the Mth pixel out of M pixels. The neighborhood vectors of other pixels can be deduced in the same way.
[0059] Step 305: Perform linear regression on the pixel value matrix, the transpose of the pixel value matrix, and the pixel values of the M pixels. The result of the linear regression is the model parameter value of the p-th band image.
[0060] After generating the pixel value matrix A, calculate the transpose matrix A of the pixel value matrix A. T Then, linear regression is performed according to the formula: AA T x = A T b. b includes the pixel values of M pixels. x represents the model parameter values of the p-th band image, i.e., a vector composed of multiple coefficients. Linear regression can be performed using the Kolesky decomposition method.
[0061] Step 306: Based on the model parameter values of the p-th band image, calculate the predicted pixel value of each pixel in the p-th band image using the neighborhood vector of each pixel in the p-th band image.
[0062] The linear regression and matrix operations in steps 305 and 306 both involve a large number of addition and multiplication instructions. In this application, single instruction multiple data (SIMD) instructions can be used for independent multiplication and addition instructions to enable parallel processing of instructions and improve the operation speed.
[0063] Step 307: Determine the pixel residual of each pixel in the p-th band image based on all pixel values of the p-th band image and all predicted pixel values of the p-th band image.
[0064] The following section introduces pixel value distribution and pixel residual distribution. Figure 4 This is a histogram of pixel value distribution for a band, where the horizontal axis represents pixel value and the vertical axis represents the number of pixel values. Figure 5 for Figure 4 The histogram showing the pixel residual distribution of the pixel values is provided, with the horizontal axis representing the pixel residual and the vertical axis representing the number of pixel residuals. (See also...) Figure 4 and Figure 5 The pixel values are generally between [1000, 1600], and the pixel residuals are generally between [-20, 20]. From Figure 4 and Figure 5 As can be seen, the distribution of pixel residuals is more concentrated than the distribution of pixel values, resulting in lower zero-order entropy and higher compression ratio. The compression ratio of this application is equal to the amount of data before compression divided by the amount of data after compression.
[0065] Step 308: Generate a set of pixel residuals based on the pixel residuals of each pixel in the images of all bands.
[0066] Step 309: Encode the pixel residual set to obtain residual encoded data.
[0067] Step 310: Generate a compressed file based on the residual coding data, compression level identifier, and model parameter values for all band images. In an optional embodiment, the header of the compressed file includes the compression level identifier, model parameter values for all band images, and other data spaces where the residual coding data is stored in the compressed file. It should be noted that the header of the compressed file may also include, but is not limited to, remote sensing image formats.
[0068] In this embodiment, linear regression is performed on pixels in 1 to 2 bands of the remote sensing image to obtain the model parameter values of the linear regression model. This eliminates the need for recursive calculations and improves image compression efficiency.
[0069] Secondly, because the pixels and model are adapted in this embodiment, lossless compression can be achieved.
[0070] Optionally, step 302 includes: dividing the p-th band image into M pixel squares; selecting one pixel from the same position in each of the M pixel squares to obtain M pixels. Optionally, any two pixel squares in the M pixel squares do not overlap.
[0071] In one example, a pixel grid consists of 4 pixels, denoted as (i, j), (i+1, j), (i, j+1), and (i+1, j+1). Selecting one pixel from each of the same positions in the M pixel grids yields M pixels. For example, selecting one pixel from each of the (i+1, j+1)th positions in the M pixel grids yields M pixels.
[0072] In other examples, the pixel square comprises 9 or 16 pixels. This application does not limit the number of pixels in the pixel square; the specific number can be selected based on the actual situation. This application can also perform interval sampling in other ways, such as selecting one pixel from two pixels or one pixel from three pixels; the specific selection can be set according to the actual situation, and this application does not impose any limitations.
[0073] In an optional embodiment, step 303 includes: when p equals 1, sequentially selecting target pixels from the p-th band image, determining the first pixel square where the target pixel is located based on the compression level identifier and the position of the target pixel, and determining that the neighboring pixels of the target pixel include other pixels in the first pixel square where the target pixel is located besides the target pixel; when p is greater than 1, sequentially selecting target pixels from the p-th band image, determining the first pixel square and the second pixel square of the (p-1)-th band image based on the compression level identifier and the position of the target pixel, and determining that the neighboring pixels of the target pixel include the second pixel square and other pixels in the first pixel square besides the target pixel.
[0074] In this design, the first pixel square and the second pixel square are the same size, and the position of the first pixel square in the p-th band image is the same as the position of the second pixel square in the p-1 band image. The target pixel refers to the selected pixel in the p-th band.
[0075] Optionally, the compression level is identified by a compression level number, which is linearly related to the number of rows in the first pixel square.
[0076] In one example, the compression level number is linearly positively correlated with the number of rows in the first pixel square. The relationship between the compression level number, the number of rows in the first pixel square, and the number of rows in the second pixel square is shown in Table 1:
[0077] Compression level number Number of rows in the first pixel square The number of rows in the second pixel square 1 2 2 2 3 3 3 4 4 4 5 5
[0078] Table 1
[0079] It should be understood that the compression level number and the number of rows in the first pixel square are not limited to the examples in Table 1, and can be set according to the actual situation. In some other embodiments, the compression level number and the number of rows in the first pixel square are linearly negatively correlated.
[0080] Optionally, when the compression level is set to 1, each pixel square includes 4 pixels.
[0081] See Figure 6 The image 61 of the first band includes pixel squares 611, 612, 613, and 614. Pixel square 611 includes pixels 6111, 6112, 6113, and 6114. The neighboring pixels of pixel 6114 include pixels 6111, 6112, and 6113. It should be understood that the image 61 of the first band also includes other pixel squares (not shown). The neighboring pixels of these other pixel squares in image 61 are similar to the neighboring pixels of pixel square 61.
[0082] For each pixel in the first row of an image in the first band, several pixels with a value of 0 can be designated as its neighboring pixels, thus constructing the corresponding pixel grid. For example, the neighboring pixels of pixel 6111 include three pixels with a value of 0. The neighboring pixels of pixel 6112 include pixel 6111 and two pixels with a value of 0. The other pixels in the first row can be deduced similarly.
[0083] See Figure 7Image 61 of the first band includes pixel squares 611, 612, 613, and 614. Image 62 of the second band includes pixel squares 621, 622, 623, and 624. Pixel square 621 includes pixels 6211, 6212, 6213, and 6214. The neighboring pixels of pixel 6214 include pixels 6211, 6212, 6213, 6111, 6112, 6113, and 6114. And so on, the neighboring pixels of a pixel in other pixel squares can be determined. The neighboring pixels in subsequent bands (such as the third band, etc.) are similar to the neighboring pixels in the second band. For pixels in the first row of images in other bands, the pixel squares of that pixel are similar to the pixel squares of the first row of pixels in the first band.
[0084] Alternatively, when the compression level is set to 2, each pixel square comprises 16 pixels.
[0085] See Figure 8 The first band image 81 includes pixel squares 811, 812, 813, and 814. Pixel square 811 comprises 16 pixels, and the neighboring pixels of the 16th pixel include the remaining 15 pixels of pixel square 811. It should be understood that the first band image 81 also includes other pixel squares, not shown.
[0086] For pixels in rows 1-3, several pixels with a value of 0 can be designated as their neighboring pixels, thus constructing the corresponding pixel grid. For example, the neighboring pixels of the first pixel in pixel grid 811 can include 15 pixels with a value of 0. The neighboring pixels of the second pixel in pixel grid 811 can include the first pixel and 14 pixels with a value of 0. Other pixels can be deduced similarly.
[0087] See Figure 9 The first band image 81 includes pixel squares 811, 812, 813, and 814, and the second band image 82 includes pixel squares 821, 822, 823, and 824. The neighboring pixels of the 16th pixel in pixel square 821 include all pixels of pixel square 811 and the first 15 pixels in pixel square 821. It should be understood that in the second band image 82, the neighboring pixels of other pixel squares are similar to the neighboring pixels of pixel square 81. In subsequent band images (such as the third band image, etc.), the neighboring pixels of pixel squares are similar to the neighboring pixels of pixel square 81. For pixels in rows 1-3 of images in other bands, the pixel square of that pixel is similar to the pixel square of pixels in rows 1-3 of the first band image.
[0088] In an optional embodiment, step 306 includes: performing matrix multiplication on the model parameter values of the p-th band image and the neighborhood vector of each pixel to obtain the predicted pixel value of each pixel in the p-th band image.
[0089] Model parameter values are typically floating-point numbers, and floating-point operations require significant computational overhead. This application provides a method to reduce computational overhead. In another optional embodiment, step 306 includes: multiplying the model parameter values of the p-th band image by a power of 2; rounding the multiplication result; performing matrix multiplication on the neighborhood vector of each pixel in the p-th band image and the rounded multiplication result; and shifting the matrix multiplication result k bits to the right to obtain the predicted pixel value for each pixel in the p-th band image.
[0090] In this embodiment, since the model parameter value of the p-th band image calculated in step 306 is a floating-point number, this application can multiply the model parameter value by 2 raised to the power of k, and then round the result of the multiplication to obtain the magnified model parameter value. When k = 8, the model parameter value x and the magnified model parameter value x′ of a band image are shown in Table 2:
[0091] x -0.0660 0.1116 -0.2887 0.2433 0.0757 0.0995 0.0410 -0.1433 x′ -68 114 -296 249 78 102 42 -147
[0092] Table 2
[0093] The above process converts floating-point numbers to integers, allowing integer multiplication to be performed during matrix multiplication, eliminating the need for floating-point operations. This reduces computational complexity and increases the speed of calculating predicted pixel values. The result of the matrix multiplication is the magnified predicted pixel value. Shifting the result k bits to the right yields the predicted pixel value. It should be understood that after shifting the result k bits to the right, rounding can be performed, and the rounded value is used as the predicted pixel value. k is a positive integer. k is greater than or equal to the number of decimal places in the pixel value, which can be, but is not limited to, one byte.
[0094] In an optional embodiment, step 308 includes: dividing each pixel residual in the pixel residual set into a high-order part and a low-order part; using a finite-state entropy coding algorithm to encode the low-order part of all addition results into low-order residual code data, using a finite-state entropy coding algorithm to encode the high-order part of all addition results into high-order residual code data, and combining the low-order residual code data and the high-order residual code data into residual code data.
[0095] In some embodiments, the finite-state entropy encoding algorithm can only process one byte. The method of this embodiment can encode two bytes of pixel residuals. Methods for encoding pixel residuals of more than one byte can be deduced similarly.
[0096] During high- and low-bit splitting, the high-bit portions of the residuals from different pixels may be inconsistent, resulting in entropy. This application provides a method to reduce entropy, thereby improving the compression ratio. See [reference needed]. Figure 10 In another alternative embodiment, step 308 includes:
[0097] Step 1001: Select a target value greater than the median from the preset sequence based on the median of the pixel residual set.
[0098] Step 1002: Determine that the target difference is equal to the target value minus the median.
[0099] Step 1003: Add the target difference to each pixel residual in the pixel residual set.
[0100] Step 1004: Divide the result of each addition operation into the high-order part and the low-order part.
[0101] Step 1005: Use the finite state entropy coding algorithm to encode the low-order part of all addition results into low-order residual code data.
[0102] Step 1006: Use the finite state entropy coding algorithm to encode the high-order bits of all addition results into high-order residual code data.
[0103] It should be understood that step 1006 may be performed before step 1005, or steps 1005 and 1006 may be performed in parallel.
[0104] Step 1007: Combine the low-order residual code data and the high-order residual code data to form residual code data.
[0105] In this embodiment, each value in the preset sequence is an odd multiple of 128, such as 128, 384, etc. Adding each pixel residual in the pixel residual set to the target difference can be understood as shifting the pixel residual set. When generating the compressed file, the target difference can be added to the header of the compressed file.
[0106] The pixel residual in the i-th row and j-th column is denoted as Δ. i,j When the length of the pixel residual is 2 bytes, the range of the pixel residual is [-2 byte]. 16 +1,2 16 -1], usually the difference between the maximum and minimum values is less than 2. 16 -1. In extreme cases, it may exceed 2. 16 -1. This embodiment also provides supplementary solutions.
[0107] In general, the difference between the maximum and minimum values is less than 2. 16-1. Because the range of pixel residuals exceeds 8-bit integers, the high and low bits of the shifted pixel residual values need to be split due to the single-byte processing capability of the entropy encoding module. Taking two 8-bit integers as an example, if the median of the pixel residual set is near a multiple of 256, the high-bit values after splitting will be relatively random. For example, if the pixel residual set is {128, 129, ..., 383}, and the median is 256, the high bits will randomly contain 0 and 1, and the low-bit entropy will be the same as the original entropy, resulting in more additional costs for high-bit encoding. If the pixel residual set is shifted to a center of an odd multiple of 128, for example, by adding 128 to each pixel residual, the high bits after splitting will all be 1, with an entropy of 0, and the low bits after splitting will be the same as the original entropy, without causing additional entropy increase.
[0108] In the special case where the difference between the maximum and minimum values is greater than 2... 16 -1, we save the residual sign separately, so the absolute value part will fall within the range of 16-bit integers, and then we perform the above operation.
[0109] When the remote sensing image exceeds the available memory space, it can be divided into multiple data blocks, each containing P bands of image data, with each block's size not exceeding the memory capacity. The compression method for each data block is similar to... Figure 3 The image compression method in the illustrated embodiment is similar. The compression process for multiple data blocks can be executed in parallel to improve compression efficiency.
[0110] The image compression process has been described above. The image decompression process of this application will now be described. (See attached document.) Figure 11 One embodiment of the image decompression method of this application includes:
[0111] Step 1101: Obtain the compressed file.
[0112] Step 1102: Obtain residual coded data, compression level identifier, and model parameter values for all band images from the compressed file according to the decompression command.
[0113] Step 1103: Decode the residual encoded data into a set of pixel residuals.
[0114] Step 1104: Select the pixels to be processed according to the band order and pixel order.
[0115] The band order refers to the order of the bands in the remote sensing data. The pixel order is the row-by-row, column-by-column arrangement of pixels.
[0116] Step 1105: Obtain the neighborhood vector of the pixel to be processed based on the compression level identifier and the band number of the pixel to be processed.
[0117] The neighborhood vector includes the neighboring pixel values and a bias term. The bias term is preset, and its specific value can be, but is not limited to, 1.
[0118] In one example, with the compression level flag set to 1 and p = 1, the pixel to be processed is denoted as... Its neighboring pixels include and
[0119] When i = 1 and j = 1 The three neighboring pixel values are all 0. When i = 1 and j > 1, in Among the neighboring pixel values, pixel values and The pixel values of the two neighbors are all 0, and the pixel value of the other neighboring neighbor is... The pixel value. When i > 1 and j > 1, The neighboring pixel values include pixel values, pixel values and The pixel value.
[0120] When the compression level is 1 and p > 1, the pixel to be processed is denoted as... Its neighboring pixels include and This represents the pixel in the i-th row and j-th column of the p-th band. This represents the pixel in the i-th row and j-th column of the p-1-th band, and other pixels can be deduced in the same way.
[0121] When i = 1 and j = 1, in In addition to the neighboring pixel values The other 6 pixels have a value of 0. When i = 1 and j > 1, in In addition to the neighboring pixel values The other four pixels have a value of 0. When i > 1 and j > 1, The neighboring pixels include and
[0122] In another example, with compression level set to 2 and p = 1, when the pixel square of the pixel to be processed includes pixels that do not belong to band 1, the pixel values of the pixels that do not belong to band 1 are all 0. When the pixel square of the pixel to be processed belongs to the image of band 1, the neighboring pixels of band 1 include 15 pixels of band 1.
[0123] When the compression level is set to 2 and p > 1, if the pixel square of the pixel to be processed includes pixels that do not belong to the p-th band, the pixel values of the pixels that do not belong to the 1st band are all 0. If the pixel square of the pixel to be processed belongs to the image of the p-th band, the neighboring pixels of the pixel to be processed include 15 pixels of the p-th band and 16 pixels of the (p-1)-th band. For other values of the number of neighboring pixels, the corresponding neighboring pixels can be obtained in a similar manner.
[0124] Step 1106: Determine the predicted pixel value of the pixel to be processed based on the neighborhood vector of the pixel to be processed and the model parameter values of the p-th band image.
[0125] Step 1107: Determine the pixel value of the pixel to be processed based on the predicted pixel value and the pixel residual of the pixel to be processed. Following steps 1104 to 1007, all pixels in each band can be determined.
[0126] Step 1108: Generate remote sensing images based on the pixel values of all band images.
[0127] In this embodiment, since the compression level identifier, model parameter values, and pixel residuals used in the image decompression process are the same as those used in the image compression process, a lossless image decompression method is provided. It should be understood that the decompression process does not require calculating model parameter values, and therefore is faster than compression.
[0128] In an optional embodiment, step 1103 includes: dividing the residual encoded data into high-bit residual encoded data and low-bit residual encoded data; decoding the high-bit residual encoded data into a high-bit partial set using a finite-state entropy encoding algorithm; decoding the low-bit residual encoded data into a low-bit partial set using a finite-state entropy encoding algorithm; generating a target value set based on the high-bit partial set and the low-bit partial set; and subtracting a target difference from each value in the target value set to obtain a pixel residual set.
[0129] In this embodiment, the compressed file also includes target differences. Specifically, generating a target value set based on the high-order part set and the low-order part set includes: combining the i-th high-order part and the i-th low-order part to form the i-th target value, and generating a target value set based on all target values.
[0130] In this embodiment, the residual coding data is based on Figure 10 The steps in the illustrated embodiment yield a pixel residual set whose median sum to the target difference is an odd multiple of 128. Segmenting, decoding, concatenating, and subtracting these residual encoded data allows for the reconstruction of pixel residuals across all bands.
[0131] The image compression method of this application is described below with reference to another embodiment. Figure 12 Another embodiment of the image compression method of this application includes:
[0132] Step 1201: Read the remote sensing image.
[0133] Step 1202: Confirm the compression level identifier.
[0134] Compression level identifiers can be preset or entered by the user.
[0135] Step 1203: Determine the residual calculation function based on the compression level identifier.
[0136] Step 1204: Allocate data space. This data space refers to the data space allocated for the remote sensing image.
[0137] Step 1205: Fill the remaining space outside the remote sensing image. The remaining space refers to the space in the data space other than the remote sensing image.
[0138] Step 1206: Allocate compressed data space.
[0139] Step 1207: Linear regression model sampling. Specifically, based on the compression level identifier and band number, the neighboring pixel values of multiple pixels are determined, thereby obtaining the neighborhood vector of multiple pixels.
[0140] Step 1208: Determine the parameter values for the linear regression model.
[0141] A linear regression operation is performed on the sampled neighborhood vectors and pixel values, and the resulting coefficient matrix represents the linear regression model parameters. The model parameters for the first band and the other bands are calculated separately.
[0142] This application can perform linear regression on the neighborhood vectors and pixel values of a subset of pixels to obtain the original model parameter values. Then, by performing linear regression on the neighborhood vectors and pixel values of more pixels, new model parameter values can be obtained. These new model parameter values replace the old ones, achieving a step-by-step update of the model parameter values.
[0143] Step 1209: Quantize model parameter values.
[0144] The model parameter values refer to the parameter values of the linear regression model. After obtaining the linear regression model parameter values, they can be amplified and rounded. It should be understood that during the calculation process, space needs to be allocated for the data involved in the calculation, and data types need to be aligned.
[0145] Step 1210: Predict pixels.
[0146] Specifically, the predicted pixel value for each pixel is determined based on the quantized model parameter values and the neighborhood vector.
[0147] Step 1211: Determine the pixel residual based on the residual calculation function.
[0148] By inputting the pixel value of each pixel and the predicted pixel value into the residual calculation function, the pixel residual of each pixel can be determined.
[0149] Step 1212: Shift the pixel residual.
[0150] Specifically, by adding the target difference to each pixel residual, the pixel residual can be shifted so that the high-order parts of the shifted pixel residual are the same.
[0151] Steps 1213: High and low digit splitting.
[0152] By splitting the translated pixel residuals into high and low bits, we can obtain the high bit part and the low bit part.
[0153] Step 1214: Low-order encoding.
[0154] Step 1215: High-order bit encoding.
[0155] Specifically, the encoding method encodes all high-order bits into high-order residual encoded data, and the encoding method encodes all low-order bits into low-order residual encoded data. The encoding method can be, but is not limited to, finite state entropy (FSE) encoding.
[0156] Step 1216: Save the compression level identifier, model parameter values, and encoding data.
[0157] The encoded data includes high-bit residual encoded data and low-bit residual encoded data. The compression level identifier, model parameter values, and encoded data are stored in a cache, and then a compressed file is generated based on these parameters. It should be understood that the compressed file may also include, but is not limited to, header information from the remote sensing image.
[0158] The image decompression method of this application is described below with reference to another embodiment. Figure 13 Another embodiment of the image compression method of this application includes:
[0159] Step 1301: Read the compressed file.
[0160] Step 1302: Check the size of the compressed file.
[0161] If the size of the compressed file is correct, proceed to step 1303; otherwise, terminate. The compressed file includes residual coded data, compression level identifier, and model parameter values for all band images. This application can also check whether the size of the model parameter values is correct; if not, terminate.
[0162] Step 1303: Read the model parameter values.
[0163] Step 1304: Allocate data space. Specifically, allocate data space for the data to be decoded.
[0164] Step 1305: Residual Decoding. Specifically, the FSE method is used to decode the high-bit residual encoded data and the low-bit residual encoded data respectively, to obtain the high-bit set and the low-bit set.
[0165] Step 1306: Merge high and low positions.
[0166] Merge the high-order set and the low-order set into a target value set.
[0167] Step 1307: Translation. Specifically, subtract the target difference from each value in the target value set to obtain the pixel residual set.
[0168] Step 1308: Reconstruct the image. Specifically, obtain the predicted pixel value based on the model parameter values and the neighborhood vector of each pixel. The pixel value can be obtained based on the predicted pixel value and the pixel residual.
[0169] Step 1309: Remove padding. After obtaining all pixel values, removing the padding pixels yields the remote sensing image. In practical applications, this frees up data space, reducing memory usage.
[0170] The image compression and decompression effects of this application are illustrated below using specific data. For a satellite remote sensing image comprising 15 bands, when compression level 1 is selected, the image compression and decompression information are shown in Table 3:
[0171] Size of satellite remote sensing images 304.25MB size of compressed file 83.58MB Compression rate 3.64 Single-core single-thread compression speed 57.00MBps Single-core single-thread decompression speed 113.32MBps
[0172] Table 3
[0173] The existing CCSDS has a throughput of approximately 10 MB / s, meaning that both image compression and decompression speeds are around 10 MB / s. In comparison, the image compression and decompression speeds of this application are significantly improved.
[0174] This application also provides an interface for users to input different compression parameters.
[0175] In one embodiment, the user input command is: `fractalrs[-d][-s DHW][-1 level][-ooutput_file][-h][-r]input_file`, where `fractalrs` represents the command type. `-d` indicates decompression. `-s DHW` represents the file depth, height, and width. `-r` indicates reading or writing in reverse byte order. `-1` indicates the compression level is set to 1, which is the default compression level. `-o` indicates the output file prefix, with the default prefix being `output.bin`. `-h` indicates help information. `input_file` represents the input file.
[0176] In this embodiment, after receiving the above instructions, the image processing device can compress or decompress the input file according to the input compression parameters. The compression method can be found in [reference needed]. Figure 3 The image compression and decompression methods in the illustrated embodiments can be found in [reference needed]. Figure 11 The image decompression method in the illustrated embodiment. It should be understood that the user can input one or more compression parameters included in the above instructions according to actual needs.
[0177] The image compression and decompression effects of this application are described below using another set of specific data. For a satellite remote sensing image containing 8 bands, when compression level 1 is selected, the image compression and decompression information are shown in Table 4:
[0178] Size of satellite remote sensing images 322.53MB size of compressed file 112.22MB Compression rate 2.87 Single-core single-thread compression speed 61.60MBps Single-core single-thread decompression speed 107.85MBps
[0179] Table 4
[0180] This application also provides an image processing apparatus 1400 capable of implementing the above-described image compression method. (See also...) Figure 14 In one embodiment, the image processing apparatus 1400 includes:
[0181] The acquisition unit 1401 is used to acquire remote sensing images, which include images of multiple bands;
[0182] Select pixel unit 1402, used to select multiple pixels from the p-th band image, where p is a positive integer;
[0183] Vector unit 1403 is used to determine the neighborhood vector of each pixel in the p-th band image based on the compression level identifier and p. The neighborhood vector includes the neighborhood pixel value and the bias term.
[0184] Model unit 1404 is used to generate a pixel value matrix based on the neighborhood vectors of multiple pixels; and to perform linear regression operation on the pixel value matrix, the transpose of the pixel value matrix, and the pixel values of multiple pixels to obtain the model parameter values of the p-th band image.
[0185] The prediction unit 1405 is used to calculate the predicted pixel value of each pixel in the p-th band image based on the model parameter values of the p-th band image and the neighborhood vector of each pixel in the p-th band image.
[0186] The residual calculation unit 1406 is used to determine the pixel residual of each pixel in the p-th band image based on all pixel values of the p-th band image and all predicted pixel values of the p-th band image;
[0187] The encoding unit 1407 is used to generate a pixel residual set based on the pixel residual of each pixel in the image of all bands; and to encode the pixel residual set to obtain residual encoded data.
[0188] The compressed file unit 1408 is used to generate a compressed file based on the residual coding data, the compression level identifier, and the model parameter values of all band images.
[0189] In an optional embodiment, the pixel selection unit 1402 is specifically used to select a plurality of pixel squares from the p-th band image, and to select one pixel from the same position of each of the plurality of pixel squares to obtain a plurality of pixels.
[0190] In another optional embodiment, the vector unit 1403 is specifically used to: when p equals 1, sequentially select target pixels from the p-th band image, determine the first pixel square where the target pixel is located based on the compression level identifier and the position of the target pixel, and determine that the neighboring pixels of the target pixel include other pixels in the first pixel square besides the target pixel; when p is greater than 1, sequentially select target pixels from the p-th band image, determine the first pixel square and the second pixel square based on the compression level identifier and the position of the target pixel, and determine that the neighboring pixels of the target pixel include the second pixel square and other pixels in the first pixel square besides the target pixel, wherein the first pixel square and the second pixel square are the same size and the position of the first pixel square in the p-th band image is the same as the position of the second pixel square in the p-1 band image; and generate a neighborhood vector for each pixel based on the neighboring pixel values and bias terms of each pixel.
[0191] In another alternative embodiment, the compression level is identified as a compression level number, which is linearly related to the number of rows in the first pixel square.
[0192] In another optional embodiment, the prediction unit 1405 is specifically used to multiply the model parameter value of the p-th band image by 2 raised to the power of k, where k is a positive integer; round the result of the multiplication operation; perform matrix multiplication on the neighborhood vector of each pixel in the p-th band image and the rounded multiplication result; and shift the matrix multiplication result to the right by k bits to obtain the predicted pixel value of each pixel in the p-th band image.
[0193] In another alternative embodiment,
[0194] The encoding unit 1407 is specifically used to select a target value greater than the median from a preset sequence based on the median of the pixel residual set, wherein each value in the preset sequence is an odd multiple of 128; determine that the target difference is equal to the target value minus the median; perform an addition operation on each pixel residual in the pixel residual set with the target difference; divide each addition result into a high-order part and a low-order part; use a finite-state entropy encoding algorithm to encode the low-order part of all addition results into low-order residual encoded data; use a finite-state entropy encoding algorithm to encode the high-order part of all addition results into high-order residual encoded data; and combine the low-order residual encoded data and the high-order residual encoded data to form residual encoded data.
[0195] This application also provides an image processing apparatus 1500 capable of implementing the above-described image decompression method. (See also...) Figure 15 In one embodiment, the image processing apparatus 1500 includes:
[0196] Acquisition unit 1501 is used to acquire compressed files; according to the decompression instructions, it acquires residual coded data, compression level identifier and model parameter values of all band images from the compressed files;
[0197] Decoding unit 1502 is used to decode residual encoded data into a set of pixel residuals;
[0198] The image processing unit 1503 is used to select pixels to be processed according to band order and pixel order; obtain the neighborhood vector of the pixel to be processed according to the compression level identifier and the band number of the pixel to be processed, the neighborhood vector including the neighborhood pixel value and the bias term; determine the predicted pixel value of the pixel to be processed according to the neighborhood vector of the pixel to be processed and the model parameter value of the p-th band image; determine the pixel value of the pixel to be processed according to the predicted pixel value of the pixel to be processed and the pixel residual of the pixel to be processed; and generate a remote sensing image according to the pixel values of all band images.
[0199] In an optional embodiment, the decoding unit 1502 is specifically configured to: divide the residual encoded data into high-order residual encoded data and low-order residual encoded data when the compressed file includes a target difference; decode the high-order residual encoded data into a high-order part set using a finite-state entropy encoding algorithm; decode the low-order residual encoded data into a low-order part set using a finite-state entropy encoding algorithm; generate a target value set based on the high-order part set and the low-order part set; and subtract the target difference from each value in the target value set to obtain a pixel residual set, wherein the sum of the median of the pixel residual set and the target difference is an odd multiple of 128.
[0200] This application provides an image processing apparatus 1600 capable of implementing the above-described image compression and decompression methods. (See also...) Figure 16In one embodiment, the image processing apparatus 1600 includes a processor 1601, a memory 1602, and an input / output (I / O) device 1603. The number of processor 1601, memory 1602, and input / output (I / O) device 1603 may be one or more.
[0201] In this embodiment, the processor 1601 may be a central processing unit (CPU) or another application-specific integrated circuit (ASIC). The processor 1601 may also be another general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0202] Memory 1602 is the main memory of the image processing device 1600. Dynamic Random Access Memory (DRAM) is typically used as memory 1602. The processor 1601 can access memory 1602 at high speed through the memory controller, performing read and write operations on any storage unit within memory 1602. Besides DRAM, memory 1602 can also be other random access memories, such as Static Random Access Memory (SRAM). Alternatively, memory 1602 can also be read-only memory (ROM). For example, read-only memory could be programmable read-only memory (PROM) or erasable programmable read-only memory (EPROM). This embodiment does not limit the number or type of memory 1602. Furthermore, memory 1602 can be configured to have a power-saving function. The power-saving function means that when the system experiences a power outage and is then powered on again, the data stored in the memory will not be lost. The 1602 memory with power-saving function is called non-volatile memory.
[0203] Input / output devices (I / O devices) refer to hardware capable of data transmission; they can also be understood as devices that interface with I / O interfaces. Common I / O devices include network cards, printers, keyboards, and mice. All external storage devices can also be used as I / O devices, such as hard drives, floppy disks, and optical discs.
[0204] Processor 1601 and memory 1602 are connected via bus 1604, and processor 1601 and input / output device 1603 are connected via bus 1605. Bus 1604 may be, but is not limited to, a double data rate (DDR) bus, and bus 1605 may be, but is not limited to, a PCIe bus. Here, different memory modules 1602 may use different data buses to communicate with processor 1601, therefore DDR bus 1604 can also be replaced with other types of data buses. This application embodiment does not limit the bus type.
[0205] In this embodiment, memory 1602 is used to store programs, and processor 1601 can execute programs stored in memory 1602. Figure 3 The image compression method of the embodiment shown or Figure 11 The image decompression method in the illustrated embodiment.
[0206] It should be noted that the information interaction and execution process between the modules / units of the above-mentioned device are based on the same concept as the method embodiments of this application, and the resulting technical effects are the same as those of the method embodiments of this application. For details, please refer to the description in the method embodiments shown above in this application, and will not be repeated here.
[0207] This application provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the communication method described in the above embodiments or optional embodiments.
[0208] This application also provides a computer program product that, when run on a computer, causes the computer to perform the communication method as shown in the embodiments or alternative embodiments described above.
[0209] This application also provides a chip system comprising a processor and a memory coupled to each other. The memory stores computer programs or instructions, and the processing unit executes the computer programs or instructions stored in the memory to cause the routing device to perform the steps performed by the first routing device, the target routing device, or the second routing device in the above embodiments. Optionally, the memory is on-chip memory, such as registers, caches, etc. The memory can also be off-chip memory within a site, such as read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions, random access memory (RAM), etc. The processor mentioned above can be a general-purpose central processing unit, a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for implementing the above communication methods.
[0210] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided in this application, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines.
[0211] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, dedicated CPUs, dedicated memory, dedicated components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can be diverse, such as analog circuits, digital circuits, or dedicated circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0212] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0213] A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state disks (SSDs)).
[0214] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. An image compression method, characterized in that, include: Acquire remote sensing images, which include images in multiple spectral bands; Select multiple pixels from the p-th band image, where p is a positive integer; The neighborhood vector of each pixel in the p-th band image is determined based on the compression level identifier and p, and the neighborhood vector includes the neighborhood pixel value and the bias term; A pixel value matrix is generated based on the neighborhood vectors of the plurality of pixels; Linear regression is performed on the pixel value matrix, the transpose of the pixel value matrix, and the pixel values of the plurality of pixels to obtain the model parameter values of the p-th band image; Based on the model parameter values of the p-th band image, the predicted pixel value of each pixel in the p-th band image is calculated from the neighborhood vector of each pixel in the p-th band image. The pixel residual of each pixel in the p-th band image is determined based on all pixel values of the p-th band image and all predicted pixel values of the p-th band image; Generate a set of pixel residuals based on the pixel residuals of each pixel in the images of all bands; The pixel residual set is encoded to obtain residual encoded data; A compressed file is generated based on the residual coding data, compression level identifier, and model parameter values for all band images.
2. The method according to claim 1, characterized in that, The selection of multiple pixel values from the p-th band image includes: Select multiple pixel squares from the p-th band image; Select one pixel from the same position in each of the multiple pixel squares to obtain multiple pixels.
3. The method according to claim 1, characterized in that, The step of determining the neighborhood vector of each pixel in the p-th band image based on the compression level identifier and p includes: When p equals 1, target pixels are selected sequentially from the p-th band image. The first pixel square where the target pixel is located is determined according to the compression level identifier and the position of the target pixel. The neighboring pixels of the target pixel include other pixels in the first pixel square besides the target pixel. When p is greater than 1, target pixels are selected sequentially from the p-th band image. The first pixel square and the second pixel square are determined according to the compression level identifier and the position of the target pixel. The neighboring pixels of the target pixel include the second pixel square and other pixels in the first pixel square except for the target pixel. The first pixel square and the second pixel square are the same size, and the position of the first pixel square in the p-th band image is the same as the position of the second pixel square in the p-1 band image. Generate a neighborhood vector for each pixel based on the neighboring pixel values and the bias term.
4. The method according to claim 3, characterized in that, The compression level is identified by a compression level number, which is linearly related to the number of rows in the first pixel square.
5. The method according to claim 1, characterized in that, The step of calculating the predicted pixel value of each pixel in the p-th band image based on the model parameter values of the p-th band image and the neighborhood vector of each pixel in the p-th band image includes: The model parameter values of the p-th band image are multiplied by 2 raised to the power of k, where k is a positive integer; Round the result of the multiplication operation to the nearest integer; Perform matrix multiplication on the neighborhood vector of each pixel in the p-th band image and the result of the rounded multiplication operation; The result of the matrix multiplication operation is shifted k positions to the right to obtain the predicted pixel value for each pixel in the p-th band image.
6. The method according to any one of claims 1 to 5, characterized in that, The step of encoding the pixel residual set to obtain residual encoded data includes: A target value greater than the median is selected from a preset sequence based on the median of the pixel residual set, wherein each value in the preset sequence is an odd multiple of 128; The target difference is determined to be equal to the target value minus the median; Add the target difference to each pixel residual in the pixel residual set; Divide the result of each addition operation into a high-order part and a low-order part; The finite state entropy coding algorithm is used to encode the low-order part of all addition results into low-order residual code data; The finite state entropy coding algorithm is used to encode the high-order bits of all addition results into high-order residual code data. The low-order residual code data and the high-order residual code data are combined to form residual code data.
7. An image decompression method, characterized in that, include: Get the compressed file; The residual coded data, compression level identifier, and model parameter values for all band images are obtained from the compressed file according to the decompression command. The residual encoded data is decoded into a set of pixel residuals; Select the pixels to be processed according to the band order and pixel order; The neighborhood vector of the pixel to be processed is obtained based on the compression level identifier and the band number of the pixel to be processed. The neighborhood vector includes the neighboring pixel value and the bias term. The predicted pixel value of the pixel to be processed is determined based on the neighborhood vector of the pixel to be processed and the model parameter value of the p-th band image. The pixel value of the pixel to be processed is determined based on the predicted pixel value of the pixel to be processed and the pixel residual of the pixel to be processed; A remote sensing image is generated based on the pixel values of all band images.
8. The method according to claim 7, characterized in that, The compressed file also includes the target difference; Decoding the residual encoded data into a set of pixel residuals includes: The residual encoded data is divided into high-order residual encoded data and low-order residual encoded data; The finite-state entropy coding algorithm is used to decode the high-bit residual coded data into a set of high-bit parts. The finite-state entropy coding algorithm is used to decode the low-bit residual encoded data into a set of low-bit parts. Generate a target value set based on the high-order portion set and the low-order portion set; Subtract the target difference from each value in the target value set to obtain a pixel residual set, wherein the sum of the median of the pixel residual set and the target difference is an odd multiple of 128.
9. An image processing apparatus, characterized in that, include: An acquisition unit is used to acquire remote sensing images, which include images of multiple spectral bands; Select pixel units for selecting multiple pixels from the p-th band image, where p is a positive integer; A vector unit is used to determine the neighborhood vector of each pixel in the p-th band image based on the compression level identifier and p, wherein the neighborhood vector includes the neighborhood pixel value and a bias term; A model unit is used to generate a pixel value matrix based on the neighborhood vectors of the plurality of pixels; Linear regression is performed on the pixel value matrix, the transpose of the pixel value matrix, and the pixel values of the plurality of pixels to obtain the model parameter values of the p-th band image; The prediction unit is used to calculate the predicted pixel value of each pixel in the p-th band image based on the model parameter values of the p-th band image and the neighborhood vector of each pixel in the p-th band image. The residual calculation unit is used to determine the pixel residual of each pixel in the p-th band image based on all pixel values of the p-th band image and all predicted pixel values of the p-th band image; The encoding unit is used to generate a set of pixel residuals based on the pixel residuals of each pixel in the image of all bands; and to encode the set of pixel residuals to obtain residual encoded data. The compressed file unit is used to generate a compressed file based on the residual encoded data, compression level identifier, and model parameter values of all band images.
10. The image processing apparatus according to claim 9, characterized in that, The pixel selection unit is specifically used to select multiple pixel squares from the p-th band image, and to select one pixel from the same position of each of the multiple pixel squares to obtain multiple pixels.
11. The image processing apparatus according to claim 9, characterized in that, Specifically, the vector unit is used to: when p equals 1, sequentially select target pixels from the p-th band image; determine the first pixel square where the target pixel is located based on the compression level identifier and the position of the target pixel; determine the neighboring pixels of the target pixel including all pixels in the first pixel square except the target pixel; when p is greater than 1, sequentially select target pixels from the p-th band image; determine the first pixel square and the second pixel square based on the compression level identifier and the position of the target pixel; determine the neighboring pixels of the target pixel including the second pixel square and all pixels in the first pixel square except the target pixel; the first pixel square and the second pixel square are the same size, and the position of the first pixel square in the p-th band image is the same as the position of the second pixel square in the (p-1)-th band image; and generate a neighborhood vector for each pixel based on the neighboring pixel values and bias terms of each pixel.
12. The image processing apparatus according to claim 11, characterized in that, The compression level is identified by a compression level number, which is linearly related to the number of rows in the first pixel square.
13. The image processing apparatus according to claim 9, characterized in that, The prediction unit is specifically used to multiply the model parameter value of the p-th band image with 2 raised to the power of k, where k is a positive integer; round the result of the multiplication operation; perform matrix multiplication on the neighborhood vector of each pixel in the p-th band image and the rounded multiplication result; and shift the matrix multiplication result to the right by k bits to obtain the predicted pixel value of each pixel in the p-th band image.
14. The image processing apparatus according to any one of claims 9 to 13, characterized in that, The encoding unit is specifically used to select a target value greater than the median from a preset sequence based on the median of the pixel residual set, wherein each value in the preset sequence is an odd multiple of 128; The target difference is determined to be equal to the target value minus the median; Each pixel residual in the pixel residual set is added to the target difference; the result of each addition operation is divided into a high-order part and a low-order part; The finite state entropy coding algorithm is used to encode the low-order part of all addition results into low-order residual code data; The finite state entropy coding algorithm is used to encode the high-order part of all addition results into high-order residual code data; the low-order residual code data and the high-order residual code data are combined to form residual code data.
15. An image processing apparatus, characterized in that, include: The acquisition unit is used to acquire compressed files; According to the decompression command, residual coded data, compression level identifier and model parameter values of all band images are obtained from the compressed file; The decoding unit is used to decode the residual encoded data into a set of pixel residuals; The image processing unit is used to select pixels to be processed according to band order and pixel order; obtain the neighborhood vector of the pixel to be processed according to the compression level identifier and the band number of the pixel to be processed, the neighborhood vector including the neighborhood pixel value and the bias term; and determine the predicted pixel value of the pixel to be processed according to the neighborhood vector of the pixel to be processed and the model parameter value of the p-th band image. The pixel value of the pixel to be processed is determined based on the predicted pixel value of the pixel to be processed and the pixel residual of the pixel to be processed. A remote sensing image is generated based on the pixel values of all band images.
16. The image processing apparatus according to claim 15, characterized in that, The decoding unit is specifically used to divide the residual encoded data into high-order residual encoded data and low-order residual encoded data when the compressed file still includes the target difference; and to decode the high-order residual encoded data into a high-order part set using a finite state entropy encoding algorithm. The low-order residual encoded data is decoded into a low-order part set using a finite state entropy encoding algorithm; a target value set is generated based on the high-order part set and the low-order part set; a target difference is subtracted from each value in the target value set to obtain a pixel residual set, wherein the sum of the median of the pixel residual set and the target difference is an odd multiple of 128.
17. A computer-readable storage medium storing instructions, characterized in that, When it is run on a computer, it causes the computer to perform the method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Image lossless compression method and electronic device
CN104202607A
Hyperspectral image lossless compression method based on deep learning
CN108960333A