CN112532981B - Method, apparatus, and computer-readable storage medium for image compression - Google Patents

Method, apparatus, and computer-readable storage medium for image compression Download PDF

Info

Publication number
CN112532981B
CN112532981B CN202011391716.0A CN202011391716A CN112532981B CN 112532981 B CN112532981 B CN 112532981B CN 202011391716 A CN202011391716 A CN 202011391716A CN 112532981 B CN112532981 B CN 112532981B
Authority
CN
China
Prior art keywords
channel
data
hue angle
lch
dct
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
Application number
CN202011391716.0A
Other languages
Chinese (zh)
Other versions
CN112532981A (en
Inventor
廉玉生
胡永乐
曹栩珩
刘金钠
陈颖雯
呼香美
王彩艺
何孜孜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Institute of Graphic Communication
Original Assignee
Beijing Institute of Graphic Communication
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Institute of Graphic Communication filed Critical Beijing Institute of Graphic Communication
Priority to CN202011391716.0A priority Critical patent/CN112532981B/en
Publication of CN112532981A publication Critical patent/CN112532981A/en
Application granted granted Critical
Publication of CN112532981B publication Critical patent/CN112532981B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/186Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a colour or a chrominance component
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
    • H04N19/625Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using discrete cosine transform [DCT]

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • Discrete Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

The embodiment of the application provides a method, equipment and a computer-readable storage medium for image compression, wherein the method comprises the following steps: carrying out lightness, chroma and hue angle LCH color space conversion on the original image, and respectively carrying out Discrete Cosine Transform (DCT) on the converted image on each channel to obtain DCT data of each channel; performing function model quantization on the DCT data of each channel respectively to obtain compressed data of each channel; and respectively carrying out inverse DCT (discrete cosine transform) transformation and LCH (hue, saturation and value) color space inverse transformation on the compressed data of each channel to obtain a compressed image of the original image. According to the method, the original color image is quantized by using the quantization function, so that the quantization process can be adjusted according to the change of the color information of the image during quantization, and the compression quality of the color image is improved.

Description

Method, apparatus, and computer-readable storage medium for image compression
Technical Field
The present application relates to the field of image processing, and in particular, to a method, apparatus, and computer-readable storage medium for image compression.
Background
Among the current still image compression algorithms, the JPEG format (Joint Photographic Experts Group) is the most compressed and is widely used in multimedia and network programs. The compression principle is as follows: firstly, the image is divided into 8*8 image blocks, after the image blocks are subjected to Discrete Cosine Transform (DCT), the low frequency components of the image blocks are concentrated in the upper left corner, the high frequency components of the image blocks are distributed in the lower right corner, and the low frequency components mainly contain the main information of the image. The quantization operation is to divide a value by a corresponding value in the quantization table. Because the value of the upper left corner of the quantization table is small and the value of the lower right corner is large, the purposes of keeping low-frequency components and suppressing high-frequency components are achieved. However, the quantization tables of brightness and chroma used in the quantization of JPEG are fixed and cannot change with the change of image color information, and when the change of image color information is relatively slow, the image data quantized by JPEG still has many information redundancies, resulting in a low image compression rate.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method, an apparatus, and a computer-readable storage medium for image compression, so as to improve the problem that the image compression rate is low due to the fact that the quantization cannot be changed along with the change of image color information in the existing JPEG technology.
In a first aspect, an embodiment of the present application provides a method for image compression, including: carrying out LCH color space conversion on the original image by lightness, chroma and hue angle to obtain an LCH image; respectively performing Discrete Cosine Transform (DCT) on the lightness channel data, the chroma channel data and the hue angle channel data of the LCH image to obtain lightness channel DCT data, chroma channel DCT data and hue angle channel DCT data of the LCH image; performing function model quantization on the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of the LCH image respectively to obtain compressed data of the lightness channel, compressed data of the chroma channel and compressed data of the hue angle channel of the LCH image; respectively carrying out inverse DCT (discrete cosine transformation) on the compressed data of the lightness channel, the compressed data of the chroma channel and the compressed data of the hue angle channel of the LCH image to obtain a compressed LCH image of the original image; and performing LCH color space inverse transformation on the compressed LCH image to obtain a compressed image of the original image.
In the implementation process, the original color image is converted into an LCH color space, DCT discrete cosine transformation is carried out on the image, and the data of the L, C, H three channels after transformation are dequantized by using brightness, chroma and hue angle visual frequency sensitivity characteristic functions, so that the quantized image data is obtained, and the compression of the image data is realized.
With reference to the first aspect, in an embodiment, before the performing Discrete Cosine Transform (DCT) on the luma channel data, chroma channel data, and hue angle channel data of the LCH image, respectively, the method further includes: partitioning the LCH image to obtain a plurality of sub LCH image blocks with the same size; the obtaining of the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of the LCH image by respectively performing Discrete Cosine Transform (DCT) on the lightness channel data, the chroma channel DCT data and the hue angle channel DCT data of the LCH image includes: and respectively performing Discrete Cosine Transform (DCT) on the lightness channel data, the chroma channel data and the hue angle channel data of each sub-LCH image block in the plurality of sub-LCH image blocks to obtain lightness channel DCT data, chroma channel DCT data and hue angle channel DCT data of each sub-LCH image block, wherein the lightness channel DCT data of the LCH image comprises the lightness channel DCT data of all the sub-LCH image blocks, the chroma channel DCT data of the LCH image comprises the chroma channel DCT data of all the sub-LCH image blocks, and the hue angle channel DCT data of the LCH image comprises the hue angle channel DCT data of all the sub-LCH image blocks.
In the implementation process, the LCH image is subjected to blocking processing, and further discrete cosine transform is performed on the data of each sub-LCH image block subjected to the blocking processing on the L, C and the H channel respectively, so that DCT data of each sub-image block on each channel are obtained, the algorithm complexity of the DCT transform can be reduced through the blocking processing, and the image compression efficiency is improved.
With reference to the first aspect, in another implementation manner, the performing function model quantization on the lightness channel DCT data, the chroma channel DCT data, and the hue angle channel DCT data of the LCH image respectively to obtain compressed data of the lightness channel, compressed data of the chroma channel, and compressed data of the hue angle channel of the LCH image includes: and performing function model quantization on the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of each sub-LCH image block respectively to obtain lightness channel compressed data, chroma channel compressed data and hue angle channel compressed data of each sub-LCH image block, wherein the lightness channel compressed data of the LCH image comprises lightness channel compressed data of all sub-LCH image blocks, the chroma channel compressed data of the LCH image comprises chroma channel compressed data of all sub-LCH image blocks, and the hue angle channel compressed data of the LCH image comprises hue angle channel compressed data of all sub-LCH image blocks.
In the implementation process, the DCT data of each subimage block on each channel is subjected to function model quantization, so that the image compression efficiency can be further improved, information insensitive to human eyes is quantized by using the model, information which can be sensitively perceived by the human eyes is reserved, the requirement of the human eyes on image compression is met, and the image quality is improved.
With reference to the first aspect, in another embodiment, the performing inverse DCT on the compressed data of the lightness channel, the compressed data of the chroma channel, and the compressed data of the hue angle channel of the LCH image to obtain a compressed LCH image of the original image includes: and respectively performing inverse DCT (discrete cosine transformation) on the compressed data of the lightness channel, the compressed data of the chroma channel and the compressed data of the hue angle channel of each sub-LCH image block to obtain a compressed LCH image of each sub-LCH image block, wherein the compressed LCH image of the original image comprises compressed LCH images of all sub-LCH image blocks.
In the implementation process, the compressed LCH image of each sub-LCH image block is further obtained by performing inverse DCT transformation on the compressed data of each sub-image block on each channel.
With reference to the first aspect, in another implementation manner, the performing function model quantization on the brightness channel DCT data, the chroma channel DCT data, and the hue angle channel DCT data of each sub-LCH image block respectively to obtain the compressed brightness channel data, the compressed chroma channel data, and the compressed hue angle channel data of each sub-LCH image block includes: performing function model quantization on the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of each sub-LCH image block respectively to obtain the data after lightness channel quantization, the data after chroma channel quantization and the data after hue angle channel quantization of each sub-LCH image block; and respectively carrying out threshold processing on the data after brightness channel quantization, the data after chroma channel quantization and the data after hue angle channel quantization of each sub-LCH image block to obtain the data after brightness channel compression, the data after chroma channel compression and the data after hue angle channel compression of each sub-LCH image block.
With reference to the first aspect, in another embodiment, the performing function model quantization on the lightness channel DCT data, the chroma channel DCT data, and the hue angle channel DCT data of the LCH image respectively to obtain compressed lightness channel data, compressed chroma channel data, and compressed hue angle channel data of the LCH image includes: performing function model quantization on the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of the LCH image respectively to obtain the quantized data of the lightness channel, the quantized data of the chroma channel and the quantized data of the hue angle channel of the LCH image; and respectively carrying out threshold processing on the data after the lightness channel quantization, the data after the chroma channel quantization and the data after the hue angle channel quantization of the LCH image to obtain the data after the lightness channel compression, the data after the chroma channel compression and the data after the hue angle channel compression of the LCH image.
In the implementation process, the data of the image after quantization on each channel is subjected to threshold processing, partial high-frequency information which can not be distinguished by human eyes can be changed into zero after quantization and threshold processing, the purposes of keeping low-frequency components and restraining high-frequency components are achieved, the redundancy of the compressed image is reduced, and the space required for storing the data and the time used for transmission in the image compression process are further reduced.
With reference to the first aspect, in another implementation manner, before the performing function model quantization on the lightness channel DCT data, the chroma channel DCT data, and the hue angle channel DCT data of each sub-LCH image block respectively to obtain the compressed lightness channel data, the compressed chroma channel data, and the compressed hue angle channel data of each sub-LCH image block, the method further includes: respectively obtaining hue angle values of each pixel point of each sub-LCH image block in a lightness channel, a chroma channel and a hue angle channel, wherein one pixel point of each sub-LCH image block in each channel corresponds to one hue angle value; determining a hue angle center corresponding to each pixel point from a plurality of preset hue angle centers according to the hue angle value of each pixel point; determining the weight of each hue angle center in the plurality of hue angle centers according to the number of pixel points corresponding to each hue angle center in the plurality of hue angle centers in each sub-LCH image block; and performing weighted accumulation on the function model corresponding to each hue angle center according to the weight of each hue angle center to obtain the function model of each sub-LCH image block on each channel.
With reference to the first aspect, in another implementation manner, before the performing function model quantization on the lightness channel DCT data, the chroma channel DCT data, and the hue angle channel DCT data of the LCH image respectively to obtain compressed lightness channel data, compressed chroma channel data, and compressed hue angle channel data of the LCH image, the method further includes: respectively obtaining hue angle values of all pixel points of the LCH image in a lightness channel, a chroma channel and a hue angle channel, wherein one pixel point of the LCH image in each channel corresponds to one hue angle value; determining a hue angle center corresponding to each pixel point from a plurality of preset hue angle centers according to the hue angle value of each pixel point; determining a weight for each of the plurality of hue angle centers based on a number of pixels in the LCH image corresponding to each of the plurality of hue angle centers; and performing weighted accumulation on the function model corresponding to each hue angle center according to the weight of each hue angle center to obtain the function model of the LCH image on each channel.
In the implementation process, the function weight corresponding to each color angle modulation center on each channel is determined according to the color tone angle value of each pixel point in the image, and the final quantization function model is determined according to the function weight, so that the change sensitivity of human eyes to lightness, chroma and color tone angle is fully considered in the image data quantization process, and the image data is subjected to adaptive filtering processing according to the visual frequency sensitivity characteristic function model of lightness, hue and chroma, so that the compressed image is more in line with the visual characteristics of human eyes.
With reference to the first aspect, in another implementation manner, the performing function model quantization on the brightness channel DCT data, the chroma channel DCT data, and the hue angle channel DCT data of each sub-LCH image block respectively to obtain the brightness channel compressed data, the chroma channel compressed data, and the hue angle channel compressed data of each sub-LCH image block includes: performing brightness visual frequency sensitivity characteristic function model quantization on the brightness channel DCT data of each sub-LCH image block to obtain compressed brightness channel data of each sub-LCH image block; performing chroma visual frequency sensitivity characteristic function model quantization on the chroma channel DCT data of each sub-LCH image block to obtain chroma channel compressed data of each sub-LCH image block; and performing hue angle visual frequency sensitive characteristic function model quantization on the hue angle channel DCT data of each sub-LCH image block to obtain hue angle channel compressed data of each sub-LCH image block.
With reference to the first aspect, in another implementation manner, the performing function model quantization on the lightness channel DCT data, the chroma channel DCT data, and the hue angle channel DCT data of the LCH image respectively to obtain compressed data of the lightness channel, compressed data of the chroma channel, and compressed data of the hue angle channel of the LCH image includes: performing brightness visual frequency sensitivity characteristic function model quantization on brightness channel DCT data of the LCH image to obtain compressed data of a brightness channel of the LCH image; performing visual frequency sensitivity characteristic function model quantization of chroma on chroma channel DCT data of the LCH image to obtain chroma channel compressed data of the LCH image; and performing visual frequency sensitive characteristic function model quantization of hue angles on the hue angle channel DCT data of the LCH image to obtain hue angle channel compressed data of the LCH image.
In the implementation process, the visual frequency sensitivity characteristic function model corresponding to each channel is quantized on the data subjected to DCT conversion of each channel of the image, so that the adaptive filtering processing of the image data can be realized, the image data can be changed according to the change of the color information of the image, and the color image compression quality is improved.
In a second aspect, an embodiment of the present application provides an apparatus for image compression, including: the spatial conversion module is used for carrying out LCH color spatial conversion on the lightness, chroma and hue angle of the original image to obtain an LCH image; the processing module is used for respectively carrying out Discrete Cosine Transform (DCT) on the lightness channel data, the chroma channel data and the hue angle channel data of the LCH image to obtain the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of the LCH image; the compression module is used for respectively carrying out function model quantization on lightness channel DCT data, chroma channel DCT data and hue angle channel DCT data of the LCH image to obtain lightness channel compressed data, chroma channel compressed data and hue angle channel compressed data of the LCH image; the processing module is further used for respectively carrying out inverse DCT (discrete cosine transformation) on the compressed data of the lightness channel, the compressed data of the chroma channel and the compressed data of the hue angle channel of the LCH image to obtain a compressed LCH image of the original image; the spatial conversion module is further configured to perform LCH color spatial inverse conversion on the compressed LCH image to obtain a compressed image of the original image.
With reference to the second aspect, in an embodiment, before the processing module is configured to perform Discrete Cosine Transform (DCT) on the luma channel data, chroma channel data, and hue angle channel data of the LCH image, respectively, the processing module is further configured to: partitioning the LCH image to obtain a plurality of sub LCH image blocks with the same size; the processing module is specifically configured to: and respectively performing Discrete Cosine Transform (DCT) on the lightness channel data, the chroma channel data and the hue angle channel data of each sub-LCH image block in the plurality of sub-LCH image blocks to obtain lightness channel DCT data, chroma channel DCT data and hue angle channel DCT data of each sub-LCH image block, wherein the lightness channel DCT data of the LCH image comprises the lightness channel DCT data of all the sub-LCH image blocks, the chroma channel DCT data of the LCH image comprises the chroma channel DCT data of all the sub-LCH image blocks, and the hue angle channel DCT data of the LCH image comprises the hue angle channel DCT data of all the sub-LCH image blocks.
With reference to the second aspect, in another embodiment, the compression module is specifically configured to: and performing function model quantization on the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of each sub-LCH image block respectively to obtain lightness channel compressed data, chroma channel compressed data and hue angle channel compressed data of each sub-LCH image block, wherein the lightness channel compressed data of the LCH image comprises lightness channel compressed data of all sub-LCH image blocks, the chroma channel compressed data of the LCH image comprises chroma channel compressed data of all sub-LCH image blocks, and the hue angle channel compressed data of the LCH image comprises hue angle channel compressed data of all sub-LCH image blocks.
With reference to the second aspect, in another embodiment, the processing module is specifically configured to: and respectively performing inverse DCT (discrete cosine transformation) on the compressed data of the lightness channel, the compressed data of the chroma channel and the compressed data of the hue angle channel of each sub-LCH image block to obtain a compressed LCH image of each sub-LCH image block, wherein the compressed LCH image of the original image comprises compressed LCH images of all sub-LCH image blocks.
With reference to the second aspect, in another embodiment, the compression module is specifically configured to: performing function model quantization on the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of each sub-LCH image block respectively to obtain the data after lightness channel quantization, the data after chroma channel quantization and the data after hue angle channel quantization of each sub-LCH image block; and respectively carrying out threshold processing on the data after brightness channel quantization, the data after chroma channel quantization and the data after hue angle channel quantization of each sub-LCH image block to obtain the data after brightness channel compression, the data after chroma channel compression and the data after hue angle channel compression of each sub-LCH image block.
With reference to the second aspect, in another embodiment, the compression module is specifically configured to: performing function model quantization on the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of the LCH image respectively to obtain the quantized data of the lightness channel, the quantized data of the chroma channel and the quantized data of the hue angle channel of the LCH image; and respectively carrying out threshold processing on the data after the lightness channel quantization, the data after the chroma channel quantization and the data after the hue angle channel quantization of the LCH image to obtain the data after the lightness channel compression, the data after the chroma channel compression and the data after the hue angle channel compression of the LCH image.
With reference to the second aspect, in another embodiment, the compression module is further configured to: respectively obtaining hue angle values of each pixel point of each sub-LCH image block in a lightness channel, a chroma channel and a hue angle channel, wherein one pixel point of each sub-LCH image block in each channel corresponds to one hue angle value; determining a hue angle center corresponding to each pixel point from a plurality of preset hue angle centers according to the hue angle value of each pixel point; determining a weight of each hue angle center of the plurality of hue angle centers according to the number of pixel points corresponding to each hue angle center of the plurality of hue angle centers in each sub-LCH image block; and performing weighted accumulation on the function model corresponding to each hue angle center according to the weight of each hue angle center to obtain a function model of each sub-LCH image block on each channel.
With reference to the second aspect, in another embodiment, the compression module is further configured to: respectively obtaining hue angle values of all pixel points of the LCH image in a lightness channel, a chroma channel and a hue angle channel, wherein one pixel point of the LCH image in each channel corresponds to one hue angle value; determining a hue angle center corresponding to each pixel point from a plurality of preset hue angle centers according to the hue angle value of each pixel point; determining a weight for each of the plurality of hue angle centers based on a number of pixels in the LCH image corresponding to each of the plurality of hue angle centers; and performing weighted accumulation on the function model corresponding to each hue angle center according to the weight of each hue angle center to obtain the function model of the LCH image on each channel.
With reference to the second aspect, in another embodiment, the compression module is further configured to: performing brightness visual frequency sensitivity characteristic function model quantization on brightness channel DCT data of each sub-LCH image block to obtain compressed brightness channel data of each sub-LCH image block; performing chroma visual frequency sensitivity characteristic function model quantization on the chroma channel DCT data of each sub-LCH image block to obtain chroma channel compressed data of each sub-LCH image block; and performing hue angle visual frequency sensitive characteristic function model quantization on the hue angle channel DCT data of each sub-LCH image block to obtain hue angle channel compressed data of each sub-LCH image block.
With reference to the second aspect, in another embodiment, the compression module is further configured to: performing brightness visual frequency sensitivity characteristic function model quantization on brightness channel DCT data of the LCH image to obtain compressed data of a brightness channel of the LCH image; performing chroma visual frequency sensitivity characteristic function model quantization on chroma channel DCT data of the LCH image to obtain chroma channel compressed data of the LCH image; and performing visual frequency sensitive characteristic function model quantization of hue angles on the hue angle channel DCT data of the LCH image to obtain hue angle channel compressed data of the LCH image.
In a third aspect, an embodiment of the present application provides an apparatus for image compression, including a processor, a memory, and a bus, where the processor is connected to the memory through the bus, and the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method as provided in the first aspect are executed.
In a fourth aspect, embodiments of the present application provide a readable storage medium, on which a computer program is stored, where the computer program, when executed by a server, implements the steps in the method as provided in the first aspect.
Additional features and advantages of the present application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the present application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a flowchart of a method for image compression according to an embodiment of the present application;
FIG. 2 is a block diagram of an apparatus for image compression according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an apparatus for image compression according to an embodiment of the present disclosure.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not construed as indicating or implying relative importance.
Referring to fig. 1, fig. 1 is a flowchart of a method for image compression according to an embodiment of the present application, where the method can be applied to the apparatus 200 for image compression shown in fig. 2, and specifically, the method shown in fig. 1 includes:
110, LCH color space conversion of the original image.
Performing LCH color space conversion on the original image to obtain an LCH image;
it should be noted that, in the embodiment of the present application, the LCH color space is selected as the basis to compress the original color image, where L is the lightness of the color, C is the chroma of the color, and H is the hue angle of the color.
In one embodiment, the original color image is color space converted into an LCH image, wherein the LCH image includes three channels of lightness L, chroma C, and hue angle H.
As an embodiment, the image data compression flow of each channel is described by a color RGB image.
Firstly, converting an original color image into an LCH color space, performing 8*8 size sub-block division, and taking a sub-image block as an example, obtaining image data of each pixel point L, C and an H channel of the sub-image block.
After conversion, the sub image block C channel image data is shown in table 1.
TABLE 1 sub-image Block C channel image data
Figure BDA0002810449790000121
After conversion, the image data of the H channel of the subimage block is shown in table 2.
TABLE 2 subimage Block H-channel image data
Figure BDA0002810449790000122
120, DCT transformation.
Respectively carrying out Discrete Cosine Transform (DCT) on lightness channel data, chroma channel data and hue angle channel data of the LCH image to obtain lightness channel DCT data, chroma channel DCT data and hue angle channel DCT data of the LCH image; before performing Discrete Cosine Transform (DCT) on lightness channel data, chroma channel data and hue angle channel data of the LCH image respectively, the method further comprises the following steps of:
partitioning the LCH image to obtain a plurality of sub LCH image blocks with the same size; the method for obtaining the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of the LCH image by respectively carrying out Discrete Cosine Transform (DCT) on the lightness channel data, the chroma channel data and the hue angle channel data of the LCH image comprises the following steps: and respectively performing Discrete Cosine Transform (DCT) on the lightness channel data, the chroma channel data and the hue angle channel data of each sub-LCH image block in the plurality of sub-LCH image blocks to obtain lightness channel DCT data, chroma channel DCT data and hue angle channel DCT data of each sub-LCH image block, wherein the lightness channel DCT data of the LCH image comprises the lightness channel DCT data of all the sub-LCH image blocks, the chroma channel DCT data of the LCH image comprises the chroma channel DCT data of all the sub-LCH image blocks, and the hue angle channel DCT data of the LCH image comprises the hue angle channel DCT data of all the sub-LCH image blocks.
As an embodiment, the L channel data, the C channel data, and the H channel data of the LCH image after LCH color space conversion are respectively subjected to DCT discrete cosine transform to obtain L channel DCT data, C channel DCT data, and H channel DCT data.
As an embodiment, the LCH image after LCH color space conversion is processed by blocking to obtain a plurality of sub-LCH image blocks with the same size, and then the L-channel data, C-channel data, and H-channel data of each sub-image block after blocking are respectively subjected to DCT discrete cosine transform to obtain the L-channel DCT data, C-channel DCT data, and H-channel DCT data of each sub-image block.
It should be noted that the DCT data represent data obtained by DCT transforming an image, which is obtained by LCH color space converting an original image, on L, C, H channels, respectively.
It should be noted that the L-channel DCT data includes L-channel DCT data of all sub image blocks, the C-channel DCT data includes C-channel DCT data of all sub image blocks, and the H-channel DCT data includes H-channel DCT data of all sub image blocks.
And performing discrete cosine transform on the channel data of the sub-image block C, wherein the transformed data is shown in table 3.
TABLE 3 data of sub-image block C channel image data after discrete cosine transform
Figure BDA0002810449790000131
130, function model quantization.
Performing function model quantization on the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of the LCH image respectively to obtain compressed data of the lightness channel, compressed data of the chroma channel and compressed data of the hue angle channel of the LCH image; the method for quantizing the brightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of the LCH image by the function model respectively to obtain the compressed data of the brightness channel, the compressed data of the chroma channel and the compressed data of the hue angle channel of the LCH image comprises the following steps: and respectively carrying out function model quantization on lightness channel DCT data, chroma channel DCT data and hue angle channel DCT data of each sub LCH image block to obtain lightness channel compressed data, chroma channel compressed data and hue angle channel compressed data of each sub LCH image block, wherein the lightness channel compressed data of the LCH image comprises lightness channel compressed data of all sub LCH image blocks, the chroma channel compressed data of the LCH image comprises chroma channel compressed data of all sub LCH image blocks, and the hue angle channel compressed data of the LCH image comprises hue angle channel compressed data of all sub LCH image blocks.
The method comprises the following steps of respectively carrying out function model quantization on lightness channel DCT data, chroma channel DCT data and hue angle channel DCT data of each sub-LCH image block to obtain lightness channel compressed data, chroma channel compressed data and hue angle channel compressed data of each sub-LCH image block, wherein the method comprises the following steps: performing function model quantization on the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of each sub-LCH image block respectively to obtain the data after lightness channel quantization, the data after chroma channel quantization and the data after hue angle channel quantization of each sub-LCH image block; and respectively carrying out threshold processing on the data after lightness channel quantization, the data after chroma channel quantization and the data after hue angle channel quantization of each sub LCH image block to obtain the data after lightness channel compression, the data after chroma channel compression and the data after hue angle channel compression of each sub LCH image block.
The method for quantizing the brightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of the LCH image by the function model respectively to obtain the compressed data of the brightness channel, the compressed data of the chroma channel and the compressed data of the hue angle channel of the LCH image comprises the following steps: performing function model quantization on lightness channel DCT data, chroma channel DCT data and hue angle channel DCT data of the LCH image respectively to obtain lightness channel quantized data, chroma channel quantized data and hue angle channel quantized data of the LCH image; and respectively carrying out threshold processing on the data after the lightness channel quantization, the data after the chroma channel quantization and the data after the hue angle channel quantization of the LCH image to obtain the data after the lightness channel compression, the data after the chroma channel compression and the data after the hue angle channel compression of the LCH image.
Before performing function model quantization on the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of each sub-LCH image block respectively to obtain the compressed data of the lightness channel, the compressed data of the chroma channel and the compressed data of the hue angle channel of each sub-LCH image block, the method further comprises the following steps: respectively obtaining hue angle values of each pixel point of each sub-LCH image block in a lightness channel, a chroma channel and a hue angle channel, wherein one pixel point of each sub-LCH image block in each channel corresponds to one hue angle value; determining a hue angle center corresponding to each pixel point from a plurality of preset hue angle centers according to the hue angle value of each pixel point; determining the weight of each hue angle center in the plurality of hue angle centers according to the number of pixel points corresponding to each hue angle center in the plurality of hue angle centers in each sub-LCH image block; and performing weighted accumulation on the function model corresponding to each hue angle center according to the weight of each hue angle center to obtain a function model of each sub-LCH image block on each channel.
Before performing function model quantization on lightness channel DCT data, chroma channel DCT data and hue angle channel DCT data of the LCH image respectively to obtain compressed data of the lightness channel, compressed data of the chroma channel and compressed data of the hue angle channel of the LCH image, the method further comprises the following steps: respectively acquiring hue angle values of pixels of the LCH image in a lightness channel, a chroma channel and a hue angle channel, wherein one pixel of the LCH image in each channel corresponds to one hue angle value; determining a hue angle center corresponding to each pixel point from a plurality of preset hue angle centers according to the hue angle value of each pixel point; determining the weight of each hue angle center in the plurality of hue angle centers according to the number of pixel points corresponding to each hue angle center in the plurality of hue angle centers in the LCH image; and performing weighted accumulation on the function model corresponding to each hue angle center according to the weight of each hue angle center to obtain a function model of the LCH image on each channel.
The method comprises the following steps of respectively carrying out function model quantization on lightness channel DCT data, chroma channel DCT data and hue angle channel DCT data of each sub-LCH image block to obtain lightness channel compressed data, chroma channel compressed data and hue angle channel compressed data of each sub-LCH image block, wherein the method comprises the following steps: performing brightness visual frequency sensitivity characteristic function model quantization on brightness channel DCT data of each sub-LCH image block to obtain compressed brightness channel data of each sub-LCH image block; performing color visual frequency sensitivity characteristic function model quantization on the color channel DCT data of each sub-LCH image block to obtain compressed color channel data of each sub-LCH image block; and performing visual frequency sensitive characteristic function model quantization of hue angles on the hue angle channel DCT data of each sub-LCH image block to obtain hue angle channel compressed data of each sub-LCH image block.
The method for quantizing the brightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of the LCH image by the function model respectively to obtain the compressed data of the brightness channel, the compressed data of the chroma channel and the compressed data of the hue angle channel of the LCH image comprises the following steps: performing brightness visual frequency sensitivity characteristic function model quantization on brightness channel DCT data of the LCH image to obtain brightness channel compressed data of the LCH image; performing chrominance visual frequency sensitivity characteristic function model quantization on the DCT data of the chrominance channel of the LCH image to obtain compressed data of the chrominance channel of the LCH image;
and performing visual frequency sensitive characteristic function model quantization of hue angles on the hue angle channel DCT data of the LCH image to obtain hue angle channel compressed data of the LCH image.
As an embodiment, when the LCH image is not subjected to the blocking processing, the DCT data subjected to DCT discrete cosine transform is quantized by using a function model to obtain quantized data, a threshold is set, and the number lower than the threshold is set to zero to obtain compressed data of the original image.
Specifically, L-channel DCT data of an LCH image are quantized by using a visual frequency sensitivity characteristic function model of lightness to obtain quantized data of an L channel, a threshold value is set, and the number lower than the threshold value is set to be zero to obtain compressed data of the L channel;
meanwhile, quantizing C channel DCT data of the LCH image by using a visual frequency sensitivity characteristic function model of chroma to obtain quantized C channel data, setting a threshold, and setting the number lower than the threshold to be zero to obtain compressed C channel data;
and meanwhile, quantizing the H-channel DCT data of the LCH image by using a visual frequency sensitivity characteristic function model of hue angle to obtain H-channel quantized data, setting a threshold, and setting the number lower than the threshold to be zero to obtain compressed data of the H channel.
As an embodiment, when an LCH image is subjected to blocking processing to obtain a plurality of sub-LCH image blocks, the DCT data of each sub-LCH image block subjected to DCT discrete cosine transform is quantized by using a function model to obtain quantized data of each sub-LCH image block, a threshold is set, and the number lower than the preset threshold of each channel is set to zero to obtain compressed data of each sub-LCH image block.
Specifically, the L-channel DCT data of each sub-LCH image block are quantized using a visual frequency sensitivity function model of lightness to obtain quantized L-channel data of each sub-LCH image block, a threshold is set, and the number lower than a preset threshold of the L-channel is set to zero to obtain compressed L-channel data of each sub-LCH image block.
And meanwhile, quantizing the C-channel DCT data of each sub-LCH image block by using a chroma visual frequency sensitivity characteristic function model to obtain quantized C-channel data of each sub-LCH image block, setting a threshold, and setting the number lower than the preset threshold of the C-channel to be zero to obtain compressed C-channel data of each sub-LCH image block.
And meanwhile, quantizing the H-channel DCT data of each sub-LCH image block by using a visual frequency sensitivity characteristic function model of hue angle to obtain the H-channel quantized data of each sub-LCH image block, setting a threshold, and setting the number lower than the preset threshold of the H channel to be zero to obtain the compressed data of the H channel of each sub-LCH image block.
It should be noted that the compressed data of the L channel includes compressed data of L channels of all sub LCH image blocks; the compressed data of the C channel comprises compressed data of the C channel of all the sub-LCH image blocks; the compressed data of the H-channel includes compressed data of the H-channel of all the sub-LCH image blocks.
The method for constructing and selecting the visual frequency sensitivity characteristic function model of each channel of 8*8 sub-image blocks is as follows:
constructing a basic mathematical model of a human eye color visual characteristic function, wherein the model is as follows:
CS=a[exp(-b·f)-exp(-c·f)]
wherein, a, b and c represent model parameters respectively, and f represents the spatial frequency of the image.
In LCH color space, establishing visual frequency sensitivity characteristic function model CSF about human eye to lightness L Color visual frequency sensitivity characteristic function model CSF C Visual frequency sensitivity characteristic function model CSF of sum hue angle H
Visual frequency sensitivity characteristic function model CSF at lightness L In the test, six groups of images of sine wave color ripples are set, and the tested spatial frequency range is as follows: 0.24-20CPD (period/degree). The frequency is divided into two sections: 0.24-0.428 CPD (period/degree) and 0.428-20 CPD (period/degree). The frequency intervals of the front and the back sections of tests are respectively as follows: 0.238CPD (period/degree) and 0.476CPD (period/degree), 25 different spatial frequency values are taken for testing, and each group of ripple images is arranged in sequence according to the spatial frequency, that is, each group contains 25 images. The hue angles of the six groups of moire images were set to 30 °, 90 °, 150 °, 210 °, 270 °, and 330 °, respectively, the chroma was set to a fixed value of 50, and the lightness center was set to 50.
During testing, the group of ripple images with the hue angle of 30 ° are sequentially displayed on the display, the spatial frequency of one ripple image is fixed when the display displays the ripple image, the brightness component of the ripple image is changed around the brightness center according to a sine wave, and the maximum brightness L in the ripple image is continuously changed MAX And minimum lightness L MIN Until the viewer can exactly distinguish the brightness difference, the contrast at this time is the exactly distinguishable contrast corresponding to the spatial frequency as
Figure BDA0002810449790000181
And calculating the brightness contrast sensitivity->
Figure BDA0002810449790000182
Then CS L That is, the brightness contrast sensitivity data corresponding to the spatial frequency. The display continues to display the next image, and the brightness contrast sensitivity data corresponding to the next spatial frequency is calculated in the same way. When the display of all 25 images is finished, brightness contrast sensitivity data corresponding to different spatial frequencies under a hue angle of 30 degrees are obtained.
And sequentially displaying the ripple images under the other five groups of hue angles on the display by the same method, and calculating brightness contrast sensitivity data corresponding to different spatial frequencies under each hue angle.
It should be noted that, in the embodiment of the present application, the sinusoidal wave color moire images are not limited to six groups, and may be ten groups, the hue angles of the ten groups of moire images are set to 36 °, 72 °, 108 °, 144 °, 180 °, 216 °, 252 °, 288 °, 324 °, and 360 °, or may be four groups, the hue angles of the four groups of moire images are set to 90 °, 180 °, 270 °, and 360 °, or may be twelve groups, and the hue angles of the ten groups of moire images are set to 15 °, 45 °, 75 °, 105 °, 135 °, 165 °, 195 °, 225 °, 255 °, 285 °, 315 °, and 345 °, but the embodiment of the present application is not limited thereto; the number of spatial frequency values is not limited to 25, and may be 30, 40, or 45, but the present embodiment is not limited thereto.
Visual frequency sensitivity characteristic function model CSF in chroma C In the test of (2), six groups of sine ripple images are also set, and the hue angle corresponding to each group of ripple images is also the same, and the spatial frequency range of the test is as follows: 0.119-19.05CPD. The frequency is divided into two sections: 0.119 to 0.952CPD and 0.952 to 19.05CPD. The frequency intervals of the front and the back sections of tests are respectively as follows: 0.119CPD and 0.476CPD, together with 46 different spatial frequency values, were tested, thus CSF C Each set of moire images included 46 images when tested and were arranged in order of spatial frequency.
What needs to be changed for this test is the chroma component. Therefore, the brightness of all the ripple images is set as a fixed value of 50, the chroma center is set as 50, when each image is displayed by the display, the chroma components of the image change according to a sine wave around the chroma center, and the maximum chroma C in the image is continuously changed MAX And minimum chroma C MIN Straight, straightWhen the observer can exactly distinguish the chroma difference, the contrast at this time is the corresponding exactly distinguishable contrast at the spatial frequency, which is
Figure BDA0002810449790000191
And calculates a color contrast sensitivity>
Figure BDA0002810449790000192
Then CS C That is, the corresponding color contrast sensitivity data at that spatial frequency. When the display of all 46 images is finished, the data of the chroma contrast sensitivity corresponding to different spatial frequencies under the hue angle of 30 degrees are obtained.
And sequentially displaying the ripple images under the other five groups of hue angles on the display by the same method, and calculating the chroma contrast sensitivity data corresponding to different spatial frequencies under each hue angle.
It should be noted that, in the embodiment of the present application, the sinusoidal wave color moire images are not limited to six groups, and may be ten groups, the hue angles of the ten groups of moire images are set to 36 °, 72 °, 108 °, 144 °, 180 °, 216 °, 252 °, 288 °, 324 °, and 360 °, or may be four groups, the hue angles of the four groups of moire images are set to 90 °, 180 °, 270 °, and 360 °, or may be twelve groups, and the hue angles of the ten groups of moire images are set to 15 °, 45 °, 75 °, 105 °, 135 °, 165 °, 195 °, 225 °, 255 °, 285 °, 315 °, and 345 °, but the embodiment of the present application is not limited thereto; the number of spatial frequency values is not limited to 46, and may be 30, 50, or 60, but the embodiment of the present application is not limited thereto.
Visual frequency sensitivity characteristic function model CSF at hue angle H Unlike the lightness and chroma tests, in this test, 12 hue angle centers are used, namely: with 15 °, 45 °, 75 °, 105 °, 135 °, 165 °, 195 °, 225 °, 255 °, 285 °, 315 °, 345 °, 12 groups of moire images are set. The spatial frequency range tested was: 0.058 to 19.05CPD. The frequency is divided into two sections: 0.058 to 0.407CPD and 0.952 to 19.05CPD. The frequency intervals of the front and rear two-section test are respectively as follows: 0.058CPD and0.476CPD, a total of 46 different spatial frequency values were taken for testing.
First, the hue angle contrast formula is explained
Figure BDA0002810449790000201
H START And H END Respectively an initial value and an end value, Δ H, offset from the center of the hue angle MAX The maximum deviation value of the hue angle center. In calculating the hue angle contrast, it is necessary to set different maximum deviation values Δ H for different hue angle centers MAX . When the hue angle center is 15 DEG or 345 DEG, delta H MAX =15 °, the range of the hue angle change is [0 °,30 ° ] respectively]And [330 °,360 ° ]]At the time of test, 30 images were each generated as 1 sequence at 1 ° intervals at each spatial frequency. Then the 46 spatial frequencies together generate 1380 images to observe. And for other hue angle centers, Δ H MAX =20 °, then a total of 1840 images are generated for observation for the 46 spatial frequencies. What needs to be changed in this test is the hue angle component, then the brightness of all images is set to 50, and to ensure that all colors are within the display gamut, the chroma of the images with hue angle centers of 15 °, 315 °, 345 ° is set to 60, the chroma of the images with hue angle centers of 45 °, 285 ° is set to 50, and the chroma of the images with the other 7 hue angle centers is set to 40.
When a set of images centered at 15 ° is displayed on the display, sequential images at a first spatial frequency are first displayed in sequence, each image having a corresponding hue angle start value and end value. When the observer can exactly distinguish the difference for a certain image, the contrast C at the moment can be calculated according to the hue angle initial value and the hue angle end value of the image H Then, again
Figure BDA0002810449790000202
The corresponding hue angle contrast sensitivity data at this spatial frequency is calculated. When the sequence images of 46 spatial frequencies are all displayed and the calculation is finished, hue angle contrast sensitivity data corresponding to different spatial frequencies at the hue angle center of 15 ° are obtained.
Similarly, the images of other hue angle centers are displayed and calculated according to the above method, and the contrast sensitivity data corresponding to different spatial frequencies under 12 kinds of hue angle centers can be obtained.
It should be noted that, in the embodiment of the present application, the number of hue angle centers is not limited to 12, and may be ten, that is: 36 °, 72 °, 108 °, 144 °, 180 °, 216 °, 252 °, 288 °, 324 °, and 360 °, four sets are also possible, namely: 90 °, 180 °, 270 °, and 360 °, but the embodiments of the present application are not limited thereto; the number of spatial frequency values is not limited to 46, and may be 30, 50, or 60, but the embodiment of the present application is not limited thereto.
After contrast sensitivity data under all color angle modulation centers of three components of lightness, chroma and hue angle are obtained, fitting is carried out on the relation between the contrast sensitivity data and spatial frequency, and thus a visual frequency sensitive characteristic function model CSF of lightness is obtained L Visual frequency sensitivity characteristic function model CSF of chroma C Visual frequency sensitivity characteristic function model CSF of sum hue angle H
It should be noted that, in the fitting process, at least one of an exponential function, a logarithmic function, and a power function may be used, but the embodiment of the present application is not limited thereto.
And obtaining visual frequency sensitivity characteristic models of the sub image blocks in L, C and an H channel respectively according to the construction method of each channel model.
In the case of constructing the lightness visual frequency sensitivity characteristic model, since the difference in lightness contrast sensitivity is not significant at different hue angles, the lightness contrast sensitivity data at each hue angle is averaged to construct 1 lightness visual characteristic model:
CS L =163.6*[exp(-0.1347*f)-exp(-1.187*f)]
the parameters of the chroma visual frequency sensitivity characteristic mathematical model constructed under the chroma channel are shown in table 4:
TABLE 4 chroma visual frequency sensitivity characteristic mathematical model parameters constructed under chroma channel
Figure BDA0002810449790000211
And constructing a chroma visual frequency sensitivity characteristic function model under each chroma angle of the chroma channel according to the chroma visual frequency sensitivity characteristic mathematical model parameters constructed under the chroma channel.
In the same way, an excellent hue angle visual frequency sensitivity characteristic function model is constructed according to hue angle visual frequency sensitivity characteristic mathematical model parameters constructed under a hue angle channel.
Since function models at a plurality of hue angles are established in each channel, before function model quantization is performed on image data, the function models need to be selected, and the function model selection method is as follows:
and respectively counting tone angle values of each pixel point of each subblock of the image under each channel, selecting a tone angle center close to the tone angle value according to the tone angle value of the point, determining the weight of the function model corresponding to each tone angle center in the subblock according to the weight of each tone angle center in the subblock, and performing weighted accumulation on each function model according to the weight of the function model corresponding to each tone angle center in each subblock, thereby obtaining the function model of each subblock.
Namely, the contrast sensitivity of a sub image block after being weighted is calculated by the formula
Figure BDA0002810449790000221
Wherein V represents three channels L, C, H, i represents the serial number of the function model, m is the number of the function models in each channel, in this embodiment, L and C channels m =6, and m =12,n in H channel i Representing the number of times the hue angle center corresponding to the ith function model appears in the image block.
It should be noted that the number of function models in each channel corresponds to the number of hue angle centers during model test, and it is not limited herein that the number of function models of the L and C channels is 6, and the number of function models of the H channel is 12, and the number may be adjusted accordingly according to the test requirements.
After the contrast sensitivity data of a certain channel is calculated by using the contrast sensitivity calculation formula, sensitivity normalization processing is carried out to obtain CS = CS/CS MAX Wherein CS is MAX Representing the maximum value of the contrast sensitivity data of a certain channel, and finally obtaining the quantized data of the image block.
Similarly, each image block is quantized to obtain quantized data of the image.
As an embodiment, the hue angle values of each pixel point of the sub-image block C channel are counted to obtain the weight of each hue angle center of the function model as shown in table 5.
TABLE 5 weight data for each hue angle center of sub-image Block C channel function model
Figure BDA0002810449790000222
Utilizing the constructed chroma visual frequency sensitivity characteristic model and the weighting formula
Figure BDA0002810449790000231
The chroma channel quantization data after the image block normalization is calculated, and meanwhile, in order to retain the dc component, the data in the upper left corner is set to 1, as shown in table 6.
TABLE 6 quantized data of sub-image block C channel normalized
Figure BDA0002810449790000232
The quantized data after the sub-image chroma channel normalization is multiplied by the data (i.e., the data in table 3) after the sub-image chroma channel image data is subjected to discrete cosine transform, the threshold is set to be 2, the number lower than the threshold is set to be zero, and the compressed data after the sub-image chroma channel quantization and threshold processing is obtained, as shown in table 7.
TABLE 7 compressed data after C channel quantization and thresholding of sub-image blocks
Figure BDA0002810449790000233
As can be seen from table 7, part of the high frequency information that is hardly distinguishable by human eyes becomes 0 after quantization and threshold processing, and compression of chroma channel image data is achieved.
Similarly, the compressed data of the L channel and the H channel of the image block are obtained by the same method.
140, inverse DCT transform.
Respectively carrying out inverse DCT (discrete cosine transformation) on the compressed data of the lightness channel, the compressed data of the chroma channel and the compressed data of the hue angle channel of the LCH image to obtain a compressed LCH image of an original image; the method comprises the following steps of respectively carrying out inverse DCT (discrete cosine transformation) on compressed data of a lightness channel, compressed data of a chroma channel and compressed data of a hue angle channel of an LCH (liquid Crystal display) image to obtain a compressed LCH image of an original image, wherein the steps of: and respectively performing inverse DCT (discrete cosine transformation) on the compressed data of the lightness channel, the compressed data of the chroma channel and the compressed data of the hue angle channel of each sub-LCH image block to obtain a compressed LCH image of each sub-LCH image block, wherein the compressed LCH image of the original image comprises compressed LCH images of all sub-LCH image blocks.
As an embodiment, when the LCH image is not subjected to the blocking process, the L-channel compressed data, the C-channel compressed data, and the H-channel compressed data of the LCH image are subjected to inverse DCT transform, respectively, to obtain a compressed LCH image of the original image.
As an embodiment, when the LCH image is partitioned to obtain a plurality of sub-LCH image blocks, the L-channel compressed data, the C-channel compressed data, and the H-channel compressed data of each sub-LCH image block are respectively subjected to inverse DCT to obtain a compressed LCH image of each sub-LCH image block.
It should be noted that the compressed LCH image of the original image includes the compressed LCH images of all the sub-LCH image blocks.
150,lch color space inverse transform.
And performing LCH color space inverse transformation on the compressed LCH image to obtain a compressed image of the original image.
As an embodiment, the LCH color space inverse conversion is performed on the compressed LCH image to obtain a compressed image of the original image, thereby completing the compression of the original color image.
And respectively carrying out inverse DCT (discrete cosine transformation) and color space inverse transformation on the compressed data of the sub-image blocks in each channel to obtain a compressed image of the original color RGB image.
Referring to fig. 2, fig. 2 is a block diagram of an apparatus for image compression according to an embodiment of the present disclosure; the apparatus 200 for image compression provided in fig. 2 corresponds to the method described in fig. 1, having functional modules for implementing the method described in fig. 1.
In one embodiment, the apparatus 200 for image compression provided in fig. 2 comprises:
a spatial transform module 210, a processing module 220, and a compression module 230; the spatial conversion module is used for carrying out LCH color spatial conversion on the lightness, chroma and hue angle of the original image to obtain an LCH image; the processing module is used for respectively carrying out Discrete Cosine Transform (DCT) on the lightness channel data, the chroma channel data and the hue angle channel data of the LCH image to obtain the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of the LCH image; the compression module is used for respectively carrying out function model quantization on lightness channel DCT data, chroma channel DCT data and hue angle channel DCT data of the LCH image to obtain compressed data of the lightness channel, compressed data of the chroma channel and compressed data of the hue angle channel of the LCH image; the processing module is also used for respectively carrying out inverse DCT (discrete cosine transformation) on the compressed data of the lightness channel, the compressed data of the chroma channel and the compressed data of the hue angle channel of the LCH image to obtain a compressed LCH image of the original image; the spatial conversion module is further used for performing LCH color spatial inverse conversion on the compressed LCH image to obtain a compressed image of the original image.
Before the processing module is configured to perform Discrete Cosine Transform (DCT) on the lightness channel data, the chroma channel data, and the hue angle channel data of the LCH image, respectively, the processing module is further configured to: partitioning the LCH image to obtain a plurality of sub LCH image blocks with the same size; the processing module is specifically configured to: and respectively performing Discrete Cosine Transform (DCT) on the lightness channel data, the chroma channel data and the hue angle channel data of each sub-LCH image block in the plurality of sub-LCH image blocks to obtain lightness channel DCT data, chroma channel DCT data and hue angle channel DCT data of each sub-LCH image block, wherein the lightness channel DCT data of the LCH image comprises the lightness channel DCT data of all the sub-LCH image blocks, the chroma channel DCT data of the LCH image comprises the chroma channel DCT data of all the sub-LCH image blocks, and the hue angle channel DCT data of the LCH image comprises the hue angle channel DCT data of all the sub-LCH image blocks.
The compression module is specifically configured to: and respectively carrying out function model quantization on the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of each sub-LCH image block to obtain lightness channel compressed data, chroma channel compressed data and hue angle channel compressed data of each sub-LCH image block, wherein the lightness channel compressed data of the LCH image comprises lightness channel compressed data of all sub-LCH image blocks, the chroma channel compressed data of the LCH image comprises chroma channel compressed data of all sub-LCH image blocks, and the hue angle channel compressed data of the LCH image comprises hue angle channel compressed data of all sub-LCH image blocks.
The processing module is specifically configured to: and respectively carrying out inverse DCT (discrete cosine transformation) on the compressed data of the lightness channel, the compressed data of the chroma channel and the compressed data of the hue angle channel of each sub-LCH image block to obtain a compressed LCH image of each sub-LCH image block, wherein the compressed LCH image of the original image comprises compressed LCH images of all sub-LCH image blocks.
The compression module is specifically configured to: performing function model quantization on the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of each sub-LCH image block respectively to obtain the data after lightness channel quantization, the data after chroma channel quantization and the data after hue angle channel quantization of each sub-LCH image block; and respectively carrying out threshold processing on the data after brightness channel quantization, the data after chroma channel quantization and the data after hue angle channel quantization of each sub-LCH image block to obtain the data after brightness channel compression, the data after chroma channel compression and the data after hue angle channel compression of each sub-LCH image block.
The compression module is specifically configured to: performing function model quantization on lightness channel DCT data, chroma channel DCT data and hue angle channel DCT data of the LCH image respectively to obtain lightness channel quantized data, chroma channel quantized data and hue angle channel quantized data of the LCH image; and respectively carrying out threshold processing on the data after the lightness channel quantization, the data after the chroma channel quantization and the data after the hue angle channel quantization of the LCH image to obtain the data after the lightness channel compression, the data after the chroma channel compression and the data after the hue angle channel compression of the LCH image.
The compression module is further to: respectively obtaining hue angle values of each pixel point of each sub-LCH image block in a lightness channel, a chroma channel and a hue angle channel, wherein one pixel point of each sub-LCH image block in each channel corresponds to one hue angle value; determining a hue angle center corresponding to each pixel point from a plurality of preset hue angle centers according to the hue angle value of each pixel point; determining the weight of each hue angle center in the plurality of hue angle centers according to the number of pixel points corresponding to each hue angle center in the plurality of hue angle centers in each sub-LCH image block; and performing weighted accumulation on the function model corresponding to each hue angle center according to the weight of each hue angle center to obtain a function model of each sub-LCH image block on each channel.
The compression module is further to: respectively acquiring hue angle values of pixels of the LCH image in a lightness channel, a chroma channel and a hue angle channel, wherein one pixel of the LCH image in each channel corresponds to one hue angle value; determining a hue angle center corresponding to each pixel point from a plurality of preset hue angle centers according to the hue angle value of each pixel point; determining the weight of each hue angle center in the plurality of hue angle centers according to the number of pixel points corresponding to each hue angle center in the plurality of hue angle centers in the LCH image; and performing weighted accumulation on the function model corresponding to each hue angle center according to the weight of each hue angle center to obtain a function model of the LCH image on each channel.
The compression module is further to: performing brightness visual frequency sensitivity characteristic function model quantization on brightness channel DCT data of each sub-LCH image block to obtain compressed brightness channel data of each sub-LCH image block; performing chroma visual frequency sensitivity characteristic function model quantization on chroma channel DCT data of each sub-LCH image block to obtain chroma channel compressed data of each sub-LCH image block; and performing hue angle visual frequency sensitive characteristic function model quantization on the hue angle channel DCT data of each sub-LCH image block to obtain hue angle channel compressed data of each sub-LCH image block.
The compression module is further to: performing brightness visual frequency sensitivity characteristic function model quantization on brightness channel DCT data of the LCH image to obtain brightness channel compressed data of the LCH image; performing visual frequency sensitivity characteristic function model quantization of chroma on chroma channel DCT data of the LCH image to obtain chroma channel compressed data of the LCH image; and performing visual frequency sensitive characteristic function model quantization of hue angles on the hue angle channel DCT data of the LCH image to obtain hue angle channel compressed data of the LCH image.
It should be noted that the apparatus 200 for image compression provided in fig. 2 can implement the processes related to image compression in the embodiment of the method in fig. 1. The operations and/or functions of the respective modules in the apparatus 200 for image compression are respectively for implementing the corresponding flows in the method embodiment in fig. 1. Reference may be made specifically to the description of the above method embodiments, and a detailed description is appropriately omitted herein to avoid redundancy.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an apparatus for image compression according to an embodiment of the present disclosure, and the apparatus 300 for image compression shown in fig. 3 may include: at least one processor 310, such as a CPU (Central Processing Unit), at least one communication interface 320, at least one memory 330, and at least one communication bus 340. Wherein the communication bus 340 is used for realizing direct connection communication of these components. The communication interface 320 of the device in the embodiment of the present application is used for performing signaling or data communication with other node devices. The memory 330 may be a high-speed RAM (random access memory) memory or a non-volatile memory, such as at least one disk memory. The memory 330 may optionally be at least one memory device located remotely from the aforementioned processor. The memory 330 stores computer readable instructions which, when executed by the processor 310, cause the apparatus to perform the method processes of fig. 1.
An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a server, the computer program implements the method process shown in fig. 1.
In the several embodiments provided in the present application, it should be understood that the disclosed system and method may be implemented in other manners. The above-described system embodiments are merely illustrative, and for example, the division of the system apparatus into only one logical functional division may be implemented in other ways, and for example, a plurality of apparatuses or components may be combined or integrated into another system, or some features may be omitted, or not implemented.
In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (9)

1. A method for image compression, comprising:
carrying out LCH color space conversion on the original image by lightness, chroma and hue angle to obtain an LCH image; respectively obtaining hue angle values of each pixel point of each sub-LCH image block in a lightness channel, a chroma channel and a hue angle channel, wherein one pixel point of each sub-LCH image block in each channel corresponds to one hue angle value; determining a hue angle center corresponding to each pixel point from a plurality of preset hue angle centers according to the hue angle value of each pixel point; determining a weight of each hue angle center of the plurality of hue angle centers according to the number of pixel points corresponding to each hue angle center of the plurality of hue angle centers in each sub-LCH image block; performing weighted accumulation on the function model corresponding to each hue angle center according to the weight of each hue angle center to obtain a function model of each sub-LCH image block on each channel;
performing Discrete Cosine Transform (DCT) on lightness channel data, chroma channel data and hue angle channel data of the LCH image respectively to obtain lightness channel DCT data, chroma channel DCT data and hue angle channel DCT data of the LCH image;
performing function model quantization on the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of the LCH image respectively to obtain compressed data of the lightness channel, compressed data of the chroma channel and compressed data of the hue angle channel of the LCH image;
performing inverse DCT on the compressed data of the lightness channel, the compressed data of the chroma channel and the compressed data of the hue angle channel of the LCH image respectively to obtain a compressed LCH image of the original image;
performing LCH color space inverse transformation on the compressed LCH image to obtain a compressed image of the original image, wherein when the LCH image is not subjected to blocking processing, DCT data subjected to DCT discrete cosine transform are quantized by using a function model to obtain quantized data, a preset threshold is set, the number of the DCT data lower than the preset threshold is set to be zero to obtain the compressed data of the original image, when the LCH image is subjected to blocking processing to obtain a plurality of sub-LCH image blocks,
and quantizing the DCT data of each sub-LCH image block subjected to DCT discrete cosine transform by using a function model to obtain quantized data of each sub-LCH image block, setting a second preset threshold, and setting the number lower than the second preset threshold of each channel to be zero to obtain compressed data of each sub-LCH image block.
2. The method according to claim 1, wherein before the performing Discrete Cosine Transform (DCT) on the luma channel data, chroma channel data, and hue angle channel data of the LCH image, respectively, the method further comprises:
partitioning the LCH image to obtain a plurality of sub LCH image blocks with the same size;
the obtaining of the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of the LCH image by respectively performing Discrete Cosine Transform (DCT) on the lightness channel data, the chroma channel DCT data and the hue angle channel DCT data of the LCH image includes:
and respectively performing Discrete Cosine Transform (DCT) on the lightness channel data, the chroma channel data and the hue angle channel data of each sub-LCH image block in the plurality of sub-LCH image blocks to obtain lightness channel DCT data, chroma channel DCT data and hue angle channel DCT data of each sub-LCH image block, wherein the lightness channel DCT data of the LCH image comprises the lightness channel DCT data of all the sub-LCH image blocks, the chroma channel DCT data of the LCH image comprises the chroma channel DCT data of all the sub-LCH image blocks, and the hue angle channel DCT data of the LCH image comprises the hue angle channel DCT data of all the sub-LCH image blocks.
3. The method according to claim 2, wherein the performing function model quantization on the lightness channel DCT data, chroma channel DCT data, and hue angle channel DCT data of the LCH image to obtain lightness channel compressed data, chroma channel compressed data, and hue angle channel compressed data of the LCH image comprises:
and performing function model quantization on the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of each sub-LCH image block respectively to obtain lightness channel compressed data, chroma channel compressed data and hue angle channel compressed data of each sub-LCH image block, wherein the lightness channel compressed data of the LCH image comprises lightness channel compressed data of all sub-LCH image blocks, the chroma channel compressed data of the LCH image comprises chroma channel compressed data of all sub-LCH image blocks, and the hue angle channel compressed data of the LCH image comprises hue angle channel compressed data of all sub-LCH image blocks.
4. The method according to claim 3, wherein said performing inverse DCT on the compressed data of the lightness channel, the compressed data of the chroma channel and the compressed data of the hue channel of the LCH image to obtain the compressed LCH image of the original image comprises:
and performing inverse DCT (discrete cosine transformation) on the compressed data of the lightness channel, the compressed data of the chroma channel and the compressed data of the hue angle channel of each sub-LCH image block respectively to obtain a compressed LCH image of each sub-LCH image block, wherein the compressed LCH image of the original image comprises compressed LCH images of all sub-LCH image blocks.
5. The method according to claim 3 or 4, wherein the performing function model quantization on the lightness channel DCT data, chroma channel DCT data, and hue angle channel DCT data of each sub-LCH image block to obtain lightness channel compressed data, chroma channel compressed data, and hue angle channel compressed data of each sub-LCH image block comprises:
performing function model quantization on the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of each sub-LCH image block respectively to obtain the data after lightness channel quantization, the data after chroma channel quantization and the data after hue angle channel quantization of each sub-LCH image block;
and respectively carrying out threshold processing on the data after brightness channel quantization, the data after chroma channel quantization and the data after hue angle channel quantization of each sub-LCH image block to obtain the data after brightness channel compression, the data after chroma channel compression and the data after hue angle channel compression of each sub-LCH image block.
6. The method according to claim 5, wherein the performing function model quantization on the lightness channel DCT data, the chroma channel DCT data, and the hue angle channel DCT data of each sub-LCH image block to obtain the lightness channel compressed data, the chroma channel compressed data, and the hue angle channel compressed data of each sub-LCH image block comprises:
performing brightness visual frequency sensitivity characteristic function model quantization on brightness channel DCT data of each sub-LCH image block to obtain compressed brightness channel data of each sub-LCH image block;
performing chroma visual frequency sensitivity characteristic function model quantization on the chroma channel DCT data of each sub-LCH image block to obtain chroma channel compressed data of each sub-LCH image block;
and performing hue angle visual frequency sensitive characteristic function model quantization on the hue angle channel DCT data of each sub-LCH image block to obtain hue angle channel compressed data of each sub-LCH image block.
7. An apparatus for image compression, comprising:
the spatial conversion module is used for carrying out LCH color spatial conversion on the lightness, chroma and hue angle of the original image to obtain an LCH image; respectively obtaining hue angle values of each pixel point of each sub-LCH image block in a lightness channel, a chroma channel and a hue angle channel, wherein one pixel point of each sub-LCH image block in each channel corresponds to one hue angle value; determining a hue angle center corresponding to each pixel point from a plurality of preset hue angle centers according to the hue angle value of each pixel point; determining a weight of each hue angle center of the plurality of hue angle centers according to the number of pixel points corresponding to each hue angle center of the plurality of hue angle centers in each sub-LCH image block; performing weighted accumulation on the function model corresponding to each hue angle center according to the weight of each hue angle center to obtain a function model of each sub-LCH image block on each channel;
the processing module is used for respectively carrying out Discrete Cosine Transform (DCT) on the lightness channel data, the chroma channel data and the hue angle channel data of the LCH image to obtain the lightness channel DCT data, the chroma channel DCT data and the hue angle channel DCT data of the LCH image;
the compression module is used for respectively carrying out function model quantization on lightness channel DCT data, chroma channel DCT data and hue angle channel DCT data of the LCH image to obtain lightness channel compressed data, chroma channel compressed data and hue angle channel compressed data of the LCH image;
the processing module is further used for respectively carrying out inverse DCT (discrete cosine transformation) on the compressed data of the lightness channel, the compressed data of the chroma channel and the compressed data of the hue angle channel of the LCH image to obtain a compressed LCH image of the original image;
the spatial conversion module is further configured to perform LCH color spatial inverse conversion on the compressed LCH image to obtain a compressed image of the original image, wherein when the LCH image is not subjected to blocking processing, DCT data subjected to DCT discrete cosine transform are quantized by using a function model to obtain quantized data, a preset threshold is set, the number of the DCT data lower than the preset threshold is set to zero to obtain compressed data of the original image, when the LCH image is subjected to blocking processing to obtain a plurality of sub-LCH image blocks, DCT data of each sub-LCH image block subjected to DCT discrete cosine transform are quantized by using the function model to obtain quantized data of each sub-LCH image block, a second preset threshold is set, the number of the DCT data lower than the second preset threshold of each channel is set to zero to obtain compressed data of each sub-LCH image block.
8. An apparatus for image compression, comprising:
a processor, a memory, and a bus, the processor being connected to the memory through the bus, the memory storing computer readable instructions for implementing the method of any one of claims 1-6 when the computer readable instructions are executed by the processor.
9. A computer-readable storage medium, having stored thereon a computer program which, when executed by a server, implements the method of any one of claims 1-6.
CN202011391716.0A 2020-12-01 2020-12-01 Method, apparatus, and computer-readable storage medium for image compression Active CN112532981B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011391716.0A CN112532981B (en) 2020-12-01 2020-12-01 Method, apparatus, and computer-readable storage medium for image compression

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011391716.0A CN112532981B (en) 2020-12-01 2020-12-01 Method, apparatus, and computer-readable storage medium for image compression

