Image compression method, image decompression method and system thereof

By using differential coding to compress and decompress images based on their spatial correlation, the problem of increased bandwidth and storage space caused by the improvement of image sensor resolution is solved, and efficient image data transmission and processing is achieved.

CN121842401APending Publication Date: 2026-04-10HEFEI JUNZHENG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-10
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

As the resolution of image sensors increases, the storage space and bandwidth requirements for image data during transmission and processing gradually increase, and existing technologies are struggling to effectively reduce them.

Method used

By employing the principle of spatial correlation of images, image compression is performed by calculating the difference between the pixel values ​​of non-base pixels and their reference pixels. Lossless compression is achieved by using difference encoding, and the original pixel values ​​are restored during decompression.

Benefits of technology

It effectively reduces the bandwidth pressure of image signals from the image sensor to the image processing unit, reduces storage space occupation, improves chip operating efficiency, and has fast compression and decompression speeds with low hardware costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121842401A_ABST
    Figure CN121842401A_ABST
Patent Text Reader

Abstract

The invention discloses an image compression method, an image decompression method and a system thereof, which are applied to the field of image processing. For each image area, the compression process comprises the following steps: calculating a pixel value difference value between each non-basic pixel point and a reference pixel point thereof; for the basic pixel points, the pixel values of the basic pixel points are stored according to the original data width and the original values; and for non-basic pixel points, the pixel values of the non-basic pixel points are compressed and stored according to the new data width and the pixel value difference value. Correspondingly, the decompression process comprises the following steps: for the basic pixel points, directly reading the pixel values of the basic pixel points from the compressed image; and for the non-basic pixel point, reading the pixel value difference value between the non-basic pixel point and the reference pixel point from the compressed image, converting the read pixel value difference value from the new data width to the original data width, and restoring the pixel value based on the converted pixel value difference value and the obtained pixel value of the reference pixel point. Therefore, the occupation of the transmission bandwidth and the storage space can be effectively reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the field of image processing, and particularly relates to an image compression method, an image decompression method and a system thereof. BACKGROUND

[0002] With the popularity of consumer electronics, the requirement for image quality is increasing, and therefore the resolution of image sensors is also increasing. Taking an image sensor with a specification of 2560x1440@30fps 10bit as an example, the required transmission bandwidth is 1,105,920,000bps. With the continuous improvement of application requirements, such as in the fields of vehicle-mounted and monitoring, in order to reduce the bandwidth pressure of image signals from the image sensor to the image processing unit, it is imperative to compress and transmit the original image. SUMMARY

[0003] In order to reduce the storage space and bandwidth occupied by image data in the transmission and processing process, the present application provides an image compression method, an image decompression method and a system thereof.

[0004] In a first aspect, the present application provides an image compression method, comprising: obtaining a to-be-compressed image, the to-be-compressed image comprising pixel values of a plurality of pixel points; for each region of a plurality of regions of the to-be-compressed image, performing the following compression operation to obtain a compressed image: calculating a pixel value difference between each non-basic pixel point and its reference pixel point in the region, wherein at least one non-basic pixel point takes a basic pixel point as a reference pixel point; storing the pixel value of the basic pixel point in the region in the original data width and original value; storing the pixel value of the non-basic pixel point in the region in the new data width and pixel value difference, wherein the new data width is smaller than the original data width.

[0005] In some embodiments, the to-be-compressed image is an original image collected by an image sensor.

[0006] In some embodiments, the to-be-compressed image is an original RGB image, the resolution of the image sensor is N*N, each region of the plurality of regions comprises continuous N pixel points, and the N pixel points are composed of pixel points of a first color and pixel points of a second color. For each region of the plurality of regions: the basic pixel points comprise a first basic pixel point of the first color and a second basic pixel point of the second color; each non-basic pixel point and its reference pixel point are of the first color or of the second color.

[0007] In some embodiments, for each region of the plurality of regions: the first base pixel point is a first pixel point in the region, and the second base pixel point is a second pixel point in the region; and each non-base pixel point has a same color as a previous pixel point thereof as a reference pixel point.

[0008] In some embodiments, for each region of the plurality of regions, the new data width is L+1, where L is a maximum significant bit width of pixel value difference between a non-base pixel point and a reference pixel point thereof in the region, and a most significant bit of the pixel value difference stored in the new data width is a sign bit. For each region of the plurality of regions, the compression operation further comprises storing the maximum significant bit width.

[0009] In a second aspect, the present application provides an image decompression method, comprising: obtaining a compressed image, the compressed image being generated by the image compression method according to the first aspect; and for each region of a plurality of regions of the compressed image, performing the following decompression operation to obtain a decompressed image: for a base pixel point in the region, directly reading a pixel value thereof from the compressed image; for a non-base pixel point in the region, reading a pixel value difference between the non-base pixel point and a reference pixel point thereof from the compressed image, converting the read pixel value difference from a new data width to an original data width, and restoring a pixel value of the non-base pixel point based on the converted pixel value difference and a pixel value of the reference pixel point.

[0010] In a third aspect, the present application provides an electronic device, comprising a processor and a memory, the memory storing a computer program, when the processor executes the computer program, the image compression method according to the first aspect or the image decompression method according to the second aspect is implemented.

[0011] In a fourth aspect, the present application provides a computer readable storage medium, the computer readable storage medium storing a computer program, when the computer program is executed on a computer, the computer is caused to execute the image compression method according to the first aspect or the image decompression method according to the second aspect.

[0012] In a fifth aspect, the present application provides a computer program product, when the computer program product is executed on a computer, the computer is caused to execute the image compression method according to the first aspect or the image decompression method according to the second aspect.

[0013] The present application has at least the following beneficial effects:

[0014] (1) The application utilizes the spatial correlation principle of images, realizes image compression through difference coding, can effectively reduce the bandwidth pressure of image signals from the image sensor to the image processing unit, also can reduce the storage space occupied in the image signal processing process, and improves the running efficiency of the chip (for example, the ISP chip);

[0015] (2) Compared with some complex lossless compression algorithms (for example, Huffman coding, LZ77 algorithm, etc.), the method provided by the application has faster compression and decompression speed, lower hardware implementation cost, and certain cost performance;

[0016] (3) The application is suitable for various scenes, and can bring good compression effect for simple scenes and complex scenes. BRIEF DESCRIPTION OF DRAWINGS

[0017] The drawings described herein are used to provide further understanding of the application, constitute a part of the present application, and do not constitute a limitation of the application.

[0018] Figure 1 is an exemplary flowchart of the image compression method provided by the embodiments of the application.

[0019] Figure 2A is a schematic diagram of the distribution of light sensing elements in the GRBG mode.

[0020] Figure 2B is a schematic diagram of the distribution of light sensing elements in the RGGB mode.

[0021] Figure 2C is a schematic diagram of the distribution of light sensing elements in the BGGR mode.

[0022] Figure 2D is a schematic diagram of the distribution of light sensing elements in the GBRG mode.

[0023] Figure 3 is a schematic diagram of the data compression processing process in the RG row.

[0024] Figure 4 is an exemplary flowchart of the image decompression method provided by the embodiments of the application.

[0025] Figure 5 is an exemplary module diagram of the image compression system provided by the embodiments of the application.

[0026] Figure 6 is an exemplary module diagram of the image decompression system provided by the embodiments of the application.

[0027] Figure 7 is a structural schematic diagram of the electronic device provided by the embodiments of the application. DETAILED DESCRIPTION

[0028] In order to enable persons skilled in the art to more clearly understand the technical content and advantages of the present application, the present application will be further described in detail in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by persons skilled in the art without creative labor fall within the protection scope of the present application. The present application will be further described in detail in conjunction with the accompanying drawings.

[0029] First, important terms in this paper are introduced.

[0030] An image sensor is a device that converts optical images into electronic signals, and is widely used in digital cameras and other electronic optical devices. Early image sensors used analog signals, such as video camera tubes. Today, image sensors are mainly divided into charge-coupled devices (CCD) and complementary metal-oxide semiconductor active pixel sensors (CMOS Active pixel sensor).

[0031] RGB is a color mode widely used in electronic display systems, which displays various colors by mixing red, green and blue.

[0032] A RAW image is the original image data output by an image sensor (referred to as a sensor). A RAW image is simply image data that has not been processed in any way, i.e., data that represents the intrinsic characteristics of the sensor and the lens. Taking the RGB color mode as an example, after a series of processes such as reflection of light on the imaged object, lens convergence, photoelectric conversion, ADC (analog-to-digital conversion), data encoding, etc., the image sensor outputs a RAW RGB image.

