Dynamic image compression method
By dividing image frames into image blocks and dynamically adjusting the quantization factor, combined with discrete cosine transform and coding algorithms, the problems of instability and high resource requirements of traditional image compression methods in embedded systems are solved, achieving efficient image data compression and real-time adaptability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2026-03-27
AI Technical Summary
Traditional image compression methods are unstable in output when the environment changes, and have high requirements for bandwidth, processing power and memory, making them difficult to apply effectively in embedded systems.
By dividing image frames into image blocks, using a preliminary quantization profile and dynamically adjusting the quantization factor, combined with discrete cosine transform and coding algorithms, the quantization profile is updated in real time to adapt to the target size range.
It enables efficient dynamic compression of image data in embedded systems, reducing bandwidth and storage requirements, adapting to changes in environment and network conditions, and providing real-time processing capabilities.
Smart Images

Figure CN121750871A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to image compression. In particular, systems and methods for dynamically compressing images to a desired size range with low processor and memory requirements. BACKGROUND
[0002] In the digital age, the amount of data generated, transmitted, and stored is growing exponentially. Among the types of data, images and videos constitute a significant portion. However, raw digital images require a large amount of storage space and bandwidth, which often makes it impractical to store and / or transmit these data in their original form. Image compression addresses this challenge by reducing the size of images.
[0003] Conventional image compression methods, such as Joint Photographic Experts Group (JPEG), typically employ a uniform compression factor under different circumstances. When the environmental conditions change, such methods can result in unstable output size or encoding rate. For example, a conventional compression method that produces a desired size output for night images can output significantly larger images for day images due to the inclusion of more visual information.
[0004] Furthermore, these conventional image compression methods often rely on complex algorithms to achieve precise size reduction. While this can enhance the quality of the compressed images, it also results in high requirements for bandwidth, processing power, and memory. Such requirements are particularly challenging for embedded systems, which are limited by finite hardware resources and are often used in real-time image processing and transmission scenarios. SUMMARY
[0005] One aspect of the present disclosure provides an image compression method for a system. The method can include obtaining a first image frame and dividing the first image frame into a set of image blocks. Each image block in the set can include a predetermined number of pixels. The method can also include obtaining a preliminary quantization profile and generating a first compressed image frame based on the set of image blocks of the first image frame and the preliminary quantization profile. The preliminary quantization profile can include a preliminary quantization factor corresponding to each pixel in the predetermined number of pixels. The method can further include obtaining a target size range for the first image frame, comparing a size of the first compressed image frame to the target size range for the first image frame, and updating the preliminary quantization profile based on the comparison of the size of the compressed image frame to the target size range for the first image frame. The method can also include obtaining a second image frame and generating a second compressed image frame based on the second image frame and the updated preliminary quantization profile.
[0006] In another aspect, the disclosure provides a system. The system can include a processor and a memory storing instructions. When executed by the processor, the instructions can configure the system to obtain a first image frame and divide the first image frame into a set of image blocks. Each image block in the set can include a predetermined number of pixels. The instructions can also configure the system to obtain a preliminary quantization profile and generate a first compressed image frame based on the set of image blocks of the first image frame and the preliminary quantization profile. The preliminary quantization profile can include a preliminary quantization factor corresponding to each pixel in the predetermined number of pixels. The instructions can also configure the system to obtain a target size range for the first image frame, compare a size of the first compressed image frame to the target size range for the first image frame, and update the preliminary quantization profile based on the comparison of the size of the compressed image frame to the target size range for the first image frame. The instructions can also configure the system to obtain a second image frame and generate a second compressed image frame based on the second image frame and the updated preliminary quantization profile.
[0007] In another aspect, the disclosure provides a non-transitory computer-readable storage medium. When executed by a system, the computer-readable storage medium can include instructions that cause the system to obtain a first image frame and divide the first image frame into a set of image blocks. Each image block in the set can include a predetermined number of pixels. The instructions can also cause the system to obtain a preliminary quantization profile and generate a first compressed image frame based on the set of image blocks of the first image frame and the preliminary quantization profile. The preliminary quantization profile can include a preliminary quantization factor corresponding to each pixel in the predetermined number of pixels. The instructions can also cause the system to obtain a target size range for the first image frame, compare a size of the first compressed image frame to the target size range for the first image frame, and update the preliminary quantization profile based on the comparison of the size of the compressed image frame to the target size range for the first image frame. The instructions can also cause the system to obtain a second image frame and generate a second compressed image frame based on the second image frame and the updated preliminary quantization profile. BRIEF DESCRIPTION OF DRAWINGS
[0008] For ease of quick reference to a specific discussion of any element or action, the reference number highest order digit employed herein corresponds to the figure number where such element or action first appears.
[0009] Figure 1 A block diagram of an embedded system is shown in accordance with an embodiment of the disclosure.
[0010] Figure 2 A schematic diagram showing example steps of dividing an original image into image blocks is shown in accordance with an embodiment of the disclosure.
[0011] Figure 3A An example image block is shown in accordance with an embodiment of the disclosure.
[0012] Figure 3B An RGB value of a pixel in an example image block is shown in accordance with embodiments of the present disclosure.
[0013] Figure 4A A luminance component level of a pixel in an example image block is shown in accordance with embodiments of the present disclosure.
[0014] Figure 4B A chrominance component level of a pixel in an example image block is shown in accordance with embodiments of the present disclosure.
[0015] Figure 5 A centralized luminance component level of a pixel in an example image block is shown in accordance with embodiments of the present disclosure.
[0016] Figure 6 A frequency-dependent profile of a centralized luminance component level of a pixel in an example image block is shown in accordance with embodiments of the present disclosure.
[0017] Figure 7 An example quantization profile of a luminance component level is shown in accordance with embodiments of the present disclosure.
[0018] Figure 8 A quantized image block is shown in accordance with embodiments of the present disclosure.
[0019] Figure 9 is a schematic diagram showing the execution of a sawtooth encoding step on a quantized image block in accordance with embodiments of the present disclosure.
[0020] Figure 10 An updated quantization profile of a luminance component level is shown in accordance with embodiments of the present disclosure.
[0021] Figure 11 A quantized image block generated based on the updated quantization profile is shown in accordance with embodiments of the present disclosure.
[0022] Figure 12 An updated quantization profile of a luminance component level is shown in accordance with embodiments of the present disclosure.
[0023] Figure 13 A quantized image block generated based on the updated quantization profile is shown in accordance with embodiments of the present disclosure.
[0024] Figure 14 is a flowchart showing the operation of an embedded system to dynamically compress an image frame to a target size range in accordance with embodiments of the present disclosure.
[0025] Figure 15 is a flowchart showing the operation of an embedded system to update a quantization profile in accordance with embodiments of the present disclosure. DETAILED DESCRIPTION
[0026] The description that follows includes systems, methods, techniques, instruction sequences, and computing machine program products embodying illustrative embodiments of the present disclosure. In the following description, for purposes of explanation, numerous specific details are set forth in order to provide an understanding of various embodiments of the inventive subject matter. It will be evident, however, to those skilled in the art, that embodiments of the inventive subject matter can be practiced without some or all of these specific details. In general, well-known instruction instances, protocols, structures, and techniques have not been shown in detail.
[0027] The present disclosure provides systems and methods for dynamically compressing image data to a pre-set size range in real-time image transmission. First, an image frame is acquired. This image frame can be captured by a camera sensor associated with the system. The image frame is then divided into a set of smaller image blocks, each image block comprising a predetermined number of pixels (e.g., 4x4 pixels, 4x8 pixels, 8x8 pixels, 16x16 pixels, etc.). In some examples, the image blocks can initially be represented in RGB (red, green, blue) values. The human eye is generally more sensitive to light intensity (brightness level) than to color. Optionally, the RGB values can be converted to YCbCr values, where Y represents the luminance component level and CbCr represent the chrominance component levels. The luminance component level can be preserved, while the chrominance component levels can be pre-compressed, e.g., by taking the average of the values in 2*2 sub-blocks.
[0028] A preliminary quantization profile (also referred to as a preliminary quantization table) is then acquired. The preliminary quantization profile can be a standard or custom quantization profile and contains quantization factors for each pixel within a block. The system can perform a frequency conversion transform (e.g., a discrete cosine transform (DCT) or similar transform) on each image block to convert its spatial image data to a frequency-dependent image profile.
[0029] After converting the image data to a frequency-dependent image profile, the profile is quantized using the preliminary quantization profile to reduce high frequency image components (to which the human eye is less sensitive). After quantization, the system employs one or more encoding algorithms to further compress the quantized data. These algorithms can include lossless algorithms (e.g., zigzag encoding, Huffman encoding, or run-length encoding (RLE)), as well as potentially lossy algorithms. The compressed image blocks are then combined to generate a compressed image frame.
[0030] Subsequently, the system compares the size of this compressed image frame with a predefined target size range. If the size of the compressed frame is outside this range, the preliminary quantization profile can be updated. If the system supports dynamic encoding (e.g., dynamic scaling quantization profile), the quantization factor in the preliminary quantization profile can be increased or decreased by a pre-set step size. The pre-set step size can be 10%, 20%, 30%, 50%, etc. If the system does not support dynamic encoding, the quantization profile can be updated by selecting a new quantization profile from a pre-determined quantization profile pool. The pre-determined quantization profiles can correspond to different compression levels. If the system supports adaptive step size adjustment, the system can adjust the step size based on the comparison of the compressed image size with the target size range. For example, if the size of the compressed image is more than twice the upper limit of the target size range, the system can adjust the step size to be twice or four times its original value, so as to converge faster. It should be noted that the relationship between the size of the compressed image and the quantization factor is usually non-linear, so when the size of the compressed image is twice the upper limit, it does not mean that the quantization factor should be doubled. That is why the method in this disclosure adjusts the quantization factor based on a fixed or adaptively changed step size to gradually approach the target size range.
[0031] It should be noted that the present method can be used to iteratively update the same image frame until it falls within the target size range, and / or to update the quantization profile in real time, so that although the first image frame can fall outside the target size range, subsequent image frames can be located within the target size range. For example, subsequent image frames can be compressed using the newly updated quantization profile, and the compressed subsequent image frames can have a size that is within or closer to the target size range.
[0032] In addition, the system can dynamically modify the target size range according to various factors, such as environmental conditions (e.g., light intensity, color, etc.) and / or network conditions of the system (e.g., bandwidth variation, network traffic).
[0033] The present disclosure has at least the following advantages:
[0034] 1. Bandwidth and storage usage efficiency: The system dynamically compresses image data to fit within a predefined size range, which can significantly reduce the bandwidth required to transmit images and the storage space required to save images.
[0035] 2. Ability to adapt to changing conditions: The system can dynamically adjust the target size range to effectively respond to different environmental conditions (e.g., lighting conditions) and network conditions (e.g., bandwidth).
[0036] 3. Real-time processing capability: The system updates the quantization profile in real time, allowing immediate adaptation to changes in image content and transmission requirements.
[0037] Based on the above advantages, this disclosure differs from other image compression methods (such as JPEG) and is suitable for embedded systems with limited processing power, memory, and storage. Of course, this method can also be used on other systems, devices, and platforms, offering highly competitive performance.
[0038] Figure 1 A block diagram of an embedded system 100 according to an embodiment of the present disclosure is shown. (As...) Figure 1 As shown, the embedded system 100 may include a microprocessor 102, a digital logic component 104, an input / output interface 106, a memory 108, a power management circuit 110, and a timer 112. The embedded system 100 may be connected to an external device 114 (e.g., a camera) for capturing real-time image data.
[0039] The microprocessor 102 is an electronic component that serves as a central data processing unit. The microprocessor 102 processes instructions from the firmware or software of the embedded system 100, interacts with other hardware components, and controls the operation of the embedded system 100.
[0040] Digital logic component 104 is a circuit element designed to interpret and generate binary signals. Digital logic component 104 handles specific tasks such as discrete cosine transform (DCT), encoding / decoding, and other operations in dynamic compression processes. As the backbone of data processing operations, digital logic component 104 interprets inputs, executes logic, and generates outputs. In some examples, digital logic component 104 is embedded within microprocessor 102.
[0041] Input / output interface 106 serves as a connection between internal devices (e.g., microprocessor 102, memory 108) and external devices (e.g., external device 114). It facilitates image data transmission between embedded system 100 and external devices and is configured to handle high data throughput, enabling the system to efficiently receive raw image data from the camera and output compressed image data.
[0042] The memory 108 stores raw image data, pre-compressed image files, compressed and / or encoded image files, compression / decompression algorithms, encoding / decoding algorithms, and dynamic quantization profiles. The memory 108 may include volatile and non-volatile components to provide fast access to the data required for real-time processing and to retain necessary information when the system is powered off.
[0043] The power management circuit 110 optimizes energy consumption, which is especially important in portable or remote applications of the embedded system 100. The power management circuit 110 can adjust power usage according to the system's operational needs, which may vary significantly during intensive image processing tasks.
[0044] Timer 112 ensures that specific operations occur within precise time intervals, allowing for efficient pipelined processing of tasks. Furthermore, timer 112 can trigger events or generate interrupts based on predefined intervals, ensuring that the image compression process is timely and synchronized with other system operations.
[0045] External device 114 (typically a camera or image sensor) is essential to the operation of system 100, providing the raw image data required for compression. External device 114 may also include other peripheral devices, such as storage devices or displays, depending on the application scenario.
[0046] It should be noted that the embedded system 100 is for illustrative purposes only and should not limit the scope of this disclosure. Components in the embedded system 100 may be combined, changed, or omitted. Additional components may be included in the embedded system 100. It should also be noted that this disclosure can be adopted by other types of systems (such as tablets, mobile phones, computers, and servers). These applications are also within the scope of this disclosure.
[0047] Figure 2 A schematic diagram illustrating example steps of dividing an original image 202 into image blocks 204 according to an embodiment of the present disclosure is shown. Dividing the image 202 into smaller blocks 204 simplifies the processing of the original image 202 because each divided image block 204 can be processed independently, which can improve the efficiency of subsequent processing steps. For example, different blocks 204 can be assigned to different processing units within the embedded system 100. This parallel processing method allows multiple blocks 204 to be compressed simultaneously, accelerating the overall compression process.
[0048] In some examples, the size of image patch 204 can vary depending on the specific requirements of the compression algorithm and the features of the image being processed. Example sizes for image patch 204 might include 4x4 pixels, 4x8 pixels, 8x8 pixels, 16x16 pixels, and 32x32 pixels. Choosing the right size balances the fineness of compression with computational efficiency. Smaller patches may allow for more detailed compression, but at the cost of increased processing time, while larger patches can be processed faster, but may result in less compressed detail. Image patches 204 may have the same or different sizes.
[0049] In some alternative examples, adaptive block size adjustment can be employed, where the size of image block 204 is dynamically adjusted based on the content of the original image 202. For example, regions of high detail and variability in image 202 may be divided into smaller blocks to maintain image quality after compression, while regions of less detail may be divided into larger blocks to maximize compression efficiency.
[0050] In some other examples, dividing image 202 into blocks 204 can be guided by analyzing the image content within image 202. Techniques such as edge detection or region-based segmentation can be used to determine the boundaries of block 204, ensuring that the division aligns with the natural boundaries of the image content within image 202.
[0051] Figure 3A An example image block 302 according to an embodiment of this disclosure is shown. Image block 302 comprises 8*8 pixels and may correspond to... Figure 2 One of the image blocks 204 is shown. For simplicity, in this example, image block 302 is instantiated as a grayscale image; however, this representation does not limit the scope of this disclosure. In practice, image blocks may contain color data, and the methods discussed in this disclosure can be applied to both grayscale and color images.
[0052] Figure 3B The illustration shows the RGB values 304 of pixels in an example image block according to an embodiment of the present disclosure. For example, each pixel within the image block is represented by an RGB (red, green, blue) value ranging from 0 to 255, where 0 represents no intensity and 255 represents maximum intensity. For example, an RGB value (255, 0, 0) represents bright red, an RGB value (0, 255, 0) represents bright green, an RGB value (0, 0, 255) represents dark blue, an RGB value (0, 0, 0) represents black, and an RGB value (255, 255, 255) represents white. When the values of the red, green, and blue channels are the same (e.g., ...), the pixel's intensity is determined by the RGB values. Figure 3B As shown, pixels are white, gray, or black. In some examples, pixels with higher RGB values in grayscale image block 302 are brighter than pixels with lower RGB values.
[0053] Figure 4A The luminance component level 402 of a pixel in an example image block 302 according to an embodiment of the present disclosure is shown. The luminance component (represented as "Y" in the YCbCr color model) represents the luminance information of the image block 302. The luminance component is crucial for the perception of image details because it reflects the brightness or darkness of a color, where lower values represent darker areas and higher values represent brighter areas. Since the human visual system is more sensitive to changes in brightness than to changes in color, the luminance component is more important than the chrominance components ("Cb" and "Cr").
[0054] Figure 4B The chromaticity component level 404 of a pixel in an example image block 302 according to an embodiment of the present disclosure is shown. The chromaticity components (denoted as 'Cb' for blue difference and 'Cr' for red difference) represent the deviations of the blue and red components relative to luminance, respectively. In the case of a grayscale image, these chromaticity components are typically at a center level of 128, indicating no color deviation.
[0055] In some examples, the initial image frame is captured in RGB values, and a conversion is performed to convert the RGB values to YCbCr values. The conversion can be performed based on the following formula (1): Y′=16+(65.481·R′+128.553·G′+24.966·B′) C B =128+(-37.797·R′-74.203·G′+112.0·B′) C R =128+(112.0·R′-93.786·G′-18.214·B′)
[0056] Where R' represents the red value, G' represents the green value, B' represents the blue value, Y' represents the Y value, and C... B C represents the blue difference chromaticity value. R This represents the red difference chromaticity value. Alternatively, the initial image frame can be captured directly using the YCbCr color model. In some other examples, the initial image frame captured using RGB values may not be converted. Other color models may also be used. These variations are also within the scope of this disclosure.
[0057] In some examples, values in the YCbCr color model can be pre-compressed. Since humans are more sensitive to changes in brightness, the luminance component value 402 might remain unchanged, while the chrominance component value 404 might be compressed. For example, the chrominance component values of a sub-block (e.g., 2x2 pixels) can be averaged to make subsequent compression more efficient and effective.
[0058] Figure 5 The centralized luminance component level 402 of pixels in an example image block according to an embodiment of the present disclosure is shown. The centralized luminance component level 402 involves adjusting the range of original luminance component values 402, such as from 0 to 255, to a new range of luminance component values 502 centered at zero, such as from -128 to 127. This adjustment is achieved by subtracting 128 from each original luminance component value 402.
[0059] By shifting the range of the luminance component value 402 to zero, mathematical operations on these values can be performed more efficiently, especially those involving transformations and optimizations, with better numerical stability.
[0060] In some examples, the centralization process enhances the performance of algorithms that rely on zero-centered symmetry and balance, such as the Discrete Cosine Transform (DCT). The DCT transforms spatial domain data into frequency domain data, benefiting from data that is symmetrically distributed around zero, resulting in better energy compression and more efficient compression.
[0061] Figure 6A frequency-dependent profile 602 of the centralized luminance component level 502 of pixels in an example image block 302 according to an embodiment of the present disclosure is shown. In some examples, the frequency-dependent profile 602 is generated based on a transformation that converts spatial domain data into frequency domain data. This transformation may include, but is not limited to, DCT.
[0062] DCT operates by decomposing an image patch 302 into a sum of cosine functions oscillating at different frequencies. In the resulting frequency-related profile 602, low-frequency components (representing general trends or slow changes in pixel values across the entire image patch) are typically located in the upper left corner of the DCT matrix. Conversely, high-frequency components (capturing subtler details and rapid changes in pixel values) are located in the lower right corner. Because human vision is more sensitive to changes in low-frequency components than to high-frequency components, DCT allows compression algorithms to apply more aggressive compression to high-frequency components without significantly impacting perceived image quality. By reducing precision or even discarding some high-frequency components, significant data reduction can be achieved, thereby improving the efficiency of image storage and transmission.
[0063] Figure 7 An example quantization profile 702 of the luminance component level 502 according to an embodiment of the present disclosure is shown. The quantization profile 702 is used to reduce the number of bits required to store the centralized luminance component level 502, thereby effectively compressing the image block 302 by reducing the precision of the frequency-dependent profile 602.
[0064] Quantization in image compression involves mapping a series of values to a single quantized value. Figure 7 The quantization profile 702 shown includes a quantization factor matrix, which are applied to corresponding values in the frequency-dependent profile 602. These quantization factors are designed to be larger for high-frequency components and smaller for low-frequency components, reflecting the different sensitivities of human vision to different frequencies.
[0065] Figure 8 A quantized image block 802 according to an embodiment of the present disclosure is shown. For example, each value in the frequency correlation profile 602 is divided by the corresponding quantization factor in the quantization profile 702 and rounded to the nearest integer to generate the quantized image block 802.
[0066] Figure 9 This is a schematic diagram illustrating the sawtooth encoding step performed on a quantized image block 802 according to an embodiment of the present disclosure. Sawtooth encoding is a method for further compressing data using the structure of the quantized image block 802. The sawtooth encoding follows the sawtooth pattern of the quantized image block 802, moving from the upper left corner to the lower right corner.
[0067] The purpose of sawtooth coding is to sort the values in the quantized image block 802 in a way that groups the zero values. Since high-frequency components (near the lower right of the matrix) are more likely to be quantized to zero, following the sawtooth pattern ensures that these zeros are grouped, making the data more suitable for subsequent compression steps, such as run-length coding, Huffman coding, or entropy coding.
[0068] In some examples, the values in the jagged image patch 902 can be represented as [-24,-2,0,-2,-1,-3,1,-2,0,-1,0,0,1 ... Additional encoding and / or processing algorithms can also be performed, and these variations are also within the scope of this disclosure.
[0069] Figure 10 An updated quantization profile 1002 for the luminance component level according to an embodiment of this disclosure is shown. In some examples, the size of the compressed image frame 202 may be larger than the upper limit of the target size range. The quantization profile 702 can be updated using the following formula (2) based on a preset step size: Q'=Q(1-T) (2)
[0070] Where Q' represents the updated quantization profile, Q represents the original quantization profile, and T represents the preset step size. The preset step size can be 10%, 20%, 30%, 50%, etc.
[0071] In this example, the preset step size is 50% (0.5), and the quantization profile 702 is updated by multiplying each quantization factor in the quantization profile 702 by (1-0.5).
[0072] Figure 11A quantized image block 1102 generated according to an embodiment of this disclosure based on an updated quantization profile 1002 is shown. Similar to quantized image block 802, each value in the frequency-related profile 602 is divided by the corresponding quantization factor in the updated quantization profile 1002 and rounded to the nearest integer to generate quantized image block 1102. After performing sawtooth coding and run-length coding algorithms on quantized image block 1102, these values can be represented as [-46,-3,0,-4,-2,-5,1,-5,1,-2,0,0,3,0,1,0,0,0,1,(0,6),-1,(0,37)], increasing the size from 17 values to 24 values, thereby increasing the size of the compressed image frame.
[0073] Figure 12 An updated quantization profile 1202 for the luminance component level according to an embodiment of the present disclosure is shown. In some examples, the size of the compressed image frame 202 may be smaller than the lower limit of the target size range. The quantization profile 702 can be updated using the following formula (3) based on a preset step size: Q'=Q(1+T) (3)
[0074] In this example, the preset step size is 50% (0.5). However, the system may determine that the size of the compressed image 202 is significantly smaller than the lower limit of the target size range. Therefore, the preset step size may be adaptively adjusted to 300%. The quantization profile 702 is updated by multiplying each quantization factor in the quantization profile 702 by (1+3).
[0075] Figure 13 A quantized image block 1302 generated according to an embodiment of this disclosure based on an updated quantization profile 1202 is shown. Similar to quantized image block 802, each value in the frequency-related profile 602 is divided by the corresponding quantization factor in the updated quantization profile 1202 and rounded to the nearest integer to generate quantized image block 1302. After performing sawtooth coding and run-length coding algorithms on quantized image block 1302, these values can be represented as [-6,(0,4),-1,0,-1,(0,56)], reducing the size from 17 values to 8 values, thereby reducing the size of the compressed image frame.
[0076] Figure 14This is a flowchart illustrating the operation of an embedded system 100 according to an embodiment of the present disclosure to dynamically compress image frames to a target size range. Method 1400 may be embodied as computer-readable instructions executable by one or more processors, such that the operation of method 1400 may be performed partially or entirely by functional components of the embedded system 100; therefore, method 1400 is described by reference to these components. However, it should be understood that at least some operations of method 1400 may be deployed on various other hardware configurations different from the embedded system 100. Furthermore, operations of method 1400 may be partially omitted or performed in any order.
[0077] In operation 1402, embedded system 100 may acquire an image frame. This image frame may be captured directly from a camera within embedded system 100 or received from an external source. The image frame may initially be in a high-resolution format and needs to be compressed to meet the storage or transmission requirements of embedded system 100. In some examples, the image frame is one of multiple consecutive frames in real-time video communication, such as an image frame captured by a home surveillance system.
[0078] In operation 1404, the embedded system 100 can obtain a quantization profile from the previous iteration. If it is the first iteration, a preliminary quantization profile can be obtained. The quantization profile may include quantization factors that specify how each component of the image frame should be compressed, with a particular focus on reducing the precision of imperceptible high-frequency components to achieve an effective reduction in data size.
[0079] In operation 1406, the embedded system 100 can generate a compressed image frame based on the image frame and a quantization profile. In some examples, operation 1406 may include the following sub-operations:
[0080] RGB to YCbCr conversion: Optionally, if the image frame was originally in RGB format, it can be converted to the YCbCr color space, where Y represents the luminance component (brightness), and Cb and Cr represent the chrominance components (color differences). This conversion is beneficial for compression because it is closer to human visual perception, emphasizing brightness rather than color.
[0081] Discrete Cosine Transform (DCT): This transforms each block of an image from the spatial domain to the frequency domain. DCT helps separate an image into parts that are of different importance to human visual perception.
[0082] Quantization: The frequency domain data for each block can then be quantized using the obtained quantization profile. This step reduces the number of bits required to represent less important information (which typically includes high-frequency components).
[0083] Encoding: Quantized data can be encoded using data compression algorithms such as sawtooth coding, Huffman coding, or run-length encoding (RLE). These methods further reduce data size by eliminating redundancy and efficiently encoding the data.
[0084] In operation 1408, the embedded system 100 can acquire a target size range for image frames. This target size range may be predefined based on application requirements and can vary significantly from a few bytes to several megabytes. This target size range guides the compression process, ensuring that the output meets specific storage or transmission requirements without unduly impacting image quality. The target size range may be adjusted based on the network and environmental conditions of the embedded system 100. For example, the target size range can be reduced at lower bandwidths and increased at higher bandwidths. Another example is that the target size range can be reduced at night and increased during the day.
[0085] In operation 1410, the embedded system 100 may determine the size of the compressed image frame. The size of the compressed image frame may refer here to the code size required to store the compressed image frame. Operation 1410 may include calculating the total amount of data (in bytes or bits) occupied by the compressed image frame.
[0086] In operation 1412, the embedded system 100 can determine whether the size of the compressed image frame is within the target size range. If it is determined that the size of the compressed image frame is within the target size range, method 1400 proceeds to operation 1416; otherwise, method 1400 proceeds to operation 1414.
[0087] In operation 1416, the embedded system 100 can keep the quantization profile unchanged, indicating that the current settings have effectively achieved the desired compression effect.
[0088] In operation 1418, embedded system 100 may output compressed image frames. This output may involve storing the frames for later use, or transmitting them immediately via wireless or wired communication methods as needed by the application. After operation 1418, method 1400 may return to operation 1402 to process new image frames, continuing the cycle of capturing, compressing, and transmitting image data.
[0089] In operation 1414, the embedded system 100 may update the quantization profile based on the difference between the compressed image size and the target range. This may involve adjusting the quantization factor to increase or decrease the compression level, or replacing the quantization profile in the current iteration with a new profile selected from multiple predefined quantization profiles. Details regarding updating the quantization profile in operation 1414 can be found in... Figure 15 It was found in its description.
[0090] Optionally, method 1400 may loop back to operation 1406, reprocessing the same image frame with the updated quantization profile until it falls within the target size range. Alternatively, method 1400 may directly move to operation 1418 to output the compressed image frame, and then return to operation 1402 to obtain a new frame. This approach ensures that even if the first image frame does not meet the target size standard, subsequent frames are more likely to meet it, thus optimizing system performance over time. Another benefit is that no frames are delayed in real-time transmission.
[0091] Figure 15 This is a flowchart illustrating the operations of an embedded system 100 updating a quantization profile according to an embodiment of the present disclosure. Method 1500 may be embodied as computer-readable instructions executable by one or more processors, such that the operations of method 1500 may be performed partially or entirely by functional components of the embedded system 100; therefore, method 1500 is described by reference to these components. However, it should be understood that at least some operations of method 1500 may be deployed on various other hardware configurations different from the embedded system 100. Furthermore, operations of method 1500 may be partially omitted or performed in any order. In some examples, method 1500 may correspond to... Figure 14 Operation 1414 in the middle.
[0092] In operation 1502, the embedded system 100 can determine that the size of the compressed image frame exceeds the target size range. This determination may be based on... Figure 14 The response to operation 1412.
[0093] In operation 1504, embedded system 100 can determine whether it supports dynamic encoding, such as a dynamically scaled quantization profile. This determination may involve checking a configuration bit at a memory address of embedded system 100. If the bit is set to 1, dynamic encoding is enabled or supported; if the bit is set to 0, dynamic encoding is disabled or not supported. If embedded system 100 does not support dynamic encoding, method 1500 proceeds to operation 1506; otherwise, method 1500 proceeds to operation 1510.
[0094] In operation 1506, the embedded system 100 can acquire multiple predefined quantization profiles. These predefined quantization profiles may correspond to different compression levels. The predefined quantization profiles may be ordered according to these different compression levels.
[0095] In operation 1508, the embedded system 100 can select one of multiple predefined quantization profiles as the updated quantization profile. For example, if the compressed image frame size is larger than the upper limit of the target size range, a quantization profile with a higher compression level can be selected to replace the current quantization profile. Similarly, if the compressed image frame size is smaller than the lower limit of the target size range, a quantization profile with a lower compression level can be selected to replace the current quantization profile.
[0096] In operation 1510, the embedded system 100 can determine whether the system supports adaptive step size adjustment. If it does not support it, method 1500 proceeds to operation 1512; otherwise, method 1500 proceeds to operation 1514.
[0097] In operation 1512, the embedded system 100 may update the quantization profile based on a preset fixed step size. In some examples, operation 1512 may include: if the size of the compressed image frame is greater than the upper limit of the target size range, increasing the quantization factor in the quantization profile based on the preset step size; if the size of the compressed image frame is less than the lower limit of the target size range, decreasing the quantization factor in the quantization profile based on the preset step size.
[0098] In operation 1514, the embedded system 100 can adaptively adjust the step size. In some examples, operation 1514 may include: if increasing the quantization factor causes the updated compressed image frame size to exceed the upper limit, but decreasing the quantization factor causes the size to fall below the lower limit (the size of the compressed image fluctuates but never falls within the target size range), then the step size is reduced. The step size may be reduced by 10%, 20%, 30%, 50%, etc.
[0099] Operation 1514 may also include: increasing the step size if the size of the compressed image frame exceeds a preset multiple of the upper limit or is less than a preset fraction of the lower limit. Preset multiples may include 1.5, 2, 3, 5, 10, etc. Preset fractions may include 10%, 20%, 40%, 50%, 70%, etc. The step size may be increased to two times, four times, etc., of the original value.
[0100] Similar to operation 1512, embedded system 100 can update the quantization profile based on the adjusted step size in operation 1516.
[0101] In some examples, the embedded system 100 may offer user interactivity and customization features, allowing users to adjust settings through various interfaces. For example, users can control and modify settings via a mobile application, set preferences during initial setup, or use a dedicated control panel. This adaptability ensures that users can tailor the image compression process to their specific needs, whether by adjusting quantization profiles or selecting different compression algorithms.
[0102] It is important to clarify that the "size" of a compressed image frame is not directly related to its resolution, but rather to its coding rate or compression ratio. Because different components of a compressed image frame are encoded using different amounts of code data, the size of a compressed image frame may differ even at the same resolution. To better understand the technical solution of the present invention, several possible implementations will be described in further detail below. It should be noted that these implementations are merely illustrative examples of the present invention and not limitations thereof. Those skilled in the art can make various modifications or variations to these implementations based on the teachings herein without departing from the scope of the present invention. The implementations described below cover multiple technical features of the present invention, including key steps such as image acquisition, block processing, quantization configuration, compression processing, size evaluation, and dynamic adjustment. Each implementation may include specific implementations of one or more technical features and may combine these features in different ways. Through these diverse implementations, the technical concept of the present invention and its flexibility in practical applications can be fully understood. Example 1 is a method for an image compression system (e.g., an embedded system), comprising: Acquire the first image frame (e.g., read from memory); The first image frame is divided into a set of image blocks, each of which includes a predetermined number of pixels; Obtain a preliminary quantization profile (e.g., read from memory), the preliminary quantization profile including a preliminary quantization factor corresponding to each pixel in the predetermined number of pixels; A first compressed image frame is generated based on the image block set of the first image frame and the preliminary quantization configuration file; Obtain the target size range of the first image frame; Compare the size of the first compressed image frame with the target size range of the first image frame; The preliminary quantization profile is updated based on the comparison result between the size of the first compressed image frame and the target size range of the first image frame; Acquire the second image frame; and A second compressed image frame is generated based on the second image frame and the updated preliminary quantization profile. Example 2 improves upon Example 1, wherein generating the first compressed image frame based on the image patch set of the first image frame and the preliminary quantization profile further includes: Perform a discrete cosine transform (DCT) on each image patch in the image patch set to generate a frequency-dependent image profile; Divide each value in the frequency-related image profile by the corresponding preliminary quantization factor to generate a quantized frequency profile; and The quantized frequency profile is compressed using at least one compression coding algorithm to generate the compressed image frame. Example 3 is an improvement on Example 2, wherein the at least one compression coding algorithm includes at least one of the following: sawtooth coding algorithm, Huffman coding algorithm, or run-length coding (RLE) algorithm. Example 4 is an improvement on any one of Examples 1-3, wherein updating the preliminary quantization profile based on a comparison between the size of the first compressed image frame and the target size range of the first image frame further includes: When the comparison result indicates that the size of the compressed image frame is greater than the upper limit of the target size range, each initial quantization factor is increased based on a preset step size; or When the comparison results indicate that the size of the compressed image frame is less than the lower limit of the target size range, each preliminary quantization factor is reduced based on the preset step size. Example 5 is an improvement on Example 4, and includes the following: When the comparison results indicate that the size of the compressed image frame is less than the lower limit, but increasing each initial quantization factor would cause the size of the updated compressed image frame to be greater than the upper limit, the step size is reduced; or... When the comparison results indicate that the size of the compressed image frame is greater than the upper limit, but reducing each initial quantization factor would cause the size of the updated compressed image frame to be less than the lower limit, the step size is reduced. Example 6 is an improvement on Example 4 or 5, and includes the following: Determine that the size of the compressed image frame exceeds the upper limit by a preset multiple or falls below the lower limit by a preset fraction; and Increase the step size. Example 7 is an improvement on any one of Examples 1-3, wherein updating the preliminary quantization profile based on a comparison between the size of the compressed image frame and the target size range includes: When the size of the compressed image frame is determined to be within the target size range, the initial quantization profile remains unchanged. Example 8 is an improvement on any one of Examples 1-3, wherein updating the preliminary quantization profile based on a comparison between the size of the compressed image frame and the target size range includes: Select one quantization profile from a number of predefined quantization profiles. Example 9 is an improvement on any one of Examples 1-8, and also includes: The target size range of the first image frame is dynamically adjusted based on the environmental conditions of the system. Example 10 is an improvement on any one of Examples 1-9, and also includes: The target size range of the first image frame is dynamically adjusted based on the network conditions of the system. Example 11 is a system (e.g., an embedded system) that includes: Processor; and Non-transitory memory that stores instructions that, when executed by the processor, cause the system to: Obtain the first image frame; The first image frame is divided into a set of image blocks, each of which includes a predetermined number of pixels; Obtain a preliminary quantization profile, which includes a preliminary quantization factor corresponding to each pixel in the predetermined number of pixels; A first compressed image frame is generated based on the image block set of the first image frame and the preliminary quantization configuration file; Obtain the target size range of the first image frame; Compare the size of the first compressed image frame with the target size range of the first image frame; The preliminary quantization profile is updated based on the comparison result between the size of the first compressed image frame and the target size range of the first image frame; Acquire the second image frame; and A second compressed image frame is generated based on the second image frame and the updated preliminary quantization profile. Example 12 is an improvement on Example 11, wherein, in order to generate the first compressed image frame, the instructions cause the system to: Perform a discrete cosine transform (DCT) on each image patch in the image patch set to generate a frequency-dependent image profile; Divide each value in the frequency-related image profile by the corresponding preliminary quantization factor to generate a quantized frequency profile; and The quantized frequency profile is compressed using at least one compression coding algorithm to generate the compressed image frame. Example 13 is an improvement on Example 11 or 12, wherein, in order to update the initial quantization configuration file, the instructions cause the system to: When the comparison result indicates that the size of the compressed image frame is greater than the upper limit of the target size range, each initial quantization factor is increased based on a preset step size; or When the comparison results indicate that the size of the compressed image frame is less than the lower limit of the target size range, each preliminary quantization factor is reduced based on the preset step size. Example 14 is an improvement on Example 13, wherein the instructions further enable the system to: When the comparison results indicate that the size of the compressed image frame is less than the lower limit, but increasing each initial quantization factor would cause the size of the updated compressed image frame to be greater than the upper limit, the step size is reduced; or... When the comparison results indicate that the size of the compressed image frame is greater than the upper limit, but reducing each initial quantization factor would cause the size of the updated compressed image frame to be less than the lower limit, the step size is reduced. Example 15 is an improvement on Example 13 or 14, wherein the instructions further enable the system to: Determine that the size of the compressed image frame exceeds the upper limit by a preset multiple or falls below the lower limit by a preset fraction; and Increase the step size. Example 16 is an improvement on Example 11 or 12, wherein, in order to update the initial quantization configuration file, the instructions cause the system to: When the size of the compressed image frame is determined to be within the target size range, the initial quantization profile remains unchanged. Example 17 is an improvement on Example 11 or 12, wherein, in order to update the initial quantization configuration file, the instructions cause the system to: Select one quantization profile from a number of predefined quantization profiles. Example 18 is an improvement on any one of Examples 11-17, wherein the instructions further enable the system to: The target size range of the first image frame is dynamically adjusted based on the environmental conditions of the system. Example 19 is an improvement on any one of Examples 11-18, wherein the instructions further enable the system to: The target size range of the first image frame is dynamically adjusted based on the network conditions of the system. Example 20 is a non-transitory computer-readable storage medium, wherein the computer-readable storage medium includes instructions that, when executed by a system, cause the system to: Obtain the first image frame; The first image frame is divided into a set of image blocks, each of which includes a predetermined number of pixels; Obtain a preliminary quantization profile, which includes a preliminary quantization factor corresponding to each pixel in the predetermined number of pixels; A first compressed image frame is generated based on the image block set of the first image frame and the preliminary quantization configuration file; Obtain the target size range of the first image frame; Compare the size of the first compressed image frame with the target size range of the first image frame; The preliminary quantization profile is updated based on the comparison result between the size of the first compressed image frame and the target size range of the first image frame; Acquire the second image frame; and A second compressed image frame is generated based on the second image frame and the updated preliminary quantization profile. in conclusion
[0103] This disclosure provides a system and method for dynamically compressing image data to fit a preset size range. After acquiring an image frame and dividing it into a set of smaller image blocks, the system compresses the image frame based on a quantization profile. After compression, the size of the compressed image frame is compared with the preset size range, and the quantization profile is updated based on the comparison result. When a new image frame is acquired, the updated quantization profile is used to compress the new image frame, ensuring that the size of the compressed new image frame falls within or is close to the boundary limit of the preset size range.
[0104] This disclosure may have at least the following advantages: 1. Bandwidth and storage efficiency: The system dynamically compresses image data to fit a predefined size range, which can significantly reduce the bandwidth required for image transmission and the storage space required for image preservation. 2. Ability to adapt to changing conditions: The system can dynamically adjust the target size range to effectively respond to different environmental and network conditions. 3. Real-time processing capability: The system updates the quantization profile in real time, allowing immediate adaptation to changes in image content and transmission requirements. Based on the above advantages, this disclosure differs from other image compression methods (e.g., JPEG) and is suitable for embedded systems with limited processing power, memory, and storage. This method can also be used in other systems, devices, and platforms with highly competitive performance.
Claims
1. A method for an image compression system, characterized in that, include: Obtain the first image frame; The first image frame is divided into a set of image blocks, each of which includes a predetermined number of pixels; Obtain a preliminary quantization profile, which includes a preliminary quantization factor corresponding to each pixel in the predetermined number of pixels; A first compressed image frame is generated based on the image block set of the first image frame and the preliminary quantization configuration file; Obtain the target size range of the first image frame; Compare the size of the first compressed image frame with the target size range of the first image frame; The preliminary quantization profile is updated based on the comparison result between the size of the first compressed image frame and the target size range of the first image frame; Obtain the second image frame; as well as A second compressed image frame is generated based on the second image frame and the updated preliminary quantization profile.
2. The method according to claim 1, characterized in that, The process of generating the first compressed image frame based on the image block set of the first image frame and the preliminary quantization configuration file further includes: Perform a discrete cosine transform (DCT) on each image patch in the image patch set to generate a frequency-dependent image profile; Divide each value in the frequency-related image profile by the corresponding preliminary quantization factor to generate a quantized frequency profile; and The quantized frequency profile is compressed using at least one compression coding algorithm to generate the compressed image frame.
3. The method according to claim 2, characterized in that, The at least one compression coding algorithm includes at least one of the following: sawtooth coding algorithm, Huffman coding algorithm, or run-length coding (RLE) algorithm.
4. The method according to claim 1, characterized in that, The step of updating the preliminary quantization profile based on the comparison result between the size of the first compressed image frame and the target size range of the first image frame further includes: When the comparison result indicates that the size of the compressed image frame is greater than the upper limit of the target size range, each initial quantization factor is increased based on a preset step size; or When the comparison results indicate that the size of the compressed image frame is less than the lower limit of the target size range, each preliminary quantization factor is reduced based on the preset step size.
5. The method according to claim 4, characterized in that, Also includes: When the comparison results indicate that the size of the compressed image frame is less than the lower limit, but increasing each initial quantization factor would cause the size of the updated compressed image frame to be greater than the upper limit, the step size is reduced. or When the comparison results indicate that the size of the compressed image frame is greater than the upper limit, but reducing each initial quantization factor would cause the size of the updated compressed image frame to be less than the lower limit, the step size is reduced.
6. The method according to claim 4, characterized in that, Also includes: Determine that the size of the compressed image frame exceeds the upper limit by a preset multiple or falls below the lower limit by a preset fraction; as well as Increase the step size.
7. The method according to claim 1, characterized in that, Updating the preliminary quantization profile based on the comparison result between the size of the compressed image frame and the target size range includes: When the size of the compressed image frame is determined to be within the target size range, the initial quantization profile remains unchanged.
8. The method according to claim 1, characterized in that, Updating the preliminary quantization profile based on the comparison result between the size of the compressed image frame and the target size range includes: Select one quantization profile from a number of predefined quantization profiles.
9. The method according to claim 1, characterized in that, Also includes: The target size range of the first image frame is dynamically adjusted based on the environmental conditions of the system.
10. The method according to claim 1, characterized in that, Also includes: The target size range of the first image frame is dynamically adjusted based on the network conditions of the system.
11. A system, characterized in that, include: processor; as well as Non-transitory memory that stores instructions that, when executed by the processor, cause the system to: Obtain the first image frame; The first image frame is divided into a set of image blocks, each of which includes a predetermined number of pixels; Obtain a preliminary quantization profile, which includes a preliminary quantization factor corresponding to each pixel in the predetermined number of pixels; A first compressed image frame is generated based on the image block set of the first image frame and the preliminary quantization configuration file; Obtain the target size range of the first image frame; Compare the size of the first compressed image frame with the target size range of the first image frame; The preliminary quantization profile is updated based on the comparison result between the size of the first compressed image frame and the target size range of the first image frame; Obtain the second image frame; as well as A second compressed image frame is generated based on the second image frame and the updated preliminary quantization profile.
12. The system according to claim 11, characterized in that, To generate the first compressed image frame, the instruction causes the system to: Perform a discrete cosine transform (DCT) on each image patch in the image patch set to generate a frequency-dependent image profile; Divide each value in the frequency-related image profile by the corresponding preliminary quantization factor to generate a quantized frequency profile. as well as The quantized frequency profile is compressed using at least one compression coding algorithm to generate the compressed image frame.
13. The system according to claim 11, characterized in that, In order to update the initial quantization configuration file, the instruction causes the system to: When the comparison result shows that the size of the compressed image frame is greater than the upper limit of the target size range, each preliminary quantization factor is increased based on a preset step size; or When the comparison results indicate that the size of the compressed image frame is less than the lower limit of the target size range, each preliminary quantization factor is reduced based on the preset step size.
14. The system according to claim 13, characterized in that, The instructions also cause the system to: When the comparison results indicate that the size of the compressed image frame is less than the lower limit, but increasing each initial quantization factor would cause the size of the updated compressed image frame to be greater than the upper limit, the step size is reduced. or When the comparison results indicate that the size of the compressed image frame is greater than the upper limit, but reducing each initial quantization factor would cause the size of the updated compressed image frame to be less than the lower limit, the step size is reduced.
15. The system according to claim 13, characterized in that, The instructions also cause the system to: Determine that the size of the compressed image frame exceeds the upper limit by a preset multiple or falls below the lower limit by a preset fraction; and Increase the step size.
16. The system according to claim 11, characterized in that, In order to update the initial quantization configuration file, the instruction causes the system to: When the size of the compressed image frame is determined to be within the target size range, the initial quantization profile remains unchanged.
17. The system according to claim 11, characterized in that, In order to update the initial quantization configuration file, the instruction causes the system to: Select one quantization profile from a number of predefined quantization profiles.
18. The system according to claim 11, characterized in that, The instructions also cause the system to: The target size range of the first image frame is dynamically adjusted based on the environmental conditions of the system.
19. The system according to claim 13, characterized in that, The instructions also cause the system to: The target size range of the first image frame is dynamically adjusted based on the network conditions of the system.
20. A non-transitory computer-readable storage medium, characterized in that, The computer-readable storage medium includes instructions that, when executed by the system, cause the system to: Obtain the first image frame; The first image frame is divided into a set of image blocks, each of which includes a predetermined number of pixels; Obtain a preliminary quantization profile, which includes a preliminary quantization factor corresponding to each pixel in the predetermined number of pixels; A first compressed image frame is generated based on the image block set of the first image frame and the preliminary quantization configuration file; Obtain the target size range of the first image frame; Compare the size of the first compressed image frame with the target size range of the first image frame; The preliminary quantization profile is updated based on the comparison result between the size of the first compressed image frame and the target size range of the first image frame; Obtain the second image frame; as well as A second compressed image frame is generated based on the second image frame and the updated preliminary quantization profile.