CN110049334B - Image compression device and image compression method - Google Patents
Image compression device and image compression method Download PDFInfo
- Publication number
- CN110049334B CN110049334B CN201910332787.4A CN201910332787A CN110049334B CN 110049334 B CN110049334 B CN 110049334B CN 201910332787 A CN201910332787 A CN 201910332787A CN 110049334 B CN110049334 B CN 110049334B
- Authority
- CN
- China
- Prior art keywords
- channel
- template
- slope
- channel information
- difference
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/42—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
Abstract
The invention discloses an image compression device and an image compression method. The image compression device comprises a processor and a storage device. The processor is used for selecting one of red channel information, green channel information and blue channel information in an original image file as reference channel information, the other two pieces of red channel information, green channel information and blue channel information are respectively first channel information and second channel information, calculating a channel difference value between the first channel information and the reference channel information to generate a difference value curve, calculating a template difference value between the difference value curve and each curve template, selecting the curve template corresponding to the minimum template difference value as a first current template, and coding a template number corresponding to the first current template, a reference value corresponding to the first current template, at least one turning point position corresponding to the first current template and at least one slope corresponding to the first current template.
Description
Technical Field
The present invention relates to a file compression mechanism, and more particularly, to an image compression method and an image compression apparatus.
Background
In an image block (block) compression algorithm, there is usually strong similarity between multiple channels of pixels, so encoding according to this similarity is one of the important methods for compression, and most of the existing algorithms calculate differences between channels, and then use the differences of neighboring pixels for prediction, so as to reduce residual (residual), and then use quantization and entropy coding for compression. However, such methods generally encode more residual information, which requires more bits to be stored and encoded, and thus the file cannot be compressed greatly, or the accuracy is sacrificed and a larger quantization parameter is used, which results in a larger error and a reduced quality of the decompressed image.
Therefore, how to encode with a smaller number of bits and have a higher image restoration degree when decompressing is one of the problems to be solved in the art.
Disclosure of Invention
According to one embodiment of the present disclosure, an image compression apparatus includes a processor and a storage device. The processor is used for receiving an original image file, selecting one of red channel (R-channel) information, green channel (G-channel) information and blue channel (B-channel) information in the original image file as reference channel information, the other two of the red channel (R-channel) information, the green channel (G-channel) information and the blue channel (B-channel) information are respectively first channel information and second channel information, calculating a channel difference between the first channel information and the reference channel information to generate a difference curve, calculating a template difference between the difference curve and each of a plurality of curve templates (patternn), selecting a curve template corresponding to the template with the minimum template difference as a first current template, coding a template number corresponding to the first current template, a reference value corresponding to the first current template, at least one turning point position corresponding to the first current template and at least one slope corresponding to the first current template, so as to generate a first channel code, and regard the first channel code, a second channel code and the compressed reference channel information as an image compression file. The storage device is used for storing the image compression file.
According to another embodiment of the present disclosure, an image compression method is provided, including: receiving an original image file; selecting one of red channel (R-channel) information, green channel (G-channel) information and blue channel (B-channel) information in the original image file as reference channel information, wherein the other two channel information are respectively first channel information and second channel information; calculating a channel difference between the first channel information and the reference channel information to generate a difference curve; calculating a template difference value between the difference curve and each of the plurality of curve templates (patterns), and selecting the curve template corresponding to the template difference value which is the smallest as a current template; coding a template number, a reference value, at least one turning point position and at least one slope corresponding to the current template to generate a first channel code; the first channel code, the second channel code and the compressed reference channel information are regarded as an image compressed file; and storing the image compressed file.
In summary, the image compression apparatus and the image compression method according to the present invention consider that the difference between the channel information in the complex image changes, and divide the difference into different regions by analyzing the change pattern of the difference, so as to describe the change rule of the difference by using the slope-dividing region, and further describe the difference more accurately, so that the complex image block is encoded, thereby solving the problem that the traditional encoding algorithm processes the bad partial image block, and improving the overall encoding quality of the image.
Drawings
FIG. 1 is a block diagram of an image compression apparatus according to an embodiment of the present invention.
FIG. 2 is a flow chart illustrating an image compression method according to an embodiment of the invention.
Fig. 3 is a schematic diagram illustrating first channel information and reference channel information according to an embodiment of the invention.
Fig. 4 is a schematic diagram illustrating a channel difference according to an embodiment of the invention.
FIG. 5 is a schematic diagram illustrating a curve template according to an embodiment of the invention.
[ notation ] to show
100: image compression apparatus
10: processor with a memory having a plurality of memory cells
20: storage device
200: image compression method
210-270: step (ii) of
0 to 7: curve template
Detailed Description
The following description is of the best mode for carrying out the invention and is intended to illustrate the general spirit of the invention and not to limit the invention. Reference must be made to the following claims for their true scope of the invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of further features, integers, steps, operations, elements, components, and/or groups thereof.
Use of the terms "first," "second," "third," and the like in the claims is used to modify a claim element without indicating a priority, precedence, or order between elements, or the order in which a method step is performed, but is intended to distinguish one element from another element having a same name.
In one embodiment, referring to fig. 1-2, fig. 1 is a block diagram of an image compression apparatus 100 according to an embodiment of the invention. FIG. 2 is a flow chart illustrating a method 200 of image compression according to an embodiment of the invention. The image compression apparatus 100 includes a processor 10 and a storage device 20. In one embodiment, the image compression apparatus 100 may be a computer, a tablet computer, a mobile phone or other electronic devices with computing functions.
In one embodiment, the processor 10 may be implemented by a volume circuit such as a micro controller (mcu), a microprocessor (microprocessor), a digital signal processor (digital signal processor), an Application Specific Integrated Circuit (ASIC), or a logic circuit.
In one embodiment, the storage device 20 can be implemented as a read-only memory, a flash memory, a floppy disk, a hard disk, a compact disk, a flash disk, a magnetic tape, a database accessible by a network, or a storage medium with the same functions as those easily understood by those skilled in the art.
In step 210, the processor 10 receives an original image file.
In an embodiment, the processor 10 may divide the received original image file into a plurality of blocks (blocks), each block having a size of 8 × 2 pixels (i.e., a block formed by 8 pixels in the horizontal direction and 2 pixels in the vertical direction), and perform processing in units of each block in the subsequent steps. For ease of understanding, in the following embodiments, 8 pixels in the horizontal direction are described. However, the block size may be adjusted according to practical implementation, and is not limited thereto.
In step 220, the processor 10 selects one of red channel (R-channel) information, green channel (G-channel) information and blue channel (B-channel) information in the original image file as a reference channel information, and the other two are respectively a first channel information and a second channel information.
In one embodiment, the red channel information, the green channel information and the blue channel information may be used to describe a color represented by a pixel, each color channel stores information of color elements in an image, colors in all color channels are overlapped and mixed to generate a color of the pixel in the image, and the processor 10 may analyze color component information of each pixel in the image, that is, the red channel information, the green channel information and the blue channel information. In one embodiment, the processor 10 may select the red channel information as a reference channel information, the green channel information as a first channel information, and the blue channel information as a second channel information.
In one embodiment, the reference channel information (e.g., red channel information) may be compressed using an existing image compression algorithm.
In step 230, the processor 10 calculates a channel difference between the first channel information and the reference channel information to generate a difference curve.
Referring to fig. 3-4, fig. 3 is a schematic diagram illustrating first channel information and reference channel information according to an embodiment of the invention. Fig. 4 is a schematic diagram illustrating a channel difference according to an embodiment of the invention. In fig. 3, the solid line segment is used to represent the reference channel information (e.g., red channel information), and the dashed line segment is used to represent the first channel information (e.g., green channel information). In one embodiment, the horizontal axis of FIG. 3 represents 0-7 bits, and the vertical axis represents the color component information of the channel.
In one embodiment, the processor 10 calculates the channel difference between the first channel information and the reference channel information, i.e. the processor 10 subtracts each point corresponding to the first channel information and the reference channel information and takes the channel difference to generate a difference curve as shown in fig. 4.
In step 240, the processor 10 calculates a template difference between the difference curve and each of the plurality of curve templates (patterns) 0 to 7, and selects the curve template corresponding to the smallest template difference as a current template.
Referring to fig. 5, fig. 5 is a schematic diagram illustrating a curve template according to an embodiment of the invention. In one embodiment, the curve templates 0-7 are used to describe a fixed number of pixels, such as the curve templates 0-7 are used to represent the connection of 8-bit difference distribution.
In an embodiment, the processor 10 subtracts the difference curve shown in fig. 4 from each corresponding point on each curve template 0-7 and obtains an absolute value, for example, subtracts each corresponding point on the difference curve and the curve template 0 and obtains an absolute value, accumulates the absolute values to obtain a template difference between the difference curve and the curve template 0, subtracts each corresponding point on the difference curve and the curve template 1 and obtains an absolute value, accumulates the absolute values to obtain a template difference … between the difference curve and the curve template 1, and so on, calculates eight template differences, and selects a curve template corresponding to a minimum template difference as a current template, for example, the difference between the difference curve and the curve template 7 shown in fig. 4 is minimum, and then uses the curve template 7 as the current template. Thereby, the curve template most similar to the difference curve can be found out.
In step 250, the processor 10 encodes a template number, a reference value, at least one turning point position and at least one slope corresponding to the current template to generate a first channel code.
In one embodiment, the processor 10 calculates a channel difference between the second channel information (e.g., blue channel information) and the reference channel information (e.g., red channel information) to generate another difference curve, and similarly, the processor 10 calculates another template difference between the another difference curve and each of the curve templates 0 to 7, selects a curve template corresponding to the smallest of the another template differences as a second current template, and encodes a template number corresponding to the second current template, a reference value corresponding to the second current template, at least one inflection point position corresponding to the second current template, and at least one slope corresponding to the second current template to generate the second channel code.
In one embodiment, when there is a horizontal line (slope 0) in the curve templates 0-7, the horizontal line is selected as the reference value, and if there is no horizontal line (e.g., curve template 0, curve template 3), the leftmost slope is used as the reference value, so the reference values of the curve templates 0 and 3 are the same, in other words, each of the curve templates 0-7 has its own reference value, but may be the same or different. For example, the curve template 7 has three slopes, the slopes of the left two dotted lines can be regarded as a first slope and a second slope, respectively, and the slope of the rightmost solid line is zero, and the reference value is set to 0.
In one embodiment, at least one slope is used to represent the delta of the difference for each adjacent bit.
In one embodiment, the at least one slope includes a first slope and a second slope, the at least one inflection point location includes a first inflection point location, the first slope is calculated by the processor 10 according to the template difference, and the second slope is reconstructed by the processor 10 according to the first inflection point. For example, the curve template 3 has two slopes, a first slope (the upper left-lower-right dashed line segment) is calculated by the processor 10 according to the template difference, and a second slope (the upper left-lower-right dashed line segment) is reconstructed by the processor 10 according to a first turning point (i.e. the intersection point of the two slopes).
In one embodiment, the at least one slope includes a first slope, a second slope and a third slope, the at least one inflection point includes a first inflection point and a second inflection point, the first slope is a basic value, the second slope is reconstructed by the processor 10 according to the first inflection point, and the third slope is reconstructed by the processor 10 according to the second inflection point. For example, in the curve template 6, the leftmost slope is a first slope, the slope of which is a basic value (e.g., 0), the second slope (the middle slope) is reconstructed by the processor 10 according to the first turning point position (the intersection point of the first slope and the second slope), the rightmost slope is a third slope, and the third slope is reconstructed by the processor 10 according to the second turning point (the intersection point of the second slope and the third slope).
In one embodiment, in the case of only one turning point, the position of the turning point can be represented by 3 bits, and in the case of two turning points, 15 possible cases of turning points can be represented by 4 bits: (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (2, 3), (2, 4), (2, 5), (2, 6), (3, 4), (3, 5), (3, 6), (4, 5), (4, 6), (5, 6). For example, the two turning point positions of the curve template 7 are (2, 6).
In one embodiment, the encoding results of the first channel encoding (e.g., green channel encoding) and the second channel encoding (e.g., blue channel encoding) are shown in table one:
Wherein the difference base sign is 1, which represents that the reference value is a positive number, and represents that the reference value is a negative number if the difference base sign is 0, the absolute value of the difference base is represented by representing the channel difference between the first channel code and the reference channel information as "011111" by using a binary symbol, representing the channel difference between the second channel code and the reference channel information as "110100" by using a binary symbol, the template number is represented by representing which curve template the first channel code is similar to by using a binary symbol, and can be generally represented by using 2 to 3 bits, the turning point is the position of the intersection point (joining point) of the line segments of different slopes on the curve template by using a binary symbol, and the first slope symbol and the second slope symbol are the signs of the first slope and the second slope symbol in the curve template by using a binary symbol, respectively, such as 1 representing a positive slope, the 0 is represented as a negative slope, and the absolute value of the first slope and the absolute value of the second slope are represented by binary signs, which can be generally processed in a rounding manner. However, it should be understood by those skilled in the art that the definitions of the data, the bits and/or the symbols in the first table are only examples of the present application, and the definitions of the data, the bits and/or the symbols in the first table may be adjusted according to the practical application.
In step 260, the processor 10 regards the first channel code, the second channel code and the compressed reference channel information as an image compression file.
In step 270, the storage device 20 stores the image compressed file.
In one embodiment, the processor 10 may obtain the information like table one from the image compressed file during decompression, for example, the processor 10 may obtain the template number, the first slope, the second slope and the inflection point position of the first channel code from table one, and the processor 10 may reconstruct (decompress) the first channel information, and similarly, the processor 10 may obtain the template number, the first slope, the second slope and the inflection point position of the second channel code from table one, and the processor 10 may reconstruct (decompress) the second channel information. Since the reference channel information is compressed by a known compression method, a decompression method corresponding to the compression method may be used for decompression. Accordingly, the first channel information, the second channel code and the reference channel information can be decompressed smoothly.
In summary, the image compression apparatus and the image compression method according to the present invention consider that the difference between the channel information in the complex image changes, and divide the difference into different regions by analyzing the change pattern of the difference, so as to describe the change rule of the difference by using the slope-dividing region, and further describe the difference more accurately, so that the complex image block is encoded, thereby solving the problem that the traditional encoding algorithm processes the bad partial image block, and improving the overall encoding quality of the image.
Although the present invention has been described with reference to the above embodiments, it should be understood that various changes and modifications can be made by those skilled in the art without departing from the spirit and scope of the invention.
Claims (10)
1. An image compression apparatus comprising:
a processor for receiving an original image file, selecting one of red channel (R-channel) information, green channel (G-channel) information and blue channel (B-channel) information in the original image file as reference channel information, the other two being first channel information and second channel information, respectively, calculating a channel difference between the first channel information and the reference channel information to generate a difference curve, calculating a template difference between the difference curve and each of a plurality of curve templates (patternn), selecting the curve template corresponding to the template difference being the smallest as a first current template, encoding a template number corresponding to the first current template, a reference value corresponding to the first current template, at least one inflection point position corresponding to the first current template, and at least one slope corresponding to the first current template, generating a first channel code, calculating a channel difference between the second channel information and the reference channel information to generate another difference curve, calculating another template difference between the another difference curve and each of the curve templates, selecting the curve template corresponding to the smallest of the another template differences as a second current template, encoding the template number corresponding to the second current template, a reference value corresponding to the second current template, the at least one turning point position corresponding to the second current template, and the at least one slope corresponding to the second current template to generate a second channel code, and regarding the first channel code, the second channel code, and the compressed reference channel information as an image compressed file; and
and the storage device is used for storing the image compressed file.
2. The image compression apparatus according to claim 1, wherein the reference channel information is the red channel information, the first channel information is the green channel information, and the second channel information is the blue channel information.
3. The image compression device as claimed in claim 1, wherein the at least one slope comprises a first slope and a second slope, the at least one inflection point location comprises a first inflection point location, the first slope is calculated by the processor according to the template difference, and the second slope is reconstructed by the processor according to the first inflection point.
4. The image compression apparatus as claimed in claim 1, wherein the at least one slope comprises a first slope, a second slope and a third slope, the at least one inflection point location comprises a first inflection point location and a second inflection point location, the first slope is a base value, the second slope is reconstructed by the processor according to the first inflection point location, and the third slope is reconstructed by the processor according to the second inflection point.
5. The image compression apparatus as claimed in claim 1, wherein the curve templates are used to describe a fixed number of pixels.
6. A method of image compression, comprising:
receiving an original image file;
selecting one of red channel (R-channel) information, green channel (G-channel) information and blue channel (B-channel) information in the original image file as reference channel information, wherein the other two channel information are respectively first channel information and second channel information;
calculating a channel difference between the first channel information and the reference channel information to generate a difference curve;
calculating template differences between the difference curve and each of a plurality of curve templates (patterns), and selecting the curve template corresponding to the template difference which is the smallest as a current template;
coding the sample plate number, the reference value, the position of at least one turning point and at least one slope corresponding to the current sample plate to generate a first channel code;
calculating a channel difference between the second channel information and the reference channel information to generate another difference curve;
calculating a further template difference between the further difference curve and each of the curve templates;
selecting the curve template corresponding to the minimum template difference as a second current template;
coding the sample plate number corresponding to the second current sample plate, the reference value corresponding to the second current sample plate, the at least one turning point position corresponding to the second current sample plate and the at least one slope corresponding to the second current sample plate to generate a second channel code;
regarding the first channel code, the second channel code and the compressed reference channel information as an image compressed file; and
the image compressed file is stored.
7. The image compression method as claimed in claim 6, wherein the reference channel information is the red channel information, the first channel information is the green channel information, and the second channel information is the blue channel information.
8. The image compression method of claim 6, wherein the at least one slope comprises a first slope and a second slope, and the at least one inflection point location comprises a first inflection point location, the image compression method further comprising:
calculating the first slope according to the template difference; and
reconstructing the second slope according to the first turning point.
9. The image compression method as claimed in claim 6, wherein the at least one slope includes a first slope, a second slope and a third slope, the at least one inflection point location includes a first inflection point location and a second inflection point location, the first slope is a base value, the second slope is reconstructed according to the first inflection point location, and the third slope is reconstructed according to the second inflection point.
10. A method as claimed in claim 6, wherein the curve templates are used to describe a fixed number of pixels.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910332787.4A CN110049334B (en) | 2019-04-24 | 2019-04-24 | Image compression device and image compression method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910332787.4A CN110049334B (en) | 2019-04-24 | 2019-04-24 | Image compression device and image compression method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110049334A CN110049334A (en) | 2019-07-23 |
CN110049334B true CN110049334B (en) | 2021-07-23 |
Family
ID=67278978
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910332787.4A Active CN110049334B (en) | 2019-04-24 | 2019-04-24 | Image compression device and image compression method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110049334B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101511025A (en) * | 2009-01-22 | 2009-08-19 | 炬力集成电路设计有限公司 | Method and apparatus for compressing and decompressing image |
CN102740116A (en) * | 2011-04-08 | 2012-10-17 | 索尼公司 | Image property detection |
CN104837014A (en) * | 2013-11-04 | 2015-08-12 | 三星显示有限公司 | Method for compressing image and image processing device |
CN109600595A (en) * | 2017-09-30 | 2019-04-09 | 优酷网络技术(北京)有限公司 | Image processing method and device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP6416060B2 (en) * | 2015-09-02 | 2018-10-31 | 株式会社東芝 | Image compression apparatus, image expansion apparatus, and image transmission system |
-
2019
- 2019-04-24 CN CN201910332787.4A patent/CN110049334B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101511025A (en) * | 2009-01-22 | 2009-08-19 | 炬力集成电路设计有限公司 | Method and apparatus for compressing and decompressing image |
CN102740116A (en) * | 2011-04-08 | 2012-10-17 | 索尼公司 | Image property detection |
CN104837014A (en) * | 2013-11-04 | 2015-08-12 | 三星显示有限公司 | Method for compressing image and image processing device |
CN109600595A (en) * | 2017-09-30 | 2019-04-09 | 优酷网络技术(北京)有限公司 | Image processing method and device |
Non-Patent Citations (1)
Title |
---|
《一种基于色差分析的彩色图像压缩编码新方法》;陈宇拓等;《华南理工大学学报(自然科学版)》;20000430;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN110049334A (en) | 2019-07-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8977066B2 (en) | Image compression using sub-resolution images | |
CN102016829B (en) | The error calculated during reverse discrete cosine transform reduces | |
CN111145090A (en) | Point cloud attribute encoding method, point cloud attribute decoding method, point cloud attribute encoding equipment and point cloud attribute decoding equipment | |
EP0969656B1 (en) | Compression for image boundaries | |
KR101605173B1 (en) | Method for processing an image | |
CN105516540B (en) | The compression method and device of bianry image | |
CN110162290B (en) | Compression method for DeMURA data of OLED screen | |
CN112352431B (en) | Data encoding method, data decoding method, data encoding equipment, data decoding equipment and storage medium | |
CN106375762A (en) | Reference frame data compression method and apparatus | |
KR20210042355A (en) | Video image component prediction method, apparatus and computer storage medium | |
EP3886047A1 (en) | Image data decompression | |
CN110049334B (en) | Image compression device and image compression method | |
WO2017190995A1 (en) | Method and apparatus for encoding/decoding a scalar integer into a parameter representative of a pivot points of a piece-wise linear function. | |
CN114584773A (en) | Image compression device, method, electronic device, and computer-readable storage medium | |
JP2006270325A (en) | Image compression apparatus, image decompression apparatus, image data, image processing method and program | |
EP3896656A1 (en) | Image data compression | |
EP0973338A2 (en) | HVQ compression combined with orthogonal rotation | |
US8331693B2 (en) | Information encoding apparatus and method, information retrieval apparatus and method, information retrieval system and method, and program | |
Park et al. | Rapid generation of the state codebook in side match vector quantization | |
CN113382257B (en) | Encoding method, encoding device, electronic device and computer-readable storage medium | |
Hu et al. | Reversible image steganography for color image quantization based on lossless index coding | |
CN113473150B (en) | Image processing method and device and computer readable storage device | |
JP2872241B2 (en) | Image coding method | |
US11019366B2 (en) | Image compression and decompression using triangulation | |
JPH09186882A (en) | Multi-valued image encoding device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
TA01 | Transfer of patent application right | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20210316 Address after: 201203 3rd floor, building 2, No. 200, zhangheng Road, Pudong New Area pilot Free Trade Zone, Shanghai Applicant after: Gryfield Intelligent Technology Co.,Ltd. Address before: Room 301, 2537 Jinke Road, Zhangjiang High Tech Park, Pudong New Area, Shanghai 201203 Applicant before: Shanghai Zhaoxin Integrated Circuit Co.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |