Fractal image compression method based on variable coefficient quadtree segmentation and feature vectors
By using the method based on the quadtree segmentation and feature vector of the coefficient of variation, the problem of the fractal compression algorithm being too slow in high-resolution image compression is solved, and fast and efficient image compression is achieved.
Patent Information
- Application Number
- CN202411630567.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2044-11-15
AI Technical Summary
The existing fractal compression algorithms are too slow to compress high-resolution images and cannot meet the needs of real-life applications.
The fractal image compression method based on the quadtree segmentation and feature vectors of the variation coefficient is adopted, and the domain block is extracted by sliding the domain, the feature vector is calculated, and the kd tree is constructed to achieve fast fractal encoding.
On the premise of ensuring image quality, the fractal compression time of high-resolution images is significantly accelerated, and the problem of excessive compression time in the prior art is solved.
Smart Images

Figure CN120147441A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image fractal compression, and more specifically, to a fractal image compression method based on coefficient of variation quadtree segmentation and feature vectors. Background Art
[0002] In the era of big data, the rapidly growing image data makes image compression technology increasingly important. Fractal compression is an image coding algorithm that compresses using the self-correlation relationship of images. Its advantages are high compression ratio, fast image decoding, and the decoded image is independent of the resolution. However, the basic fractal compression algorithm has the disadvantage of long compression time, especially when compressing high-resolution images, the compression time cannot meet the requirements of practical applications. Therefore, on the premise of keeping the quality of the decompressed image within an acceptable range, how to improve the fractal compression algorithm and accelerate its encoding speed so that it can be applied to high-resolution images is of great significance. Summary of the Invention
[0003] The present invention provides a fractal image compression method based on coefficient of variation quadtree segmentation and feature vectors, which solves the technical problem that the compression time of general fractal compression algorithms for high-resolution images is too slow.
[0004] To solve the above technical problems, the technical solution of the present invention is as follows:
[0005] The present invention provides a fractal image compression method based on coefficient of variation quadtree segmentation and feature vectors, including the following steps:
[0006] Slide and extract multiple domain blocks from the image to be compressed, and divide each domain block into different domain block pools according to the variance of each domain block;
[0007] For different domain block pools, calculate the feature vectors of each domain block in the domain block pool respectively, and construct kd-trees for different domain block pools according to the feature vectors;
[0008] Divide the image to be compressed into multiple range blocks of the same size without overlap;
[0009] If the range block meets the preset condition, add the range block to the range block pool; if the range block does not meet the preset condition, divide the range block into four sub-range blocks by quadtree, and use the sub-range blocks as new range blocks to judge whether they meet the preset condition until all range blocks are added to the range block pool;
[0010] Take any range block from the range block pool and calculate the feature vector of the range block;
[0011] Select kd - trees in the domain block pool of corresponding size according to the size of the range block, find K eigenvectors closest to the eigenvector of the range block, and add the domain blocks corresponding to the K eigenvectors to the reduced block pool;
[0012] Take any domain block from the reduced block pool, find the gray - level transformation parameters, domain block identifier, isometric transformation identifier, and range block size corresponding to when the mean square error is less than the mean square error threshold as the fractal coding of the current range block and record it, to obtain the fractal coding of all range blocks in the range block pool;
[0013] Merge the fractal coding of all range blocks in the range block pool to obtain the compressed image of the image to be compressed.
[0014] Further, slide and extract multiple domain blocks from the image to be compressed, and divide each domain block into different domain block pools according to the variance of each domain block, including:
[0015] Use a sliding window of size 2B×2B to translate on the image I with a preset step size to generate domain blocks, where the value of B is changed sequentially to obtain domain blocks of different sizes;
[0016] Perform a four - neighborhood average compression transformation on the domain blocks;
[0017] If the variance of the transformed domain block is less than the first threshold, do not add it 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, add it to the low - variation 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, add it to the drastic - variation block domain pool corresponding to the size of the domain block according to the size of the domain block.
[0020] Further, for different domain block pools, calculate the eigenvector of each domain block in the domain block pool respectively, including:
[0021] For the domain blocks in the low - variation block domain pool, calculate the centrality, coefficient of variation, skewness, and kurtosis of the domain block as eigenvectors, where the centrality of the domain block is calculated as follows:
[0022]
[0023] In the formula, Cty is the centrality of the domain block, i and j are pixel coordinates, z(i, j) represents the gray value of the coordinate point, represents the gray - level average value of the domain block, and Std represents the standard deviation of the domain block;
[0024] For the domain blocks in the drastic change block domain pool, calculate the roughness, coefficient of variation, skewness, and kurtosis of the domain blocks as feature vectors. The roughness of the domain block is calculated as follows:
[0025] Perform row - direction difference on the domain block. Specifically, subtract the difference between the previous row from each row of the domain block except the first row to obtain the value of the current row, resulting in matrix B;
[0026] Classify matrix B. If the absolute value of the pixel value in matrix B is less than the third threshold, assign it as 0; if the absolute value of the pixel value in matrix B is greater than the third threshold and the pixel value is positive, assign it as 1, and if the pixel value is negative, assign it as - 1, to obtain matrix C;
[0027] Record the non - zero quantity in matrix C as num 1 , perform row - direction difference on C again and take the absolute value to obtain matrix D. Record the quantity of 2 in matrix D as num 2 ;
[0028] Then the row - direction roughness Coarse r is:
[0029]
[0030] Perform column - direction difference on the domain block. Specifically, subtract the difference between the previous column from each column of the domain block except the first column to obtain the value of the current column, resulting in matrix E;
[0031] Classify matrix E. If the absolute value of the pixel value in matrix E is less than the fourth threshold, assign it as 0; if the absolute value of the pixel value in matrix E is greater than the fourth threshold and the pixel value is positive, assign it as 1, and if the pixel value is negative, assign it as - 1, to obtain matrix F;
[0032] Record the non - zero quantity in matrix F as num 3 , perform column - direction difference on F again and take the absolute value to obtain matrix G. Record the quantity of 2 in matrix G as num 4 ;
[0033] Then the column - direction roughness Coarse c is:
[0034]
[0035] Then the roughness Coarse of the domain block is:
[0036]
[0037] Furthermore, the value range block meets the preset conditions, and the preset conditions include:
[0038] The coefficient of variation of the value range block is less than the fifth threshold or the side length of the value range block is the preset side length.
[0039] Further, randomly select a value range block from the value range block pool and calculate the feature vector of the value range block, including:
[0040] Calculate the variance of the value 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, and the mean value is used for encoding;
[0042] If the variance of the value range block is greater than the first threshold and less than the second threshold, calculate the centrality, coefficient of variation, skewness, and kurtosis of the value range block as the feature vector;
[0043] If the variance of the value range block is greater than the second threshold, calculate the roughness, coefficient of variation, skewness, and kurtosis of the value range block.
[0044] Further, according to the size of the value range block, select the kd-tree in the domain block pool of the corresponding size to find the K feature vectors closest to the feature vector of the value range block, including:
[0045] If the variance of the value range block is greater than the first threshold and less than the second threshold, select the low-variation block domain pool of the corresponding size according to the side length of the value range block, and find the K feature vectors closest to the feature vector of the value range block in the kd-tree in the low-variation block domain pool of the corresponding size;
[0046] If the variance of the value range block is greater than the second threshold, select the sharp-variation block domain pool of the corresponding size according to the side length of the value range block, and find the K feature vectors closest to the feature vector of the value range block in the kd-tree in the sharp-variation block domain pool of the corresponding size.
[0047] Further, randomly select a domain block from the reduced block pool and find the corresponding grayscale transformation parameter when the mean square error is less than the mean square error threshold, including:
[0048]
[0049]
[0050]
[0051] In the formula, s i , o i are the grayscale transformation parameters, R represents the value range block pool, t k represents the isometric transformation, T represents the set of isometric transformations, R i represents the i-th value range block in the value range block pool, D jRepresents the \(i\)-th domain block in the reduced block pool. \(\langle D, D\rangle\) and \(\langle D, I\rangle\) represent the inner products of domain blocks, and \(\langle D, R\rangle\) and \(\langle R, I\rangle\) represent the inner products of range blocks.
[0052] Furthermore, the inner product of the domain blocks is calculated synchronously when constructing the kd-tree of different domain block pools.
[0053] Furthermore, the inner product of the range blocks is calculated synchronously when calculating the feature vectors of the range blocks.
[0054] Furthermore, it also includes a decompression method:
[0055] Obtain the image to be decompressed;
[0056] Read the fractal coding parameters of the image to be decompressed sequentially;
[0057] If the fractal coding parameter is mean coding, use the corresponding range block of the mean fractal coding;
[0058] If the fractal coding parameter is non-mean coding, find the domain block corresponding to the fractal coding parameter, and perform a compression affine transformation on the domain block according to the fractal coding parameter and the isometric transformation flag, and replace the current range block corresponding to the fractal coding parameter with the transformed domain block;
[0059] When all the range blocks of the image to be decompressed are replaced, the final decompressed image is obtained.
[0060] Compared with the prior art, the beneficial effects of the technical solution of the present invention are:
[0061] The present invention uses feature vectors and methods such as coefficient of variation quadtree segmentation and kd-tree, which can accelerate the fractal compression time of high resolution while ensuring that the image quality meets the actual requirements, and solves the problem that the compression time of high resolution images is too slow in general fractal compression algorithms. Description of the Drawings
[0062] Figure 1 It is a schematic flow chart of a fractal image compression method based on coefficient of variation quadtree segmentation and feature vectors provided by an embodiment of the present invention.
[0063] Figure 2 It is a schematic flow chart of the generation of the domain block pool and the kd-tree provided by an embodiment of the present invention;
[0064] Figure 3 It is a schematic flow chart of the fractal image compression method provided by an embodiment of the present invention;
[0065] Figure 4 It is a schematic diagram of the quadtree segmentation principle provided by an embodiment of the present invention; Figure 5Schematic flowchart of the decompression method provided by the embodiment of the present invention; Figure 6 Schematic diagram of the compression effect provided by the embodiment of the present invention. Detailed implementation manners
[0066] The accompanying drawings are only for illustrative purposes and should not be construed as limitations on this patent;
[0067] To better illustrate this embodiment, some components in the accompanying drawings are omitted, enlarged or reduced, which do not represent the dimensions of the actual product;
[0068] For those skilled in the art, it is understandable that some well-known structures and their descriptions in the accompanying drawings may be omitted.
[0069] The technical solutions of the present invention will be further described below with reference to the accompanying drawings and embodiments.
[0070] Embodiment 1
[0071] A fractal image compression method based on coefficient of variation quadtree segmentation and feature vectors, as Figure 1 shown, includes the following steps:
[0072] Slide and extract a plurality of domain blocks from the image to be compressed, and divide each of the domain blocks into different domain block pools according to the variance of each domain block;
[0073] For different domain block pools, calculate the feature vectors of each domain block in the domain block pool respectively, and construct kd-trees for different domain block pools according to the feature vectors;
[0074] Divide the image to be compressed into a plurality of range blocks of the same size without overlap;
[0075] If the range block meets the preset condition, add the range block to the range block pool; if the range block does not meet the preset condition, divide the range block into four sub-range blocks by quadtree, and use the sub-range blocks as new range blocks to judge whether they meet the preset condition until all range blocks are added to the range block pool;
[0076] Arbitrarily select a range block from the range block pool, and calculate the feature vector of the range block;
[0077] According to the size of the range block, find the K feature vectors closest to the feature vector of the 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 reduced block pool;
[0078] Take any domain block from the reduced block pool, find the corresponding grayscale transformation parameters, domain block identifier, isometric transformation identifier, and range block size when the mean square error is less than the mean square error threshold as the fractal coding of the current range block and record it, and obtain the fractal coding of all range blocks in the range block pool;
[0079] Merge the fractal coding of all range blocks in the range block pool to obtain the compressed image of the image to be compressed.
[0080] In the embodiment of the present invention, first, the input picture is used to generate the domain block D through the translation of the sliding window j , and after performing a four-neighborhood compression transformation on the D j block, according to the variance of the D j block, determine whether to add it to the domain block pool, or add it to the low-variance block domain pool or the high-variance block domain pool, and calculate the respective feature vectors of the pool blocks in different domain pools, and then construct a kd-tree based on the feature vectors; immediately after that, the input picture is segmented into non-overlapping range blocks R j with a side length half of the side length of the D i block. According to the coefficient of variation feature of the R i block, perform a top-down quadtree segmentation on the range block, and then determine whether to perform mean coding or non-mean coding according to the variance of the R i block from the range block pool obtained after the segmentation; for non-mean coding, it is necessary 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 K feature vectors closest to the feature vector of each R i . These K feature vectors are the reduced domain block pool; finally, use the reduced domain block pool and the range blocks obtained by the quadtree segmentation to find the optimal domain block corresponding to each range block in the reduced domain block pool, and determine the fractal coding of the range block R i according to the principle of the fractal algorithm and record it. Traverse all range blocks and integrate the fractal coding of all range blocks to obtain the fractal coding of the entire image and complete the fractal compression. The decompression process is to perform a compression affine transformation on any initial image of the same size as the input image according to the existing fractal coding, replace the current range block with the transformed domain block, and repeat the iteration to obtain the final image.
[0081] Embodiment 2
[0082] On the basis of Embodiment 1, this embodiment further provides the following content:
[0083] In a further embodiment, a plurality of domain blocks are slidably extracted from the image to be compressed, and each of the domain blocks is divided into different domain block pools according to the variance of each domain block, such asFigure 2 As shown in, including:
[0084] A sliding window with a size of 2B×2B translates on the image I at a preset step length to generate a domain block. Among them, the value of B is changed sequentially to obtain domain blocks of different sizes. Specifically, an image I with a size of M×M is read in, and a sliding window with a size of 2B×2B translates on the image I at a step length of δ to generate D j blocks, where B takes 32, 16, 8, and 4 in sequence;
[0085] Perform a four-neighborhood average compression transformation on the domain block;
[0086] If the variance of the transformed domain block is less than the first threshold, it is not 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, it is added to the low-variation block domain pool corresponding to the size of the domain block according to the size of the domain block. Specifically, if the variance is greater than the threshold T 1 less than the threshold T 2 then it is respectively added to the low-variation block domain pools ω 32_1 、ω 16_1 、ω 8_1 and ω 4_1 ;
[0088] If the variance of the transformed domain block is greater than the second threshold, it is added to the sharp-variation block domain pool corresponding to the size of the domain block according to the size of the domain block. Specifically, if the variance is greater than T 2 , then it is respectively added to the sharp-variation block domain pools ω 32_2 、ω 16_2 、ω 8_2 and ω 4_2 ;
[0089] In a specific embodiment, the embodiment of the present invention first generates a domain block D by translating the input picture through a sliding window j , and after performing a four-neighborhood compression transformation on the D j block, determines whether to add it to the domain block pool or add it to the low-variation block domain pool or the sharp-variation block domain pool according to the variance of the D j block.
[0090] In a further embodiment, for different domain block pools, the eigenvectors of each domain block in the domain block pool are calculated respectively, including:
[0091] For the domain blocks in the low-variation block domain pool, calculate the centrality, coefficient of variation, skewness, and kurtosis of the domain block as eigenvectors. Among them, the centrality of the domain block is calculated as follows:
[0092]
[0093] Wherein, Cty is the centrality of the domain block, i and j are the coordinates of the pixel points, z(i, j) represents the gray value of the coordinate point, represents the average gray value of the domain block, and Std represents the standard deviation of the domain block;
[0094] In a specific embodiment, the centrality Cty is an index that can simply measure the relative position of the gray value of the image block. The first term in the numerator of the above formula is the weight assigned to the gray value. The closer the pixel point is to the inner layer, the larger this value is; for the coefficient of variation, skewness, and kurtosis, they can all be calculated according to the pixel values of the domain block;
[0095] For the domain blocks in the domain pool of the drastic change blocks, calculate the roughness, coefficient of variation, skewness, and kurtosis of the domain blocks as feature vectors. The purpose of the roughness of the domain block is to extract the features of the rough block by extracting the number of large gray value changes of the rough block. The calculation steps are as follows:
[0096] Perform row-direction difference on the domain block. Specifically, subtract the difference between the previous row from each row of the domain block except the first row to obtain the value of the current row as matrix B, as shown below:
[0097]
[0098] Perform classification processing on matrix B. If the absolute value of the pixel value in matrix B is less than the third threshold, assign it as 0; if the absolute value of the pixel value in matrix B is greater than the third threshold and the pixel value is positive, assign it as 1, and if the pixel value is negative, assign it as -1 to obtain matrix C, as shown below:
[0099]
[0100] The non-zero number in matrix C is denoted as num 1 , and perform row-direction difference on C again, as follows:
[0101]
[0102] And take the absolute value to obtain matrix D. The number of 2s in matrix D is denoted as num 2 ;
[0103] Then the row-direction roughness Coarse r is:
[0104]
[0105] Perform column-direction difference on the domain block. Specifically, subtract the difference between the previous column from each column of the domain block except the first column to obtain the value of the current column as matrix E;
[0106] Classify the matrix E. If the absolute value of the pixel value in matrix E is less than the fourth threshold, assign it a value of 0; if the absolute value of the pixel value in matrix E is greater than the fourth threshold and the pixel value is positive, assign it a value of 1, and if the pixel value is negative, assign it a value of -1 to obtain matrix F;
[0107] The number of non-0 elements in matrix F is denoted as num 3 , perform column-direction difference on F and take the absolute value to obtain matrix G. The number of 2s in matrix G is denoted as num 4 ;
[0108] Then the column-direction roughness Coarse c is:
[0109]
[0110] Then the roughness Coarse of the domain block is:
[0111]
[0112] After constructing the domain block pool and the kd-tree, for the fractal image compression method, as Figure 3 shown, the input picture is segmented into non-overlapping blocks with side length D j Half of the side length of the block is the range block R i , according to the coefficient of variation characteristics of the R i blocks, perform a top-down quadtree segmentation on the range blocks, and then according to the variance of the R i blocks from the range block pool obtained after the segmentation, determine whether to perform mean coding or non-mean coding; for non-mean coding, it is necessary to determine whether to use the kd-tree in the low-variance block domain pool or the high-variance block domain pool to find the K feature vectors closest to the feature vector of each R i using the K-nearest neighbor search algorithm. These K feature vectors are the reduced domain block pool; finally, use the reduced domain block pool and the range blocks obtained by the quadtree segmentation to find the optimal domain block corresponding to each range block in the reduced domain block pool, and determine the fractal coding of the range block R i according to the fractal algorithm principle and record it. Traverse all range blocks and integrate the fractal codings of all range blocks to obtain the fractal coding of the entire image and complete the fractal compression.
[0113] In a further embodiment, the range block satisfies a preset condition, and the preset condition includes:
[0114] The coefficient of variation of the range block is less than the fifth threshold or the side length of the range block is the preset side length.
[0115] In a specific embodiment, the input image I is segmented into non - overlapping value - range blocks R of size 32×32. i The block; the preset side length is set to 4.
[0116] In order to minimize the reduction in image quality while reducing the value - range blocks, here we perform a processing on the R i blocks based on the quadtree segmentation of the coefficient of variation, that is, continuously segmenting the value - range blocks until the value - range blocks meet the preset conditions. The quadtree segmentation principle is as Figure 4 shown.
[0117] In a further embodiment, randomly select a value - range block from the value - range block pool, and calculate the feature vector of the value - range block, including:
[0118] Calculate the variance of the value - 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 use the mean value as the fractal coding of the current value - range block;
[0120] If the variance of the value - range block is greater than the first threshold and less than the second threshold, calculate the centrality, coefficient of variation, skewness, and kurtosis of the value - range block as the feature vector;
[0121] If the variance of the value - range block is greater than the second threshold, calculate the roughness, coefficient of variation, skewness, and kurtosis of the value - range block.
[0122] In a further embodiment, according to the size of the value - range block, select the corresponding - sized kd - tree in the domain - block pool to find the K feature vectors closest to the feature vector of the value - range block, including:
[0123] If the variance of the value - range block is greater than the first threshold and less than the second threshold, select the corresponding - sized low - variation - block domain pool according to the side length of the value - range block, and find the K feature vectors closest to the feature vector of the value - range block in the kd - tree of the corresponding - sized low - variation - block domain pool;
[0124] If the variance of the value - range block is greater than the second threshold, select the corresponding - sized drastic - variation - block domain pool according to the side length of the value - range block, and find the K feature vectors closest to the feature vector of the value - range block in the kd - tree of the corresponding - sized drastic - variation - block domain pool.
[0125] In a further embodiment, take any domain block from the reduced - block pool, and find the corresponding gray - scale transformation parameter when the mean - square error is less than the mean - square error threshold, including:
[0126]
[0127]
[0128]
[0129] where s i and o i are grayscale transformation parameters, R represents the range block pool, t k represents an isometric transformation, T represents the set of isometric transformations, specifically including 8 isometric transformations, namely 4 rotations and 4 flips, R i represents the i-th range block in the range block pool, D j represents the j-th domain block in the reduced block pool, <D, D> and <D, I> represent the inner product of domain blocks, and <D, R> and <R, I> represent the inner product of range blocks.
[0130] In a further embodiment, the inner product of the domain blocks is calculated synchronously when constructing the kd-tree of different domain block pools.
[0131] In a further embodiment, the inner product of the range blocks is calculated synchronously when calculating the feature vectors of the range blocks.
[0132] Embodiment 3
[0133] Based on Embodiments 1 and 2, this embodiment further provides a decompression method, as Figure 5 shown, including the following steps
[0134] Obtain the image to be decompressed, where the image to be decompressed is compressed by the compression method described in Embodiments 1 and 2;
[0135] Read the fractal coding parameters of the image to be decompressed in sequence;
[0136] If the fractal coding parameter is mean coding, use the range block corresponding to the mean fractal coding;
[0137] If the fractal coding parameter is non-mean 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, and replace the range block corresponding to the current fractal coding parameter with the transformed domain block;
[0138] After all the range blocks of the image to be decompressed are replaced, the final decompressed image is obtained.
[0139] In the specific implementation process, 6 high-resolution images are used as experimental objects, and the sizes of the 6 images include 1024×1024, 2048×2048, and 4096×4096, two for each. They are respectively named cloud, purple flower, orchid, fruit, dog, tissue section, as Figure 6As shown. All the original images are three-channel color images, which are converted into single-channel grayscale images through grayscale transformation for convenient experimentation. To demonstrate the effectiveness of the method of the embodiment of the present invention, the fractal image compression algorithm based on feature vectors (FV-FIC) is selected for comparison with the fractal image compression algorithm (CVQP-FV-FIC) of the present invention based on coefficient of variation quadtree segmentation and feature vectors. The evaluation parameters selected are peak signal-to-noise ratio (PSNR), compression time (CT), and compression ratio (CR) for comparative evaluation.
[0140] In terms of parameter settings: the side length M of the image I is taken as 1024, 2048, and 4096 respectively; the sliding window step size δ = 8; B in the domain block is taken as 32, 16, 8, and 4 respectively; the variance threshold T 1 = 8, T 2 = 15; the coefficient of variation threshold μ = 0.05; the selection of the K value for the nearest neighbor search needs to be based on R i The block side lengths 32, 16, 8, and 4 correspond to 15, 15, 10, and 10 respectively; the threshold ∈ for early termination of the MSE search is 30. Substitute the above parameters into the following steps:
[0141] S1: Input the image I of size M×M, and use the sliding window algorithm with a step size of δ to extract the domain block D of size 2B×2B j , first perform a four-neighborhood average compression transformation on D j . If the variance of the domain block D j is less than the threshold T 1 , then it is not added to the domain block pool; if the variance is greater than the threshold T 1 and less than the threshold T 2 , then it is added to the low-variance block domain pool ω 1 ; if the variance is greater than T 2 , then it is added to the high-variance block domain pool ω 2 ;
[0142] S2: Calculate the feature vectors corresponding to the domain blocks in each domain pool obtained in step S1 respectively, construct a kd-tree for different domain pools based on the feature vectors, and calculate the inner products <D, D> and <D, I> for each D j ; this can accelerate the matching and calculation speed with the optimal range block;
[0143] S3: Divide the input image 1 into non-overlapping range blocks R of size 32×32 i blocks, and perform step S4 on each R i block;
[0144] S4: If the coefficient of variation of the R i block is less than the threshold μ, or the side length of the R i block is 4, then Ri Add the block to the R - block pool ω R , otherwise, the current R i block is divided into four equal - sized blocks according to the quadtree, and these four blocks are used as new R i Repeat step S4;
[0145] S5: Take an R R from the R - block pool ω i , and select the corresponding K value according to the size of R i for K - nearest neighbor search. Secondly, calculate the inner product <R, I>, as well as its coefficient of variation, centrality, roughness, skewness, and kurtosis for each R i block. If the variance of the R i block is less than the threshold T 1 , then directly encode it with the mean value; if the variance is greater than T 1 , less than T 2 , the R i block feature vectors are centrality, coefficient of variation, skewness, and kurtosis, and find the K feature vectors closest to the current feature vector in the kd - tree in the low - variance block domain pool ω 1 of the corresponding size. The D blocks corresponding to these K feature vectors are reduced to the low - variance block pool If the variance is greater than the threshold T 2 , the R i block feature vectors are roughness, coefficient of variation, skewness, and kurtosis, and find the K feature vectors closest to the current feature vector in the kd - tree in the high - variance block domain pool ω 2 of the corresponding size. The D blocks corresponding to these K feature vectors are reduced to the high - variance block pool
[0146] S6: Take D j from the corresponding reduced block pools in turn, and combine the results obtained above to find the parameters s i , o i , D j identification, isometric transformation identification, and the R - block size as the fractal coding of R i and record it; traverse all R i blocks, and all the fractal codings combined are the fractal coding of the entire image, and the compression process ends
[0147] S7: In the decompression process, use an arbitrary image I of size M×M as the initial image; read the fractal coding parameters in turn. If the fractal coding is encoded with the mean value, directly fill the R i corresponding to the fractal coding with the mean value; if it is non - mean - value coding, just find its corresponding D j block, and according to the obtained fractal coding, perform operations on D jThe block is subjected to an affine transformation, and the transformed domain block is used to replace the corresponding R in the current fractal coding. i , and repeating the above operations can reconstruct the image. After calculation, the fractal image compression results of the two are as Figure 6 shown in Table 1.
[0148] Table 1 Experimental results of the two algorithms applied to high-resolution images
[0149]
[0150] From Figure 6 it can be found that there is no visible difference in the image quality between the two algorithms to the naked eye. However, it can be clearly seen from Table 1 that the higher the resolution of the picture, the algorithm of the embodiment of the present invention not only significantly lower the operation time than the FV-FIC algorithm in terms of operation time, but also shows better performance in terms of compression ratio. For example, in the process of fractal compression of an orchid image with a size of 2048×2048, in terms of image quality, the PSNR of the two algorithms differs by only 2.24dB, and both are higher than 40dB. However, the time used by this algorithm is 159s, while the FV-FIC algorithm takes 528s, and the speedup ratio is as high as 3.32. Moreover, the compression ratio of the algorithm of the embodiment of the present invention is much higher than that of the FV-FIC algorithm, which is 3.28 times that of it; looking vertically, in the process of fractal compression of a dog image with a size of 4096×4096, the PSNR of the two algorithms differs by only 3.44dB, and both are higher than 35dB. This difference is indistinguishable to the naked eye. However, the algorithm of the embodiment of the present invention only takes 723s, while the FV-FIC algorithm takes 2305s, and the speedup ratio is as high as 3.19. Therefore, the algorithm of the embodiment of the present invention 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 also greatly compress the image while maintaining a certain image quality, and has better fractal compression performance.
[0151] In summary, compared with other fractal algorithms, the fractal image compression algorithm based on coefficient of variation quadtree segmentation and eigenvector proposed in the embodiment of the present invention has the characteristics of high speedup ratio, large compression ratio, and relatively faster acceleration time with higher resolution. Therefore, it can, to a certain extent, solve the problem of long time-consuming fractal compression of high-resolution images.
[0152] The same or similar reference numerals correspond to the same or similar components;
[0153] The terms describing the positional relationship in the drawings are only for illustrative purposes and should not be construed as a limitation of this patent;
[0154] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, rather than limitations on the implementation manners of the present invention. For those of ordinary skill in the art, other different forms of changes or alterations can be made based on the above description. It is not necessary and impossible to enumerate all the implementation manners here. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the claims of the present invention.
Claims
1. A fractal image compression method based on variation coefficient quadtree segmentation and feature vector, characterized in that: The following steps are involved: Slidingly extracting a plurality of domain blocks from the image to be compressed, and dividing each of the domain blocks into different domain block pools according to the variance of each of the domain blocks; For different domain block pools, the feature vector of each domain block in the domain block pool is calculated respectively, and the kd tree of the different domain block pools is constructed according to the feature vector; Divide the image to be compressed into a plurality of non-overlapping range blocks of the same size; If the range block meets the preset conditions, the range block is added to the range block pool; if the range block does not meet the preset conditions, the range block is divided into four sub-range blocks according to the quadtree, and the sub-range blocks are used as new range blocks to determine whether they meet the preset conditions, until all range blocks are added to the range block pool; Randomly select a range block from the range block pool and calculate the feature vector of the range block; According to the size of the range block, a kd tree in a domain block pool of a corresponding size is selected to find K feature vectors that are nearest neighbors to the feature vector of the range block, and the domain blocks corresponding to the K feature vectors are added to the reduced block pool; Take any domain block from the reduced block pool, find the grayscale transformation parameter, domain block identifier, isometric transformation identifier and range block size corresponding to the mean square error less than the mean square error threshold as the fractal code of the current range block and record them, and obtain the fractal codes of all range blocks in the range block pool; The fractal codes of all the range blocks in the range block pool are combined to obtain a compressed image of the image to be compressed.
2. The fractal image compression method based on variation coefficient quadtree segmentation and feature vector according to claim 1 is characterized in that: Sliding and extracting a plurality of domain blocks from the image to be compressed, and dividing each of the domain blocks into different domain block pools according to the variance of each of the domain blocks, including: A sliding window of size 2B×2B is translated on image I with a preset step size to generate a domain block, wherein the value of B is changed in sequence to obtain domain blocks of different sizes; Performing a four-neighborhood average compression transformation on the 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 according to the size of the domain block, it is added to the low-variance block domain pool corresponding to the size of the domain block; If the variance of the transformed domain block is greater than the second threshold, then according to the size of the domain block, it is added to the drastic block domain pool corresponding to the size of the domain block.
3. The fractal image compression method based on variation coefficient quadtree segmentation and feature vector according to claim 2 is characterized in that: For different domain block pools, the feature vector of each domain block in the domain block pool is calculated respectively, including: For the domain blocks in the low-variance block domain pool, the centrality, coefficient of variation, skewness and kurtosis of the domain blocks are calculated as feature vectors, where the centrality of the domain blocks is calculated as follows: In the formula, Cty is the center of the domain block, i and j are the coordinates of the pixel points, and z(i,j) represents the gray value of the coordinate point. It represents the grayscale average value of the domain block, and Std represents the standard deviation of the domain block; For the domain block in the drastic block domain pool, the roughness, coefficient of variation, skewness and kurtosis of the domain block are calculated as the feature vector, where the roughness of the domain block is calculated as follows: Perform row-wise differences on the domain block. Specifically, subtract the difference of the previous row from each row of the domain block except the first row to obtain the matrix B as the value of the current row. Matrix B is classified and processed. If the absolute value of the pixel value in matrix B is less than the third threshold, it is assigned 0; if the absolute value of the pixel value in matrix B is greater than the third threshold and the pixel value is positive, it is assigned 1; if the pixel value is negative, it is assigned -1, and matrix C is obtained; The number of non-zero values in matrix C is recorded as num1. C is then differentiated in the row direction and the absolute value is taken as matrix D. The number of 2s in matrix D is recorded as num2. The row direction roughness Coarse r for: Perform column-wise differences on the domain block, specifically, subtract the difference of the previous column from each column except the first column of the domain block to obtain the matrix E as the value of the current column; The matrix E is classified and processed. If the absolute value of the pixel value in the matrix E is less than the fourth threshold, it is assigned to 0; if the absolute value of the pixel value in the matrix E is greater than the fourth threshold and the pixel value is positive, it is assigned to 1; if the pixel value is negative, it is assigned to -1, and the matrix F is obtained; The number of non-zero values in matrix F is recorded as num3. F is further differentiated in the column direction and the absolute value is taken as matrix G. The number of 2s in matrix G is recorded as num4. The roughness in the row direction is Coarse c for: Then the roughness of the domain block is:
4. The fractal image compression method based on variation coefficient quadtree segmentation and feature vector according to claim 3 is characterized in that: The value range block meets the preset conditions, and the preset conditions include: The coefficient of variation of the range block is less than a fifth threshold or the side length of the range block is a preset side length.
5. The fractal image compression method based on variation coefficient quadtree segmentation and feature vector according to claim 4 is characterized in that: Randomly select a range block from the range block pool and calculate the feature vector of the range block, including: Calculating the variance of the range block; If the variance of the range block is less than the first threshold, there is no need to calculate the feature vector of the range block, and the mean value is used for encoding; If the variance of the range block is greater than the first threshold and less than the second threshold, calculating the centrality, coefficient of variation, skewness and kurtosis of the range block as a feature vector; If the variance of the range block is greater than the second threshold, the roughness, coefficient of variation, skewness and kurtosis of the range block are calculated.
6. The fractal image compression method based on variation coefficient quadtree segmentation and feature vector according to claim 5, characterized in that: According to the size of the range block, a kd tree in a domain block pool of a corresponding size is selected to search for K feature vectors that are nearest neighbors to the feature vector 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-variance block domain pool of corresponding size is selected according to the side length of the range block, and K feature vectors that are nearest neighbors to the feature vector of the range block are searched in a kd-tree in the low-variance block domain pool of corresponding size; If the variance of the range block is greater than a second threshold, a drastic block domain pool of corresponding size is selected according to the side length of the range block, and K feature vectors that are nearest neighbors to the feature vector of the range block are searched in a kd tree in the drastic block domain pool of corresponding size.
7. The fractal image compression method based on variation coefficient quadtree segmentation and feature vector according to claim 6, characterized in that: Taking any domain block from the reduced block pool, finding the grayscale transformation parameter corresponding to the case where the mean square error is less than the mean square error threshold, including: In the formula, s i ,o i is the grayscale transformation parameter, R represents the range block pool, t k represents isometric transformation, T represents isometric transformation set, R i represents the i-th range block in the range block pool, D j represents the jth domain block in the reduced block pool,<D,D> and<D,I> represents the inner product of the domain block,<D,R> and<R,I> Represents the inner product of a range block.
8. The fractal image compression method based on variation coefficient quadtree segmentation and feature vector according to claim 7, characterized in that: The inner products of the domain blocks are calculated synchronously when constructing kd-trees of different domain block pools.
9. The fractal image compression method based on variation coefficient quadtree segmentation and feature vector according to claim 8, characterized in that: The inner product of the range block is calculated synchronously when the feature vector of the range block is calculated.
10. The fractal image compression method based on variation coefficient quadtree segmentation and feature vector according to claim 9, characterized in that: Also includes decompression method: Get the image to be decompressed; Reading the fractal coding parameters of the image to be decompressed in sequence; If the fractal coding parameter is mean coding, the value range block corresponding to the mean fractal coding is used; If the fractal coding parameter is non-mean 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, and replace the domain block corresponding to the current fractal coding parameter with the transformed domain block; When all range blocks of the image to be decompressed are 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
Rebuilding algorithm for super-resolution remote sensing image based on fractal theory
CN102819829A
Image region copying tampering detection method based on LIOP (Local Intensity Order Pattern) features and block matching
CN108335290A
Fractal image compression method and system for classifying image blocks by using DCT (Discrete Cosine Transform)
CN117241042A
Method and device for compressing fractal image
JP1997065333A