[0033] Image resolution reflects the amount of information stored in an image, and is used to describe how many pixel points exist in an image. The resolution of an image sensor is used to describe the number of light-sensitive components inside the image sensor. The greater the resolution of the image sensor, the more light-sensitive components inside the image sensor.

[0034] Lossless compression means that the information contained in the data after compression has not been reduced and can be completely restored to the state before compression.

[0035] It should be noted that although the present specification mainly takes the original image (i.e. RAW image) collected by the image sensor as an example for illustration, the principles of the present application are also applicable to the compression and decompression of other types of images, and the resulting technical effects are the same or similar, for example, reducing the bandwidth occupied by the transmission of image signals between different modules (e.g. from memory to processor) within the system or between different systems (e.g. from storage device to processing device), reducing the storage space occupied in the image data processing process, improving the running efficiency of the chip (e.g. ISP chip), fast compression and decompression speed, low hardware implementation cost, etc.

[0036] Figure 1 is an exemplary flowchart of the image compression method provided by the present application. The flowchart 100 can be executed by the image compression system 500 (referred to as system 500) shown in Figure 5 . As shown in Figure 1 , the flowchart 100 includes the following steps.

[0037] Step 110, obtaining a to-be-compressed image.

[0038] The to-be-compressed image includes pixel values of a plurality of pixel points. The to-be-compressed image can be an original image (e.g. original RGB image or original YUV image), or a processed image. The to-be-compressed image can be a monochrome (grayscale) image, or a color image (e.g. RGB image or YUV image). For brevity, the following will take the original RGB image as an example for illustration.

[0039] For each region (denoted as Pi, 1≤i≤n) in the plurality of regions (denoted as P1, P2,..., Pn) of the to-be-compressed image, the compression module 530 performs the compression operation 120 to obtain a compressed image.

[0040] Since the present application utilizes the spatial correlation principle of the image, the region division should be such that the pixel values of the pixel points within a single region are as close as possible, so as to calculate the small pixel value difference that is conducive to compression storage.

[0041] Taking the original RGB image as an example, since each photosensitive element (corresponding to a pixel point) of the image sensor can only sense light of a specific color, each pixel point of the image sensor can only be red, green or blue, and the original RGB image contains the pixel values of these pixel points. Different image sensors have different distributions of internal photosensitive elements, and there are four common distributions, namely GRBG, RGGB, BGGR and GBRG. Assuming that the image sensor resolution of the image processor is 8x8, the four photosensitive element distributions are as shown in Figure 2A-2D .

[0042] The arrangement of data (pixel values) in the original RGB image is consistent with the distribution of photosensitive elements inside the image sensor. Taking an RGGB image as an example, refer to... Figure 2B Based on the resolution (8×8) of the image sensor, eight consecutive pixels can be taken as a region. That is, if the original RGB image is regarded as a pixel array, then: each row containing red and green pixels (referred to as RG row) is a region; each row containing green and blue pixels (referred to as GB row) is a region.

[0043] Generally, when the image to be compressed is an original RGB image and the resolution of the image sensor is N*N, each of the plurality of regions may contain N consecutive pixels, which are composed of pixels of a first color and pixels of a second color. Referring to the previous example, for an RGGB image, the first color and the second color are red and green, or green and blue.

[0044] like Figure 1 As shown, compression operation 120 includes steps 121 to 123.

[0045] Step 121: Calculate the pixel value difference between each non-base pixel in Pi and its reference pixel.

[0046] The pixels in each region can be divided into base pixels and non-base pixels, and each non-base pixel has a reference pixel. It is worth mentioning that, considering decompression, at least one non-base pixel uses the base pixel as its reference pixel.

[0047] When the image to be compressed is a grayscale image, a unique base pixel can be specified for each of the multiple regions.

[0048] When the image to be compressed is a color image, for each of the plurality of regions, at least two base pixels can be specified based on the color of the pixels contained in each region. For example, referring to the foregoing embodiment, if each region of the original RGB image consists of pixels of a first color and pixels of a second color, then a base pixel of the first color (referred to as the first base pixel) and a base pixel of the second color (referred to as the second base pixel) can be specified for each region. Accordingly, each non-base pixel and its reference pixel are either of the first color or both of the second color.

