Image compression method and device

By dividing the image into small pieces and extracting feature data to generate compressed data, the problem of high computational complexity of existing image compression methods is solved, and efficient image compression effect is achieved.

CN115379219BActive Publication Date: 2025-02-18VAN GOMO ELECTRONICS(SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210994510.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-18
Publication Date
2025-02-18
Estimated Expiration
2042-08-18

AI Technical Summary

Technical Problem

The existing image compression method uses larger pixel blocks, resulting in high computational complexity and is difficult to apply to low-complexity and low-power hardware devices.

Method used

The original image is divided into multiple set size image blocks, the shape feature data and range feature data of each image block are extracted, the feature extraction error is calculated, the feature type and key feature data are determined based on the error, and the compressed data of the image block is generated.

Benefits of technology

It improves the effect of image compression, approaches the lossless image quality of human vision, reduces the computational complexity of compressed images, and simplifies hardware design difficulty and power consumption requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115379219B_ABST
    Figure CN115379219B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for image compression, and relates to the fields of computer technology, chip design, and graphic image display. A specific implementation of the method includes: dividing an original image into multiple image blocks of set sizes, extracting shape feature data and range feature data from each image block, and calculating feature extraction errors of the shape feature data and range feature data, determining the selected feature type according to the feature extraction error, and determining the corresponding key feature data; further generating compressed data of the image block based on the key feature data; an embodiment of the present invention determines key feature data from multiple types of feature data extracted for an image block, and then generates compressed data; improves the compression effect of the compressed image, achieves lossless image quality close to human visual perception, reduces the computational complexity of the compressed image, and thus reduces the difficulty of hardware design and power consumption requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of computer technology, chip design, and graphic image display, and in particular to a method and device for image compression. Background Art

[0002] With the popularization of Internet applications, more and more applications involve image processing, image transmission and other services, which usually require image compression to save network resources and computing resources.

[0003] Existing image compression methods, such as the JPEG algorithm, use larger pixel blocks (for example, 16x16, 8x8, etc.) for discrete cosine transform. The large pixel block size and compression ratio lead to high computational complexity, which increases the requirements for computing resources of image processing devices and makes it difficult to apply to low-complexity, low-power hardware devices. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a method and device for image compression, which can divide an original image into multiple image blocks of set sizes, extract shape feature data and range feature data from each image block, and calculate feature extraction errors of the shape feature data and the range feature data, determine the selected feature type according to the feature extraction error, and determine the corresponding key feature data; further generate compressed data of the image block based on the key feature data; an embodiment of the present invention determines key feature data from multiple types of feature data extracted for an image block, and then generates compressed data; improves the compression effect of the compressed image, achieves lossless image quality close to human eye vision, reduces the computational complexity of the compressed image, and thus reduces the difficulty of hardware design and power consumption requirements.

[0005] To achieve the above object, according to one aspect of an embodiment of the present invention, there is provided an image compression method, characterized in that it includes: determining first pixel information of one or more image blocks of a set size in an original image, wherein the pixel information includes three types of pixel channel information;

[0006] For the first pixel information of each of the image blocks, perform steps N1 to N4:

[0007] N1: extracting shape feature data and range feature data corresponding to each type of pixel channel information from the first pixel information;

[0008] N2: calculating a first shape feature error of the shape feature data and a first range feature error of the range feature data respectively according to the shape feature data and the range feature data of the three pixel channel information;

[0009] N3: According to the calculation result, select key feature data from the shape feature data and the range feature data of the three types of pixel channel information;

[0010] N4: Based on the key feature data and the feature code of the feature type to which it belongs, determine the reference pixel from the key feature data, and generate one or more errors of other pixels corresponding to the reference pixel; generate compressed image data of the image block by quantizing and encoding the reference pixel and the error; and generate a compressed image of the original image based on the compressed image data.

[0011] Optionally, the image compression method further includes: for each first pixel information of the image block, dividing the pixel information into second pixel information corresponding to at least two image sub-blocks; extracting shape feature data and range feature data corresponding to each type of pixel channel information from the first pixel information includes: respectively extracting shape feature data and range feature data corresponding to each type of pixel channel information from the second pixel information corresponding to each sub-image block.

[0012] Optionally, respectively calculating the first shape feature error of the shape feature data and the first range feature error of the range feature data includes: respectively calculating the second shape feature error and the second range feature error of the second pixel information according to the shape feature data and the range feature data of each type of pixel channel information extracted from the second pixel information; calculating the first shape feature error according to the second shape feature error of the second pixel information corresponding to each of the sub-image blocks; and calculating the first range feature error according to the second range feature error of the second pixel information corresponding to each of the sub-image blocks.

[0013] Optionally, the step N3 includes: determining, based on the first shape feature error and the first range feature error, feature data corresponding to a feature type with a minimum error value as key feature data.

[0014] Optionally, the step N4 includes: combining key feature data of each of the second pixel information and a feature code of a feature type to which the key feature data belongs, to generate compressed image data.

[0015] Optionally, the extracting the shape feature data corresponding to each type of the pixel channel information includes: for each type of the pixel channel information, performing the following steps A1 to A3:

[0016] A1: extracting the initial shape feature data of the pixel channel information from the second pixel information; A2: calculating the pixel channel edge strength corresponding to each of the basic shapes based on the initial shape feature data of the pixel channel information and a plurality of preset basic shapes; A3: selecting a target shape for the pixel channel information from the plurality of basic shapes based on the pixel channel edge strength corresponding to each of the basic shapes; determining the second shape feature data based on the target shape of each of the pixel channel information, the preset feature calculation strategy of the target shape, and the initial shape feature data of each of the pixel channel information.

[0017] Optionally, the extracting of range characteristic data corresponding to each type of the pixel channel information includes: extracting brightness characteristic data of each type of the pixel channel information; and determining brightness range data of each type of the pixel channel information based on the brightness characteristic data of three types of the pixel channel information and a brightness calculation strategy.

[0018] Optionally, the brightness calculation strategy includes: calculating the maximum brightness and the minimum brightness based on the brightness characteristic data of the three types of pixel channel information; dividing the first brightness range formed by the maximum brightness and the minimum brightness into multiple second brightness ranges; for each type of pixel channel information, performing the following operations: determining the target second brightness range to which the brightness characteristic data of the pixel channel information belongs; and calculating the brightness range data of the pixel channel information based on the target second brightness range and its corresponding calculation strategy.

[0019] Optionally, the calculation of the second shape feature error of the second pixel information includes: based on a preset shape error calculation strategy, calculating the first shape error value between the shape feature data of each pixel channel information of the second pixel information and the second pixel information; and calculating the second shape feature error in combination with the first shape error value of each pixel channel information of the second pixel information.

[0020] Optionally, calculating the second range characteristic error of the second pixel information includes: for each type of pixel channel information of the second pixel information, according to a preset range error calculation strategy, and the second brightness range to which each type of pixel channel information of the second pixel information belongs, the maximum brightness value and the minimum brightness value of the second brightness range, calculating the brightness characteristic value of each type of pixel channel information; based on the brightness characteristic value of each type of pixel channel information and the second pixel information, calculating the first brightness error of each type of pixel channel information; and calculating the second range characteristic error of the second pixel information based on the first brightness error of each type of pixel channel information included in the second pixel information.

[0021] Optionally, the feature data corresponding to the feature type with the smallest error value is determined as key feature data, including: calculating the shape feature reference error of the image block based on the first shape feature errors of multiple second pixel information; calculating the range feature reference error of the image block based on the first range feature errors of multiple second pixel information; selecting the feature data corresponding to the feature type with the smallest value from the shape feature reference error and the range feature reference error as the key feature data of the image block; wherein the feature data is the shape feature data or the range feature data.

[0022] Optionally, generating compressed image data includes: converting the key feature data into feature quantification data; and generating compressed image data based on a feature code of a feature type to which the key feature data belongs and the feature quantification data.

[0023] Optionally, converting the key feature data into feature quantization data includes: extracting quantitative features from the key feature data; and searching for a target quantization strategy that matches the quantitative features from a plurality of preset quantization strategies; and using the target quantization strategy to perform a quantization encoding operation on the key feature pixels to obtain the feature quantization data.

[0024] Optionally, searching for a target quantization strategy that matches the quantization feature from a plurality of preset quantization strategies includes: comparing the quantization feature with the limiting conditions of a plurality of preset quantization strategies respectively; determining the target limiting conditions satisfied by the quantization feature based on the comparison result; and determining the quantization strategy of the target limiting conditions as the target quantization strategy.

[0025] Optionally, determining the pixel information of one or more image blocks of a set size in the original image includes: receiving a data stream of any image block of a set size belonging to the original image, and extracting pixel information from the data stream; or, dividing the original image into multiple image blocks of a set size, and extracting pixel information from the image blocks.

[0026] Optionally, the image compression method further includes: directly generating a compressed image of the original image using the processed multiple compressed image data corresponding to the original image; or, sending the compressed image data to other processing modules so that the other processing modules generate a compressed image of the original image using the received multiple compressed image data corresponding to the original image.

[0027] Optionally, the image compression method may be applied to a chip.

[0028] To achieve the above object, according to a second aspect of an embodiment of the present invention, there is provided an image compression device, characterized in that it comprises: an image processing module and an image compression module; wherein:

[0029] The image processing module is used to determine first pixel information of one or more image blocks of a set size in the original image, wherein the pixel information includes three types of pixel channel information;

[0030] The compressed image module is used to execute steps N1-N4 for the first pixel information of each image block: N1: extracting shape feature data and range feature data corresponding to each type of pixel channel information from the first pixel information; N2: calculating the first shape feature error of the shape feature data and the first range feature error of the range feature data respectively according to the shape feature data and range feature data of the three types of pixel channel information; N3: selecting key feature data from the shape feature data and the range feature data of the three types of pixel channel information according to the calculation results; N4: determining a reference pixel from the key feature data based on the key feature data and the feature code of the feature type to which it belongs, and generating one or more errors of other pixels corresponding to the reference pixel; generating compressed image data of the image block by quantizing and encoding the reference pixel and the error; and generating a compressed image of the original image based on the compressed image data.

[0031] Furthermore, the image compression device is used to execute any of the above-mentioned image compression methods.

[0032] To achieve the above-mentioned purpose, according to the third aspect of an embodiment of the present invention, there is provided an electronic device for image compression, characterized in that it comprises: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement any of the methods described in the above-mentioned image compression methods.

[0033] To achieve the above-mentioned purpose, according to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, characterized in that when the program is executed by a processor, a method as described in any one of the above-mentioned image compression methods is implemented.

[0034] An embodiment of the above invention has the following advantages or beneficial effects: it can divide the original image into multiple image blocks of set sizes, extract shape feature data and range feature data from each image block, and calculate the feature extraction error of the shape feature data and the range feature data, determine the selected feature type according to the feature extraction error, and determine the corresponding key feature data; further generate compressed data of the image block based on the key feature data; an embodiment of the present invention generates compressed data by determining the key feature data from the extracted multiple types of feature data for each image block; improves the compression effect of the compressed image, reduces the computational complexity of the compressed image, and thus reduces the difficulty of hardware design and power consumption requirements.

[0035] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0037] Figure 1 is a flowchart of an image compression method provided by an embodiment of the present invention;

[0038] Figure 2 is a flow chart of a method for compressing an image block provided by an embodiment of the present invention;

[0039] Figure 3 is a flow chart of a method for compressing multiple sub-image blocks provided by an embodiment of the present invention;

[0040] Figure 4 is a structural schematic diagram of an image compression device provided by an embodiment of the present invention;

[0041] Figure 5 is a schematic diagram of the structure of image block compression data provided by an embodiment of the present invention;

[0042] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0043] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention;

[0044] Figure 8 is a schematic diagram of the structure of a chip using an image compression method provided by an embodiment of the present invention;

[0045] Fig. 9 It is a schematic diagram of the structure of a chip using an image compression method provided by another embodiment of the present invention. DETAILED DESCRIPTION

[0046] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0047] like Figure 1 As shown, an embodiment of the present invention provides a method for image compression, which may include the following steps:

[0048] Step S101: determining first pixel information of one or more image blocks of a set size in an original image, wherein the pixel information includes three types of pixel channel information.

[0049] Specifically, in response to a trigger condition of receiving a compressed image (ie, the original image); wherein the trigger condition may be generated in application scenarios such as receiving an image acquisition request, a page browsing request, an image transmission request, etc.

[0050] Furthermore, after monitoring that the triggering conditions for compressing the image are met, the received original image is divided into one or more image blocks of a set size; wherein, in one embodiment of the present invention, the set size is 2×4; that is, the image block of the set size includes a 2×4 pixel area.

[0051] Further, the first pixel information of the image block is determined, and the pixel information includes three pixel channel information; wherein the three pixel channel information may be RGB three pixel channel information, respectively representing three pixel channels of red (R), green (G), and blue (B). Still taking the pixel information of the image block with a size of 2×4 (i.e., the first pixel information) as an example, the data amount of each pixel channel information is 8 bits, and the data amount of the image block is 192 bits, wherein 192=2×4×3×8.

[0052] Furthermore, there are two methods for determining the first pixel information of one or more image blocks of a set size in the original image, that is, obtaining the first pixel information: the first method: receiving a data stream of any image block of a set size belonging to the original image, and extracting pixel information from the data stream; specifically, in this method, the process of receiving the data stream, extracting pixel information, and compressing the data can be only for the received data stream, and the processing result is output after processing; similarly, the next data stream is received for processing; it can be understood that this method only processes the data stream of one image block, reduces the memory occupancy rate, reduces the computational complexity of the compressed image, and thus improves the efficiency of the compressed image; it is particularly suitable for devices with limited computing resources and memory (such as chips, etc.); and since the processing steps of the data streams of multiple image blocks are independent of each other, the processing steps of multiple image blocks can be executed concurrently, further improving the efficiency of the compressed image.

[0053] The second method is to divide the original image into multiple image blocks of a set size and extract pixel information from the image blocks. Specifically, by dividing the original image into multiple image blocks of a set size (for example, 2×4) and performing fixed-ratio compression, the problem of high computational complexity and difficulty in applying to low-complexity, low-power hardware devices caused by large-size image blocks in the prior art is overcome. Preferably, when the pixel area of ​​the original image does not meet the set size after being divided into one or more image blocks, the original image can be expanded to generate image blocks of the set size; thereby, the entire original image can be covered by each image block to maintain the integrity and accuracy of the compressed image of the original image.

[0054] That is, determining the pixel information of one or more image blocks of a set size in the original image includes: receiving a data stream of any image block of a set size belonging to the original image, and extracting pixel information from the data stream; or, dividing the original image into multiple image blocks of a set size, and extracting pixel information from the image blocks.

[0055] Step S102: Execute steps N1 to N4 for the first pixel information of each image block, so as to generate a compressed image of the original image based on the compressed image data of each image block.

[0056] Specifically, the description of executing steps N1 to N4 for the pixel information (ie, the first pixel information) contained in each image block of a set size is consistent with the description of steps S201 to S204, and will not be repeated here.

[0057] In one embodiment of the present invention, the compression rate of the compressed image relative to the original image is 1 / 3. For example, the data volume of the image block is 192 bits, and the data volume of the compressed image processed by the image compression method of the present invention is 64 bits. That is, the compression rate of the compressed image relative to the original image is 1 / 3.

[0058] Further, based on the compressed image data of each image block, a compressed image of the original image is generated; wherein, there are two methods for generating the compressed image of the original image:

[0059] The first method: directly generate a compressed image of the original image using the processed multiple compressed image data corresponding to the original image. Specifically, after compressing each image block divided from the original image, the compressed data of each image block is obtained, and splicing, integration and other operations are performed based on the compressed data of each image block to generate a compressed image of the original image; it can be understood that the compression rate of each image block is 1 / 3.

[0060] The second method is to send the compressed image data to other processing modules so that the other processing modules can generate a compressed image of the original image using the received multiple compressed image data corresponding to the original image. Specifically, for example, when receiving a data stream of any set size image block belonging to the original image, extracting pixel information from the data stream and processing it, the result of the compression processing is sent to other processing modules, wherein the other processing modules are processing modules including storage and computing capabilities, and can perform operations such as splicing and integration on the compressed data of each image block received to generate a compressed image of the original image.

[0061] That is, the compressed image of the original image is directly generated by using the processed multiple compressed image data corresponding to the original image; or, the compressed image data is sent to other processing modules, so that the other processing modules use the received multiple compressed image data corresponding to the original image to generate a compressed image of the original image.

[0062] In one embodiment of the present invention, the image compression method can be applied to a chip. Among them, other processing modules can belong to the same chip as the module for processing images (such as Figure 8 ), or belong to different chips (such as Fig. 9 shown).

[0063] Figure 8A schematic structural diagram of a chip 800 for providing an image compression method according to an embodiment of the present invention is shown; the chip includes: an image compression device 801 (for example, a module for processing image compression) and other processing modules 802; the image compression device 801 and other processing modules 802 belong to the same chip; wherein the image compression device 801 receives an original image to be processed (for example, an image block data stream, or an original image), performs image compression steps, and sends the generated compressed image data to other processing modules 802 in the chip; the other processing modules 802 can generate a compressed image of the original image based on a plurality of the compressed image data; or send the compressed image to a storage module, etc.

[0064] Fig. 9 The structure diagram of a chip 900 for providing an image compression method according to an embodiment of the present invention is shown; it includes: an image compression device 901; and other processing modules 902 belonging to other chips; wherein the image compression device 901 receives an original image to be processed (such as an image block data stream, or an original image), performs image compression steps, and sends the generated compressed image data to other processing modules 902 outside the chip; other processing modules 902 can generate a compressed image of the original image based on a plurality of the compressed image data; or send it to a storage module, etc.

[0065] In one embodiment of the present invention, an image compression method can be applied to a chip, by extracting shape feature data and range feature data from each image block, and calculating feature extraction errors of the shape feature data and the range feature data, determining the selected feature type based on the feature extraction error, and determining the corresponding key feature data; further generating compressed data of the image block based on the key feature data; improving the compression effect of the compressed image, reducing the computational complexity of the compressed image, and when applied to a chip, reducing the difficulty of the chip's hardware design and the power consumption requirements for the chip.

[0066] like Figure 2 As shown, an embodiment of the present invention provides a method for compressing an image block, and the method may include the following steps:

[0067] For each image block, the following steps are performed: Step S201: extracting shape feature data and range feature data corresponding to each type of pixel channel information from the first pixel information;

[0068] Specifically, from the first pixel information of each image block, the shape feature data and range feature data of RGB corresponding to each pixel information are extracted.

[0069] Among them, the shape feature data is associated with the shape features composed of multiple pixels contained in the image block, such as horizontal lines, vertical lines, oblique lines, corner lines, etc., and the range feature data is associated with the range features displayed by multiple pixels contained in the image block (for example: brightness range, etc.).

[0070] Furthermore, for each image block of a set size, an operation of dividing the image block into at least two sub-image blocks is performed, for example: dividing an image block of a set size of 2×4 into two sub-image blocks; the size of each sub-image block is 2×2; that is, for each first pixel information of the image block, the pixel information is divided into second pixel information corresponding to at least two image sub-blocks, and shape feature data and range feature data corresponding to each pixel channel information are extracted from the second pixel information. By further dividing the image block of a set size into at least two sub-image blocks, the computational complexity of the compressed image is further reduced, the feature extraction of at least two sub-image blocks is performed separately, and the feature error of each sub-image block in at least two sub-image blocks is used to determine the feature error of the image block of a set size, thereby improving the accuracy of extracting features of the compressed image block of a set size, thereby improving the accuracy and compression effect of the compressed image.

[0071] That is, for each of the first pixel information of the image block, the pixel information is divided into second pixel information corresponding to at least two image sub-blocks; the shape feature data and range feature data corresponding to each type of pixel channel information are extracted from the first pixel information, including: respectively extracting the shape feature data and range feature data corresponding to each type of pixel channel information from the second pixel information corresponding to each of the sub-image blocks.

[0072] The specific description of extracting the shape feature data and range feature data corresponding to each type of pixel channel information is consistent with the description of step S301 and will not be repeated here.

[0073] Step S202: Calculate a first shape feature error of the shape feature data and a first range feature error of the range feature data respectively according to the shape feature data and the range feature data of the three pixel channel information.

[0074] Specifically, there are two methods for calculating the first shape feature error of the shape feature data and the first range feature error of the range feature data:

[0075] The first method: for any one of the three types of pixel channel information (for example, RGB channels), respectively calculate the shape feature error of the shape feature data of the pixel channel information and the range feature error of the range feature data; after respectively calculating the shape feature error and the range feature error for the three types of pixel channel information, integrate the calculation results to form the first shape feature error of the shape feature data and the first range feature error of the range feature data of the image block.

[0076] The second method: calculate the shape feature error of the shape feature data of three pixel channel information (such as RGB channels), and integrate them into the first shape feature error; calculate the range feature error of the range feature data of three pixel channel information (such as RGB channels), and integrate them into the first range feature error.

[0077] That is, the respectively calculating the first shape feature error of the shape feature data and the first range feature error of the range feature data comprises: respectively calculating the second shape feature error and the second range feature error of the second pixel information according to the shape feature data and the range feature data of each kind of the pixel channel information extracted from the second pixel information; calculating the first shape feature error according to the second shape feature error of the second pixel information corresponding to each of the sub-image blocks; and calculating the first range feature error according to the second range feature error of the second pixel information corresponding to each of the sub-image blocks.

[0078] The specific description of calculating the shape feature error and the shape feature error is consistent with the description of step S302 and will not be repeated here.

[0079] Step S203: selecting key feature data from the shape feature data and the range feature data of the three types of pixel channel information according to the calculation result;

[0080] Specifically, based on the first shape feature error of the calculated shape feature data and the first range feature error of the range feature data described in step S202, determining the key feature data is to select the shape feature data or the range feature data.

[0081] Among them, there are three methods to determine the feature type corresponding to the key feature data:

[0082] The first method: calculate the difference between the first shape feature error and the first range feature error, determine whether the difference is within a set threshold range (for example: the set threshold range is smaller), and if so, select a predefined feature type (one of the shape feature or range feature).

[0083] The second method: determine whether the first shape feature error or the first range feature error is within a preset error range. If so, select a predefined feature type (one of the shape feature or the range feature). Otherwise, select a feature type within the preset error range.

[0084] The third method: select the one with the smaller error value from the first shape feature error and the first range feature error as the feature type; that is, based on the first shape feature error and the first range feature error, determine the feature data corresponding to the feature type with the smallest error value as the key feature data.

[0085] Further, after the feature type is determined, feature data (shape feature data or range feature data) corresponding to the determined feature type is used as key feature data, so as to further perform compression processing based on the key feature data of the image block.

[0086] By selecting feature data as key feature data from the error values ​​of shape features and range features and then performing compression operations, the compression accuracy is improved, thereby improving the effect of compressed graphics and the image recovery effect.

[0087] Step S204: Generate compressed image data for the first pixel information of the image block based on the key feature data and the feature code of the feature type to which it belongs, so as to generate a compressed image of the original image based on the compressed image data.

[0088] Specifically, based on the determined key feature data and the feature code of the feature type corresponding to the key feature data, compressed image data is generated for the first pixel information of the image block; wherein, one embodiment of generating compressed image data is: converting the key feature data into feature quantization data; based on the feature code of the feature type to which the key feature data belongs and the feature quantization data, generating compressed image data.

[0089] Furthermore, the compressed image data of each sub-image block is combined to generate compressed image data of the set size image block to which each sub-image block belongs, that is, the key feature data of each second pixel information and the feature code of the feature type to which the key feature data belongs are combined to generate compressed image data. Figure 5The compressed image data of an image block (for example, with a size of 2×4) is shown, and the data volume is 64 bits; wherein, the quantized data (i.e., compressed data, Header and Quantitative data) of the three pixel channel information are 15 bits respectively; Type represents the feature type of the key feature data (for example, shape feature or range feature, etc.), F1 represents the feature code of a sub-image block feature type; and F2 represents the feature code of another sub-image block feature type. The feature code of the feature type to which the key feature data belongs is determined by the number associated with the feature type in the key feature data flow; when the feature type is a shape feature, the feature code is determined by the shape number of the calculated target shape; when the feature type is a range feature, the feature code is determined by the range number of the calculated brightness range, wherein the feature code includes three types, corresponding to the three pixel channels of RGB respectively.

[0090] The description of step S201 to step S207 is that for the first pixel information of each image block in each image block divided from a certain image, steps N1 to N4 are executed cyclically until each image block is processed:

[0091] N1: extracting shape feature data and range feature data corresponding to each type of pixel channel information from the first pixel information;

[0092] N2: calculating a first shape feature error of the shape feature data and a first range feature error of the range feature data respectively according to the shape feature data and the range feature data of the three pixel channel information;

[0093] N3: According to the calculation result, select key feature data from the shape feature data and the range feature data of the three types of pixel channel information;

[0094] N4: Based on the key feature data and the feature code of the feature type to which it belongs, determine the reference pixel from the key feature data, and generate one or more errors of other pixels corresponding to the reference pixel; generate compressed image data of the image block by quantizing and encoding the reference pixel and the error; and generate a compressed image of the original image based on the compressed image data.

[0095] like Figure 3 As shown, an embodiment of the present invention provides a schematic flow chart of a method for compressing multiple sub-image blocks; the flow chart may include the following steps:

[0096] Step S301: for sub-image block 1: extracting shape feature data and range feature data sub-image blocks corresponding to each type of pixel channel information from the second pixel information of sub-image block 1.

[0097] 1) For shape feature data: Specifically, for a sub-image block, the steps of an embodiment of extracting shape feature data corresponding to each type of pixel channel information from the second pixel information of the sub-image block are as follows:

[0098] For each type of pixel channel information, perform the following steps A1 to A3:

[0099] A1: initial shape feature data of the pixel channel information extracted from the second pixel information;

[0100] A2: calculating the pixel channel edge strength corresponding to each of the basic shapes according to the shape feature initial data of the pixel channel information and a plurality of preset basic shapes;

[0101] A3: selecting a target shape for the pixel channel information from the plurality of basic shapes according to the pixel channel edge strength corresponding to each of the basic shapes;

[0102] Second shape feature data is determined according to the target shape of each type of pixel channel information, the preset feature calculation strategy of the target shape, and the shape feature initial data of each type of pixel channel information.

[0103] In one embodiment of the present invention, the above steps A1-A3 are described by taking the R pixel channel among the three pixel channels as an example: for example, the size of the sub-image block is 2×2; each second pixel information in the sub-image block is represented by a, b, c, d.

[0104] In one embodiment of the present invention, exemplarily, the shapes formed by each second pixel information can be divided into 7 types (i.e., multiple preset basic shapes), including: horizontal lines, vertical lines, oblique lines, fold lines at each corner, etc.; according to these 7 shape types, each shape type has a preset edge calculation relationship, so as to calculate the edge strength of the pixel channel corresponding to each of the basic shapes through the edge calculation relationship, for example: the formula of the edge calculation relationship is shown in formula (1):

[0105] S n =ABS(a*t an +b*t bn +c*t cn +d*t dn ) (1)

[0106] Among them, {t a , t b , t c , t d} is the edge strength detection coefficient, where n is the operator number, S nis the edge strength, the matching relationship between the operator number n and the edge strength detection coefficient is shown in Table 1:

[0107] Table 1

[0108]

[0109] It can be seen that according to the example in Table 1, the shape characteristics of the sub-image block are determined by the edge strength of the R pixel channels of a, b, c, and d, that is, the edge strength of the pixel channel corresponding to each of the basic shapes is calculated, and the target shape is selected for the pixel channel information from the multiple basic shapes.

[0110] For example, the basic shape corresponding to the maximum value is selected from the seven edge strength values ​​(for example, represented by S0-S6) obtained through calculation as the target shape corresponding to the shape feature of the sub-image block; the method for calculating the target shape is, for example, represented by formula (2):

[0111] S M =MAX(S0, S1, S2, S3, S4, S5, S6) (2)

[0112] Wherein, M is the number of the target shape (corresponding to the operator number in Table 1), that is, the optimal matching shape number.

[0113] Furthermore, second shape feature data is determined according to a target shape of each type of pixel channel information, a preset feature calculation strategy of the target shape, and shape feature initial data of each type of pixel channel information.

[0114] The following is an example of pixel channel information (such as R pixel channel): Specifically, the preset feature calculation strategy of the target shape is shown in Table 2:

[0115] Table 2

[0116] Shape number n Second shape feature data A Second shape feature data B 0 A=(a+b) / 2 B=(c+d) / 2 1 A=(a+c) / 2 B=(b+d) / 2 2 A=(a+d) / 2 B=(b+c) / 2 3 A=a B=(b+c+d) / 3 4 A=b B=(a+c+d) / 3 5 A=c B=(a+b+d) / 3 6 A=d B=(a+b+c) / 3

[0117] As shown in Table 2, shape number n corresponds to various target shapes and has corresponding preset feature calculation strategies. For example, for shape number 0, A=(a+b) / 2 and B=(c+d) / 2 are preset feature calculation strategies. For another example: when the target shape of the sub-image block is determined to be 6 by calculation, the preset feature calculation strategy corresponding to number 6 is determined according to Table 2 to calculate the second shape feature data A and the second shape feature data B, wherein a, b, c, and d represent the initial shape feature data of each of the pixel channel information.

[0118] Furthermore, for each pixel channel (for example, RGB channel), after executing the above steps A1-A3 respectively, the second shape feature data (including second shape feature data A and second shape feature data B) corresponding to each pixel channel is obtained respectively. Further, each type of second shape feature data is combined to generate the shape feature data of the sub-image block.

[0119] It can be understood that the 7 types of shape feature data shown in Table 2 are only examples. According to the application scenario, shape types corresponding to multiple basic shapes and the number of basic shapes can be set; the present invention does not limit the number of shape types and categories of basic shapes.

[0120] 2) For range feature data: Specifically, for a sub-image block, the steps of an embodiment of extracting range feature data corresponding to each type of pixel channel information from the second pixel information of the sub-image block are as follows:

[0121] Specifically, the extracting of range feature data corresponding to each type of pixel channel information includes: extracting brightness feature data of each type of pixel channel information; and determining brightness range data of each type of pixel channel information based on the brightness feature data of the three types of pixel channel information and a brightness calculation strategy.

[0122] For example, the brightness characteristic data of each pixel channel information extracted is represented by R, G, and B;

[0123] The brightness calculation strategy includes:

[0124]

[0125] Based on the brightness characteristic data of the three pixel channel information, the maximum brightness value and the minimum brightness value are calculated; for example: for the second pixel information a, b, c, d, the brightness characteristic data are calculated respectively, and the corresponding brightness characteristic data is obtained as {Y a , Y b , Y c , Y d};

[0126] Further, a first brightness range consisting of the maximum brightness value and the minimum brightness value is determined, that is, from {Y a , Y b , Y c , Y d}, select the maximum brightness value and the minimum brightness value; obtain the maximum brightness value Ymax and the minimum brightness value Ymin;

[0127] Y max =MAX{Y a , Y b , Y c, Y d}

[0128] Y min =MIN{Y a , Y b , Y c , Y d}

[0129] The first brightness range [Y min , Y max ]; further, the first brightness range formed by the maximum brightness value and the minimum brightness value is divided into a plurality of second brightness ranges; the method of dividing the plurality of second brightness ranges is as follows: if the first brightness range is divided into 4 second brightness ranges, as shown in Table 3; if the first brightness range is divided into 8 second brightness ranges, as shown in Table 4;

[0130] Table 3

[0131] Range Number Numeric 0 <![CDATA[Y min ]]> 1 <![CDATA[(Y max -AND min ) / 3+Y min ]]> 2 <![CDATA[2(Y max -AND min ) / 3+Y min ]]> 3 <![CDATA[Y max ]]>

[0132] Table 4

[0133]

[0134]

[0135] Further, determine the target second brightness range to which the brightness characteristic data of the pixel channel information belongs; that is, according to {Y a , Y b , Y c , Y d} to determine the second brightness range, and when determining the second brightness range, the nearest neighbor matching strategy can be used. For example, the matching range numbers obtained are respectively represented as {D a , D b , D c , D d}.

[0136] Furthermore, the brightness range data is calculated for the brightness feature data of the three pixel channel information of RGB, respectively, and is expressed as follows:

[0137] R max =MAX{R a , R b , R c , R d}

[0138] R min =MIN{R a , R b , R c , Rd}

[0139] G max =MAX{G a , G b , G c , G d}

[0140] G min =MIN{G a , G b , G c , G d}

[0141] B max =MAX{B a , B b , B c , B d}

[0142] B min =MIN{B a , B b , B c , B d}

[0143] That is, the brightness calculation strategy includes: calculating the maximum brightness and the minimum brightness based on the brightness characteristic data of the three types of pixel channel information; dividing the first brightness range formed by the maximum brightness and the minimum brightness into multiple second brightness ranges; for each type of pixel channel information, performing the following operations: determining the target second brightness range to which the brightness characteristic data of the pixel channel information belongs; and calculating the brightness range data of the pixel channel information based on the target second brightness range and its corresponding calculation strategy.

[0144] Furthermore, based on the brightness characteristic data of the three pixel channel information and the brightness calculation strategy, the brightness range data of each pixel channel information is determined. The determined brightness range data is the range characteristic data of the sub-image block.

[0145] It can be understood that the brightness range data shown in Tables 3 and 4 are only examples. According to the application scenario, the first brightness range can be divided into multiple corresponding second brightness ranges; that is, different brightness gears are determined according to the first brightness range; the present invention does not limit the specific values ​​of the second brightness ranges and the number of second brightness ranges.

[0146] Step S302: Calculate a second shape feature error and a second range feature error of the second pixel information corresponding to sub-image block 1.

[0147] Specifically, based on the shape feature data and range feature data calculated in step S301, the corresponding shape feature error (ie, the second shape feature error) and range feature error (ie, the second range feature error) are calculated.

[0148] 1) A method for calculating shape feature error: based on a preset shape error calculation strategy, a first shape error value is calculated between the shape feature data of each pixel channel information of the second pixel information and the second pixel information; the second shape feature error is calculated in combination with the first shape error value of each pixel channel information of the second pixel information.

[0149] The preset shape error calculation strategy may be: using a shape feature reconstructor to restore pixel information corresponding to the sub-image block according to the data shape feature, so as to compare the restored pixel information with the extracted shape feature data; wherein the restoration method is as follows:

[0150]

[0151]

[0152]

[0153]

[0154] Among them, a′, b′, c′, d′ are the restored data of the second pixel information a, b, c, d respectively; wherein M is the target shape number corresponding to the second pixel information, and according to the number of the preset multiple basic shapes to which M belongs, it is determined that the restored shape feature data is obtained from the second shape feature data A or the second shape feature data B.

[0155] Further, the shape feature error of a pixel channel is determined by using E=ABS(aa′)+ABS(bb′)+ABS(cc′)+ABS(dd′), where E represents the error and ABS is the absolute value operation of the difference; then the shape feature error of each pixel channel is obtained; the shape feature error of each pixel channel (RGB) is combined; the shape feature error corresponding to the sub-image block 1 is determined; expressed as E shape =E R +E G +E B

[0156] 2) Calculation method for range characteristic error: The calculation of the second range characteristic error of the second pixel information includes: for each type of pixel channel information of the second pixel information, according to a preset range error calculation strategy, and the second brightness range to which each type of pixel channel information of the second pixel information belongs, the maximum brightness value and the minimum brightness value of the second brightness range, calculating the brightness characteristic value of each type of pixel channel information; based on the brightness characteristic value of each type of pixel channel information and the second pixel information, calculating the first brightness error of each type of pixel channel information; calculating the second range characteristic error of the second pixel information according to the first brightness error of each type of pixel channel information included in the second pixel information.

[0157] Specifically, the preset range error calculation strategy includes using the range feature reconstructor according to the range number D x The corresponding second brightness range is calculated based on the following method:

[0158] In the case where the first brightness range includes four second brightness ranges: the preset range error calculation strategy includes calculating range feature recovery data, where R max Represents the maximum value in the second brightness range of the R pixel channel; R min Represents the minimum value in the second brightness range of the R pixel channel; D p Represents the range number corresponding to the brightness range, where p is any one of the second pixel information abcd. Calculate R' p Represents the range feature recovery data of the R pixel channel; similarly, the range feature recovery data of each RGB pixel channel is obtained as follows:

[0159] R′ p =D p (R max -R min ) / 3+R min where p in {a, b, c, d}

[0160] G′ p =D p (G max -G min ) / 3+G min where p in {a, b, c, d}

[0161] B′ p =D p (B max -B min ) / 3+B min where p in {a, b, c, d}

[0162] In the case where the first brightness range includes eight second brightness ranges: the preset range error calculation strategy includes calculating range feature recovery data, where R max Represents the maximum value in the second brightness range of the R pixel channel; R min Represents the minimum value in the second brightness range of the R pixel channel; D p Represents the range number corresponding to the brightness range, where p is any one of the second pixel information abcd; R′ is calculated p Represents the range feature recovery data of the R pixel channel; similarly, the range feature recovery data of each RGB pixel channel is obtained as follows:

[0163] R′ p =D p (R max -R min ) / 7+R min where p in {a, b, c, d}

[0164] G′ p =D p (G max -G min ) / 7+G min where p in {a, b, c, d}

[0165] B′ p =D p (B max -B min ) / 7+B min where p in {a, b, c, d}

[0166] Further, a range feature error of the second pixel information is calculated using the following method, where E p A first brightness error representing any second pixel information among abcd;