Publications (2)

Publication Number Publication Date
CN112532981A CN112532981A (en) 2021-03-19
CN112532981B true CN112532981B (en) 2023-04-18

Family

ID=74996392

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011391716.0A Active CN112532981B (en) 2020-12-01 2020-12-01 Method, apparatus, and computer-readable storage medium for image compression

Country Status (1)

Country Link
CN (1) CN112532981B (en)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4083327B2 (en) * 1998-12-22 2008-04-30 株式会社東芝 Color image processing device
CN105096910B (en) * 2015-07-09 2018-02-16 西安诺瓦电子科技有限公司 Image processing method
CN107862648B (en) * 2017-11-24 2021-01-19 齐鲁工业大学 Color watermark embedding and extracting method based on human visual characteristics

Also Published As

Publication number Publication date
CN112532981A (en) 2021-03-19

Similar Documents

Publication Publication Date Title
CN111489346B (en) Full-reference image quality evaluation method and system
CN110136057B (en) Image super-resolution reconstruction method and device and electronic equipment
CN104378636B (en) A kind of video encoding method and device
JP2019067078A (en) Image processing method and image processing program
CN108600783B (en) Frame rate adjusting method and device and terminal equipment
CN108074241B (en) Quality scoring method and device for target image, terminal and storage medium
WO2012138568A1 (en) System and method for encoding and decoding anti-aliased video data
CN111226256A (en) System and method for image dynamic range adjustment
CN111415311B (en) Resource-saving image quality enhancement model
EP3180910B1 (en) Method for optimized chroma subsampling, apparatus for optimized chroma subsampling and storage device
Hsieh et al. Objective haze removal assessment based on two-objective optimization
CN112532981B (en) Method, apparatus, and computer-readable storage medium for image compression
CN106454386B (en) A kind of method and apparatus of the Video coding based on JND
Guo et al. A log-gabor feature-based quality assessment model for screen content images
CN115829836A (en) Image processing method and device, electronic equipment and model training method
CN111918061B (en) Coding block dividing method and device, storage medium and electronic equipment
CN114782249A (en) Super-resolution reconstruction method, device and equipment for image and storage medium
CN108596959A (en) A kind of extracting method of video image space-time characteristic point
CN114092359A (en) Screen-splash processing method and device and electronic equipment
JPH05176173A (en) Picture data compression method
CN113191376A (en) Image processing method, image processing device, electronic equipment and readable storage medium
CN108933945B (en) GIF picture compression method, device and storage medium
CN110572652A (en) Static image processing method and device
CN114429439A (en) Display fault detection method and device, electronic equipment and storage medium
US8345155B2 (en) Integrated circuit comprising deflicker unit for filtering image data, and a method therefor

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
GR01 Patent grant
GR01 Patent grant