[go: up one dir, main page]

CN118714329A - Image compression method and device, and readable storage medium - Google Patents

Image compression method and device, and readable storage medium Download PDF

Info

Publication number
CN118714329A
CN118714329A CN202410835633.8A CN202410835633A CN118714329A CN 118714329 A CN118714329 A CN 118714329A CN 202410835633 A CN202410835633 A CN 202410835633A CN 118714329 A CN118714329 A CN 118714329A
Authority
CN
China
Prior art keywords
wavelet
low
frequency region
image compression
regions
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.)
Granted
Application number
CN202410835633.8A
Other languages
Chinese (zh)
Other versions
CN118714329B (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.)
Shanghai Taorun Semiconductor Co ltd
Original Assignee
Shanghai Taorun Semiconductor Co ltd
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 Shanghai Taorun Semiconductor Co ltd filed Critical Shanghai Taorun Semiconductor Co ltd
Priority to CN202410835633.8A priority Critical patent/CN118714329B/en
Publication of CN118714329A publication Critical patent/CN118714329A/en
Application granted granted Critical
Publication of CN118714329B publication Critical patent/CN118714329B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/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/18Methods 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 set of transform coefficients
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • 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/63Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using sub-band based transform, e.g. wavelets
    • H04N19/64Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using sub-band based transform, e.g. wavelets characterised by ordering of coefficients or of bits for transmission
    • H04N19/647Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using sub-band based transform, e.g. wavelets characterised by ordering of coefficients or of bits for transmission using significance based coding, e.g. Embedded Zerotrees of Wavelets [EZW] or Set Partitioning in Hierarchical Trees [SPIHT]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/85Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using pre-processing or post-processing specially adapted for video compression

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

本发明提供了一种图像压缩方法及装置、可读存储介质,包括:对输入图像进行K级小波变换,得到第一小波系数分布;确定第一小波系数分布的低频区域的公共系数N,公共系数N不超过低频区域的最小值减去其它区域的绝对值的最大值得到的差值,其它区域为第一小波系数分布中所有非低频区域;对低频区域的每个值减去公共系数N,得到更新的低频区域;更新的低频区域与其它区域构成第二小波系数分布;传输公共系数;采用嵌入式零树小波编码算法对第二小波系数分布进行扫描输出。本发明可以提升图像压缩速度和图像压缩效果。

The present invention provides an image compression method and device, and a readable storage medium, comprising: performing K-level wavelet transform on an input image to obtain a first wavelet coefficient distribution; determining a common coefficient N of a low-frequency region of the first wavelet coefficient distribution, the common coefficient N not exceeding the difference obtained by subtracting the minimum value of the low-frequency region from the maximum absolute value of other regions, and the other regions are all non-low-frequency regions in the first wavelet coefficient distribution; subtracting the common coefficient N from each value of the low-frequency region to obtain an updated low-frequency region; the updated low-frequency region and other regions constitute a second wavelet coefficient distribution; transmitting the common coefficient; and scanning and outputting the second wavelet coefficient distribution using an embedded zerotree wavelet coding algorithm. The present invention can improve image compression speed and image compression effect.

Description

一种图像压缩方法及装置、可读存储介质Image compression method and device, and readable storage medium

技术领域Technical Field

本发明涉及图像压缩领域,尤指一种图像压缩方法及装置、可读存储介质。The present invention relates to the field of image compression, and in particular to an image compression method and device, and a readable storage medium.

背景技术Background Art

图像压缩便于信息的高效存储、管理和传输。当前基于离散小波变换(DWT)和嵌入式零树小波编码算法(Embedded Zerotree Wavelet Coding,简称EZW)已经广泛应用于图像压缩处理。Image compression facilitates efficient storage, management and transmission of information. Currently, discrete wavelet transform (DWT) and embedded zerotree wavelet coding (Embedded Zerotree Wavelet Coding, EZW) have been widely used in image compression processing.

DWT将图像信息从时域转到频域进行分析,通过对图像进行多分辨率分解,得到不同空间、不同频率的信息。由于小波变换后的系数存在一定的特征,将小波变换的系数划分成父子节点后,再使用EZW算法不断扫描小波变换后的图像,以生成更多的零树来对图像进行编码。生成的零树根越多,用以表示图像的数据量便会越少。DWT transfers image information from the time domain to the frequency domain for analysis, and obtains information of different spaces and frequencies by performing multi-resolution decomposition of the image. Since the coefficients after wavelet transform have certain characteristics, the coefficients of wavelet transform are divided into parent-child nodes, and then the EZW algorithm is used to continuously scan the image after wavelet transform to generate more zero trees to encode the image. The more zero tree roots are generated, the less data will be used to represent the image.

DWT和EZW的相互结合可以有效提升压缩效果,但为了满足仅有有限资源的移动终端对图像处理日益增长的要求,需要进一步提升图像的压缩效果。The combination of DWT and EZW can effectively improve the compression effect. However, in order to meet the growing requirements of mobile terminals with limited resources for image processing, the image compression effect needs to be further improved.

发明内容Summary of the invention

本发明的目的之一是为了克服现有技术中存在的至少部分不足,提供了一种图像压缩方法及装置、可读存储介质。One of the purposes of the present invention is to overcome at least some of the deficiencies in the prior art and to provide an image compression method and device, and a readable storage medium.

本发明提供的技术方案如下:The technical solution provided by the present invention is as follows:

一种图像压缩方法,包括:对输入图像进行K级小波变换,得到第一小波系数分布;An image compression method comprises: performing a K-level wavelet transform on an input image to obtain a first wavelet coefficient distribution;

确定所述第一小波系数分布的低频区域的公共系数N,所述公共系数N不超过所述低频区域的最小值减去其它区域的绝对值的最大值得到的差值,所述其它区域为所述第一小波系数分布中所有非低频区域;Determine a common coefficient N of a low-frequency region of the first wavelet coefficient distribution, wherein the common coefficient N does not exceed a difference obtained by subtracting a minimum value of the low-frequency region from a maximum absolute value of other regions, wherein the other regions are all non-low-frequency regions in the first wavelet coefficient distribution;

对所述低频区域的每个值减去所述公共系数N,得到更新的低频区域;所述更新的低频区域与所述其它区域构成第二小波系数分布;Subtracting the common coefficient N from each value of the low-frequency region to obtain an updated low-frequency region; the updated low-frequency region and the other regions constitute a second wavelet coefficient distribution;

传输公共系数N;Transmission common coefficient N;

采用嵌入式零树小波编码算法对所述第二小波系数分布进行编码,并传输编码结果。The second wavelet coefficient distribution is encoded using an embedded zerotree wavelet coding algorithm, and the encoding result is transmitted.

在一些实施例中,公共系数N等于低频区域的最小值减去其它区域的绝对值的最大值得到的差值。In some embodiments, the common coefficient N is equal to the difference between the minimum value in the low frequency region and the maximum absolute value in other regions.

在一些实施例中,针对2L×2M的输入图像,M≥L≥3,设置K=L-1。In some embodiments, for an input image of 2 L ×2 M , M ≥ L ≥ 3, set K = L - 1.

在一些实施例中,针对2L×2M的输入图像,M≥L≥3,设置K=L-m,m>1。In some embodiments, for an input image of 2 L ×2 M , M≥L≥3, set K=Lm, m>1.

在一些实施例中,包括:解码时,在恢复出第二小波系数分布后,根据收到的所述公共系数对所述第二小波系数分布的低频区域的每个值进行对应的补偿。In some embodiments, it includes: during decoding, after restoring the second wavelet coefficient distribution, corresponding compensation is performed on each value in the low-frequency region of the second wavelet coefficient distribution according to the received common coefficients.

本发明还提供一种图像压缩装置,包括:The present invention also provides an image compression device, comprising:

小波变换模块,用于对输入图像进行K级小波变换,得到第一小波系数分布;A wavelet transform module, used for performing a K-level wavelet transform on the input image to obtain a first wavelet coefficient distribution;

公共系数确定模块,用于确定所述第一小波系数分布的低频区域的公共系数N,所述公共系数N不超过所述低频区域的最小值减去其它区域的绝对值的最大值得到的差值,所述其它区域为所述第一小波系数分布中所有非低频区域;A common coefficient determination module, used to determine a common coefficient N of a low-frequency region of the first wavelet coefficient distribution, wherein the common coefficient N does not exceed a difference obtained by subtracting a maximum absolute value of other regions from a minimum value of the low-frequency region, wherein the other regions are all non-low-frequency regions in the first wavelet coefficient distribution;

低频更新模块,用于对所述低频区域的每个值减去所述公共系数N,得到更新的低频区域;所述更新的低频区域与所述其它区域构成第二小波系数分布;A low frequency updating module, configured to subtract the common coefficient N from each value of the low frequency region to obtain an updated low frequency region; the updated low frequency region and the other regions constitute a second wavelet coefficient distribution;

编码传输模块,用于传输所述公共系数;采用嵌入式零树小波编码算法对所述第二小波系数分布进行编码,并传输编码结果。The coding transmission module is used to transmit the common coefficients; encode the second wavelet coefficient distribution using an embedded zerotree wavelet coding algorithm, and transmit the coding result.

在一些实施例中,公共系数N等于低频区域的最小值减去其它区域的绝对值的最大值得到的差值。In some embodiments, the common coefficient N is equal to the difference between the minimum value in the low frequency region and the maximum absolute value in other regions.

在一些实施例中,针对2L×2M的输入图像,M≥L≥3,设置K=L-1或K=L-m,m>1。In some embodiments, for an input image of 2 L ×2 M , M≥L≥3, K=L-1 or K=Lm, m>1 is set.

本发明还提供一种图像压缩装置,包括:The present invention also provides an image compression device, comprising:

存储器,用于存储计算机程序;Memory for storing computer programs;

处理器,用于运行所述计算机程序时实现前述任一实施例所述的图像压缩方法。A processor is used to implement the image compression method described in any of the above embodiments when running the computer program.

本发明还提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现前述任一实施例所述的图像压缩方法。The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the image compression method described in any of the above embodiments is implemented.

通过本发明提供的一种图像压缩方法及装置、可读存储介质,至少能够带来以下有益效果:The image compression method, device, and readable storage medium provided by the present invention can at least bring the following beneficial effects:

1、本发明通过对低频区域的每个值减去公共系数,减少低频区域的值的大小,从而降低扫描的初始阈值T,进而减少嵌入式零树小波编码算法的扫描次数,减少需要传输的表的个数,以此减少总体数据传输量,提高图像的有损压缩性能。1. The present invention reduces the size of the value in the low-frequency area by subtracting the common coefficient from each value in the low-frequency area, thereby reducing the initial threshold T of the scan, thereby reducing the number of scans of the embedded zerotree wavelet coding algorithm and the number of tables that need to be transmitted, thereby reducing the overall data transmission volume and improving the lossy compression performance of the image.

2、本发明通过对图像少做一次或多次的小波变换,可以减少图像压缩处理时间,在保证图像压缩质量的同时提高图像压缩效率。2. The present invention can reduce the image compression processing time by performing one or more wavelet transforms on the image, thereby improving the image compression efficiency while ensuring the image compression quality.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

下面将以明确易懂的方式,结合附图说明优选实施方式,对一种图像压缩方法及装置、可读存储介质的上述特性、技术特征、优点及其实现方式予以进一步说明。The following will explain the preferred implementation mode in a clear and understandable manner with reference to the accompanying drawings, and further explain the above-mentioned characteristics, technical features, advantages and implementation methods of an image compression method and device, and a readable storage medium.

图1是本发明的一种图像压缩方法的一个实施例的流程图;FIG1 is a flow chart of an embodiment of an image compression method of the present invention;

图2-4是对图像进行多级小波变换,得到的小波变换系数分布的示意图;FIG2-4 is a schematic diagram of the distribution of wavelet transform coefficients obtained by performing multi-level wavelet transform on an image;

图5是EZW算法中主扫描的流程示意图;FIG5 is a schematic diagram of the main scanning process in the EZW algorithm;

图6是本发明的一种图像压缩装置的一个实施例的结构示意图;FIG6 is a schematic structural diagram of an image compression device according to an embodiment of the present invention;

图7是本发明的一种图像压缩装置的另一个实施例的结构示意图。FIG. 7 is a schematic structural diagram of another embodiment of an image compression device of the present invention.

附图标号说明:Description of Figure Numbers:

100.小波变换模块,200.公共系数确定模块,300.低频更新模块,400.编码传输模块,10.存储器,20.计算机程序,30.处理器。100. Wavelet transform module, 200. Public coefficient determination module, 300. Low frequency update module, 400. Encoding transmission module, 10. Memory, 20. Computer program, 30. Processor.

具体实施方式DETAILED DESCRIPTION

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对照附图说明本发明的具体实施方式。显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图,并获得其他的实施方式。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the specific implementation methods of the present invention will be described below with reference to the accompanying drawings. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings and other implementation methods can be obtained based on these drawings without creative work.

为使图面简洁,各图中只示意性地表示出了与本发明相关的部分,它们并不代表其作为产品的实际结构。另外,以使图面简洁便于理解,在有些图中具有相同结构或功能的部件,仅示意性地绘制了其中的一个,或仅标出了其中的一个。在本文中,“一个”不仅表示“仅此一个”,也可以表示“多于一个”的情形。In order to simplify the drawings, only the parts related to the present invention are schematically shown in each figure, and they do not represent the actual structure of the product. In addition, in order to simplify the drawings and facilitate understanding, in some figures, only one of the parts with the same structure or function is schematically drawn or marked. In this article, "one" not only means "only one", but also means "more than one".

传统的基于DWT和EZW算法的图像压缩方法,包括以下步骤:The traditional image compression method based on DWT and EZW algorithm includes the following steps:

1、对输入图像进行离散小波变换1. Perform discrete wavelet transform on the input image

对输入图像进行K级小波变换,得到小波系数分布。K可根据图像的尺寸来定,比如,对于8*8的图像,K可为3;对于16*16的图像,K可为4。Perform K-level wavelet transform on the input image to obtain the wavelet coefficient distribution. K can be determined according to the size of the image. For example, for an 8*8 image, K can be 3; for a 16*16 image, K can be 4.

以8*8的图像为例,进行二维小波变换(即一级小波变换),形成四个区域(如图2),其中,LL1为低频区域,表示图像的主要特征信息;HL1、LH1为中频区域,表示图像的次要特征信息;HH1为高频区域,表示图像的细节特征信息。对低频区域LL1的信息进一步分解,即对LL1单独进行二维小波变换(即二级小波变换),得到如图3所示的小波系数分布。再对LL2区域的信息进一步分解,即对其单独进行二维小波变换(即三级小波变换),得到如图4所示的小波系数分布。通过多级小波变换,可以获得图像在不同层次的频率分解。其中,LLx(x=1,2,3)为低频区域,其它为非低频区域。低频区域的值为正值,其它区域有可能存在负值。Taking an 8*8 image as an example, a two-dimensional wavelet transform (i.e., first-level wavelet transform) is performed to form four regions (as shown in Figure 2), where LL1 is a low-frequency region, representing the main feature information of the image; HL1 and LH1 are medium-frequency regions, representing the secondary feature information of the image; and HH1 is a high-frequency region, representing the detailed feature information of the image. The information of the low-frequency region LL1 is further decomposed, that is, a two-dimensional wavelet transform (i.e., second-level wavelet transform) is performed on LL1 alone, and the wavelet coefficient distribution shown in Figure 3 is obtained. The information of the LL2 region is further decomposed, that is, a two-dimensional wavelet transform (i.e., third-level wavelet transform) is performed on it alone, and the wavelet coefficient distribution shown in Figure 4 is obtained. Through multi-level wavelet transform, the frequency decomposition of the image at different levels can be obtained. Among them, LLx (x=1,2,3) is a low-frequency region, and the others are non-low-frequency regions. The values of the low-frequency region are positive, and other regions may have negative values.

2、使用EZW算法对小波系数分布进行编码输出2. Use the EZW algorithm to encode and output the wavelet coefficient distribution

使用EZW算法对小波系数分布进行多次扫描输出,每次扫描顺序可如图4所示。The wavelet coefficient distribution is scanned and outputted multiple times using the EZW algorithm, and the scanning sequence of each time is shown in FIG4 .

EZW算法包括对小波系数分布的多次扫描,每次扫描包括主扫描和辅扫描两个阶段。主扫描扫描小波系数分布,生成重要系数以及树的信息,辅扫描扫描重要系数,对重要系数的值进行编码,以便于解码时重构重要系数值。包括:The EZW algorithm includes multiple scans of the wavelet coefficient distribution, and each scan includes two stages: main scan and auxiliary scan. The main scan scans the wavelet coefficient distribution to generate important coefficients and tree information, and the auxiliary scan scans the important coefficients and encodes the values of the important coefficients to facilitate reconstruction of the important coefficient values during decoding. It includes:

(1)确定初始阈值T(1) Determine the initial threshold T

扫描的初始阈值为T,其公式如下:The initial threshold of the scan is T, and its formula is as follows:

其中,max为小波变换后绝对值最大的小波系数,表示不大于x的最大整数。Among them, max is the wavelet coefficient with the largest absolute value after wavelet transformation, Represents the largest integer not greater than x.

第i次扫描使用的阈值Ti=T/2i-1,i=1,2,...,随着扫描次数的增加,扫描阈值逐步减小,直至等于1,因此T值决定了EZW算法的扫描次数。The threshold value used for the i-th scan is T i =T/2 i-1 , i=1, 2, ..., and as the number of scans increases, the scan threshold value gradually decreases until it is equal to 1, so the T value determines the number of scans of the EZW algorithm.

(2)进行主扫描(2) Perform the main scan

主扫描的流程图如图5所示。The flow chart of the main scan is shown in FIG5 .

扫描顺序由高级至低级进行,对于三级小波变换扫描顺序如下:LL3、The scanning order is from high level to low level. For the three-level wavelet transform, the scanning order is as follows: LL3,

HL3、LH3、HH3、HL2、LH2、HH2、HL1、LH1、HH1。HL3, LH3, HH3, HL2, LH2, HH2, HL1, LH1, HH1.

第i(i=1,2,...)次扫描时,按照扫描顺序将小波系数与阈值Ti依次进行比较,如果小波系数的绝对值大于等于阈值,则为重要系数;否则,为不重要系数,并标记以下输出符号:During the i-th (i=1, 2, ...) scan, the wavelet coefficients are compared with the threshold Ti in sequence according to the scan order. If the absolute value of the wavelet coefficient is greater than or equal to the threshold, it is an important coefficient; otherwise, it is an unimportant coefficient and is marked with the following output symbols:

正重要系数P:当前系数为正且绝对值大于等于阈值;Positive importance coefficient P: the current coefficient is positive and its absolute value is greater than or equal to the threshold;

负重要系数N:当前系数为负且绝对值大于等于阈值;Negative importance coefficient N: the current coefficient is negative and its absolute value is greater than or equal to the threshold;

零树根ZTR:当前系数为不重要系数,且所有子孙系数都为不重要系数;Zero tree root ZTR: the current coefficient is an unimportant coefficient, and all descendant coefficients are unimportant coefficients;

孤立零IZ:当前系数为不重要系数,但是至少有一个子孙系数为重要系数。Isolated zero IZ: The current coefficient is an unimportant coefficient, but at least one descendant coefficient is an important coefficient.

同时输出一副表,副表中记录重要系数。在第i个主扫描结束时,将小波系数分布中的重要系数设置为零,以避免在下一次扫描中对它们进行编码。At the same time, a sub-table is output, in which important coefficients are recorded. At the end of the ith main scan, the important coefficients in the wavelet coefficient distribution are set to zero to avoid encoding them in the next scan.

(3)进行辅扫描(3) Perform auxiliary scanning

扫描副表,如果重要系数的绝对值在[Ti,Ti+Ti/2]区间则编码为0,如果重要系数的绝对值在[Ti+Ti/2,2Ti]区间则编码为1。Scan the sub-table, if the absolute value of the important coefficient is in the interval [T i , T i +T i /2], it is encoded as 0, if the absolute value of the important coefficient is in the interval [T i +T i /2, 2T i ], it is encoded as 1.

将本次扫描所用的阈值Ti、得到的标记序列、编码序列输出以备解压缩时使用。The threshold Ti used in this scan, the obtained tag sequence, and the coded sequence are output for use in decompression.

然后将阈值Ti替换为Ti/2,如果Ti/2大于或等于1,则进行下一次扫描,否则结束。所有扫描输出构成EZW算法的编码结果。Then the threshold Ti is replaced by Ti /2, and if Ti /2 is greater than or equal to 1, the next scan is performed, otherwise the process ends. All scan outputs constitute the encoding result of the EZW algorithm.

可以看出,8*8的图像经过三级小波变换后,主要低频信息集中在左上角部分,EZW算法的初始阈值T的大小基本是由三级变换的结果决定,T值越大需要传输的表的个数越多,因此传输的数据量越大。以多传输一个扫描表为例进行计算,即使左上角被扫中为重要系数,其他均未扫中,其需要传输一个重要系数和三个零树根,每个符号需要2bit表示,所以至少需要多传输8Bit数据。It can be seen that after the 8*8 image is transformed by the three-level wavelet transform, the main low-frequency information is concentrated in the upper left corner. The size of the initial threshold T of the EZW algorithm is basically determined by the result of the three-level transform. The larger the T value, the more tables need to be transmitted, so the amount of data transmitted is larger. Take the transmission of one more scan table as an example for calculation. Even if the upper left corner is scanned as an important coefficient and the others are not scanned, it needs to transmit an important coefficient and three zero tree roots. Each symbol requires 2 bits to represent, so at least 8 bits of data need to be transmitted.

本发明提出一种降低初始阈值T的方法,通过降低初始阈值T,减少了EZW算法的扫描次数,从而减少了需要传输的表的个数,进而减少了总体数据传输量,提高了图像的压缩效果。The present invention proposes a method for reducing an initial threshold value T. By reducing the initial threshold value T, the scanning times of the EZW algorithm are reduced, thereby reducing the number of tables that need to be transmitted, thereby reducing the overall data transmission volume, and improving the image compression effect.

下面进行详细阐述。This is explained in detail below.

本发明的一个实施例,如图1所示,一种图像压缩方法,包括:One embodiment of the present invention, as shown in FIG1 , is an image compression method, comprising:

步骤S100对输入图像进行K级小波变换,得到第一小波系数分布;Step S100 performs K-level wavelet transform on the input image to obtain a first wavelet coefficient distribution;

步骤S200确定第一小波系数分布的低频区域的公共系数N,公共系数N不超过低频区域的最小值减去其它区域的绝对值的最大值得到的差值,其它区域为第一小波系数分布中所有非低频区域;Step S200 determines the common coefficient N of the low-frequency region of the first wavelet coefficient distribution, where the common coefficient N does not exceed the difference between the minimum value of the low-frequency region and the maximum absolute value of other regions, where the other regions are all non-low-frequency regions in the first wavelet coefficient distribution;

步骤S300对低频区域的每个值减去公共系数N,得到更新的低频区域;更新的低频区域与其它区域构成第二小波系数分布;Step S300: subtract the common coefficient N from each value of the low-frequency region to obtain an updated low-frequency region; the updated low-frequency region and other regions constitute a second wavelet coefficient distribution;

步骤S400传输公共系数N;Step S400: transmitting the common coefficient N;

步骤S500采用嵌入式零树小波编码算法对第二小波系数分布进行编码,并传输编码结果。Step S500 encodes the second wavelet coefficient distribution using an embedded zerotree wavelet coding algorithm and transmits the coding result.

具体的,采用传统的离散小波变换算法对输入图像进行K级小波变换,对分解得到的小波系数进行量化,量化后的小波系数构成第一小波系数分布。K为正整数。Specifically, a traditional discrete wavelet transform algorithm is used to perform a K-level wavelet transform on the input image, and the decomposed wavelet coefficients are quantized, and the quantized wavelet coefficients constitute a first wavelet coefficient distribution. K is a positive integer.

以8*8的图像为例,进行二级小波变换(即K=2),得到的第一小波系数分布如图3所示。其中,LL2为第一小波系数分布的低频区域。该低频区域包含4个点,该低频区域的最小值为这4个点的最小值。LH2、HL2、HH2、HL1、LH1、HH1构成了其它区域。假设低频区域4个点的值从高到低分别为220、200、190、180,其它区域的小波系数的绝对值的最大值为90,则低频区域的最小值=180,公共系数N可以选取不超过90(=180-90)的正数,比如N=90,或80等。Taking an 8*8 image as an example, a secondary wavelet transform (i.e., K=2) is performed, and the distribution of the first wavelet coefficients is shown in Figure 3. Among them, LL2 is the low-frequency area of the first wavelet coefficient distribution. The low-frequency area contains 4 points, and the minimum value of the low-frequency area is the minimum value of these 4 points. LH2, HL2, HH2, HL1, LH1, and HH1 constitute other areas. Assuming that the values of the 4 points in the low-frequency area are 220, 200, 190, and 180 from high to low, and the maximum absolute value of the wavelet coefficients in other areas is 90, then the minimum value of the low-frequency area = 180, and the common coefficient N can be selected as a positive number not exceeding 90 (=180-90), such as N = 90, or 80, etc.

假设取N为90,则更新后的低频区域的值对应为130、110、100、90。Assuming that N is 90, the updated values of the low-frequency area are 130, 110, 100, and 90 respectively.

如果对第一小波系数分布进行EZW扫描,则根据前述计算公式,可得初始阈值T为220。由于通过步骤S300降低了低频区域的值,对第二小波系数分布进行EZW扫描,则初始阈值T降为130。If the first wavelet coefficient distribution is subjected to an EZW scan, then according to the aforementioned calculation formula, the initial threshold T is 220. Since the value of the low frequency region is reduced by step S300, the initial threshold T is reduced to 130 when the second wavelet coefficient distribution is subjected to an EZW scan.

初始阈值T大幅降低,减少了EZW算法的扫描次数,从而减少了需要传输的表的个数。为了在解码侧能正确恢复第一小波系数分布,除了传输EZW算法对第二小波系数分布扫描的输出结果,还需要增加公共系数N的传输,由于减少传输的数据量更多,所以总体上减少了数据传输量,提高了图像的压缩效果。The initial threshold T is greatly reduced, which reduces the number of scans of the EZW algorithm, thereby reducing the number of tables that need to be transmitted. In order to correctly restore the first wavelet coefficient distribution on the decoding side, in addition to transmitting the output results of the EZW algorithm scanning the second wavelet coefficient distribution, it is also necessary to increase the transmission of the public coefficient N. Since the amount of data transmitted is reduced more, the overall data transmission amount is reduced, and the image compression effect is improved.

解码时,先按传统方法恢复出第二小波系数分布,再用收到的公共系数N对第二小波系数分布的低频区域的每个值进行补偿(即加上公共系数N),这样就得到第一小波系数分布。During decoding, the second wavelet coefficient distribution is first restored according to the traditional method, and then each value in the low-frequency region of the second wavelet coefficient distribution is compensated with the received common coefficient N (ie, the common coefficient N is added), thus obtaining the first wavelet coefficient distribution.

N也可以取其它值,比如,取N为80,则更新后的低频区域的值对应为140、120、110、100。对第二小波系数分布进行EZW扫描,则初始阈值T降为140。相对220,初始阈值T也降低了不少,只是降低量小于N为90的情况。N can also take other values. For example, if N is 80, the updated values of the low-frequency area are 140, 120, 110, and 100. When the second wavelet coefficient distribution is subjected to EZW scanning, the initial threshold T is reduced to 140. Compared with 220, the initial threshold T is also reduced a lot, but the reduction is less than when N is 90.