[0167] E p =ABS(R p -R′ p )+ABS(G p -G′ p )+ABS(B p -B′ p ) where p belongs to {a, b, c, d}

[0168] Furthermore, the range characteristic errors of each second pixel information are integrated to obtain the range characteristic error of the sub-image block 1 (ie, the second range characteristic error), which is expressed as:

[0169] E range =E a +E b +Ec +E d

[0170] That is, based on the brightness characteristic value of each pixel channel information and the second pixel information, the first brightness error of each pixel channel information is calculated; according to the first brightness error of each pixel channel information included in the second pixel information, the second range characteristic error of the second pixel information is calculated.

[0171] Step S303: for sub-image block 2: extracting shape feature data and range feature data sub-image block corresponding to each type of pixel channel information from the second pixel information of sub-image block 2.

[0172] The description of extracting the shape feature data and range feature data corresponding to each type of pixel channel information from the second pixel information of sub-image block 2 is consistent with the description of step S301 for sub-image block 1, and will not be repeated here.

[0173] Step S304: Calculate a second shape feature error and a second range feature error of the second pixel information corresponding to sub-image block 2.

[0174] The description of calculating the second shape feature error and the second range feature error of the second pixel information corresponding to sub-image block 2 is consistent with the description of step S302 for sub-image block 1, and will not be repeated here.

[0175] Step S305: Calculate the first shape feature error based on the second shape feature error corresponding to the second pixel information of each of the sub-image blocks; calculate the first range feature error based on the second range feature error corresponding to the second pixel information of each of the sub-image blocks.

[0176] Step S306: According to the first shape feature error and the first range feature error, feature data corresponding to the feature type with the smallest error value is determined as key feature data.

[0177] Specifically, for example, the first shape feature error of sub-image block 1 is represented by E0 shape The first shape feature error of sub-image block 2 is represented by E1 shape Indicates: The first range feature error of sub-image block 1 is represented by E0 range Indicates: The first range feature error of sub-image block 2 is represented by E1 range Then further, the method for calculating the shape feature reference error of the image block (ie, the shape feature error of the image block to which the sub-image block 1 and the sub-image block 2 belong) may be: E0 shape +E1 shape That is, the range feature reference error method for calculating the image block can be E0range +E1 range .

[0178] That is, the feature data corresponding to the feature type with the smallest error value is determined to be the key feature data, including: calculating the shape feature reference error of the image block based on the first shape feature errors of multiple second pixel information; calculating the range feature reference error of the image block based on the first range feature errors of multiple second pixel information; selecting the feature data corresponding to the feature type with the smallest value from the shape feature reference error and the range feature reference error as the key feature data of the image block; wherein the feature data is the shape feature data or the range feature data.

[0179] Step S307: Based on the key feature data and the feature code of the feature type to which it belongs, determine the reference pixel from the key feature data, and generate one or more errors of other pixels corresponding to the reference pixel; generate compressed image data of the image block by quantizing and encoding the reference pixel and the error; and generate a compressed image of the original image based on the compressed image data.

[0180] Specifically, the method of converting the key feature data into feature quantization data is to perform compression processing on the key feature data. That is, the method of generating compressed image data includes: converting the key feature data into feature quantization data; and generating compressed image data based on the feature code of the feature type to which the key feature data belongs and the feature quantization data.

[0181] An embodiment of converting the key feature data into feature quantification data is:

[0182] Extracting quantitative features from the key feature data, calculating the difference values ​​between the multiple key pixels according to the quantitative features; searching for a target difference judgment strategy matching the key feature data from a plurality of preset difference judgment strategies according to the difference values ​​between the multiple key pixels; and determining a corresponding quantization encoding method based on the target difference judgment strategy;

[0183] Determining a reference pixel from the key feature data and generating one or more errors of other pixels corresponding to the reference pixel includes: using the quantization coding method to indicate the reference pixel and one or more errors of other pixels corresponding to the reference pixel.

[0184] The compressed image data of the image block is generated by quantizing and encoding the reference pixel and the error, including: based on the quantization encoding method, quantizing and encoding the reference pixel and the error, generating feature quantization data of the image block as the compressed image data of the image block; wherein the feature quantization data is of fixed length.

[0185] Furthermore, the characteristic quantized data is obtained by combining header data and quantized data; wherein the lengths of header data and quantized data corresponding to different quantization encoding methods are different.

[0186] Specifically, in one embodiment of the present invention, the method for extracting the corresponding quantitative features from the key feature data is shown in Table 5:

[0187] Table 5

[0188] Extracted features Computational method for extracting features rp0 ABS(R1-R0) rp1 ABS(R2-R1) rp2 ABS(R3-R2) gp0 ABS(G1-G0) gp1 ABS(G2-G1) gp2 ABS(G3-G2) bp0 ABS(B1-B0) bp2 ABS(B2-B1) bp3 ABS(B3-B2)

[0189] Among them, R0~R3, G0~G3, B0~B3 represent the key feature data corresponding to the RGB pixel channels respectively, and ABS (absolute value operation) is a method for extracting quantitative features. It can be understood that before the ABS operation (i.e., absolute value operation), the key feature data of the shape feature data and the range feature data can be sorted respectively, so as to improve the computational efficiency of the ABS calculation.

[0190] Furthermore, rp0-rp2, gp0-gp2, bp0-bp2 calculated according to Table 5 are the difference values ​​between multiple key pixels, and the limiting conditions of the quantization strategy are respectively input for comparison. The quantization strategy is determined according to the comparison results.

[0191] Further, a quantitative feature is extracted from the key feature data, and a differential value between the multiple key pixels is calculated according to the quantitative feature; a target differential judgment strategy matching the key feature data is searched from a plurality of preset differential judgment strategies according to the differential value between the multiple key pixels; a corresponding quantization encoding method is determined based on the target differential judgment strategy; the differential judgment strategy (such as judgment conditions, etc.) is described below by taking the G pixel channel as an example, as shown in Table 6:

[0192] Table 6

[0193] Priority Quantitative Strategy No. Differential judgment strategy 0 5 gp0<2&gp1<2&gp2<2 1 0 gp0<8&gp1<8&gp2<16 2 1 gp0<16&gp1<16&gp2<32 3 3 gp0<32&gp1<32&gp2<32 4 4 gp0<64&gp1<64&gp2<64 5 2 other

[0194] And, taking the G pixel channel as an example, the quantization encoding method corresponding to the target difference judgment strategy shown in Table 7 is explained.

[0195] Table 7

[0196] Quantitative Strategy No. Header encoding Quantization Coding Method 0 0 G1(H7)g0(2)g2(2)g3(3) 1 10 G1(H6)g0(2)g2(2)g3(3) 2 110 G0(H3)G1(H3)G2(H3)G3(H3) 3 1110 G1(H5)g0(2)g2(2)g3(2) 4 11110 G1(H4)g0(2)g2(2)g3(2) 5 111110 G(H8)0

[0197] Exemplarily, according to Table 6, for example, if the quantization strategy number for calculating the key feature data of the G pixel channel according to the target differential judgment strategy is 1 (that is, according to the differential value between the multiple key pixels, the target differential judgment strategy matching the key feature data is searched from a plurality of preset differential judgment strategies), then according to the matching relationship in Table 7, the quantization coding method is determined to be the corresponding G1(H6)g0(2)g2(2)g3(3) (that is, the corresponding quantization coding method is determined based on the target differential judgment strategy.

[0198] Among them, the header code (Header) adopts Huffman coding, which is the binary unique identifier of the quantization strategy, and the quantization data (Quantitative data) is calculated according to the corresponding quantization strategy; further, the corresponding data in the quantization coding method means: uppercase letters correspond to the high bits of the data; lowercase letters correspond to the difference of the high bits of the data:

[0199] The following is an example. For example, the quantization coding method is G1(H6)g0(2)g2(2)g3(3)

[0200] in:

[0201] G1 (H6) is the high 6 bits of the G channel data of the first feature pixel;

[0202] g0(2) is 2-bit complement data, and its calculation method is:

[0203] g0(2)=G1(H6)-G0(H6)

[0204] g2(2) is 2-bit complement data, and its calculation method is:

[0205] g2(2)=G2(H6)-G1(H6)

[0206] Among them, g3(3) is 3-bit complement data, and its calculation method is:

[0207] g3(3)=G3(H6)-G2(H6)

[0208] Wherein, G1 is the reference pixel, g0(2) is the error of G corresponding to G0, g2(2) is the error of G2 corresponding to G1, and the indirect error of G2 to G0 can be calculated; that is, the reference pixel is determined from the key feature data, and one or more errors of other pixels corresponding to the reference pixel are generated; it can be understood that the error can be a direct error or an indirect error. That is, the reference pixel and one or more errors of other pixels corresponding to the reference pixel are indicated by the quantization coding method.

[0209] Similarly, the key feature data of the R channel and the B channel are converted into feature quantization data. Further, the feature quantization data is of fixed length. In the embodiment of the present invention, for a 2x4 image block, Figure 5 In the schematic diagram shown, corresponding to the RGB pixel channels, the characteristic quantization data corresponding to each pixel channel is of a fixed length, for example, 15 bits; wherein the 15-bit characteristic quantization data is obtained by combining the header data and the quantization data. It can be understood that, as shown in Table 7, the header data and the corresponding quantization data are variable lengths; the combined quantization data is of a fixed length; a constant bit rate is achieved through this method, which facilitates the hardware design or software design of the chip, facilitates the transmission and access of compressed data, and achieves lossless image quality close to human visual perception.

[0210] That is, the compressed image data of the image block is generated by quantizing and encoding the reference pixel and the error, including: based on the quantization encoding method, the reference pixel and the error are quantized and encoded to generate characteristic quantization data of the image block as the compressed image data of the image block; wherein the characteristic quantization data is of fixed length. The characteristic quantization data is obtained by combining the header data and the quantization data; wherein the lengths of the header data and the quantization data corresponding to different quantization encoding methods are different. The quantization data is adaptively determined by different quantization encoding methods, thereby improving the effect of image compression and achieving lossless image quality close to human visual perception.

[0211] like Figure 4 As shown, an embodiment of the present invention provides an image compression device 400, comprising: an image processing module and an image compression module; wherein,

[0212] The image processing module is used to determine first pixel information of one or more image blocks of a set size in the original image, wherein the pixel information includes three types of pixel channel information;

[0213] The compressed image module is used to execute steps N1-N4 for the first pixel information of each image block: N1: extracting shape feature data and range feature data corresponding to each type of pixel channel information from the first pixel information; N2: calculating the first shape feature error of the shape feature data and the first range feature error of the range feature data respectively according to the shape feature data and range feature data of the three types of pixel channel information; N3: selecting key feature data from the shape feature data and the range feature data of the three types of pixel channel information according to the calculation results; N4: determining a reference pixel from the key feature data based on the key feature data and the feature code of the feature type to which it belongs, and generating one or more errors of other pixels corresponding to the reference pixel; generating compressed image data of the image block by quantizing and encoding the reference pixel and the error; and generating a compressed image of the original image based on the compressed image data.

[0214] An embodiment of the present invention also provides an electronic device for image compression, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in any of the above embodiments.

[0215] An embodiment of the present invention further provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the image compression method provided by any of the above embodiments is implemented.

[0216] Figure 6 An exemplary system architecture 600 is shown to which the image compression method or image compression apparatus according to the embodiment of the present invention may be applied.

[0217] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, 603, network 604 and server 605. Network 604 is used to provide a medium for communication links between terminal devices 601, 602, 603 and server 605. Network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0218] Users can use terminal devices 601, 602, 603 to interact with server 605 through network 604 to receive or send messages, etc. Terminal devices 601, 602, 603 can be installed with various client applications, such as e-commerce client applications, web browser applications, instant messaging tools, and email clients.

[0219] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting various client applications, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0220] The server 605 may be a server providing various services, such as a background management server providing support for client applications used by users using the terminal devices 601, 602, and 603. The background management server may process the received request for compressed images and feed back the compressed images to the terminal devices.

[0221] It should be noted that the image compression method provided in the embodiment of the present invention is generally executed by the terminal device 601, 602, 603 or the server 605. Accordingly, the image compression device can be set in the terminal device 601, 602, 603 or in the server 605.

[0222] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0223] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0224] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. A variety of input / output (I / O) interfaces 705 are also connected to the bus 704.

[0225] The following components are connected to the various I / O interfaces 705: an input part 706 including a keyboard, a mouse, etc.; an output part 707 including a display device such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage part 708 including a hard disk, etc.; and a communication part 709 including a network interface card such as a LAN card, a modem, etc. The communication part 709 performs communication processing via a network such as the Internet. The driver 710 is also connected to the corresponding interface of the various I / O interfaces 705 as needed. The removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the driver 710 as needed, so that the computer program read therefrom is installed into the storage part 708 as needed. In the embodiment of the present invention, the camera module 712 obtains or collects the image data to be processed via the corresponding interface of the various I / O interfaces 705, and the display module 713 displays the processed compressed image via the corresponding interface of the various I / O interfaces 705.

[0226] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.

[0227] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0228] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system (including integrated circuits) that performs the specified function or operation, or can be implemented with a combination of dedicated hardware (including dedicated integrated circuits) and computer instructions.

[0229] The modules and / or units involved in the embodiments of the present invention may be implemented by software or hardware (including integrated circuits). The modules and / or units described may also be set in a processor, for example, they may be described as: a processor includes an image processing module and an image compression module; wherein the names of these modules do not constitute a limitation on the modules themselves in certain circumstances, for example, the image processing module may also be described as a "module for determining first pixel information of one or more image blocks of a set size in an original image".

[0230] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently and not assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: determining the first pixel information of one or more image blocks of a set size in the original image, the pixel information includes three kinds of pixel channel information; for each of the first pixel information of the image block, performing steps N1-N4: N1: extracting shape feature data and range feature data corresponding to each of the pixel channel information from the first pixel information; N2: calculating the first shape feature error of the shape feature data and the first range feature error of the range feature data according to the shape feature data and the range feature data of the three kinds of pixel channel information; N3: selecting key feature data from the shape feature data and the range feature data of the three kinds of pixel channel information according to the calculation results; N4: generating compressed image data for the first pixel information of the image block based on the key feature data and the feature code of the feature type to which it belongs, so as to generate a compressed image of the original image based on the compressed image data.

[0231] The embodiments of the present invention can divide the original image into multiple image blocks of set sizes, extract shape feature data and range feature data from each image block, calculate the feature extraction errors of the shape feature data and the range feature data, determine the selected feature type according to the feature extraction error, and determine the corresponding key feature data; further generate compressed data of the image block based on the key feature data; the embodiments of the present invention determine the key feature data from the feature data extracted from multiple types of image blocks, and then generate compressed data; improve the compression effect of the compressed image, reduce the computational complexity of the compressed image, and thus reduce the difficulty of hardware design and power consumption requirements.

[0232] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for image compression, characterized in that: include: Determine first pixel information of one or more image blocks of a set size in an original image, wherein the pixel information includes three types of pixel channel information; For the first pixel information of each of the image blocks, perform steps N1 to N4: N1: extracting shape feature data and range feature data corresponding to each type of the pixel channel information from the first pixel information; wherein the shape feature data is associated with a shape feature formed by a plurality of pixels included in the image block, and the range feature data is associated with a brightness range feature displayed by a plurality of pixels included in the image block; N2: calculating a first shape feature error of the shape feature data and a first range feature error of the range feature data respectively according to the shape feature data and the range feature data of the three pixel channel information; N3: According to the calculation result, select key feature data from the shape feature data and the range feature data of the three types of pixel channel information; N4: Based on the key feature data and the feature code of the feature type to which it belongs, determine the reference pixel from the key feature data, and generate one or more errors of other pixels corresponding to the reference pixel; generate compressed image data of the image block by quantizing and encoding the reference pixel and the error; and generate a compressed image of the original image based on the compressed image data.

2. The method according to claim 1, characterized in that Further including: For each of the first pixel information of the image block, dividing the pixel information into second pixel information corresponding to at least two image sub-blocks; The extracting shape feature data and range feature data corresponding to each type of pixel channel information from the first pixel information includes: The shape feature data and the range feature data corresponding to each type of the pixel channel information are respectively extracted from the second pixel information corresponding to each of the image blocks.

3. The method according to claim 2, characterized in that The respectively calculating the first shape feature error of the shape feature data and the first range feature error of the range feature data comprises: Calculating a second shape feature error and a second range feature error of the second pixel information respectively according to the shape feature data and the range feature data of each type of the pixel channel information extracted from the second pixel information; Calculating the first shape feature error according to a second shape feature error corresponding to second pixel information of each of the image blocks; The first range feature error is calculated according to a second range feature error corresponding to second pixel information of each of the image blocks.

4. The method according to claim 3, characterized in that Step N3 includes: According to the first shape feature error and the first range feature error, feature data corresponding to a feature type with a minimum error value is determined as key feature data.

5. The method according to claim 2, characterized in that: Step N4 includes: Combining the key feature data of each of the second pixel information and the feature code of the feature type to which the key feature data belongs, compressed image data is generated.

6. The method according to claim 2, characterized in that The extracting of shape feature data corresponding to each type of pixel channel information includes: For each type of pixel channel information, perform the following steps A1 to A3: A1: initial shape feature data of the pixel channel information extracted from the second pixel information; A2: calculating the pixel channel edge strength corresponding to each of the basic shapes according to the shape feature initial data of the pixel channel information and a plurality of preset basic shapes; A3: selecting a target shape for the pixel channel information from the plurality of basic shapes according to the pixel channel edge strength corresponding to each of the basic shapes; Second shape feature data is determined according to the target shape of each type of pixel channel information, the preset feature calculation strategy of the target shape, and the shape feature initial data of each type of pixel channel information.

7. The method according to claim 2, characterized in that The extracting of range feature data corresponding to each type of pixel channel information includes: Extracting brightness feature data of each pixel channel information; Based on the brightness characteristic data of the three types of pixel channel information and a brightness calculation strategy, the brightness range data of each type of pixel channel information is determined.

8. The method according to claim 7, characterized in that The brightness calculation strategy includes: Based on the brightness characteristic data of the three pixel channel information, a maximum brightness value and a minimum brightness value are calculated; a first brightness range formed by the maximum brightness value and the minimum brightness value is divided into a plurality of second brightness ranges; For each type of pixel channel information, perform the following operations: Determine a target second brightness range to which the brightness characteristic data of the pixel channel information belongs; Based on the target second brightness range and its corresponding calculation strategy, the brightness range data of the pixel channel information is calculated.

9. The method according to claim 3, characterized in that: The calculating a second shape feature error of the second pixel information comprises: Based on a preset shape error calculation strategy, a first shape error value between shape feature data of each pixel channel information of the second pixel information and the second pixel information is calculated; The second shape feature error is calculated by combining the first shape error value of each type of pixel channel information of the second pixel information.

10. The method according to claim 8, characterized in that The calculating a second range characteristic error of the second pixel information includes: For each type of pixel channel information of the second pixel information, Calculate the brightness characteristic value of each type of pixel channel information according to a preset range error calculation strategy, a second brightness range to which each type of pixel channel information of the second pixel information belongs, and a maximum brightness value and a minimum brightness value of the second brightness range; Calculating a first brightness error of each type of pixel channel information based on the brightness characteristic value of each type of pixel channel information and the second pixel information; A second range feature error of the second pixel information is calculated according to a first brightness error of each type of pixel channel information included in the second pixel information.

11. The method according to claim 4, characterized in that The feature data corresponding to the feature type with the smallest error value is determined as key feature data, including: Calculating a shape feature reference error of the image block according to a plurality of first shape feature errors of the second pixel information; Calculating a range feature reference error of the image block according to a plurality of first range feature errors of the second pixel information; Feature data corresponding to the feature type with the smallest value is selected from the shape feature reference error and the range feature reference error as key feature data of the image block; wherein the feature data is the shape feature data or the range feature data.

12. The method according to claim 1, characterized in that Further including: Extracting quantitative features from the key feature data, and calculating differential values ​​between a plurality of key pixels according to the quantitative features; According to the difference values ​​between the multiple key pixels, searching for a target difference judgment strategy matching the key feature data from a plurality of preset difference judgment strategies; Determining a corresponding quantization coding method based on the target difference judgment strategy; Determining a reference pixel from the key feature data and generating one or more errors of other pixels corresponding to the reference pixel, comprising: The reference pixel and one or more errors of other pixels corresponding to the reference pixel are indicated using the quantization encoding method.

13. The method according to claim 12, characterized in that Generating compressed image data of the image block by quantizing and encoding the reference pixel and the error, comprising: Based on the quantization encoding method, the reference pixel and the error are quantized and encoded to generate characteristic quantization data of the image block as compressed image data of the image block; wherein the characteristic quantization data is of fixed length.

14. The method according to claim 13, characterized in that The characteristic quantized data is obtained by combining the header data and the quantized data; wherein the lengths of the header data and the quantized data corresponding to different quantization encoding methods are different.

15. The method according to claim 1, characterized in that The step of determining pixel information of one or more image blocks of a set size in the original image includes: receiving a data stream of any image block of a set size belonging to an original image, and extracting pixel information from the data stream; or, The original image is divided into a plurality of image blocks of a set size, and pixel information is extracted from the image blocks.

16. The method according to claim 1, characterized in that Further including: Directly generate a compressed image of the original image by using the processed plurality of compressed image data corresponding to the original image; or, The compressed image data is sent to other processing modules, so that the other processing modules generate a compressed image of the original image by using the received multiple compressed image data corresponding to the original image.

17. The method according to claim 1, characterized in that: The image compression method can be applied to a chip.

18. An image compression device, characterized in that: include: An image processing module and an image compression module; wherein, The image processing module is used to determine first pixel information of one or more image blocks of a set size in the original image, wherein the pixel information includes three types of pixel channel information; The compressed image module is used to execute steps N1-N4 for the first pixel information of each image block: N1: extracting shape feature data and range feature data corresponding to each type of pixel channel information from the first pixel information; N2: calculating the first shape feature error of the shape feature data and the first range feature error of the range feature data respectively according to the shape feature data and range feature data of the three types of pixel channel information; N3: selecting key feature data from the shape feature data and the range feature data of the three types of pixel channel information according to the calculation results; N4: determining a reference pixel from the key feature data based on the key feature data and the feature code of the feature type to which it belongs, and generating one or more errors of other pixels corresponding to the reference pixel; generating compressed image data of the image block by quantizing and encoding the reference pixel and the error; and generating a compressed image of the original image based on the compressed image data.

19. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 17.

20. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 17 is implemented.

Citation Information

Patent Citations

  • Image compression method and image processing apparatus

    CN104025561A

  • Recompression and information hiding method based on AMBTC compression coding

    CN111741301A