CN111182301A - Method, device, equipment and system for selecting optimal quantization parameter during image compression - Google Patents

Method, device, equipment and system for selecting optimal quantization parameter during image compression Download PDF

Info

Publication number
CN111182301A
CN111182301A CN201811341033.7A CN201811341033A CN111182301A CN 111182301 A CN111182301 A CN 111182301A CN 201811341033 A CN201811341033 A CN 201811341033A CN 111182301 A CN111182301 A CN 111182301A
Authority
CN
China
Prior art keywords
quantization parameter
image
optimal quantization
regression model
optimal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811341033.7A
Other languages
Chinese (zh)
Inventor
周军
江武明
丁松
王洋
孙婷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Eyecool Technology Co Ltd
Original Assignee
Beijing Eyecool Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Eyecool Technology Co Ltd filed Critical Beijing Eyecool Technology Co Ltd
Priority to CN201811341033.7A priority Critical patent/CN111182301A/en
Publication of CN111182301A publication Critical patent/CN111182301A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/154Measured or subjectively estimated visual quality after decoding, e.g. measurement of distortion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
    • H04N19/625Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using discrete cosine transform [DCT]

Landscapes

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

Abstract

The embodiment of the application discloses a method, a device, equipment and a system for selecting an optimal quantization parameter during image compression, wherein the method comprises the steps of establishing a regression model function between image content characteristics and the optimal quantization parameter; calculating the image content characteristics of the image to be compressed, and obtaining the prediction quantization parameter of the image to be compressed according to the regression model function; and taking the range obtained by the up-and-down floating preset data with the predicted quantization parameter as the center as the quantization parameter range, and selecting the quantization parameter with the highest compression quality evaluation index as the optimal quantization parameter in the quantization parameter range. By using the embodiments of the present application, the optimal quantization parameter can be selected quickly on the premise of satisfying the code length threshold and ensuring the image compression quality.

Description

Method, device, equipment and system for selecting optimal quantization parameter during image compression
Technical Field
The present invention relates to the field of digital image processing technologies, and in particular, to a method, an apparatus, a device, and a system for selecting an optimal quantization parameter during image compression.
Background
With the continuous development of multimedia technology, informatization is closely related to people's life, and nowadays of information explosion, the contradiction between huge data volume and information storage space is increasingly prominent, especially for digital image communication, for example, for a 24-bit true color image with a resolution of 1024 × 1024, the data volume is 3MB, in the actual image storage process, because the storage space is always limited, a code length threshold is often given, so that the code length after compression is smaller than the code length threshold. Under the condition that the coding length is limited, the optimal quantization parameter is obtained through the selection of the quantization parameter, so that the code length of the coded image meets the limit of a code length threshold value, and the image quality of the image is ensured as much as possible.
Since the code rate represents the number of bits occupied by each pixel of an image, the value of the code rate is the code length divided by the total number of pixels, the given code length threshold is the code rate of the specified image, and the code rate control is a hot topic of current research.
The conventional image compression standards comprise JPEG, JPEG-LS, BPG and the like, wherein for the JPEG standard, the quantization parameters are generally solved by an iterative method, so that the calculation amount is large, the time is long, and the practical application is not facilitated; for the JPEG-LS compression standard, the quantization parameters are generally solved by a feedback adjustment method, wherein the first-order rate control method proposed by Xuyangling in the 'JPEG-LS image compression dynamic rate control strategy' adopts an array adjustment and fixed threshold value method to obtain the quantization parameters, but the control effect of the method is poor. The BPG is an image format proposed in 2014, an image compression algorithm of the BPG is based on an advanced Video compression protocol HEVC (High Efficiency Video Coding), the BPG is developed on the basis of HEVC intra-frame Coding, but the BPG image compression algorithm still cannot obtain an optimal quantization parameter at a specified code rate, and no research is provided for a BPG compression format rate control algorithm. Therefore, how to quickly select the optimal quantization parameter is an urgent problem to be solved in the art on the premise of meeting the code length threshold and ensuring the image compression quality.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method, an apparatus, a device, and a system for selecting an optimal quantization parameter during image compression, which can quickly select the optimal quantization parameter on the premise of meeting a code length threshold and ensuring image compression quality.
In one aspect, an embodiment of the present application provides a method for selecting an optimal quantization parameter during image compression, including:
establishing a regression model function between the image content characteristics and the optimal quantization parameters;
calculating the image content characteristics of the image to be compressed, and obtaining the prediction quantization parameter of the image to be compressed according to the regression model function;
and taking the range obtained by the preset data with the predicted quantization parameter as the center and floating up and down as the quantization parameter range, and selecting the quantization parameter with the highest compression quality evaluation index as the optimal quantization parameter in the quantization parameter range.
In some embodiments of the present application, the establishing a regression model function between the image content features and the optimal quantization parameter includes:
establishing a static image sample set;
calculating the image content characteristics of each static image sample in the static image sample set and the optimal quantization parameter corresponding to each static image sample when a code length threshold is appointed;
and performing regression analysis on the image content characteristics of each static image sample and the corresponding optimal quantization parameters to obtain a regression model function between the image content characteristics and the optimal quantization parameters.
In some embodiments of the present application, the performing regression analysis on the image content features of each still image sample and the corresponding optimal quantization parameters to obtain a regression model function between the image content features and the optimal quantization parameters includes:
drawing a scatter diagram of the image content characteristics of each static image sample and the corresponding optimal quantization parameters in a coordinate system;
and establishing a regression model function of the image content characteristics and the optimal quantization parameters according to the distribution rule of the scatter diagram.
In some embodiments of the present application, establishing a regression model function of image content features and optimal quantization parameters according to a distribution rule of the scatter diagram includes:
and according to the distribution rule of the scatter diagram, when the value of a preset cost function is less than 1, a function set formed by an increasing function is used as a regression model function of the image content characteristics and the optimal quantization parameters.
In some embodiments of the present application, the preset cost function is a mean square error cost function, and a function when the value of the mean square error cost function is the minimum is used as a regression model function between the image content characteristics and the optimal quantization parameter.
In some embodiments of the present application, the regression model function is any one of a sum of exponential functions, a logarithmic function, or a rational function.
In some embodiments of the present application, the image compression quality evaluation index includes any one of a peak signal-to-noise ratio, a structural similarity, and a mean square error.
In some embodiments of the present application, the image content features are texture features and/or local variance features.
In a second aspect, an embodiment of the present application provides an apparatus for selecting an optimal quantization parameter during image compression, including:
the establishing module is used for establishing a regression model function between the image content characteristics and the optimal quantization parameters;
the calculation module is used for calculating the image content characteristics of the image to be compressed and obtaining the prediction quantization parameter of the image to be compressed according to the regression model function;
and the selection module is used for taking the range obtained by the up-and-down floating preset data with the predicted quantization parameter as the center as the quantization parameter range, and selecting the quantization parameter with the highest compression quality evaluation index of the image to be compressed as the optimal quantization parameter in the quantization parameter range.
In some embodiments of the present application, the establishing module comprises:
the establishing unit is used for establishing a static image sample set;
the calculating unit is used for calculating the image content characteristics of each static image sample in the static image sample set established by the establishing unit and the optimal quantization parameter corresponding to each static image sample when the code length threshold is appointed;
and the analysis unit is used for carrying out regression analysis on the image content characteristics of each static image sample obtained by calculation of the calculation unit and the corresponding optimal quantization parameter to obtain a regression model function between the image content characteristics and the optimal quantization parameter.
In a third aspect, an embodiment of the present application provides an apparatus for selecting an optimal quantization parameter in image compression, including a processor and a memory for storing processor-executable instructions, where the instructions, when executed by the processor, implement steps including:
establishing a regression model function between the image content characteristics and the optimal quantization parameters;
calculating the image content characteristics of the image to be compressed, and obtaining the prediction quantization parameter of the image to be compressed according to the regression model function;
and taking the range obtained by the preset data with the predicted quantization parameter as the center and floating up and down as the quantization parameter range, and selecting the quantization parameter with the highest compression quality evaluation index as the optimal quantization parameter in the quantization parameter range.
In a fourth aspect, embodiments of the present application provide a system for selecting an optimal quantization parameter in image compression, including at least one processor and a memory storing computer-executable instructions, where the processor implements the steps of the method according to the first aspect when executing the instructions.
One or more embodiments of the present disclosure provide a method, an apparatus, a device, and a system for selecting an optimal quantization parameter during image compression, where a regression model function is determined according to an image content characteristic and an optimal quantization parameter of each static image in a set of static images, when an image to be compressed is compressed, a predicted quantization function can be quickly obtained according to the image content characteristic and the regression model function of the image to be compressed, a range obtained by floating a predicted quantization parameter up and down as a center preset data is used as a quantization parameter range, and a quantization parameter when a compression quality evaluation index of the image to be compressed is highest is selected as the optimal quantization parameter in the quantization parameter range. Therefore, the method provided by the embodiments of the present application can be used to compress the static image in a limited storage space, the method for selecting the optimal quantization parameter is simple and fast, and the image compression quality can be ensured under the condition of specifying the code length threshold.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without any creative effort. In the drawings:
FIG. 1 is a schematic flow chart of an image compression method provided in the present specification;
fig. 2 is a flowchart illustrating an embodiment of a method for selecting an optimal quantization parameter during image compression according to the present disclosure;
FIG. 3 is a scatter diagram formed by image texture features and optimal quantization parameters in the embodiment of the method for selecting optimal quantization parameters in image compression provided in FIG. 2;
FIG. 4 is a schematic diagram illustrating an exponential function curve of texture features of an image and an optimal quantization parameter in an embodiment of the method for selecting an optimal quantization parameter in image compression shown in FIG. 2;
FIG. 5 is a diagram illustrating a logarithmic function curve of texture features of an image and an optimal quantization parameter in an embodiment of the method for selecting an optimal quantization parameter in image compression provided in FIG. 2;
FIG. 6 is a schematic diagram of a rational function curve of texture features of an image and an optimal quantization parameter in the embodiment of the method for selecting an optimal quantization parameter in image compression provided in FIG. 2;
FIG. 7 is a flowchart illustrating an embodiment of another method for selecting an optimal quantization parameter during image compression provided in the present specification;
FIG. 8 is a scatter diagram of local variance features and optimal quantization parameters in an embodiment of the method for selecting optimal quantization parameters for image compression provided in FIG. 7;
FIG. 9 is a diagram illustrating an exponential function curve of the local variance characteristics and the optimal quantization parameter in the embodiment of the method for selecting the optimal quantization parameter in the image compression provided in FIG. 7;
FIG. 10 is a diagram illustrating a logarithmic function curve of the local variance feature and the optimal quantization parameter in the embodiment of the method for selecting the optimal quantization parameter in the image compression provided in FIG. 7;
FIG. 11 is a schematic diagram illustrating a rational function curve of a local variance feature and an optimal quantization parameter in an embodiment of the method for selecting an optimal quantization parameter in image compression provided in FIG. 7;
fig. 12 is a flowchart illustrating an embodiment of a method for selecting an optimal quantization parameter in image compression according to yet another embodiment of the present disclosure;
fig. 13 is a schematic block diagram illustrating an embodiment of an apparatus for selecting an optimal quantization parameter during image compression according to the present disclosure.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in one or more embodiments of the present specification will be clearly and completely described below with reference to the drawings in one or more embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the specification, and not all embodiments. All other embodiments obtained by a person skilled in the art based on one or more embodiments of the present specification without making any creative effort shall fall within the protection scope of the embodiments of the present specification.
As shown in fig. 1, fig. 1 is a schematic flow chart of an image compression method provided in this specification, and first, image content features of an image to be compressed are extracted, and under a specified code length threshold, according to a regression model function between pre-established image content features and optimal quantization parameters, the optimal quantization parameters during image compression can be quickly obtained, and an image to be compressed is compressed based on the optimal quantization parameters.
When compressing an image to be compressed, firstly, the image to be compressed is segmented, and the minimum operation unit is obtained through segmentation. Firstly, an image to be compressed is transversely cut into a plurality of strips, each strip is called a slice, each slice is longitudinally cut into a plurality of blocks, called macro blocks, and the macro blocks are basic units of image compression. The color image of each macroblock can be represented by 1 luminance signal and two color difference signals. Since human eyes have different subjective sensitivity to luminance and chrominance, a luminance macro block is usually divided into 4 blocks on average, and each small block is called a block or a block. Each tile may be further divided, referred to as a pixel or a pixel, which is the smallest unit that constitutes an image. For a digital image, each pixel serves as a sampling point, and has a corresponding sampling value.
Secondly, each minimum operation unit is subjected to Discrete Cosine Transform (DCT) coding, an image to be compressed can be transformed from a spatial domain image to a frequency domain for analysis, specifically, a block can be taken out from the image to be compressed, the block is divided into a 64-grid array of 8 × 8 pixels, a luminance (for example, the luminance is described by taking the luminance as an example, and the luminance can be converted into chrominance) numerical value sampling one by one, the luminance numerical value column of the pixels is formed into a matrix table, and then each spatial sampling value can be converted into a numerical value of the frequency domain, namely a DCT coefficient, by utilizing Discrete Cosine Transform (DCT), a rectangular array table formed by 64 DCT coefficients is obtained, and the array formed by 64 image sampling values is changed into a 64-point array formed by a direct current average value and 63 cosine wave amplitudes with different frequencies, which is called as a DCT coefficient array. After the above change, the data of the spatial coordinates have been converted into data of the frequency coordinates, the DCT coefficient array includes 64 orthogonal base signals, of the 64 DCT coefficients, the first term represents a dc component, i.e., an average value of 64 spatial image sample values, and the remaining 63 coefficients represent the amplitude of each base signal. Then, according to zigzag scanning sequence, the DCT coefficients of each base signal are listed into a table, and according to the rule, the DCT coefficients are arranged into a data array to become the DCT coefficient coding sequence, after the above-mentioned treatment, the two-dimensional data quantity is converted into one-dimensional data quantity, the first item of the list is the average brightness of the block, and the distribution and size of the following coefficients can reflect the intensity of brightness fluctuation.
Thirdly, the frequency data after the DCT transformation is quantized to further compress the data amount, so as to further highlight the components with large visual effect influence and weaken or ignore the components with small visual effect influence, specifically, for 64 DCT coefficients of a 64-point array, 64 different reduced values can be used corresponding to 64 different frequencies, usually, the 64 reduced values are called quantization tables, each reduced value is called quantization step size or quantization value, the 64 DCT coefficients in a block can be divided by the quantization value at the corresponding position in the quantization table respectively, and then rounded up to obtain 64 data values after the quantization, and the DCT coefficient matrix after the quantization has many 0 values, thereby greatly reducing the data amount.
Fourthly, the quantized DCT coefficient matrix has many 0 values, and the total amount of data transmission has been significantly reduced, but the code bits have not been reduced, and are still 64 coefficient bits, and variable length coding can be used to further compress the total amount of data. Specifically, although the quantization process is performed such that a plurality of 0 values appear at the end of the coefficient through zigzag scanning, the 0 values need not be transmitted bit by bit, and only a "number" code representing 0 needs to be transmitted, and the "number" code is restored to 0 bits as specified when being decoded, so as to fill up 64 bits of the matrix.
In summary, the coded bit stream is obtained through the steps of image segmentation, discrete cosine transform, quantization processing and variable length coding, and the data size of the image to be compressed can be greatly compressed. Then the coded bit stream is transmitted through a bandwidth-limited transmission channel, and when data is decoded, the coded bit stream is firstly subjected to variable length decoding and is restored to be the fixed length of the data; then, inverse quantization is carried out on the coefficient, and the coefficient is restored to the original DCT frequency coefficient; and then, the space coordinate value of the image is restored through inverse discrete cosine transform, namely, the image data is reconstructed.
It can be seen that the image coding length and quality are closely related to quantization parameters, quantization processing is an important link in the image compression process, values in a larger range of signals are mapped into a plurality of limited discrete amplitude values through quantization, so that the signal value space can be effectively reduced, meanwhile, continuous values of the signals are mapped into a plurality of limited discrete amplitude values through quantization processing, and the many-to-one mapping of the signal values is realized, so that the quantization processing is also a root cause of distortion generated by image compression, and the quality and code rate of the image compression are influenced. Therefore, how to quickly select the optimal quantization parameter is an important problem on the premise that the code length is constant and the image quality is guaranteed.
Specifically, G (x, y) is set as an image to be compressed, and an optimal quantization parameter capable of maximizing image compression quality is selected under the condition that the code length does not exceed a specified code length threshold. The problem is mathematically modeled, and the compression mapping is:
Code(Q)=Encode(G(x,y);Q) (1)
wherein Q is a quantization parameter and Code is a Code obtained in the compression process. The decompression map can be expressed as:
H(x,y;Q)=Decode(Code(Q)) (2)
wherein H (x, y; Q) is the decompressed reconstructed image.
In one embodiment provided in the present specification, the index for evaluating the image compression quality may employ a peak signal-to-noise ratio PSNR.
Wherein, the peak signal-to-noise ratio PSNR is shown as the following formula (3):
Figure BDA0001862558710000071
Figure BDA0001862558710000072
wherein xpeak=2n-1, where n is the number of bits of the image signal to be compressed, x if the code length of the image to be compressed is 8 bitspeak255, MSE is the square error of the image to be compressed and the reconstructed image, w and h are respectivelyThe width and height of the image to be compressed. Under the given code length threshold C, determining the optimal quantization parameter for the image to be compressed, so that the image compression quality is the best, namely:
Q*=argmaxQJ(Q)
s.t.R(Q)≤C (5)
wherein C is a specified Code length threshold value and is a constant with the unit of bit, and R (Q) is the Code length of the Code, namely the size of the bit stream file after coding with the unit of bit. That is, under the given code length threshold C, the image compression quality is the best when the peak signal-to-noise ratio PSNR is the maximum, and the corresponding quantization parameter is the optimal quantization parameter at this time.
In general, the peak signal-to-noise ratio PSNR can be used as an index for evaluating the image compression performance, and the larger the peak signal-to-noise ratio is, the better the quality of the reconstructed image is, that is, the better the image compression quality is.
In another embodiment provided in this specification, structural similarity SSIM may be employed in evaluating image compression quality.
Wherein, the structural similarity SSIM is shown as the following formula (6):
SSIM(X,Y)=l(X,Y)*c(X,Y)*s(X,Y) (6)
wherein
Figure BDA0001862558710000081
ux,uyThe mean values of the image X to be compressed and the reconstructed image Y are respectively, and here, for the sake of simplicity, the image G (X, Y) to be compressed in formula (1) is represented by X, and the reconstructed image H (X, Y; Q) in formula (2) is represented by Y.
Figure BDA0001862558710000082
σX,σYThe variances, σ, of the image X to be compressed and of the reconstructed image Y, respectivelyXYAs a covariance of the image X to be compressed and the reconstructed image Y, C1,C2,C3Is a constant.
The structural similarity SSIM uses a mean value as an estimation of brightness, a variance as an estimation of contrast, and a covariance as a measurement of structural similarity, and the larger the structural similarity SSIM is, the better the reconstructed image quality is, namely, the best image compression quality is.
In another embodiment provided by the present specification, the mean square error MSE may be used to evaluate the image compression quality index.
Wherein, the mean square error MSE is shown as the following formula (7):
Figure BDA0001862558710000083
w and h are the width and height of the image to be compressed respectively, X (i, j) represents a pixel in the image to be compressed, Y (i, j) represents a pixel in the reconstructed image, and the smaller the mean square error MSE is, the better the quality of the reconstructed image is, namely the best the image compression quality is.
The following describes the method for selecting the optimal quantization parameter in image compression provided by the present application in detail.
Fig. 2 is a flowchart illustrating an embodiment of a method for selecting an optimal quantization parameter during image compression according to the present disclosure. Although the present specification provides the method steps or apparatus structures as shown in the following examples or figures, more or less steps or modules may be included in the method or apparatus structures based on conventional or non-inventive efforts. In the case of steps or structures which do not logically have the necessary cause and effect relationship, the execution order of the steps or the block structure of the apparatus is not limited to the execution order or the block structure shown in the embodiments or the drawings of the present specification. When the described method or module structure is applied to a device, a server or an end product in practice, the method or module structure according to the embodiment or the figures may be executed sequentially or in parallel (for example, in a parallel processor or multi-thread processing environment, or even in an implementation environment including distributed processing and server clustering).
In a specific embodiment of the method for selecting an optimal quantization parameter during image compression provided by the present specification, as shown in fig. 2, the method may include:
and S11, establishing a regression model function between the image content characteristics and the optimal quantization parameters.
In one embodiment provided by the present specification, the image content feature may be a texture feature of an image, and a regression model function between the image content feature and the optimal quantization parameter is established according to the texture feature of each static image in the static image set. Wherein the texture feature f1The following formula (8) can be used for description:
Figure BDA0001862558710000091
wherein g isx(i,j),gyAnd (i, j) respectively representing the transverse gradient and the longitudinal gradient of the image G (i, j), calculating the texture features of the static image samples in the static image sample set, and calculating the texture features of the image to be compressed by adopting an equation (8).
Specifically, when a regression model function between the image content features and the optimal quantization parameters is established, the method can be realized by the following steps:
and S111, establishing a static image sample set.
In the embodiments provided in this specification, the image compression refers to compression performed on a still image, so as to minimize the size of image data for transmission, storage, management, processing, and application. For example: 150 still images may be selected as a sample set of still images.
And S112, calculating the image content characteristics of each static image sample in the static image sample set and the optimal quantization parameter corresponding to each static image sample when the code length threshold is specified.
In this embodiment, after the static image sample set is established, after the texture features of 150 static images are respectively calculated to obtain the texture features of each static image, and under the condition of specifying the code length threshold C, the optimal quantization parameter Q corresponding to each static image in the 150 static image sample sets is obtained by using an iterative method*. For example: starting from the quantization parameter being equal to a value for a certain still image in the sample set of still images, ifUsing the value as quantization parameter, if the obtained code length is greater than the specified code length threshold, then the quantization parameter needs to be added with 1, otherwise, the 1 is subtracted, and the iterative search is carried out until the quantization parameter which is less than the code length threshold and has the best compression quality is found out, and the quantization parameter is used as the optimal quantization parameter Q corresponding to the static image*
And S113, performing regression analysis on the image content characteristics of each static image sample and the corresponding optimal quantization parameters to obtain a regression model function between the image content characteristics and the optimal quantization parameters.
In the embodiment, when the texture feature Ti of each still image sample in the still image set and the corresponding optimal quantization parameter are obtained
Figure BDA0001862558710000101
Then, the texture features and the optimal quantization parameters of the static image sample i are expressed as
Figure BDA0001862558710000102
Where i 1, 2.. 150. regression analysis was performed using 150 sets of data.
In order to perform regression analysis on the image content characteristics of each static image sample and the corresponding optimal quantization parameter to obtain a regression model function between the image content characteristics and the optimal quantization parameter, one possible implementation manner may be implemented by the following steps:
and S1131, drawing a scatter diagram of the image content characteristics of each static image sample and the corresponding optimal quantization parameters in a coordinate system.
In this step, 150 sets of data consisting of texture features and optimal quantization parameters of each still image in 150 still image sample sets are plotted in a rectangular coordinate system to form a scatter diagram. As shown in fig. 3, fig. 3 is a scatter diagram formed by texture features and optimal quantization parameters in a static image sample set in the embodiment of the method for selecting optimal quantization parameters in image compression provided in fig. 2, wherein an abscissa represents image texture features and an ordinate represents optimal quantization parameters.
S1132, establishing a regression model function of the image content characteristics and the optimal quantization parameters according to the distribution rule of the scatter diagram.
In the step, a sample regression model function Q of image content characteristics and optimal quantization parameters is established according to the distribution rule of the scatter diagram*=H(T*(f) Wherein, T*(f) Refers to the texture features of the still image in the sample set of still images.
According to the distribution rule of the scatter diagram, one possible real-time mode for establishing the regression model function of the image content characteristics and the optimal quantization parameters is as follows:
in some machine learning algorithms, the cost function is a criterion for learning model optimization, and the model is optimized by minimizing the cost function, and in actual use, the cost function is usually determined by itself. In this step, the preset cost function may be a mean square error cost function, that is, a square error between the real optimal quantization parameter in the still image sample set and the quantization parameter obtained according to the regression model function, as shown in the following formula (9):
Figure BDA0001862558710000111
where N is the number of still image samples in the still image sample set, where N may be 150,
Figure BDA0001862558710000112
Figure BDA0001862558710000113
the optimal quantization parameter representing the reality of the still image sample i,
Figure BDA0001862558710000114
representing a regression model function.
In some embodiments of the present application, the regression fuzzy function may have various forms, such that the preset cost function J isθThe function set formed by increasing functions smaller than 1 can be used as regression model functions.
In other embodiments of the present application, a function when the preset cost function is optimal is used as a regression model function of the image content characteristics and the optimal quantization parameter. Further, a function when the value of the mean square error cost function is minimum is used as a regression model function between the image content characteristics and the optimal quantization parameters.
For example: the regression model function may be the sum of exponential functions, i.e. the texture feature T and the optimal quantization parameter
Figure BDA0001862558710000115
The functional relationship between them is the sum of exponential functions, as shown in the following equation (10):
Figure BDA0001862558710000116
wherein, c1,c2,c3,c4Is constant, in some embodiments, when the mean square error cost function takes the minimum value, c1,c2,c3,c4May be respectively c1=32.76,c2=0.002091,c3=-30.76,c4=-0.04211。
When the regression model function is the sum of the exponential functions under the specified code length threshold, the obtained exponential function curve diagram of the texture features and the optimal quantization parameters of the image is shown in fig. 4, wherein the abscissa represents the texture features, and the ordinate represents the optimal quantization parameters.
In other embodiments of the present application, the regression model function may be a logarithmic function, and the obtained image texture feature T and the optimal quantization parameter
Figure BDA0001862558710000117
Is shown in the following equation (11):
Figure BDA0001862558710000118
wherein c is1,c2Is constant when the mean square error cost function value is minimumWhen c is greater than1=13.6432,c2=-25.2061。
Under the specified code length threshold, when the regression model function is a logarithmic function, the obtained logarithmic function curve diagram of the texture feature and the optimal quantization parameter of the image is shown in fig. 5, wherein the abscissa represents the texture feature, and the ordinate represents the optimal quantization parameter.
In other embodiments of the present application, the regression model function may be a rational function, and the obtained image texture feature T and the optimal quantization parameter
Figure BDA0001862558710000121
The regression model function therebetween is shown in the following equation (12):
Figure BDA0001862558710000122
wherein, c1,c2,c3Is constant, when the mean square error cost function takes the minimum value, c1=50.01,c2=-129.4,c3=35.94。
Under the specified code length threshold, when the regression model function is a rational function, the obtained rational function curve diagram of the texture feature and the optimal quantization parameter of the image is shown in fig. 6, wherein an x coordinate represents the texture feature of the image, and a y coordinate represents the optimal quantization parameter.
And S12, calculating the image content characteristics of the image to be compressed, and obtaining the prediction quantization parameter of the image to be compressed according to the regression model function.
In an embodiment provided in this specification, the texture feature T of the image to be compressed may be calculated according to formula (8), and the prediction quantization parameter under the specified code length threshold may be calculated by using the already obtained regression model function.
And S13, taking the range obtained by the up-and-down floating prediction data with the prediction quantization parameter as the center as the quantization parameter range, and selecting the quantization parameter with the highest compression quality evaluation index as the optimal quantization parameter in the quantization parameter range.
In this step, after obtaining a prediction quantization parameter according to a regression model function, taking a preset quantization parameter as a center, taking a vertically floating preset value as a quantization parameter range, and selecting a quantization parameter with a highest quality compression evaluation index as an optimal quantization parameter within the quantization parameter range, wherein the quality compression evaluation index includes any one of a peak signal-to-noise ratio (as shown in formula 3), a structural similarity (as shown in formula 6), and a mean square error (as shown in formula 7).
For example, a prediction quantization parameter is obtained according to a regression model function, if the code length after compression of an image to be compressed according to the prediction quantization parameter is greater than a specified code length threshold, the prediction quantization parameter may be increased by 1, and if the code length after compression is less than the specified code length threshold, the prediction quantization parameter may be decreased by 1 until the specified code length threshold is reached, and a corresponding parameter when the image compression quality rating index is highest is taken as an optimal quantization parameter. Therefore, the optimal quantization parameter can be quickly obtained by selecting the optimal quantization parameter in the quantization parameter range by taking the predicted quantization parameter as the center, and the calculation amount is small.
After the optimal quantization parameter is obtained, the coded bit stream with the coding length smaller than the specified code length threshold is obtained according to an image compression algorithm, and then reconstructed image data is obtained through variable length decoding, inverse quantization and inverse discrete cosine change.
One or more embodiments of the present disclosure provide a method for selecting an optimal quantization parameter during image compression, where a regression model function is determined according to image content characteristics and an optimal quantization parameter of each static image in a set of static images, when an image to be compressed is compressed, a predicted quantization function can be quickly obtained according to the image content characteristics and the regression model function of the image to be compressed, a range obtained by floating preset data up and down with the predicted quantization parameter as a center is used as a quantization parameter range, and a quantization parameter when a compression quality evaluation index of the image to be compressed is best is selected as the optimal quantization parameter in the quantization parameter range. Therefore, the method for selecting the optimal quantization parameter provided by the embodiments of the present application can be used to compress the static image in a limited storage space, the method for selecting the optimal quantization parameter is simple and fast, and the image compression quality can be ensured under the condition of the code length threshold.
As shown in fig. 7, fig. 7 is another embodiment of a method for selecting an optimal quantization parameter in image compression provided by the present specification, and the method may include:
and S21, establishing a regression model function between the local variance characteristics and the optimal quantization parameters.
In one embodiment provided herein, the image content feature may be a local variance feature, and a regression model function between the image content feature and the optimal quantization parameter is established according to the local variance feature of each static image in the set of static images. Wherein, the local variance characteristic f2The following formula (13) is described:
Figure BDA0001862558710000131
wherein u isi,jIs the neighborhood of the image G centered on the pixel point (i, j)
Figure BDA0001862558710000132
Mean value of the gray levels of the middle pixel p, N being
Figure BDA0001862558710000133
And the number of pixels in the neighborhood. The local variance characteristics of the still image samples in the still image sample set and the local variance characteristics of the image to be compressed can be calculated by the following formula (13).
Specifically, when a regression model function between the image content features and the optimal quantization parameters is established, the method can be realized by the following steps:
s211, establishing a static image sample set.
S212, calculating the local variance characteristics of each static image sample in the static image sample set, and the optimal quantization parameter corresponding to each static image sample when the code length threshold is specified.
In this embodiment, the set of still sample images created may be the same as the above-described embodiment, when creating still image samplesAfter the collection, local variance characteristics of 150 static images are respectively calculated, and under the condition of specifying a code length threshold C, an optimal quantization parameter Q corresponding to each static image in 150 static image sample sets is obtained by using an iterative method. For example: starting from the fact that the quantization parameter is equal to a value, if the value is used as the quantization parameter, and the obtained code length is larger than a specified code length threshold, the quantization parameter needs to be increased by 1, otherwise, the value is decreased by 1, and the iterative search is carried out until the quantization parameter smaller than the code length threshold is found, and the quantization parameter with the best compression quality is used as the optimal quantization parameter Q corresponding to the static image*
And S213, performing regression analysis on the local variance characteristics of each static image sample and the corresponding optimal quantization parameters to obtain a regression model function between the image content characteristics and the optimal quantization parameters.
In the present embodiment, the local variance characteristic S of each still image sample in the still image set is obtained when obtaining the local variance characteristic SiAnd corresponding optimal quantization parameter
Figure BDA0001862558710000141
Then, the local variance feature and the optimal quantization parameter of the static image sample i are expressed as
Figure BDA0001862558710000142
Where i 1, 2.. 150. regression analysis was performed using 150 sets of data.
In order to perform regression analysis on the local variance characteristics of each static image sample and the corresponding optimal quantization parameter to obtain a regression model function between the image content characteristics and the optimal quantization parameter, one possible implementation manner may be implemented by the following steps:
and S2131, drawing a scatter diagram of the local variance characteristics and the corresponding optimal quantization parameters of each static image sample in a coordinate system.
In this step, 150 sets of data consisting of the local variance characteristics and the optimal quantization parameters of each of the 150 still image sets are plotted in a rectangular coordinate system as a scatter plot, as shown in fig. 8, where fig. 8 shows a scatter plot formed by the local variance characteristics and the optimal quantization parameters in the still image set, where the abscissa shows the local variance characteristics and the ordinate shows the optimal quantization parameters.
S2132, establishing a sample regression model function of the image content characteristics and the optimal quantization parameters according to the distribution rule of the scatter diagram.
In the step, a sample regression model function Q of image content characteristics and optimal quantization parameters is established according to the distribution rule of the scatter diagram*=H(S*(f) Wherein S is*(f) Refers to the local variance characteristics of a static image in a set of static images.
According to the distribution rule of the scatter diagram, one possible real-time mode for establishing the regression model function of the image content characteristics and the optimal quantization parameters is as follows:
in this step, the preset cost function may be a mean square error cost function, that is, a mean square error between the sample regression model function and the regression model function, as shown in the following formula (14):
Figure BDA0001862558710000143
where N is the number of still image samples in the still image sample set, where N may be 150,
Figure BDA0001862558710000151
Figure BDA0001862558710000152
the optimal quantization parameter representing the reality of the still image sample i,
Figure BDA0001862558710000153
representing a regression model function.
In other embodiments of the present application, a function when the preset cost function is optimal is used as a regression model function of the image content characteristics and the optimal quantization parameter. Further, a function when the value of the mean square error cost function is minimum is used as a regression model function between the image content characteristics and the optimal quantization parameters.
In some embodiments of the present application, the regression fuzzy function may have various forms, such that the preset cost function J isθThe function set formed by increasing functions smaller than 1 can be used as regression model functions.
For example: the regression model function may be the sum of exponential functions, i.e. the local variance feature S of the image and the optimal quantization parameter
Figure BDA0001862558710000154
The functional relationship between them is the sum of exponential functions, as shown in the following equation (15):
Figure BDA0001862558710000155
wherein, c1,c2,c3,c4Is constant, in some embodiments, when the mean square error cost function takes the minimum value, c1,c2,c3,c4May be respectively c1=38.96,c2=0.00005137,c3=-39.62,c4=-0.2988。
Under the specified code length threshold, when the regression model function is the sum of the exponential functions, the obtained exponential function curve diagram of the local variance feature and the optimal quantization parameter is shown in fig. 9, wherein an abscissa X represents the local variance feature, and an ordinate N represents the optimal quantization parameter.
In other embodiments of the present application, the regression model function may be a logarithmic function, and the local variance feature S and the optimal quantization parameter are obtained
Figure BDA0001862558710000156
Is shown in the following equation (16):
Figure BDA0001862558710000157
wherein c is1,c2Is constant, when mean squareWhen the difference cost function takes the minimum value, c1=13.0212,c2=2.9768。
Under the specified code length threshold, when the regression model function is a logarithmic function, the obtained logarithmic function curve diagram of the local variance feature and the optimal quantization parameter is shown in fig. 10, wherein an abscissa X represents the local variance feature, and an ordinate Y represents the optimal quantization parameter.
In other embodiments of the present application, the regression model function may be a rational function, and the obtained local variance feature S and the optimal quantization parameter
Figure BDA0001862558710000158
The regression model function therebetween is shown by the following equation (17):
Figure BDA0001862558710000161
wherein, c1,c2,c3,c4Is constant, when the mean square error cost function takes the minimum value, c1=-1.365,c2=81.07,c3=-7.076,c4=10.4。
Under the specified code length threshold, when the regression model function is a rational function, the obtained rational function curve diagram of the local variance feature and the optimal quantization parameter is shown in fig. 11, wherein an abscissa X represents the local variance feature, and an ordinate Y represents the optimal quantization parameter.
And S22, calculating the image content characteristics of the image to be compressed, and obtaining the prediction quantization parameter of the image to be compressed according to the regression model function.
In an embodiment provided in this specification, the local variance feature S of the image to be compressed may be calculated according to formula (13), and the prediction quantization parameter under the specified code length threshold can be calculated by using the regression model function that has been obtained.
And S23, taking the range obtained by the up-and-down floating prediction data with the prediction quantization parameter as the center as the quantization parameter range, and selecting the quantization parameter with the highest compression quality evaluation index as the optimal quantization parameter in the quantization parameter range.
In this step, after obtaining a prediction quantization parameter according to a regression model function, taking a preset quantization parameter as a center, taking a vertically floating preset value as a quantization parameter range, and selecting a quantization parameter with a highest quality compression evaluation index as an optimal quantization parameter within the quantization parameter range, wherein the quality compression evaluation index includes any one of a peak signal-to-noise ratio (as shown in formula 3), a structural similarity (as shown in formula 6), and a mean square error (as shown in formula 7).
For example, a prediction quantization parameter is obtained according to a regression model function, if the code length after compression of an image to be compressed according to the prediction quantization parameter is greater than a specified code length threshold, the prediction quantization parameter may be increased by 1, and if the code length after compression is less than the specified code length threshold, the prediction quantization parameter may be decreased by 1 until the specified code length threshold is reached, and a corresponding parameter when the image compression quality rating index is highest is taken as an optimal quantization parameter. Therefore, the optimal quantization parameter can be quickly obtained by selecting the optimal quantization parameter in the quantization parameter range by taking the predicted quantization parameter as the center, and the calculation amount is small.
After the optimal quantization parameter is obtained, the coded bit stream with the coding length smaller than the specified code length threshold is obtained according to an image compression algorithm, and then reconstructed image data is obtained through variable length decoding, inverse quantization and inverse discrete cosine change.
One or more embodiments of the present disclosure provide a method for selecting an optimal quantization parameter during image compression, where a regression model function is determined according to a local variance characteristic and an optimal quantization parameter of each static image in a set of static images, when an image to be compressed is compressed, a predicted quantization function can be quickly obtained according to the local variance characteristic and the regression model function of the image to be compressed, a range obtained by using a preset data whose predicted quantization parameter is a center and floating up and down is used as a quantization parameter range, and a quantization parameter when a compression quality evaluation index of the image to be compressed is best is selected as the optimal quantization parameter in the quantization parameter range. Therefore, the method for selecting the optimal quantization parameter provided by the embodiments of the present application can be used to compress the static image in a limited storage space, the method for selecting the optimal quantization parameter is simple and fast, and the image compression quality can be ensured under the condition of the code length threshold.
As shown in fig. 12, fig. 12 is another embodiment of a method for selecting an optimal quantization parameter in image compression provided by the present specification, and the method may include:
and S31, establishing a regression model function between the image texture feature, the local variance feature and the optimal quantization parameter.
Specifically, step S31 may be implemented by:
s311, establishing a static image sample set.
The still image sample set described in this embodiment may be the same as the still image sample set described in the above-described embodiment. 150 still images were selected as a sample set of still images.
S312, calculating texture features and local variance features of each static image sample in the static image sample set, and an optimal quantization parameter corresponding to each static image sample when a code length threshold is specified.
In this step, the texture feature and the local variance feature of each static image in the static image sample set are calculated by using the formula (8) and the formula (13), and under the condition of specifying the code length threshold C, the optimal quantization parameter Q corresponding to each static image in the 150 static image sets is obtained by using an iterative method*The specific implementation manner can be understood by referring to the content described in the above embodiments, and is not described herein again.
S313, performing regression analysis on the texture feature and the local variance feature of each static image sample and the corresponding optimal quantization parameter to obtain a regression model function between the image content feature and the optimal quantization parameter.
In this embodiment, the texture feature T of each still image sample in the still image set is obtained when obtaining the texture feature T of each still image sampleiLocal variance feature SiAnd corresponding optimal quantization parameter
Figure BDA0001862558710000171
Then, the texture feature T of the image i isiLocal variance feature SiAnd optimal quantization parameter
Figure BDA0001862558710000172
Is shown as
Figure BDA0001862558710000173
Where i is 1, 2, …, 150. And performing regression analysis by using 150 groups of data, and finding a function set formed by increasing functions enabling the value of the preset cost function to be less than 1 as a regression model function, further finding a function when the value of the preset cost function is minimum as the regression model function, wherein the preset cost function can be a mean square error cost function.
The above process of determining the regression model function can be understood by referring to the contents described in the above embodiments, and will not be described herein.
In some embodiments of the present application, the regression model function may be a sum of exponential functions, i.e. a texture feature T, a local variance feature S and an optimal quantization parameter of an image
Figure BDA0001862558710000181
The functional relationship between them is the sum of exponential functions, as shown in the following equation (18):
Figure BDA0001862558710000182
wherein, c1,c2,c3,c4Is constant, in some embodiments, when the mean square error cost function takes the minimum value, c1=20.2794,c2=0.7977,c3=0.2661,c4=279.1924。
It should be noted that, in this embodiment, the description is only given by taking the regression model function as the sum of exponential functions as an example, in other embodiments of the present application, the regression model function may also be a logarithmic function and a rational function, which can be understood by referring to the contents described in the foregoing embodiments, and details are not described here.
And S32, calculating image texture characteristics and local variance characteristics of the image to be compressed, and obtaining the prediction quantization parameters of the image to be compressed according to the regression model function.
In an embodiment provided in this specification, the texture feature T of the image to be compressed may be calculated according to formula (8), the local variance feature S of the image to be compressed may be calculated according to formula (13), and the prediction quantization parameter under the specified code length threshold may be calculated by using the obtained regression model function.
And S33, taking the range obtained by the up-and-down floating prediction data with the prediction quantization parameter as the center as the quantization parameter range, and selecting the quantization parameter with the highest compression quality evaluation index as the optimal quantization parameter in the quantization parameter range.
Step S33 is similar to step S13 and step S23 set forth in the above embodiments, and can be understood by referring to the content described in the above embodiments, which is not described herein again.
One or more embodiments of the present disclosure provide a method for selecting an optimal quantization parameter during image compression, where a regression model function is determined according to a texture feature, a local variance feature, and an optimal quantization parameter of each static image in a set of static images, when an image to be compressed is compressed, a prediction quantization function can be quickly obtained according to the texture feature, the local variance feature, and the regression model function of the image to be compressed, a range obtained by using the prediction quantization parameter as central up-and-down floating preset data is used as a quantization parameter range, and a quantization parameter when a compression quality evaluation index of the image to be compressed is best is selected as the optimal quantization parameter in the quantization parameter range. Therefore, the method for selecting the optimal quantization parameter provided by the embodiments of the present application can be used to compress the static image in a limited storage space, the method for selecting the optimal quantization parameter is simple and fast, and the image compression quality can be ensured under the condition of specifying the code length threshold.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. For details, reference may be made to the description of the related embodiments of the related processing, and details are not repeated herein.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
Based on the method for selecting the optimal quantization parameter during image compression, one or more embodiments of the present disclosure further provide an apparatus for selecting the optimal quantization parameter during image compression. The apparatus may include systems, software (applications), modules, components, servers, etc. that utilize the methods described in the embodiments of the present specification in conjunction with hardware implementations as necessary. Based on the same innovative conception, embodiments of the present specification provide an apparatus as described in the following embodiments. Since the implementation scheme of the apparatus for solving the problem is similar to that of the method, the specific implementation of the apparatus in the embodiment of the present specification may refer to the implementation of the foregoing method, and repeated details are not repeated. As used hereinafter, the term "unit" or "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated. Specifically, fig. 13 is a schematic block diagram of an embodiment of an apparatus for selecting an optimal quantization parameter during image compression, where as shown in fig. 13, the apparatus may include:
an establishing module 41, configured to establish a regression model function between the image content features and the optimal quantization parameters;
the calculating module 42 may be configured to calculate image content characteristics of the image to be compressed, and obtain a prediction quantization parameter of the image to be compressed according to the regression model function;
the selecting module 43 may be configured to use a range obtained by floating preset data up and down with the predicted quantization parameter as a center as a quantization parameter range, and select a quantization parameter with a best evaluation index of compression quality of the image to be compressed as an optimal quantization parameter within the quantization parameter range.
In one embodiment of the present description, the setup module may comprise a setup unit, a calculation unit and an analysis unit, wherein,
the establishing unit can be used for establishing a static image sample set;
the calculating unit may be configured to calculate an image content characteristic of each still image sample in the set of still image samples established by the establishing unit, and an optimal quantization parameter corresponding to each still image sample when a total number of coding bits is specified;
the analysis unit may be configured to perform regression analysis on the image content features of each still image sample calculated by the calculation unit and the corresponding optimal quantization parameter, so as to obtain a regression model function between the image content features and the optimal quantization parameter.
It should be noted that the above-described apparatus may also include other embodiments according to the description of the method embodiment. The specific implementation manner may refer to the description of the related method embodiment, and is not described in detail herein.
One or more embodiments of the present disclosure provide an apparatus for selecting an optimal quantization parameter during image compression, where a regression model function is determined according to an image content characteristic and an optimal quantization parameter of each static image in a set of static images, when an image to be compressed is compressed, a predicted quantization function can be quickly obtained according to the image content characteristic and the regression model function of the image to be compressed, a range obtained by floating preset data up and down with the predicted quantization parameter as a center is used as a quantization parameter range, and a quantization parameter when a compression quality evaluation index of the image to be compressed is best is selected as the optimal quantization parameter in the quantization parameter range. Therefore, the method for selecting the optimal quantization parameter provided by the embodiments of the present application can be used to compress the static image in a limited storage space, the method for selecting the optimal quantization parameter is simple and fast, and the image compression quality can be ensured under the condition of the code length threshold.
The method or apparatus provided by the present specification and described in the foregoing embodiments may implement service logic through a computer program and record the service logic on a storage medium, where the storage medium may be read and executed by a computer, so as to implement the effect of the solution described in the embodiments of the present specification. Accordingly, the present specification also provides an apparatus for selecting an optimal quantization parameter in image compression, comprising a processor and a memory storing processor-executable instructions, which when executed by the processor, implement steps comprising:
establishing a regression model function between the image content characteristics and the optimal quantization parameters;
calculating the image content characteristics of the image to be compressed, and obtaining the prediction quantization parameter of the image to be compressed according to the regression model function;
and taking the range obtained by the preset data with the predicted quantization parameter as the center and floating up and down as the quantization parameter range, and selecting the quantization parameter with the best compression quality evaluation index as the optimal quantization parameter in the quantization parameter range.
The storage medium may include a physical device for storing information, and typically, the information is digitized and then stored using an electrical, magnetic, or optical media. The storage medium may include: devices that store information using electrical energy, such as various types of memory, e.g., RAM, ROM, etc.; devices that store information using magnetic energy, such as hard disks, floppy disks, tapes, core memories, bubble memories, and usb disks; devices that store information optically, such as CDs or DVDs. Of course, there are other ways of storing media that can be read, such as quantum memory, graphene memory, and so forth.
It should be noted that the above description of the apparatus according to the method embodiment may also include other embodiments. The specific implementation manner may refer to the description of the related method embodiment, and is not described in detail herein.
The apparatus for selecting an optimal quantization parameter during image compression according to the embodiments determines a regression model function according to image content characteristics of each static image in a set of static images and the optimal quantization parameter, when an image to be compressed is compressed, a predicted quantization function can be quickly obtained according to the image content characteristics of the image to be compressed and the regression model function, a range obtained by using the predicted quantization parameter as center up-down floating preset data is used as a quantization parameter range, and a quantization parameter when a compression quality evaluation index of the image to be compressed is best is selected as the optimal quantization parameter in the quantization parameter range. Therefore, the method for selecting the optimal quantization parameter provided by the embodiments of the present application can be used to compress the static image in a limited storage space, the method for selecting the optimal quantization parameter is simple and fast, and the image compression quality can be ensured under the condition of the code length threshold.
The present specification also provides a system for selecting an optimal quantization parameter during image compression, where the system may be a single computer, and the system for selecting an optimal quantization parameter during image compression may include at least one processor and a memory storing computer-executable instructions, where the processor executes the instructions to implement the steps of the method in any one or more of the above embodiments.
It should be noted that the above-mentioned system may also include other implementation manners according to the description of the method or apparatus embodiment, and specific implementation manners may refer to the description of the related method embodiment, which is not described in detail herein.
The system for selecting the optimal quantization parameter during image compression described in the above embodiment determines a regression model function according to the image content characteristics of each static image in a static image set and the optimal quantization parameter, when an image to be compressed is compressed, a predicted quantization function can be quickly obtained according to the image content characteristics of the image to be compressed and the regression model function, a range obtained by using the predicted quantization parameter as central up-down floating preset data is used as a quantization parameter range, and a quantization parameter when the compression quality evaluation index of the image to be compressed is the best is selected as the optimal quantization parameter in the quantization parameter range. Therefore, the method for selecting the optimal quantization parameter provided by the embodiments of the present application can be used to compress the static image in a limited storage space, the method for selecting the optimal quantization parameter is simple and fast, and the image compression quality can be ensured under the condition of the code length threshold.
It should be noted that, the above-mentioned device or system in this specification may also include other implementation manners according to the description of the related method embodiment, and a specific implementation manner may refer to the description of the method embodiment, which is not described herein in detail. The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the hardware + program class, storage medium + program embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the relevant points, refer to the partial description of the method embodiment.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. Of course, when implementing one or more of the present description, the functions of each module may be implemented in one or more software and/or hardware, or a module implementing the same function may be implemented by a combination of multiple sub-modules or sub-units, etc. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may therefore be considered as a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method or apparatus that comprises the element.
As will be appreciated by one skilled in the art, one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
One or more embodiments of the present description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. One or more embodiments of the present specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment. In the description of the specification, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the specification. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (12)

1. A method for selecting an optimal quantization parameter during image compression is characterized by comprising the following steps:
establishing a regression model function between the image content characteristics and the optimal quantization parameters;
calculating the image content characteristics of the image to be compressed, and obtaining the prediction quantization parameter of the image to be compressed according to the regression model function;
and taking the range obtained by the preset data with the predicted quantization parameter as the center and floating up and down as the quantization parameter range, and selecting the quantization parameter with the highest compression quality evaluation index as the optimal quantization parameter in the quantization parameter range.
2. The method of claim 1, wherein the establishing a regression model function between the image content features and the optimal quantization parameters comprises:
establishing a static image sample set;
calculating the image content characteristics of each static image sample in the static image sample set and the optimal quantization parameter corresponding to each static image sample when a code length threshold is appointed;
and performing regression analysis on the image content characteristics of each static image sample and the corresponding optimal quantization parameters to obtain a regression model function between the image content characteristics and the optimal quantization parameters.
3. The method of claim 2, wherein performing regression analysis on the image content characteristics of each still image sample and the corresponding optimal quantization parameter to obtain a regression model function between the image content characteristics and the optimal quantization parameter comprises:
drawing a scatter diagram of the image content characteristics of each static image sample and the corresponding optimal quantization parameters in a coordinate system;
and establishing a regression model function of the image content characteristics and the optimal quantization parameters according to the distribution rule of the scatter diagram.
4. The method of claim 3, wherein the establishing a regression model function of the image content features and the optimal quantization parameters according to the distribution rule of the scatter diagram comprises:
and according to the distribution rule of the scatter diagram, when the value of a preset cost function is less than 1, a function set formed by an increasing function is used as a regression model function of the image content characteristics and the optimal quantization parameters.
5. The method of claim 4, wherein the preset cost function is a mean square error cost function, and a function when the mean square error cost function has a minimum value is used as a regression model function between the image content features and the optimal quantization parameters.
6. The method of claim 4, wherein the regression model function is any one of an addition of exponential functions, a logarithmic function, or a rational function.
7. The method of claim 1, wherein the image compression quality evaluation index comprises any one of a peak signal-to-noise ratio, a structural similarity, and a mean square error.
8. The method for selecting the optimal quantization parameter for image compression according to any one of claims 1 to 7, wherein the image content features are texture features and/or local variance features.
9. An apparatus for selecting an optimal quantization parameter in image compression, comprising:
the establishing module is used for establishing a regression model function between the image content characteristics and the optimal quantization parameters;
the calculation module is used for calculating the image content characteristics of the image to be compressed and obtaining the prediction quantization parameter of the image to be compressed according to the regression model function;
and the selection module is used for taking the range obtained by the up-and-down floating preset data with the predicted quantization parameter as the center as the quantization parameter range, and selecting the quantization parameter with the highest compression quality evaluation index of the image to be compressed as the optimal quantization parameter in the quantization parameter range.
10. The apparatus for selecting an optimal quantization parameter during image compression according to claim 9, wherein the establishing module comprises:
the establishing unit is used for establishing a static image sample set;
the calculating unit is used for calculating the image content characteristics of each static image sample in the static image sample set established by the establishing unit and the optimal quantization parameter corresponding to each static image sample when the code length threshold is appointed;
and the analysis unit is used for carrying out regression analysis on the image content characteristics of each static image sample obtained by calculation of the calculation unit and the corresponding optimal quantization parameter to obtain a regression model function between the image content characteristics and the optimal quantization parameter.
11. An apparatus for selecting an optimal quantization parameter for image compression, comprising a processor and a memory for storing processor-executable instructions, the instructions when executed by the processor implementing the steps comprising:
establishing a regression model function between the image content characteristics and the optimal quantization parameters;
calculating the image content characteristics of the image to be compressed, and obtaining the prediction quantization parameter of the image to be compressed according to the regression model function;
and taking the range obtained by the preset data with the predicted quantization parameter as the center and floating up and down as the quantization parameter range, and selecting the quantization parameter with the highest compression quality evaluation index as the optimal quantization parameter in the quantization parameter range.
12. A system for selecting optimal quantization parameters for image compression, comprising at least one processor and a memory storing computer-executable instructions, the processor implementing the steps of the method of any one of claims 1 to 8 when executing the instructions.
CN201811341033.7A 2018-11-12 2018-11-12 Method, device, equipment and system for selecting optimal quantization parameter during image compression Pending CN111182301A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811341033.7A CN111182301A (en) 2018-11-12 2018-11-12 Method, device, equipment and system for selecting optimal quantization parameter during image compression

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811341033.7A CN111182301A (en) 2018-11-12 2018-11-12 Method, device, equipment and system for selecting optimal quantization parameter during image compression

Publications (1)

Publication Number Publication Date
CN111182301A true CN111182301A (en) 2020-05-19

Family

ID=70657096

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811341033.7A Pending CN111182301A (en) 2018-11-12 2018-11-12 Method, device, equipment and system for selecting optimal quantization parameter during image compression

Country Status (1)

Country Link
CN (1) CN111182301A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113985217A (en) * 2021-07-26 2022-01-28 中国电力科学研究院有限公司 Method and system for determining optimal starting parameter
CN114745556A (en) * 2022-02-07 2022-07-12 浙江智慧视频安防创新中心有限公司 Encoding method, encoding device, digital video film system, electronic device, and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101110957A (en) * 2007-07-12 2008-01-23 上海交通大学 Video constant quality control method in the mode of pyramid type bidirectional estimation
CN102970540A (en) * 2012-11-21 2013-03-13 宁波大学 Multi-view video code rate control method based on key frame code rate-quantitative model
CN105321141A (en) * 2015-09-17 2016-02-10 清华大学深圳研究生院 Image load balancing processing method and apparatus
CN107659595A (en) * 2016-07-25 2018-02-02 阿里巴巴集团控股有限公司 A kind of method and apparatus for the ability for assessing distributed type assemblies processing specified services
WO2018049335A1 (en) * 2016-09-09 2018-03-15 Dolby Laboratories Licensing Corporation Coding of high dynamic range video using segment-based reshaping
CN108780499A (en) * 2016-03-09 2018-11-09 索尼公司 The system and method for video processing based on quantization parameter

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101110957A (en) * 2007-07-12 2008-01-23 上海交通大学 Video constant quality control method in the mode of pyramid type bidirectional estimation
CN102970540A (en) * 2012-11-21 2013-03-13 宁波大学 Multi-view video code rate control method based on key frame code rate-quantitative model
CN105321141A (en) * 2015-09-17 2016-02-10 清华大学深圳研究生院 Image load balancing processing method and apparatus
CN108780499A (en) * 2016-03-09 2018-11-09 索尼公司 The system and method for video processing based on quantization parameter
CN107659595A (en) * 2016-07-25 2018-02-02 阿里巴巴集团控股有限公司 A kind of method and apparatus for the ability for assessing distributed type assemblies processing specified services
WO2018049335A1 (en) * 2016-09-09 2018-03-15 Dolby Laboratories Licensing Corporation Coding of high dynamic range video using segment-based reshaping

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113985217A (en) * 2021-07-26 2022-01-28 中国电力科学研究院有限公司 Method and system for determining optimal starting parameter
CN113985217B (en) * 2021-07-26 2023-10-13 中国电力科学研究院有限公司 Method and system for determining optimal stunning parameters
CN114745556A (en) * 2022-02-07 2022-07-12 浙江智慧视频安防创新中心有限公司 Encoding method, encoding device, digital video film system, electronic device, and storage medium
CN114745556B (en) * 2022-02-07 2024-04-02 浙江智慧视频安防创新中心有限公司 Encoding method, encoding device, digital retina system, electronic device, and storage medium

Similar Documents

Publication Publication Date Title
RU2748360C1 (en) Method and device for image encoding and method and device for image decoding
WO2021244363A1 (en) Point cloud compression method, encoder, decoder, and storage medium
US20180240221A1 (en) Method for image processing and video compression
CN102611823B (en) Method and equipment capable of selecting compression algorithm based on picture content
CN103299624A (en) Adaptively performing smoothing operations
CN104378636B (en) A kind of video encoding method and device
CN110418177A (en) Method for video coding, device, equipment and storage medium
CN110996101B (en) Video coding method and device
CN111182301A (en) Method, device, equipment and system for selecting optimal quantization parameter during image compression
CN106664404A (en) Block segmentation mode processing method in video coding and relevant apparatus
Katsenou et al. Predicting video rate-distortion curves using textural features
CN110418142A (en) A kind of coding method based on video interested region, device, storage medium
Zhang et al. Fast intra algorithm based on texture characteristics for 360 videos
JP7411785B2 (en) Interpolation filtering method and device, computer program and electronic device for intra prediction
Paul et al. On visual masking estimation for adaptive quantization using steerable filters
US11546597B2 (en) Block-based spatial activity measures for pictures
CN105706447A (en) Moving image coding device, moving image decoding device, moving image coding method, moving image decoding method, and program
KR102593004B1 (en) Apparatus and method for successive deep image compression
US10015507B2 (en) Transform system and method in video and image compression
Fryza A Complete Video Coding Chain Based on Multi-Dimensional Discrete Cosine Transform.
RU2796934C2 (en) Measurements of spatial actions of images based on blocks
CN111885378B (en) Multimedia data encoding method, apparatus, device and medium
CN102948147A (en) Video rate control based on transform-coefficients histogram
KR20240006667A (en) Point cloud attribute information encoding method, decoding method, device and related devices
Amirpour et al. EVCA: Enhanced Video Complexity Analyzer

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination