Background
The digital image has wide application in the fields of consumption digital code, medical image, satellite remote sensing, video conference and the like. In fact, images acquired by various imaging devices are compressed, otherwise, the storage space occupied by a single image is large. Taking a single lens reflex as an example, a non-compressed image of 3600 ten thousand pixels occupies a storage space of 108MB, and a 16GB memory card can only store about 150 non-compressed images. After the image compression algorithm is adopted for processing, the storage space occupied by the 3600-ten-thousand-pixel image is generally not more than 10MB, and one 16GB memory card can store about two thousand pictures. Therefore, the storage space can be greatly saved by compressing the image, and the data transmission efficiency is improved. The quality of the image compression method directly influences the subsequent practical engineering application.
The classical image compression methods include an entropy compression method, a prediction compression method, a transformation compression method, a neural network compression method and the like. The entropy compression method is a semantic-free data stream lossless coding method which compresses by utilizing statistical information of data. The prediction compression method is to perform prediction compression coding by using the characteristic that the adjacent pixel values of the image have strong correlation. The transform compression method is to transform an image from a spatial domain to a frequency domain by using an appropriate discrete orthogonal transform (e.g., discrete cosine transform, discrete wavelet transform, etc.), and to perform compression coding by processing transform coefficients. The neural network compression method is used for simulating some local primary positioning functions of a human visual system and applying the primary positioning functions to the field of image compression coding.
The above image compression methods each have advantages and disadvantages. The entropy compression method is slightly less efficient, but the advantage of this method is lossless compression. In the predictive compression method, the image is regarded as a "random process" in probability statistics, and the gray value of the current pixel is predicted by knowing the gray value of the pixel, and the prediction is in error. The prediction compression method has the advantages that the algorithm is easy to realize by hardware, the defect is obvious, the algorithm is sensitive to noise in the image, error code diffusion can be generated, and the compression ratio is low. The transformation compression method changes an image into a set of coefficients which are linearly independent through orthogonal transformation, and achieves the purpose of image compression by reserving a few coefficients. But transform compression methods tend to be computationally complex. The neural network compression method is a bionic compression method, and realizes compression by simulating human brain processing information, and has the defects of high computational complexity, difficult realization by hardware and only staying at a software code level at present.
The above-mentioned class 4 methods also have a common disadvantage in that they process color images in a way that is done in channels. That is, the above method views R, G and B color channels of the color image as a grayscale image, and compression-encodes the grayscale image. This processing method does not consider the internal relationship between the color components of the color image, directly affects the color reproduction of the color image, and is prone to color reproduction distortion. Therefore, how to realize the whole compression coding of the color image is very important, and the method has very important research significance and practical value.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides an image compression method based on a directional double-quaternion filter bank, and the technical scheme adopted by the invention is as follows:
the image compression method based on the directional double-quaternion filter bank comprises the following steps:
step S1: preprocessing an original image to be compressed, namely representing the original image to be compressed in a double-quaternion form to obtain an image f (x, y), wherein the value ranges of variables x and y are as follows: x 1, 2,., M, y 1, 2.., N, where M and N are positive integers, the number of rows and columns, respectively, of an image;
step S2: transforming the image F (x, y) by using a directional double-quaternion analysis filter bank to obtain a total of 2T subband frequency domain images { F) in different directionsm(u, v) | m ═ 1, 2,.., 2T }, the variables u and v take on the following ranges: u 1, 2., M/2, v 1, 2., N/2;
step S3: for each sub-band frequency domain image { Fm(u, v) | m ═ 1, 2,. 2, 2T } performing quantization encoding;
step S4: storing and outputting the quantized and coded data to obtain a compressed image;
in order to recover the original image from the compressed image data, the following steps are also required:
step S5: carrying out quantization decoding on the compressed image to restore a sub-band frequency domain image;
step S6: performing inverse transformation on the sub-band frequency domain image restored in the step S5 by using a directional double-quaternion synthesis filter bank to obtain a color image in a double-quaternion form;
step S7: the real or imaginary components of the color image in the form of a double quad number in step S6 are extracted to obtain a decompressed image.
Preferably, the mathematical formula for characterizing the original image to be compressed by using a biquad number in step S1 is as follows:
f(x,y)=(fR(x,y)·i+fG(x,y)·j+fB(x,y)·k)+(fR(x,y)·i+fG(x,y)·j+fB(x,y)·k)·I
wherein f isR(x,y)、fG(x, y) and fB(x, y) are R, G and B color components of the color image, I, j, k, and I are imaginary units of biquad numbers, respectively, according to the following operation rules:
i2=-1,j2=-1,k2=-1,I2=-1,ij=k,jk=i,ki=j。
preferably, the filter coefficients of the directional biquad analysis filter bank in step S2 are:
preferably, the quantization encoding in step S3 is completed by a threshold valid scan.
Preferably, the filter coefficients of the directional biquad filter bank in step S6 are:
compared with the prior art, the invention has the beneficial effects that: the method adopts a double-quaternion form to represent the color image, uses a directional double-quaternion analysis filter bank to carry out sub-band decomposition on the image, effectively extracts useful information in the image and carries out quantization coding, and then adopts a double-quaternion comprehensive filter bank to restore the original color image.
Detailed Description
In order to facilitate the technical solutions of the present invention for the understanding of the technical solutions of the present invention, the technical solutions of the present invention will be further described in detail with reference to the drawings and the embodiments of the present specification.
The invention provides an image compression method based on a directional double-quaternion filter bank, which adopts the following technical scheme:
with reference to fig. 1, the image compression method based on the directional biquad filter bank includes the following steps:
step S1: preprocessing an original image to be compressed, namely representing the original image to be compressed in a double-quaternion form to obtain an image f (x, y), wherein the value ranges of variables x and y are as follows: x 1, 2, the M, y 1, 2, N, where M and N are positive integers, the number of rows and columns, respectively, of the image, and the values of M and N should be integer powers of 2 for the convenience of the subband decomposition of the following direction biquad filter bank.
In step S1, the mathematical formula for characterizing the original image to be compressed by using the biquad number is:
f(x,y)=(fR(x,y)·i+fG(x,y)·j+fB(x,y)·k)+(fR(x,y)·i+fG(x,y)·j+fB(x,y)·k)·I
wherein f isR(x,y)、fG(x, y) and fB(x, y) are R, G and B color components of the color image, I, j, k, and I are imaginary units of biquad numbers, respectively, according to the following operation rules:
i2=-1,j2=-1,k2=-1,I2=-1,ij=k,jk=i,ki=j。
step S2: the image F (x, y) is transformed by using the directional biquad analysis filter bank shown in fig. 2, and a total of 2T subband frequency domain images { F } in different directions are obtainedm(u, v) | m ═ 1, 2,.., 2T }, the variables u and v take on the following ranges: u 1, 2., M/2, v 1, 2., N/2;
it should be noted that fig. 2 is a structural diagram of a one-dimensional direction bi-quad analysis filter bank, in order to process a two-dimensional image, the present invention uses a tensor product form to implement a two-dimensional operation, specifically, a final image filtering operation is implemented by processing rows of an image f (x, y) and performing T downsampling, and then processing columns of the image and performing T downsampling. The symbol "↓ T" in fig. 2 represents T downsampling. The filter coefficients in fig. 2 are:
the directional biquad analysis filter bank is composed of two groups of filter coefficients, which are h1(n),h2(n),...,h2T(n) and g1(n),g2(n),...,g2T(n), the two sets of filter coefficients are dual. Wherein h is1(n) and h2(n) corresponds to the 1 st band filter coefficient, and so on, h2T-1(n) and h2T(n) corresponds to the Tth band filter coefficient. Accordingly, g1(n) and g2(n) is the T +1 th band filter coefficient, g2T-1(n) and g2TAnd (n) is a 2T-th band filter coefficient.
The directional biquad analysis filter bank shown in fig. 2 is essentially a dual redundant filter bank, and each frequency band corresponds to a specific direction of a two-dimensional image. For example, when T is 8, 8 subband frequency domain images obtained using a directional biquad analysis filter bank, F1(u, v) emphasis on the frequency domain information of the image in the horizontal direction, F2(u, v) emphasizes the frequency domain information of the image in the 45-degree direction, and so on, the difference between the directions of two adjacent frequency bands is 45 degrees, F8(u, v) emphasizes the frequency domain information of the image in the direction of 315 deg.. It should be noted that the filter coefficients are all quaternion value arrays with a length of n, in this embodiment, the value of n is 10, which is specifically as follows:
h1(n)=(0 -0.01 0.01 0.08 0.08 -0.69 0.69 -0.08 -0.08 0)·(i+j+k)
h2(n)=(0 -0.08 0.08 0.69 0.69 0.08 -0.08 0.01 0.01 0)·(i+j+k)
h2T-1(n)=(0.01 0.01 0.08 0.08 0.69 0.69 0.08 -0.08 0 0)·(i+j+k)
h2T(n)=(0 0 -0.08 -0.08 0.69 -0.69 0.08 0.08 0.01 -0.01)·(i+j+k)
g1(n)=(0 -0.08 -0.08 0.69 -0.69 0.08 0.08 0.01 -0.01 0)·(i+j+k)
g2(n)=(0 0.01 0.01 -0.08 0.08 0.69 0.69 0.08 -0.08 0)·(i+j+k)
g2T-1(n)=(0 0 -0.08 0.08 0.69 0.69 0.08 -0.08 0 0)·(i+j+k)
g2T(n)=(-0.01 0.01 0.08 0.08 -0.69 0.69 -0.08 -0.08 0 0)·(i+j+k)
the filter coefficients for the 2 nd band to the T-1 th band can be obtained by using a conventional M-channel filter bank theoretical method, i.e., by using sequential shift and polyphase decomposition, and are not described in detail here. It should be noted that the filter coefficients mentioned in the present invention are different from the conventional filter coefficients in that the values of the filter coefficients are quaternions, and F is1(u, v) and FT+1The corresponding position elements in (u, v) form a biquad number, and so on, FT(u, v) and F2TThe (u, v) corresponding position element also constitutes a biquad number, whereas the conventional filter coefficient value is a real number.
Step S3: for each sub-band frequency domain image { Fm(u, v) | m ═ 1, 2,.., 2T } is quantized. It is noted that each sub-band frequency domain image Fm(u, v) are each a quaternion matrix, each matrix element corresponds to a frequency domain coefficient, and for a frequency domain coefficient, the frequency domain coefficient is encoded according to the threshold effective scanning flow chart shown in fig. 3, where the specific scanning flow is as follows:
firstly, judging whether current scanning is effective or not, if so, namely, the current scanned frequency domain coefficient (hereinafter referred to as coefficient) is coded, directly jumping out of circulation, and scanning the next coefficient; if the real part and the imaginary part of the current coefficient are larger than the threshold value A, the scanning method enters the next process and judges whether the real part and the imaginary part of the current coefficient are larger than the threshold value A. If so, the sign of the coefficient needs to be further determined, i.e. whether each component of the coefficient is a positive or negative number, and is encoded and marked as a positive significant value PS for positive numbers and as a negative significant value NS for negative numbers. The above step is a scanning of a coefficient, for a sub-band frequency domain image FmEach element of (u, v) is judged row by row and column by column. A subband domain image FmAfter the (u, v) scanning is finished, the scanning is carried outAnd scanning the rest sub-band domain images to finally obtain a coded sub-band frequency domain image.
In the method, the value of the threshold value A is 5. The larger the threshold, the higher the compression rate, but the higher the degree of distortion of the decompressed image. The choice of threshold is therefore a compromise, depending on the actual requirements.
Step S4: quantizing the encoded data (i.e. { F }mAnd (u, v) | m ═ 1, 2T }) is stored and output to obtain a compressed image. This step is the same as that used in conventional compression algorithms and will not be described in detail here.
In order to recover the original image from the compressed image data, the following steps are also required;
step S5: quantizing and decoding the compressed image to restore a sub-band frequency domain image { F }m(u, v) | m ═ 1, 2,.., 2T }. This step is actually the reverse of step S3, and will not be further described here. It should be noted that, after the quantization coding of step S3, part of the image information has been destroyed, which is called quantization error, and this is present in most image compression processes, as long as it is allowed to exist within the range that the human eye is visually acceptable (i.e. the human eye cannot detect that the decompressed image has significant distortion). In fact, steps S3 and S5 are substantially the same as the conventional compression algorithm, and the only difference is that the quantized coefficient encoded by the conventional compression algorithm is a real number, whereas the quantized coefficient encoded by the present invention is a quaternion, which also causes the particularity in the specific encoding process.
Step S6: and performing inverse transformation on the sub-band frequency domain image restored in the step S5 by using a directional double-quaternion synthesis filter bank to obtain a color image in a double-quaternion form. The directional biquad filter bank is shown in fig. 4, and the specific filter coefficients are:
direction two and fourThe filter coefficient SF of the element number comprehensive filter bank is obtained by analyzing the filter coefficient AF to carry out quaternion Hilbert transform under discrete condition
By way of example, can be represented by h
1(n) and
performing convolution operation to obtain:
step S7: the real or imaginary components of the color image in the form of a double quad number in step S6 are extracted to obtain a decompressed image.
It should be noted that the above embodiments can be freely combined as necessary. The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.