之所以限定公共系数N不超过低频区域的最小值减去其它区域的绝对值的最大值得到的差值,是为了保证后续低频区域值的更新不影响小波系数分布的零树结构,即第二小波系数分布的零树结构要与第一小波系数分布的零树结构保持一致,具体说,就是要保证小波系数分布中的父节点的值不小于子节点的值。这样可以保证图像压缩的质量不变。The reason why the common coefficient N is limited to not more than the difference between the minimum value of the low-frequency region and the maximum absolute value of other regions is to ensure that the subsequent update of the low-frequency region value does not affect the zero tree structure of the wavelet coefficient distribution, that is, the zero tree structure of the second wavelet coefficient distribution must be consistent with the zero tree structure of the first wavelet coefficient distribution. Specifically, it is to ensure that the value of the parent node in the wavelet coefficient distribution is not less than the value of the child node. This ensures that the quality of image compression remains unchanged.

通过对低频区域的每个值减去公共系数N,可以在不影响零树结构的情况下,减少低频区域内小波系数的大小,达到减少初始扫描阈值T的目的,从而减少数据的传输量。By subtracting the common coefficient N from each value in the low-frequency region, the size of the wavelet coefficients in the low-frequency region can be reduced without affecting the zero-tree structure, thereby reducing the initial scanning threshold T and reducing the amount of data transmission.

本实施例通过确定一公共系数,对低频区域的每个值减去公共系数,从而降低扫描的初始阈值T,进而减少嵌入式零树小波编码算法的扫描次数,减少需要传输的表的个数,以此减少总体数据传输量,提高图像的有损压缩性能。This embodiment determines a common coefficient and subtracts the common coefficient from each value in the low-frequency area, thereby reducing the initial threshold T of the scan, thereby reducing the number of scans of the embedded zerotree wavelet coding algorithm and the number of tables that need to be transmitted, thereby reducing the overall data transmission volume and improving the lossy compression performance of the image.

在一个实施例中,公共系数N等于低频区域的最小值减去其它区域的绝对值的最大值得到的差值。In one embodiment, the common coefficient N is equal to the difference obtained by subtracting the maximum absolute value of other regions from the minimum value of the low frequency region.

这样可以在不影响零树结构的情况下最大限度地降低EZW扫描的初始阈值T。This allows the initial threshold T of the EZW scan to be minimized without affecting the zerotree structure.

在一个实施例中,针对2L×2M的输入图像,M≥L≥3,设置K=L-1。In one embodiment, for an input image of 2 L ×2 M , M ≥ L ≥ 3, K = L - 1 is set.

针对2L×2M的输入图像,M≥L≥3,最多可进行L级小波变换,可以设置K等于L,再实施前述实施例方案。但通过设置K=L-1,进行K级小波变换,可以减少一次小波变换,进一步减少图像压缩处理时间,提高图像压缩效率。For an input image of 2 L × 2 M , M≥L≥3, a maximum of L levels of wavelet transform can be performed, and K can be set equal to L, and the aforementioned embodiment scheme can be implemented. However, by setting K=L-1 and performing K levels of wavelet transform, one wavelet transform can be reduced, further reducing the image compression processing time and improving the image compression efficiency.

在一个实施例中,针对2L×2M的输入图像,M≥L≥3,设置K=L-m,m>1。In one embodiment, for an input image of 2 L ×2 M , M ≥ L ≥ 3, K = Lm, m>1.

针对2L×2M的输入图像,M≥L≥3,最多可进行L级小波变换。假设L比较大,此时可设置K=L-m,进行K级小波变换,这样可减少m次小波变换,同时减少嵌入式零树扫描的级数,加快扫描速度,进一步减少图像压缩处理时间,提高图像压缩效率。For an input image of 2 L × 2 M , M ≥ L ≥ 3, a maximum of L levels of wavelet transform can be performed. Assuming that L is relatively large, K = Lm can be set to perform K-level wavelet transform, which can reduce m wavelet transforms and the number of embedded zerotree scans, speed up the scanning speed, further reduce the image compression processing time, and improve the image compression efficiency.

这主要是针对比较大的图像,可以减少多次小波变换。比如64*64的图像,L=M=6,K可以取4或5,既提高了图像压缩效率,又保证了图像的压缩质量。m可根据经验进行设置。This is mainly for relatively large images, which can reduce the number of wavelet transforms. For example, for a 64*64 image, L=M=6, and K can be 4 or 5, which not only improves the image compression efficiency but also ensures the image compression quality. m can be set based on experience.

本发明的一个实施例,如图6所示,一种图像压缩装置包括:According to an embodiment of the present invention, as shown in FIG6 , an image compression device includes:

小波变换模块100,用于对输入图像进行K级小波变换,得到第一小波系数分布;The wavelet transform module 100 is used to perform a K-level wavelet transform on the input image to obtain a first wavelet coefficient distribution;

公共系数确定模块200,用于确定第一小波系数分布的低频区域的公共系数N,公共系数N不超过低频区域的最小值减去其它区域的绝对值的最大值得到的差值,其它区域为第一小波系数分布中所有非低频区域;A common coefficient determination module 200 is used to determine a common coefficient N of a low-frequency region of the first wavelet coefficient distribution, wherein the common coefficient N does not exceed a difference obtained by subtracting a minimum value of the low-frequency region from a maximum absolute value of other regions, where the other regions are all non-low-frequency regions in the first wavelet coefficient distribution;

低频更新模块300,用于对低频区域的每个值减去公共系数N,得到更新的低频区域;更新的低频区域与其它区域构成第二小波系数分布;The low frequency updating module 300 is used to subtract the common coefficient N from each value of the low frequency region to obtain an updated low frequency region; the updated low frequency region and other regions constitute a second wavelet coefficient distribution;

编码传输模块400,用于传输公共系数;采用嵌入式零树小波编码算法对第二小波系数分布进行编码,并传输编码结果。The coding and transmission module 400 is used to transmit the common coefficients; encode the second wavelet coefficient distribution using an embedded zerotree wavelet coding algorithm, and transmit the coding result.

在一个实施例中,公共系数N等于低频区域的最小值减去其它区域的绝对值的最大值得到的差值。In one embodiment, the common coefficient N is equal to the difference obtained by subtracting the maximum absolute value of other regions from the minimum value of the low frequency region.

在一个实施例中,对2L×2M的输入图像,M≥L≥3,设置K=L-1In one embodiment, for an input image of 2 L × 2 M , M ≥ L ≥ 3, set K = L - 1

在一个实施例中,对2L×2M的输入图像,M≥L≥3,设置K=L-m,m>1。In one embodiment, for an input image of size 2 L ×2 M , M ≥ L ≥ 3, K = Lm, m>1.

在一个实施例中,解码时,在恢复出第二小波系数分布后,根据收到的公共系数对第二小波系数分布的低频区域的每个值进行对应的补偿。In one embodiment, during decoding, after the second wavelet coefficient distribution is restored, each value in the low-frequency region of the second wavelet coefficient distribution is compensated accordingly according to the received common coefficients.

需要说明的是,本发明提供的图像压缩装置的实施例与前述提供的图像压缩方法的实施例均基于同一发明构思,能够取得相同的技术效果。因而,图像压缩装置的实施例的其它具体内容可以参照前述图像压缩方法的实施例内容的记载。It should be noted that the embodiment of the image compression device provided by the present invention and the embodiment of the image compression method provided above are based on the same inventive concept and can achieve the same technical effect. Therefore, other specific contents of the embodiment of the image compression device can refer to the contents of the embodiment of the image compression method provided above.

本发明的一个实施例,如图7所示,一种图像压缩装置包括:According to an embodiment of the present invention, as shown in FIG7 , an image compression device includes:

存储器10,用于存储计算机程序20;A memory 10 for storing a computer program 20;

处理器30,用于运行计算机程序20时实现前述任一实施例所述的图像压缩方法。The processor 30 is used to implement the image compression method described in any of the above embodiments when running the computer program 20.

存储器10可以为任意能够实现数据、程序存储的内部存储单元和/或外部存储设备。比如,存储器10可以为插接式硬盘、智能存储卡(SMC)、安全数字(SD)卡或闪存卡等。The memory 10 may be any internal storage unit and/or external storage device capable of storing data and programs, for example, a plug-in hard disk, a smart memory card (SMC), a secure digital (SD) card, or a flash memory card.

根据需要,处理器10可以是中央处理单元(CPU)、图形处理单元(GPU)、数字信号处理器(DSP)、专用集成电路(ASIC)、现场可编程门阵列(FPGA)、通用处理器或其他逻辑器件等。As needed, the processor 10 can be a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), a general-purpose processor or other logic devices, etc.

本发明的一个实施例,一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时可实现如前述实施例记载的图像压缩方法。也即是,当前述本发明实施例对现有技术做出贡献的技术方案的部分或全部通过计算机软件产品的方式得以体现时,前述计算机软件产品存储在一个计算机可读存储介质中。该计算机可读存储介质可以为任意可携带计算机程序代码实体装置或设备。譬如,U盘、移动磁盘、磁碟、光盘、计算机存储器、只读存储器、随机存取存储器等。One embodiment of the present invention is a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can implement the image compression method described in the aforementioned embodiment. That is, when part or all of the technical solutions that contribute to the prior art in the aforementioned embodiment of the present invention are embodied in the form of a computer software product, the aforementioned computer software product is stored in a computer-readable storage medium. The computer-readable storage medium can be any physical device or equipment that can carry computer program code. For example, a USB flash drive, a mobile disk, a magnetic disk, an optical disk, a computer memory, a read-only memory, a random access memory, etc.

应当说明的是,上述实施例均可根据需要自由组合。以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。It should be noted that the above embodiments can be freely combined as needed. The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered as the protection scope of the present invention.

Claims (10)

1. An image compression method, comprising:
Performing K-level wavelet transformation on an input image to obtain first wavelet coefficient distribution;
Determining a common coefficient N of a low-frequency region of the first wavelet coefficient distribution, wherein the common coefficient N is not more than a difference value obtained by subtracting the maximum value of absolute values of other regions from the minimum value of the low-frequency region, and the other regions are all non-low-frequency regions in the first wavelet coefficient distribution;
Subtracting the common coefficient N from each value of the low frequency region to obtain an updated low frequency region; the updated low frequency region and the other regions form a second wavelet coefficient distribution;
Transmitting the common coefficients;
and adopting an embedded zero tree wavelet coding algorithm to code the second wavelet coefficient distribution, and transmitting a coding result.
2. The image compression method according to claim 1, wherein,
The common coefficient N is equal to a difference obtained by subtracting the maximum value of the absolute values of the other regions from the minimum value of the low frequency region.
3. The image compression method according to claim 1, wherein for an input image of 2 L×2M, M is equal to or greater than L is equal to or greater than 3, and k=l-1 is set.
4. The image compression method according to claim 1, wherein for an input image of 2 L×2M, M is equal to or greater than L is equal to or greater than 3, k=l-M, M >1 is set.
5. The image compression method according to claim 1, comprising:
and in decoding, after recovering the second wavelet coefficient distribution, correspondingly compensating each value of a low-frequency region of the second wavelet coefficient distribution according to the received common coefficient.
6. An image compression apparatus, comprising:
the wavelet transformation module is used for carrying out K-level wavelet transformation on the input image to obtain first wavelet coefficient distribution;
a common coefficient determining module, configured to determine a common coefficient N of a low frequency region of the first wavelet coefficient distribution, where the common coefficient N is not greater than a difference obtained by subtracting a maximum value of absolute values of other regions from a minimum value of the low frequency region, and the other regions are all non-low frequency regions in the first wavelet coefficient distribution;
the low-frequency updating module is used for subtracting the common coefficient N from each value of the low-frequency area to obtain an updated low-frequency area; the updated low frequency region and the other regions form a second wavelet coefficient distribution;
the code transmission module is used for transmitting the common coefficients; and adopting an embedded zero tree wavelet coding algorithm to code the second wavelet coefficient distribution, and transmitting a coding result.
7. The image compression apparatus according to claim 6, wherein,
The common coefficient N is equal to a difference obtained by subtracting the maximum value of the absolute values of the other regions from the minimum value of the low frequency region.
8. The image compression apparatus according to claim 6, wherein,
For an input image of 2 L×2M, M is greater than or equal to L is greater than or equal to 3, K=L-1, or K=L-M, M >1 is set.
9. An image compression apparatus, comprising:
A memory for storing a computer program;
A processor for implementing the image compression method according to any one of claims 1 to 5 when running the computer program.
10. A computer-readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the image compression method according to any one of claims 1 to 5.
CN202410835633.8A 2024-06-26 2024-06-26 Image compression method and device, and readable storage medium Active CN118714329B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410835633.8A CN118714329B (en) 2024-06-26 2024-06-26 Image compression method and device, and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410835633.8A CN118714329B (en) 2024-06-26 2024-06-26 Image compression method and device, and readable storage medium

Publications (2)

Publication Number Publication Date
CN118714329A true CN118714329A (en) 2024-09-27
CN118714329B CN118714329B (en) 2025-05-30

Family

ID=92812188

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410835633.8A Active CN118714329B (en) 2024-06-26 2024-06-26 Image compression method and device, and readable storage medium

Country Status (1)

Country Link
CN (1) CN118714329B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR19990060794A (en) * 1997-12-31 1999-07-26 구자홍 Image encoding and decoding method and apparatus
KR20000039315A (en) * 1998-12-12 2000-07-05 구자홍 Method and apparatus for encoding image
KR20070028872A (en) * 2005-09-08 2007-03-13 주식회사 메디슨 Wavelet Image Coding Method Using Differential Threshold
CN104079947A (en) * 2014-06-25 2014-10-01 武汉大学 Sonar image data compression method based on improved EZW
CN109951711A (en) * 2019-03-25 2019-06-28 贵州大学 An EZW Data Compression Method Based on Random Threshold Adjustment
CN110572682A (en) * 2019-07-31 2019-12-13 杭州电子科技大学 An Embedded Zerotree Wavelet Image Coding and Compression Method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR19990060794A (en) * 1997-12-31 1999-07-26 구자홍 Image encoding and decoding method and apparatus
KR20000039315A (en) * 1998-12-12 2000-07-05 구자홍 Method and apparatus for encoding image
KR20070028872A (en) * 2005-09-08 2007-03-13 주식회사 메디슨 Wavelet Image Coding Method Using Differential Threshold
CN104079947A (en) * 2014-06-25 2014-10-01 武汉大学 Sonar image data compression method based on improved EZW
CN109951711A (en) * 2019-03-25 2019-06-28 贵州大学 An EZW Data Compression Method Based on Random Threshold Adjustment
CN110572682A (en) * 2019-07-31 2019-12-13 杭州电子科技大学 An Embedded Zerotree Wavelet Image Coding and Compression Method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
林行: "《基于零树小波的静止图像压缩算法的研究》", 《CNKI优秀硕士学位论文全文库》, 16 September 2014 (2014-09-16) *

Also Published As

Publication number Publication date
CN118714329B (en) 2025-05-30

Similar Documents

Publication Publication Date Title
US6834123B2 (en) Method and apparatus for coding of wavelet transformed coefficients
CN105430416A (en) A Fingerprint Image Compression Method Based on Adaptive Sparse Field Coding
JPH09130800A (en) Coding method
CN115242475A (en) Method and system for secure transmission of big data
JPH11163733A (en) Encoding method and device
JP2001258027A (en) Image processing unit and method and storage medium
CN108009975A (en) Jpeg image reversible information hidden method based on two-dimensional histogram modification
CN101321283B (en) Codec methods and codecs compatible with different size block transformations
CN116456094B (en) Distributed video hybrid digital-analog transmission method and related equipment
CN118714329B (en) Image compression method and device, and readable storage medium
Boujelbene et al. Enhanced embedded zerotree wavelet algorithm for lossy image coding
CN110572682A (en) An Embedded Zerotree Wavelet Image Coding and Compression Method
CN111652789B (en) Big data-oriented color image watermark embedding and extracting method
Bin et al. An improved SPIHT wavelet transform in the underwater acoustic image compression
CN110740333A (en) Improved SPIHT image coding and decoding method based on wavelet modulus maximum reconstruction
George et al. A novel approach for image compression using zero tree coding
JP4003628B2 (en) Image encoding apparatus and method, and program
JP3660558B2 (en) Image encoding method, image encoding device, and medium storing image encoding program
Malviya et al. 2D-discrete walsh wavelet transform for image compression with arithmetic coding
JP4054430B2 (en) Image processing apparatus and method, and storage medium
CN112422992A (en) Image coding method and device
CN113554722B (en) An Image Compression Method of RMB Banknote Serial Number Based on Improved EZW
Pandey et al. Hybrid image compression based on fuzzy logic technology
CN120264004A (en) Embedded zero tree wavelet coding method, storage medium and computer equipment
Rashid et al. Sub-band coding of hexagonal images

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