Fractal image compression method based on coefficient of variation quadtree partitioning and eigenvector

By using a fractal image compression method based on quadtree segmentation with coefficient of variation and feature vectors, the problem of slow compression speed of high-resolution images is solved, and fast and efficient image compression is achieved.

CN120147441BActive Publication Date: 2025-11-25SUN YAT SEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411630567.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-11-25
Estimated Expiration
2044-11-15

AI Technical Summary

Technical Problem

Existing fractal compression algorithms are too slow to compress high-resolution images, failing to meet the needs of real-world applications.

Method used

A fractal image compression method based on quadtree segmentation and feature vectors is adopted. By sliding to extract domain blocks, constructing kd-trees, calculating feature vectors, and optimizing quadtree segmentation and grayscale transformation parameters, fast encoding is achieved.

Benefits of technology

While maintaining image quality, it significantly accelerates the compression speed of high-resolution images and improves compression efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120147441B_ABST
    Figure CN120147441B_ABST
Patent Text Reader

Abstract

The application discloses a fractal image compression method based on a coefficient of variation quadtree partition and a feature vector. The method can accelerate the fractal compression time of high resolution under the condition that the image quality meets the actual requirements by using the feature vector, the coefficient of variation quadtree partition, and a kd tree method, and solves the problem that the general fractal compression algorithm is too slow in compressing high resolution images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image fractal compression technology, and more specifically, to a fractal image compression method based on quadtree segmentation with coefficient of variation and feature vectors. Background Technology

[0002] In the era of big data, the rapidly increasing amount of image data makes image compression technology increasingly important. Fractal compression is an image coding algorithm that utilizes the autocorrelation relationship of images for compression. Its advantages include high compression ratio, fast image decoding, and resolution independence of the decoded image. However, basic fractal compression algorithms suffer from long compression times, especially for high-resolution images, where the compression time cannot meet the needs of real-world applications. Therefore, improving fractal compression algorithms and accelerating their encoding speed to enable their application to high-resolution images while maintaining acceptable decompressed image quality is of significant importance. Summary of the Invention

[0003] This invention provides a fractal image compression method based on quadtree segmentation with coefficient of variation and feature vectors, which solves the technical problem that general fractal compression algorithms are too slow in compressing high-resolution images.

[0004] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:

[0005] This invention provides a fractal image compression method based on quadtree segmentation and feature vectors, comprising the following steps:

[0006] Multiple domain blocks are extracted by sliding from the image to be compressed, and each domain block is assigned to a different domain block pool according to the variance of each domain block;

[0007] For different domain block pools, the feature vector of each domain block in the domain block pool is calculated, and kd-trees of different domain block pools are constructed based on the feature vectors.

[0008] The image to be compressed is divided into multiple non-overlapping value range blocks of the same size;

[0009] If a value block meets the preset conditions, the value block is added to the value block pool; if a value block does not meet the preset conditions, the value block is divided into four sub-value blocks according to the quadtree, and the sub-value blocks are used as new value blocks to determine whether they meet the preset conditions, until all value blocks are added to the value block pool.

[0010] Take any value block from the value block pool and calculate the feature vector of the value block;

[0011] Based on the size of the value range block, select the K nearest neighbors of the feature vectors of the value range block in the kd tree of the corresponding size of the domain block pool, and add the domain blocks corresponding to the K feature vectors to the shrinking block pool.

[0012] Take any domain block from the reduced block pool, find the grayscale transformation parameters, domain block identifier, isometry transformation identifier, and domain block size that make the mean square error less than the mean square error threshold, and record them as the fractal code of the current domain block to obtain the fractal codes of all domain blocks in the domain block pool.

[0013] The fractal codes of all value blocks in the value block pool are merged to obtain the compressed image of the image to be compressed.

[0014] Furthermore, multiple domain blocks are extracted from the image to be compressed by sliding, and each domain block is assigned to a different domain block pool based on the variance of each domain block, including:

[0015] A domain block is generated by translating a sliding window of size 2B×2B on image I with a preset step size. The value of B is changed sequentially to obtain domain blocks of different sizes.

[0016] Perform a four-neighbor average compression transformation on the defined domain block;

[0017] If the variance of the transformed domain block is less than the first threshold, it will not be added to the domain block pool.

[0018] If the variance of the transformed domain block is greater than the first threshold and less than the second threshold, then it is added to the low variable block domain pool corresponding to the size of the domain block, according to the size of the domain block.

[0019] If the variance of the transformed domain block is greater than the second threshold, then it is added to the drastic block domain pool corresponding to the size of the domain block, based on the size of the domain block.

[0020] Furthermore, for different domain block pools, the feature vector of each domain block in the domain block pool is calculated, including:

[0021] For a domain block in the low-variable domain pool, the centrality, coefficient of variation, skewness, and kurtosis of the domain block are calculated as feature vectors. The centrality of the domain block is calculated as follows:

[0022]

[0023] In the formula, Cty represents the centrality of the domain block, i and j are the pixel coordinates, and z(i,j) represents the gray value of the coordinate point. Std represents the average gray value of the domain block, and Std represents the standard deviation of the domain block.

[0024] For a domain block in the domain pool of a drastic block, the roughness, coefficient of variation, skewness, and kurtosis of the domain block are calculated as feature vectors. The roughness of the domain block is calculated as follows:

[0025] The domain block is subjected to row-direction differencing, specifically by subtracting the difference of the previous row from each row of the domain block except the first row to obtain the value of the current row, thus obtaining matrix B.

[0026] Classify matrix B: if the absolute value of a pixel in matrix B is less than the third threshold, assign it a value of 0; if the absolute value of a pixel in matrix B is greater than the third threshold and the pixel value is positive, assign it a value of 1; if the pixel value is negative, assign it a value of -1, thus obtaining matrix C.

[0027] The number of non-zero values ​​in matrix C is denoted as num1. Then, C is subjected to row-wise difference and the absolute value is taken to form matrix D. The number of 2s in matrix D is denoted as num2.

[0028] Coarse roughness in the direction of travel r for:

[0029]

[0030] The domain block is subjected to column-directed differencing, specifically by subtracting the difference of the previous column from each column of the domain block except the first column to obtain the value of the current column, thus obtaining matrix E.

[0031] Classify matrix E: if the absolute value of a pixel in matrix E is less than the fourth threshold, assign it a value of 0; if the absolute value of a pixel in matrix E is greater than the fourth threshold and the pixel value is positive, assign it a value of 1; if the pixel value is negative, assign it a value of -1, thus obtaining matrix F.

[0032] The number of non-zero values ​​in matrix F is denoted as num3. Then, F is subjected to column-directed difference, and the absolute value is taken to form matrix G. The number of 2s in matrix G is denoted as num4.

[0033] Coarse roughness in column direction c for:

[0034]

[0035] The roughness Coarse of the defined domain block is:

[0036]

[0037] Furthermore, the value range block satisfies preset conditions, which include:

[0038] The coefficient of variation of the range block is less than the fifth threshold or the side length of the range block is a preset side length.

[0039] Furthermore, a value block is randomly selected from the value block pool, and the feature vector of the value block is calculated, including:

[0040] Calculate the variance of the range block;

[0041] If the variance of the value range block is less than the first threshold, there is no need to calculate the feature vector of the value range block; instead, the mean is used for encoding.

[0042] If the variance of the range block is greater than the first threshold and less than the second threshold, the centrality, coefficient of variation, skewness and kurtosis of the range block are calculated as feature vectors.

[0043] If the variance of the range block is greater than the second threshold, calculate the roughness, coefficient of variation, skewness, and kurtosis of the range block.

[0044] Furthermore, based on the size of the range block, the kd-tree in the corresponding size of the domain block pool is used to find the K nearest neighbors of the feature vector of the range block, including:

[0045] If the variance of the range block is greater than the first threshold and less than the second threshold, a low-variable block definition pool of the corresponding size is selected according to the side length of the range block, and the K nearest neighbors of the feature vector of the range block are found in the kd tree of the low-variable block definition pool of the corresponding size.

[0046] If the variance of the range block is greater than the second threshold, a domain pool of a drastic block of the corresponding size is selected according to the side length of the range block, and the K nearest neighbors of the feature vectors of the range block are found in the kd tree of the domain pool of the drastic block of the corresponding size.

[0047] Further, from the reduced block pool, any domain block is selected, and the corresponding grayscale transformation parameters that make the mean square error less than the mean square error threshold are found, including:

[0048]

[0049] In the formula, s i ,o i Here, R represents the grayscale transformation parameters, and t represents the value range block pool. k Let T represent the set of isometric transformations, and R represent the set of isometric transformations. i D represents the i-th range block in the range block pool. j This represents the j-th domain block in the reduced block pool.<D,D> and<D,I> Represents the inner product of domain blocks.<D,R> and<R,I> This represents the inner product of the range block.

[0050] Furthermore, the inner product of the domain blocks is calculated synchronously when constructing the kd-trees of different domain block pools.

[0051] Furthermore, the inner product of the range block is calculated simultaneously when the eigenvector of the range block is calculated.

[0052] Furthermore, it also includes decompression methods:

[0053] Obtain the image to be decompressed;

[0054] The fractal encoding parameters of the image to be decompressed are read sequentially;

[0055] If the fractal encoding parameter is mean value encoding, use the value range block corresponding to the mean value fractal encoding;

[0056] If the fractal coding parameter is a non-mean value coding, find the domain block corresponding to the fractal coding parameter, and perform a compressed affine transformation on the domain block according to the fractal coding parameter and the isometric transformation identifier. Replace the domain block corresponding to the current fractal coding parameter with the transformed domain block.

[0057] Once all value blocks of the image to be decompressed have been replaced, the final decompressed image is obtained.

[0058] Compared with the prior art, the beneficial effects of the technical solution of the present invention are:

[0059] This invention utilizes feature vectors and methods such as quadtree segmentation based on coefficient of variation and kd-tree to accelerate the high-resolution fractal compression time while ensuring that the image quality meets real-world requirements, thus solving the problem of slow compression time for high-resolution images by general fractal compression algorithms. Attached Figure Description

[0060] Figure 1 This is a flowchart illustrating a fractal image compression method based on quadtree segmentation and feature vectors, provided in an embodiment of the present invention.

[0061] Figure 2 This is a schematic diagram illustrating the process of generating the domain block pool and kd-tree according to an embodiment of the present invention.

[0062] Figure 3 This is a schematic flowchart of the fractal image compression method provided in an embodiment of the present invention;

[0063] Figure 4 This is a schematic diagram of the quadtree segmentation principle provided in an embodiment of the present invention;

[0064] Figure 5 A schematic flowchart of the decompression method provided in an embodiment of the present invention;

[0065] Figure 6 This is a schematic diagram illustrating the compression effect provided in an embodiment of the present invention. Detailed Implementation

[0066] The accompanying drawings are for illustrative purposes only and should not be construed as limiting the scope of this patent.

[0067] To better illustrate this embodiment, some parts in the accompanying drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions;

[0068] It will be understood by those skilled in the art that certain well-known structures and their descriptions may be omitted in the accompanying drawings.

[0069] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0070] Example 1

[0071] A fractal image compression method based on quadtree segmentation and eigenvectors, such as... Figure 1 As shown, it includes the following steps:

[0072] Multiple domain blocks are extracted by sliding from the image to be compressed, and each domain block is assigned to a different domain block pool according to the variance of each domain block;

[0073] For different domain block pools, the feature vector of each domain block in the domain block pool is calculated, and kd-trees of different domain block pools are constructed based on the feature vectors.

[0074] The image to be compressed is divided into multiple non-overlapping value range blocks of the same size;

[0075] If a value block meets the preset conditions, the value block is added to the value block pool; if a value block does not meet the preset conditions, the value block is divided into four sub-value blocks according to the quadtree, and the sub-value blocks are used as new value blocks to determine whether they meet the preset conditions, until all value blocks are added to the value block pool.

[0076] Take any value block from the value block pool and calculate the feature vector of the value block;

[0077] Based on the size of the value range block, select the K nearest neighbors of the feature vectors of the value range block in the kd tree of the corresponding size of the domain block pool, and add the domain blocks corresponding to the K feature vectors to the shrinking block pool.

[0078] Take any domain block from the reduced block pool, find the grayscale transformation parameters, domain block identifier, isometry transformation identifier, and domain block size that make the mean square error less than the mean square error threshold, and record them as the fractal code of the current domain block to obtain the fractal codes of all domain blocks in the domain block pool.

[0079] The fractal codes of all value blocks in the value block pool are merged to obtain the compressed image of the image to be compressed.

[0080] In this embodiment of the invention, the input image is first translated through a sliding window to generate a domain block D. j , for D j After the block undergoes a four-neighbor compression transformation, according to D j The variance of the blocks is used to determine whether to add them to the pool of blocks in the domain of definition, or to the pool of blocks in the domain of low-variance blocks or the pool of blocks in the domain of high-variance blocks. Feature vectors are then calculated for each pool of blocks in each domain, and a kd-tree is constructed based on these feature vectors. Next, the input image is segmented into non-overlapping blocks with side length D. j The range of blocks R with half the side length of the block i According to R i Based on the coefficient of variation characteristics of the blocks, the value range blocks are partitioned into top-down quadtrees. Then, the value range blocks obtained after the partitioning are selected from the pool according to R. i The block variance is used to determine whether to perform mean encoding or non-mean encoding. Non-mean encoding requires using the feature vector of each value range block to determine whether to use the K-nearest neighbor search algorithm in the kd-tree of the low-variance block domain pool or the high-variance block domain pool to find the nearest neighbor to each R. i The K nearest eigenvectors to the eigenvector are used to form the reduced domain block pool. Finally, using the reduced domain block pool and the quadtree-segmented range blocks, the optimal domain block for each range block is found in the reduced domain block pool. Based on the fractal algorithm principle, the range block R is determined. i The fractal encoding of the image is recorded, and by traversing all domain blocks and integrating the fractal codes of all domain blocks, the fractal code of the entire image can be obtained, thus completing fractal compression. The decompression process involves taking any initial image of the same size as the input image, finding the corresponding domain block based on the existing fractal code, performing a compressed affine transformation on it according to the fractal code, replacing the current domain block with the transformed domain block, and repeating this iteration to obtain the final image.

[0081] Example 2

[0082] This embodiment continues to provide the following content based on Embodiment 1:

[0083] In a further embodiment, multiple domain blocks are extracted by sliding from the image to be compressed, and each domain block is assigned to a different domain block pool based on the variance of each domain block, such as... Figure 2 As shown, it includes:

[0084] A domain block is generated by translating a 2B×2B sliding window on image I with a preset step size. The value of B is changed sequentially to obtain domain blocks of different sizes. Specifically, an M×M image I is read in, and a 2B×2B sliding window with a step size δ is translated on image I to generate a domain block D. jThe blocks, where B takes values ​​of 32, 16, 8, and 4 in sequence;

[0085] Perform a four-neighbor average compression transformation on the defined domain block;

[0086] If the variance of the transformed domain block is less than the first threshold, it will not be added to the domain block pool.

[0087] If the variance of the transformed domain block is greater than the first threshold and less than the second threshold, then it is added to the low-variable block domain pool corresponding to the size of the domain block, based on the size of the domain block. Specifically, if the variance is greater than threshold T1 and less than threshold T2, it is added to the low-variable block domain pool ω corresponding to the size of the domain block, respectively. 32_1 ω 16_1 ω 8_1 and ω 4_1 middle;

[0088] If the variance of the transformed domain block is greater than the second threshold, then it is added to the drastic block domain pool corresponding to the size of the domain block, based on the size of the domain block. Specifically, if the variance is greater than T2, it is added to the drastic block domain pool ω corresponding to the size of the domain block. 32_2 ω 16_2 ω 8_2 and ω 4_2 middle;

[0089] In a specific embodiment, the present invention first generates a domain block D by translating the input image through a sliding window. j , for D j After the block undergoes a four-neighbor compression transformation, according to D j The variance of the block determines whether to add it to the domain block pool, the low-variance block domain pool, or the high-variance block domain pool.

[0090] In a further embodiment, for different domain block pools, the feature vector of each domain block in the domain block pool is calculated, including:

[0091] For a domain block in the low-variable domain pool, the centrality, coefficient of variation, skewness, and kurtosis of the domain block are calculated as feature vectors. The centrality of the domain block is calculated as follows:

[0092]

[0093] In the formula, Cty represents the centrality of the domain block, i and j are the pixel coordinates, and z(i,j) represents the gray value of the coordinate point. Std represents the average gray value of the domain block, and Std represents the standard deviation of the domain block.

[0094] In a specific embodiment, centrality Cty is a simple indicator that measures the relative position of gray values ​​of image blocks. The first term in the numerator of the above formula is the weight assigned to the gray value. The closer the pixel is to the inner layer, the larger the value. For the coefficient of variation, skewness, and kurtosis, they can all be calculated based on the pixel values ​​of the domain block.

[0095] For the domain blocks in the domain pool of the drastic block definition, the roughness, coefficient of variation, skewness, and kurtosis of the domain block are calculated as feature vectors. The purpose of roughness is to extract the features of the rough block by extracting the number of large gray-level changes in the rough block. The calculation steps are as follows:

[0096] The domain block is subjected to row-wise differencing. Specifically, each row of the domain block except the first row is subtracted from the difference of the previous row to obtain the value of the current row, resulting in matrix B, as shown below:

[0097]

[0098] Matrix B is classified. If the absolute value of a pixel in matrix B is less than the third threshold, it is assigned a value of 0; if the absolute value of a pixel in matrix B is greater than the third threshold and the pixel value is positive, it is assigned a value of 1; if the pixel value is negative, it is assigned a value of -1, resulting in matrix C, as shown below:

[0099]

[0100] The number of non-zero values ​​in matrix C is denoted as num1. Then, C is further subjected to row-wise differencing, as follows:

[0101]

[0102] And take the absolute value of the matrix D, and denote the number of 2s in matrix D as num2;

[0103] Coarse roughness in the direction of travel r for:

[0104]

[0105] The domain block is subjected to column-directed differencing, specifically by subtracting the difference of the previous column from each column of the domain block except the first column to obtain the value of the current column, thus obtaining matrix E.

[0106] Classify matrix E: if the absolute value of a pixel in matrix E is less than the fourth threshold, assign it a value of 0; if the absolute value of a pixel in matrix E is greater than the fourth threshold and the pixel value is positive, assign it a value of 1; if the pixel value is negative, assign it a value of -1, thus obtaining matrix F.

[0107] The number of non-zero values ​​in matrix F is denoted as num3. Then, F is subjected to column-directed difference, and the absolute value is taken to form matrix G. The number of 2s in matrix G is denoted as num4.

[0108] Coarse roughness in column direction c for:

[0109]

[0110] The roughness Coarse of the defined domain block is:

[0111]

[0112] After defining the domain block pool and constructing the kd-tree, fractal image compression methods, such as... Figure 3 As shown, the input image is segmented into non-overlapping segments with side length D. j The range of blocks R with half the side length of the block i According to R i Based on the coefficient of variation characteristics of the blocks, the value range blocks are partitioned into top-down quadtrees. Then, the value range blocks obtained after the partitioning are selected from the pool according to R. i The block variance is used to determine whether to perform mean encoding or non-mean encoding. Non-mean encoding requires using the feature vector of each value range block to determine whether to use the K-nearest neighbor search algorithm in the kd-tree of the low-variance block domain pool or the high-variance block domain pool to find the nearest neighbor to each R. i The K nearest eigenvectors to the eigenvector are used to form the reduced domain block pool. Finally, using the reduced domain block pool and the quadtree-segmented range blocks, the optimal domain block for each range block is found in the reduced domain block pool. Based on the fractal algorithm principle, the range block R is determined. i By encoding and recording the fractal values ​​of the image, traversing all value range blocks, and integrating the fractal codes of all value range blocks, the fractal code of the entire image can be obtained, thus completing fractal compression.

[0113] In a further embodiment, the value range block satisfies preset conditions, the preset conditions including:

[0114] The coefficient of variation of the range block is less than the fifth threshold or the side length of the range block is a preset side length.

[0115] In a specific embodiment, the input image I is segmented into non-overlapping 32×32 value range blocks R. i Block; preset side length is 4.

[0116] In order to reduce the value range block without degrading image quality as much as possible, R needs to be adjusted here. i The blocks are processed using a quadtree partitioning method based on the coefficient of variation, which involves continuously partitioning the value range into blocks until the value range blocks meet preset conditions. The principle of quadtree partitioning is as follows: Figure 4 As shown.

[0117] In a further embodiment, a value range block is randomly selected from the value range block pool, and the feature vector of the value range block is calculated, including:

[0118] Calculate the variance of the range block;

[0119] If the variance of the value range block is less than the first threshold, there is no need to calculate the feature vector of the value range block, and the mean is used as the fractal encoding of the current value range block.

[0120] If the variance of the range block is greater than the first threshold and less than the second threshold, the centrality, coefficient of variation, skewness and kurtosis of the range block are calculated as feature vectors.

[0121] If the variance of the range block is greater than the second threshold, calculate the roughness, coefficient of variation, skewness, and kurtosis of the range block.

[0122] In a further embodiment, based on the size of the range block, the K nearest neighbors of the feature vectors of the range block are selected from the kd-tree in the corresponding size of the range block pool, including:

[0123] If the variance of the range block is greater than the first threshold and less than the second threshold, a low-variable block definition pool of the corresponding size is selected according to the side length of the range block, and the K nearest neighbors of the feature vector of the range block are found in the kd tree of the low-variable block definition pool of the corresponding size.

[0124] If the variance of the range block is greater than the second threshold, a domain pool of a drastic block of the corresponding size is selected according to the side length of the range block, and the K nearest neighbors of the feature vectors of the range block are found in the kd tree of the domain pool of the drastic block of the corresponding size.

[0125] In a further embodiment, taking any domain block from the reduced block pool and finding the grayscale transformation parameters that make the mean square error less than the mean square error threshold includes:

[0126]

[0127]

[0128] In the formula, s i ,o i Here, R represents the grayscale transformation parameters, and t represents the value range block pool. k Represents isometric transformation, where T represents the set of isometric transformations, specifically including 8 isometric transformations: 4 rotations and 4 flips. R i D represents the i-th range block in the range block pool. j This represents the j-th domain block in the reduced block pool.<D,D> and<D,I> Represents the inner product of domain blocks.<D,R> and<R,I> This represents the inner product of the range block.

[0129] In a further embodiment, the inner product of the domain blocks is calculated synchronously when constructing kd-trees for different domain block pools.

[0130] In a further embodiment, the inner product of the range block is calculated simultaneously when the eigenvector of the range block is computed.

[0131] Example 3

[0132] This embodiment, based on Embodiments 1 and 2, also provides a decompression method, such as... Figure 5 As shown, it includes the following steps:

[0133] Obtain the image to be decompressed, wherein the image to be decompressed is compressed according to the compression methods described in Embodiments 1 and 2;

[0134] The fractal encoding parameters of the image to be decompressed are read sequentially;

[0135] If the fractal encoding parameter is mean value encoding, use the value range block corresponding to the mean value fractal encoding;

[0136] If the fractal coding parameter is a non-mean value coding, find the domain block corresponding to the fractal coding parameter, and perform a compressed affine transformation on the domain block according to the fractal coding parameter and the isometric transformation identifier. Replace the domain block corresponding to the current fractal coding parameter with the transformed domain block.

[0137] Once all value blocks of the image to be decompressed have been replaced, the final decompressed image is obtained.

[0138] In the specific implementation process, six high-resolution images were used as experimental subjects. Two of these images were 1024×1024, two were 2048×2048, and two were 4096×4096 pixels. They were named cloud, purple flower, orchid, fruit, dog, and tissue section, respectively. Figure 6 As shown. All images were originally three-channel color images, which were converted to single-channel grayscale images through grayscale transformation for experimental purposes. To demonstrate the effectiveness of the method in this embodiment, a fractal image compression algorithm based on feature vectors (FV-FIC) was selected for comparison with the fractal image compression algorithm based on coefficient of variation quadtree segmentation and feature vectors (CVQP-FV-FIC) of this invention. Peak signal-to-noise ratio (PSNR), compression time (CT), and compression ratio (CR) were selected as evaluation parameters for comparison.

[0139] Regarding parameter settings: the side length M of image I is set to 1024, 2048, and 4096 respectively; the sliding window step size δ = 8; the B values ​​in the domain block are set to 32, 16, 8, and 4 respectively; the variance thresholds T1 = 8 and T2 = 15; the coefficient of variation threshold μ = 0.05; the selection of the nearest neighbor search value K needs to be based on R.i The block side lengths of 32, 16, 8, and 4 correspond to 15, 15, 10, and 10 respectively; making the threshold for early termination of the MSE search ∈ = 30. Substitute the above parameters into the following steps:

[0140] S1: Input image size I of size M×M, and use the sliding window algorithm with a step size of δ to extract a domain block D of size 2B×2B. j First, D j Perform a four-neighbor average compression transformation if the domain block D j If the variance is less than the threshold T1, it is not added to the domain block pool; if the variance is greater than the threshold T1 but less than the threshold T2, it is added to the low-variable block domain pool ω1; if the variance is greater than T2, it is added to the drastic variable block domain pool ω2.

[0141] S2: For each domain block pool obtained in step S1, calculate the feature vector corresponding to the domain block in each domain pool, and construct a kd-tree based on the feature vectors for different domain block pools. Simultaneously, for each D... j Calculate the inner product<D,D> ,<D,I> It can speed up the matching and calculation of the optimal value range block;

[0142] S3: Segment the input image I into non-overlapping 32×32 value range blocks R. i Block, for each R i Step S4 is performed in the block;

[0143] S4: If R i The coefficient of variation of the block is less than the threshold μ, or R i If the side length of the block is 4, then R... i Add the block to the R block pool ω R Otherwise, the current R i The block is divided into four equal parts according to the quadtree partitioning method, and these four parts serve as the new R. i Repeat step S4;

[0144] S5: From R block pool ω R Take R from the middle i According to R i Choose a suitable K value for the size to facilitate K-nearest neighbor search. Next, calculate each R... i Inner product<R,I> And its coefficient of variation, centrality, roughness, skewness, and kurtosis. If R i If the block variance is less than the threshold T1, then the mean is used for encoding directly; if the variance is greater than T1 but less than T2, R... i The block feature vectors are centrality, coefficient of variation, skewness, and kurtosis. The K nearest neighbors of the current feature vector are found in the kd-tree within the corresponding low-variable block pool ω1. The D blocks corresponding to these K feature vectors are then reduced to a low-variable block pool. If the variance is greater than the threshold T2, R i The block feature vectors are roughness, coefficient of variation, skewness, and kurtosis. The K nearest neighbors of the current feature vector are found in the kd-tree within the domain pool ω2 of the drastic block of the corresponding size. The D blocks corresponding to these K feature vectors are then reduced to the drastic block pool.

[0145] S6: Take D sequentially from the corresponding reduced block pool. j Based on the results obtained above, we find the parameter s that minimizes MSE or makes MSE less than the threshold ε for the first time. i o i D j The identifier, the isometric transformation identifier, and the R block size are used as R. i Encode and record the fractal representations; traverse all R... i The blocks, all the fractal codes combined, constitute the fractal code of the entire image, and the compression process ends.

[0146] S7: The decompression process uses any image I of size M×M as the initial image; it sequentially reads the fractal encoding parameters. If the fractal encoding uses mean value encoding, it directly fills the corresponding R of the fractal encoding with the mean value. i If it is a non-mean encoding, you only need to find its corresponding D. j Blocks, according to the already fractal encoding of D j The block undergoes an affine transformation, and the transformed domain block replaces the R corresponding to the current fractal code. i Repeating the above steps will reconstruct the image. After calculation, the fractal image compression results for both are as follows: Figure 6 As shown in Table 1.

[0147] Table 1. Experimental results of applying the two algorithms to high-resolution images.

[0148]

[0149] from Figure 6It can be observed that the two algorithms are indistinguishable in terms of image quality to the naked eye. However, Table 1 clearly shows that the higher the image resolution, the algorithm of this embodiment not only has a significantly shorter computation time than the FV-FIC algorithm, but also exhibits better performance in terms of compression ratio. For example, in the fractal compression process of a 2048×2048 orchid image, from the perspective of image quality, the PSNR difference between the two algorithms is only 2.24dB, and both are higher than 40dB. However, the algorithm of this invention takes 159s while the FV-FIC algorithm takes 528s, resulting in a speedup of 3.32. Moreover, the compression ratio of the algorithm of this embodiment is much higher than that of the FV-FIC algorithm, being 3.28 times higher. Looking at the vertical aspect, in the fractal compression process of a 4096×4096 dog image, the PSNR difference between the two algorithms is only 3.44dB, and both are higher than 35dB. This difference is imperceptible to the naked eye. However, the algorithm of this embodiment takes only 723s while the FV-FIC algorithm takes 2305s, resulting in a speedup of 3.19. Therefore, the algorithm of this embodiment greatly improves the compression time. Moreover, the compression ratio of the embodiment of the present invention is 3.64 times that of the FV-FIC algorithm, which shows that the algorithm of the embodiment of the present invention can greatly compress the image while maintaining a certain image quality, and has better fractal compression performance.

[0150] In summary, the fractal image compression algorithm based on quadtree segmentation and feature vectors proposed in this embodiment of the invention has the advantages of high acceleration ratio, large compression ratio, and relatively faster acceleration time with higher resolution compared to other fractal algorithms. Therefore, it can solve the problem of long time consumption for fractal compression of high-resolution images to a certain extent.

[0151] The same or similar labels correspond to the same or similar parts;

[0152] The terms used to describe positional relationships in the accompanying drawings are for illustrative purposes only and should not be construed as limiting this patent.

[0153] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the implementation of the present invention. Those skilled in the art can make other variations or modifications based on the above description. It is neither necessary nor possible to exhaustively describe all embodiments here. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the claims of the present invention.

Claims

1. A fractal image compression method based on quadtree segmentation and feature vectors, characterized in that, Includes the following steps: Multiple domain blocks are extracted by sliding from the image to be compressed, and each domain block is assigned to a different domain block pool according to the variance of each domain block; For different domain block pools, the feature vector of each domain block in the domain block pool is calculated, and kd-trees of different domain block pools are constructed based on the feature vectors. The image to be compressed is divided into multiple non-overlapping value range blocks of the same size; If a value block meets the preset conditions, the value block is added to the value block pool; if a value block does not meet the preset conditions, the value block is divided into four sub-value blocks according to the quadtree, and the sub-value blocks are used as new value blocks to determine whether they meet the preset conditions, until all value blocks are added to the value block pool. Take any value block from the value block pool and calculate the feature vector of the value block; Based on the size of the value range block, find the K nearest neighbors of the feature vector of the value range block in the kd tree of the corresponding size domain block pool, and add the domain blocks corresponding to the K feature vectors to the shrink block pool. Take any domain block from the reduced block pool, find the grayscale transformation parameters, domain block identifier, isometry transformation identifier, and domain block size corresponding to the condition that the mean square error is less than the mean square error threshold, and record them as the fractal encoding of the current domain block. This yields the fractal encodings of all domain blocks in the domain block pool. The step of finding the grayscale transformation parameters corresponding to the condition that the mean square error is less than the mean square error threshold includes: In the formula, These are the grayscale transformation parameters. Indicates the value range block pool, Indicates isometric transformation. Represents the set of isometric transformations. Indicates the first value in the value range block pool i A value range block Indicates the number of blocks in the shrinking pool j One domain block; The fractal codes of all value blocks in the value block pool are merged to obtain the compressed image of the image to be compressed. The step of arbitrarily selecting a value block from the value block pool and calculating the feature vector of the value block includes: Calculate the variance of the range block; If the variance of the value range block is less than the first threshold, there is no need to calculate the feature vector of the value range block; instead, the mean is used for encoding. If the variance of the range block is greater than the first threshold and less than the second threshold, the centrality, coefficient of variation, skewness and kurtosis of the range block are calculated as feature vectors. If the variance of the range block is greater than the second threshold, calculate the roughness, coefficient of variation, skewness, and kurtosis of the range block.

2. The fractal image compression method based on quadtree segmentation and feature vectors according to claim 1, characterized in that, Multiple domain blocks are extracted by sliding from the image to be compressed, and each domain block is assigned to a different domain block pool based on the variance of each domain block, including: With a preset step size of 2B A sliding window of 2B is translated on image I to generate domain blocks, wherein different sizes of domain blocks are obtained by changing the value of B in turn; Perform a four-neighbor average compression transformation on the defined domain block; If the variance of the transformed domain block is less than the first threshold, it will not be added to the domain block pool. If the variance of the transformed domain block is greater than the first threshold and less than the second threshold, then it is added to the low variable block domain pool corresponding to the size of the domain block, according to the size of the domain block. If the variance of the transformed domain block is greater than the second threshold, then it is added to the drastic block domain pool corresponding to the size of the domain block, based on the size of the domain block.

3. The fractal image compression method based on quadtree segmentation and feature vectors according to claim 2, characterized in that, For different domain block pools, the feature vector of each domain block in the domain block pool is calculated, including: For a domain block in the low-variable domain pool, the centrality, coefficient of variation, skewness, and kurtosis of the domain block are calculated as feature vectors. The centrality of the domain block is calculated as follows: In the formula, To define the centrality of the domain block, These are the pixel coordinates. Represents the grayscale value of the coordinate point. This represents the average grayscale value of the defined domain block. This represents the standard deviation of the domain block; For a domain block in the domain pool of a drastic block, the roughness, coefficient of variation, skewness, and kurtosis of the domain block are calculated as feature vectors. The roughness of the domain block is calculated as follows: The domain block is subjected to row-direction differencing, specifically by subtracting the difference of the previous row from each row of the domain block except the first row to obtain the value of the current row, thus obtaining matrix B. Classify matrix B: if the absolute value of a pixel in matrix B is less than the third threshold, assign it a value of 0; if the absolute value of a pixel in matrix B is greater than the third threshold and the pixel value is positive, assign it a value of 1; if the pixel value is negative, assign it a value of -1, thus obtaining matrix C. The number of non-zero values ​​in matrix C is denoted as Perform row-wise differencing on C and take the absolute value to form matrix D. The number of 2s in matrix D is denoted as . ; Then the roughness in the direction of travel for: The domain block is subjected to column-directed differencing, specifically by subtracting the difference of the previous column from each column of the domain block except the first column to obtain the value of the current column, thus obtaining matrix E. Classify matrix E: if the absolute value of a pixel in matrix E is less than the fourth threshold, assign it a value of 0; if the absolute value of a pixel in matrix E is greater than the fourth threshold and the pixel value is positive, assign it a value of 1; if the pixel value is negative, assign it a value of -1, thus obtaining matrix F. The number of non-zero values ​​in matrix F is denoted as Perform column-wise difference on F and take the absolute value matrix G. The number of 2s in matrix G is denoted as . ; column direction roughness for: Then the roughness of the domain block for: 。 4. The fractal image compression method based on quadtree segmentation and feature vectors according to claim 3, characterized in that, The value range block satisfies preset conditions, which include: The coefficient of variation of the range block is less than the fifth threshold or the side length of the range block is a preset side length.

5. The fractal image compression method based on quadtree segmentation and feature vectors according to claim 4, characterized in that, Based on the size of the range block, find the K nearest neighbors of the feature vectors of the range block in the kd-tree of the corresponding size of the range block, including: If the variance of the range block is greater than the first threshold and less than the second threshold, a low-variable block definition pool of the corresponding size is selected according to the side length of the range block, and the K nearest neighbors of the feature vector of the range block are found in the kd tree in the low-variable block definition pool of the corresponding size. If the variance of the range block is greater than the second threshold, a domain pool of a drastic block of the corresponding size is selected according to the side length of the range block, and the K nearest neighbors of the feature vector of the range block are found in the kd tree in the domain pool of the drastic block of the corresponding size.

6. The fractal image compression method based on quadtree segmentation and feature vectors according to claim 5, characterized in that, The calculation methods for the grayscale transformation parameters include: In the formula, and Represents the inner product of domain blocks. and This represents the inner product of the range block.

7. The fractal image compression method based on quadtree segmentation and feature vectors according to claim 6, characterized in that, The inner product of the domain blocks is calculated synchronously when constructing the kd-trees of different domain block pools.

8. The fractal image compression method based on quadtree segmentation and feature vectors according to claim 7, characterized in that, The inner product of the range block is calculated simultaneously when the eigenvectors of the range block are computed.

9. The fractal image compression method based on quadtree segmentation and feature vectors according to claim 8, characterized in that, It also includes decompression methods: Obtain the image to be decompressed; The fractal encoding parameters of the image to be decompressed are read sequentially; If the fractal encoding parameter is mean value encoding, use the value range block corresponding to the mean value fractal encoding; If the fractal coding parameter is a non-mean value coding, find the domain block corresponding to the fractal coding parameter, and perform a compressed affine transformation on the domain block according to the fractal coding parameter and the isometric transformation identifier. Replace the domain block corresponding to the current fractal coding parameter with the transformed domain block. Once all value blocks of the image to be decompressed have been replaced, the final decompressed image is obtained.

Citation Information

Patent Citations

  • Fractal image compression method based on combination of quad tree and neighborhood searching

    CN102595141A

  • Method and device for compressing fractal image

    JP1997065333A