[0049] In some embodiments, for each of the plurality of regions, the first base pixel is the first pixel in that region, and the second base pixel is the second pixel in that region. For example, when Pi is the RG row in an RGGB image, the first base pixel is the first pixel in Pi (i.e., the red pixel), and the second base pixel is the second pixel in Pi (i.e., the green pixel). Using the head pixel of each region as the base pixel, base pixels and non-base pixels can be easily identified by sequential reading.

[0050] In some embodiments, for each of the plurality of regions, when the base pixel includes a first reference pixel of a first color and a second reference pixel of a second color, each non-base pixel uses the preceding pixel of the same color as its reference pixel. Thus, for non-base pixels of the same color (first color / second color) within the same region, the pixel values ​​of these non-base pixels can be sequentially restored.

[0051] In some embodiments, when the image to be compressed is a grayscale image, similarly, for each of the plurality of regions, the first pixel can be selected as the base pixel, and correspondingly, each subsequent non-base pixel uses the previous pixel as the reference pixel.

[0052] In an alternative embodiment, for each of the plurality of regions, all non-base pixels are referenced to a base pixel. For example, for a grayscale image, all non-base pixels within each region are referenced to a base pixel (such as a specified pixel at the center). As another example, for a raw RGB image, when each region consists of pixels of a first color and pixels of a second color, all non-base pixels of the first color (such as red) are referenced to a first base pixel (such as a specified red pixel at the center), and all non-base pixels of the second color (such as green) are referenced to a second base pixel (such as a specified green pixel at the center).

[0053] Step 122: For the basic pixels in Pi, store their pixel values ​​according to the original data width and original value.

[0054] Step 123: For non-basic pixels in Pi, compress and store their pixel values ​​according to the new data width and pixel value difference.

[0055] The new data width here is smaller than the original data width, enabling image data compression. Specifically, because images are spatially correlated—that is, the pixel values ​​of different pixels in neighboring regions are close to each other (i.e., neighboring pixels are similar in color and brightness)—difference processing on the pixel values ​​of different pixels in neighboring regions often yields smaller values. Therefore, the pixel value differences can be stored with a smaller data width. After difference calculation and storage conversion, the information contained in the compressed data is not reduced (the original pixel values ​​can be recovered through decompression), but the data volume is effectively reduced, achieving lossless compression. Therefore, process 100 can effectively reduce the consumption of transmission bandwidth and storage space.

[0056] It should be understood that, in order to achieve lossless compression, at least all the significant bits of the pixel value difference must be stored. Preferably, all invalid parts of the pixel value difference with high-order bits set to 0 can be removed, and only the significant parts with low-order bits can be stored (if there is a sign bit, the sign bit is also retained). For example, if the original data width is 8 bits, and the pixel value difference between a non-base pixel and its reference pixel is 00000100 (the highest bit is the sign bit), then only the sign bit (highest bit 0) and the significant bits (last 3 bits 100) of this difference can be stored, that is, the pixel value of the non-base pixel is compressed and stored as 0100.

[0057] In some embodiments, for each of the plurality of regions, the new data width is L+1, where L is the maximum effective bit width of the pixel value difference between a non-base pixel and a reference pixel in that region, and the highest bit of the pixel value difference stored with the new data width is the sign bit. Accordingly, for each of the plurality of regions, the compression operation 120 further includes step 124.

[0058] Step 124: Store the maximum effective bit width of the pixel value difference between a non-base pixel in Pi and its reference pixel.

[0059] It should be noted that storing the maximum effective bit width is not necessary. In an alternative embodiment, if the effective bit width threshold for pixel value differences is known (this threshold is less than the original data width), the new data width can be uniformly determined based on this threshold (let's call it L), that is, the new data width is determined according to L for all the regions. L can be determined by statistical methods. For example, if it is found statistically that more than 99% of the samples (each sample is the pixel value difference determined based on different pixels in the same region) are less than a certain value, then the effective bit width of that value can be determined as L. Furthermore, the new data width can be L+1, and the highest bit of the pixel value difference stored according to the new data width is the sign bit. It should be understood that the resulting information loss is negligible or controlled within an acceptable range.

[0060] Without conflict, the foregoing embodiments can be appropriately combined. Taking an original RGGB image with a sensor resolution of 8×8 as an example, such as... Figure 3 As shown, each RG row of the original RGGB image includes the pixel values ​​of 8 pixels (i.e., 4 groups of pixel values), which are denoted as R0, G0, R1, G1, R2, G2, R3, and G3 respectively.

[0061] Then, starting from the second set of pixel values, the compression module 520 can calculate the pixel value difference (ΔR1 / ΔR2 / ΔR3) between each red pixel (R1 / R2 / R3) and the previous red pixel (R0 / R1 / R2), and calculate the pixel value difference (ΔG1 / ΔG2 / ΔG3) between each green pixel (G1 / G2 / G3) and the previous red pixel (G0 / G1 / G2). That is, ΔR1 = R1 - R0, ΔG1 = G1 - G0, ΔR2 = R2 - R1, ΔG2 = G2 - G1, ΔR3 = R3 - R2, ΔG3 = G3 - G2.

[0062] After obtaining the pixel value difference sequence [ΔR1, ΔG1, ΔR2, ΔG2, ΔR3, ΔG3] (stored according to the original data width), the compression module 520 can determine the maximum effective bit width of this data set (let's call it L). Then, the compression module 520 can retain only the highest bit (sign bit) and the last L bits to obtain the pixel value difference sequence [ΔR1', ΔG1', ΔR2', ΔG2', ΔR3', ΔG3'] stored according to the new data width (i.e., L+1).

[0063] More specifically, assuming the pixel value difference sequence based on a certain RG row is represented in decimal as [4,8,15,-3,-9,20] and the original data width is 8 bits, its binary original code is [00000100,00001000,00001111,10000011,10001001,00010100], where the highest bit is the sign bit and the remaining bits are the values. Since the maximum effective bit width of this data is 5, through deredundancy removal (keeping only the highest bit and the last 5 bits), the compression module 520 can compress and store the pixel value difference sequence of this RG row as [000100,001000,001111,100011,101001,010100]. That is, the new data width is 6 bits.

[0064] refer to Figure 3 The compression module 520 can also store the maximum effective bit width corresponding to the pixel value difference sequence of each RG row (or each BG row) between the first and second sets of data. For example, when the maximum sampling bit width is 12 bits, the maximum effective bit width can be stored in 4 bits (which can represent 0 to 15).

[0065] For each GB line, the compression module 520 can process it in the same way.

[0066] Repeating the above process will compress the entire image.

[0067] Figure 4 This is an exemplary flowchart of the image decompression method provided in this application embodiment. Flow 400 can be... Figure 6 The image decompression system 600 (hereinafter referred to as System 600) shown is executed. For example... Figure 4 As shown, process 400 includes the following steps.

[0068] Step 410: Obtain the compressed image.

[0069] The compressed image is generated using the image compression method provided in the embodiments of this application. More details regarding image compression can be found... Figure 1 The relevant descriptions can be found here, so I will not repeat them here.

[0070] For each region (let's call it Pi) of the multiple regions in the compressed image, perform decompression operation 420 to obtain the decompressed image. For more details on region division, please refer to the description of compression operation 120.

[0071] like Figure 4 As shown, the decompression operation 420 includes steps 421 to 423.

[0072] Step 421: For the basic pixels in Pi, read their pixel values ​​directly from the compressed image.

[0073] Since the pixel values ​​of the basic pixels are stored with the original data width and original value, the decompression module 620 can directly read the pixel values ​​from the compressed image.

[0074] Step 422: For non-base pixels in Pi, read the pixel value difference between the non-base pixel and its reference pixel from the compressed image, and convert the read pixel value difference back from the new data width to the original data width.

[0075] Since the restoration of pixel values ​​depends on the addition of the pixel value (reference pixel) and the pixel value difference, it is necessary to convert the data width to make the data width of the pixel value (reference pixel) and the pixel value difference that participate in the addition operation consistent.

[0076] Step 423: For non-base pixels in Pi, restore their pixel values ​​based on the difference in converted pixel values ​​and the pixel values ​​of their reference pixels that have been obtained.

[0077] Step 422 restores the data width, and step 423 restores the numerical values. At this point, all pixels in the image have been restored to their original data width and values, thus obtaining the decompressed image. It should be understood that the decompressed image is equivalent to the image to be compressed.

[0078] As described above, at least one non-base pixel uses a base pixel as a reference pixel. Therefore, for each of the at least one non-base pixel, the decompression module 620 can restore its pixel value based on the difference between the pixel value of the non-base pixel and the pixel value of the base pixel, as well as the pixel value of the base pixel. For other non-base pixels (if any), since their reference pixel is a non-base pixel whose pixel value has been restored (e.g., the at least one non-base pixel), the decompression module 620 can continue to restore their pixel values.

[0079] In some embodiments, for each of the plurality of regions, when the compressed image contains the maximum effective bit width of the pixel value difference between a non-base pixel in that region and its reference pixel, the decompression module 620 can read the maximum effective bit width from the compressed image to identify the pixel value difference corresponding to different non-base pixels in the compressed image.

[0080] Continue to refer to Figure 3 Decompression is the reverse process of compression. For each RG row, the decompression module 620 reads the pixel value R0 of the first base pixel and the pixel value G0 of the second base pixel in the original data width (e.g., 8 bits). Next, the decompression module 620 reads a fixed number of bits (e.g., 4 bits) of data from the RG row as the maximum effective bit width, thereby determining the data width of each subsequent pixel value difference, i.e., the new data width (e.g., 6 bits). Then, the decompression module 620 reads three sets of pixel value differences ΔR1', ΔG1', ΔR2', ΔG2', ΔR3', ΔG3' in the new data width order, and converts this set of data from the new data width (e.g., 6 bits) back to the original data width (e.g., 8 bits). The conversion result is recorded as ΔR1, ΔG1, ΔR2, ΔG2, ΔR3, ΔG3. Then, the decompression module 620 restores the remaining 3 sets of pixel values ​​(i.e., the pixel values ​​of 6 non-basic pixels) through addition operations. The restoration process is recorded as R1=R0+ΔR1, G1=G0+ΔG1, R2=R1+ΔR2, G2=G1+ΔG2, R3=R2+ΔR3, G3=G2+ΔG3.

[0081] For each GB line, the compression module 520 can process it in the same way.

[0082] Repeat the above process to decompress the entire image.

[0083] Figure 5This is an exemplary block diagram of the image compression system provided in this application embodiment. System 500 can... Figure 7 This is implemented on the electronic device 700 shown. For example... Figure 5 As shown, system 500 includes a first acquisition module 510 and a compression module 520.

[0084] The first acquisition module 510 is used to acquire the image to be compressed, which includes the pixel values ​​of multiple pixels.

[0085] The compression module 520 is configured to: for each of the plurality of regions, perform the following compression operations to obtain a compressed image: determine the base pixel in the region; calculate the pixel value difference between each non-base pixel in the region and its reference pixel, wherein at least one non-base pixel uses the base pixel as its reference pixel; for the base pixel in the region, store its pixel value according to the original data width and the original value; for the non-base pixel in the region, compress and store its pixel value according to the new data width and the pixel value difference, wherein the new data width is smaller than the original data width.

[0086] More details about System 500 and its modules can be found at [link / website / etc.]. Figure 1 The relevant descriptions can be found here, so I will not repeat them here.

[0087] Figure 6 This is an exemplary block diagram of the image compression system provided in this application embodiment. System 600 can... Figure 7 This is implemented on the electronic device 700 shown. It should be noted that systems 500 and 600 can be implemented on the same device or on different devices, depending on the specific application scenario. For example... Figure 6 As shown, system 600 includes a second acquisition module 610 and a decompression module 620.

[0088] The second acquisition module 610 is used to acquire a compressed image, which is obtained by the image compression method provided in the embodiments of this application.

[0089] The decompression module 620 is configured to: for each of the multiple regions of the image to be compressed, perform the following decompression operations to obtain a decompressed image: for the base pixel in the region, directly read its pixel value from the compressed image; for the non-base pixel in the region, read the pixel value difference between the non-base pixel and its reference pixel from the compressed image, convert the read pixel value difference from the new data width back to the original data width, and then, based on the converted pixel value difference and the obtained pixel value of its reference pixel, restore its pixel value.

[0090] More details about System 600 and its modules can be found at [link to relevant information]. Figure 4The relevant descriptions can be found here, so I will not repeat them here.

[0091] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 700 includes a processor 710 and a memory 720. The memory 720 stores a computer program. When the processor 710 executes the computer program, it implements the image compression method or image decompression method provided in the embodiment of this application.

[0092] This application also provides a computer-readable storage medium storing a computer program. When the computer program is run on a computer, it causes the computer to execute the image compression method or image decompression method provided in this application.

[0093] This application also provides a computer program product that, when run on a computer, causes the computer to execute the image compression method or image decompression method provided in this application.

[0094] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0095] The image enhancement method and system provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principle and implementation of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation and application scope based on the idea of ​​the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. An image compression method, characterized in that, include: Step 110: Obtain the image to be compressed, wherein the image to be compressed includes pixel values ​​of multiple pixels; Step 120: For each of the multiple regions of the image to be compressed, perform the following compression operation to obtain a compressed image: Step 121: Calculate the pixel value difference between each non-base pixel and its reference pixel in the region, wherein at least one non-base pixel uses the base pixel as its reference pixel. Step 122: For the basic pixels in this region, store their pixel values ​​according to the original data width and original values; Step 123: For non-basic pixels in the region, compress and store their pixel values ​​according to the new data width and the difference in pixel values, wherein the new data width is smaller than the original data width.

2. The image compression method as described in claim 1, characterized in that, The image to be compressed is the original image acquired by the image sensor.

3. The image compression method as described in claim 2, characterized in that, The image to be compressed is an original RGB image, the resolution of the image sensor is N*N, each of the multiple regions contains N consecutive pixels, and the N pixels are composed of pixels of a first color and pixels of a second color. For each of the plurality of regions: the base pixels include a first base pixel of the first color and a second base pixel of the second color; each non-base pixel and its reference pixel are either of the first color or both of the second color.

4. The image compression method as described in claim 3, characterized in that, For each of the plurality of regions: the first base pixel is the first pixel in the region, and the second base pixel is the second pixel in the region; each non-base pixel is referenced by the previous pixel of the same color.

5. The image compression method as described in claim 1, characterized in that, For each of the plurality of regions, the new data width is L+1, where L is the maximum effective bit width of the pixel value difference between a non-base pixel and its reference pixel in that region, and the highest bit of the pixel value difference stored according to the new data width is the sign bit; For each of the plurality of regions, the compression operation further includes: Step 124: Store the maximum effective bit width.

6. An image decompression method, characterized in that, include: Step 410: Obtain a compressed image, wherein the compressed image is generated by the image compression method as described in any one of claims 1 to 5; Step 420: For each of the multiple regions of the compressed image, perform the following decompression operation to obtain a decompressed image: Step 421: For the basic pixels in this region, their pixel values ​​are directly read from the compressed image; Step 422, for non-base pixels in the region: read the pixel value difference between the non-base pixel and its reference pixel from the compressed image, and convert the read pixel value difference from the new data width back to the original data width; Step 423: For non-base pixels in the region: restore their pixel values ​​based on the difference in converted pixel values ​​and the pixel values ​​of their reference pixels that have been obtained.

7. An image compression system, characterized in that, The system is applicable to the image compression method according to any one of claims 1 to 5, and the system comprises: The first acquisition module is used to acquire the image to be compressed, the image to be compressed including the pixel values ​​of multiple pixels; The compression module is configured to perform the following compression operation for each of the plurality of regions to obtain a compressed image: Determine the base pixels in this region; Calculate the pixel value difference between each non-base pixel and its reference pixel in this region. Among them, at least one non-base pixel uses the base pixel as a reference pixel; For the basic pixels in this region, store their pixel values ​​with the original data width and original values; For non-base pixels in this region, their pixel values ​​are compressed and stored according to the difference between the new data width and the pixel value, wherein the new data width is smaller than the original data width.

8. An image decompression system, characterized in that, The system is applicable to the image decompression method of claim 6, comprising: The second acquisition module is used to acquire a compressed image, wherein the image to be compressed is obtained by the image compression method as described in any one of claims 1 to 5; The decompression module is configured to: perform the following decompression operation for each of the multiple regions of the image to be compressed to obtain a decompressed image: For the basic pixels in this region, their pixel values ​​are read directly from the compressed image; For non-base pixels in this region: read the pixel value difference between the non-base pixel and its reference pixel from the compressed image, and convert the read pixel value difference from the new data width back to the original data width; based on the converted pixel value difference and the obtained pixel value of its reference pixel, restore its pixel value.