CN111770330B - Image compression method and device and electronic equipment - Google Patents

Image compression method and device and electronic equipment Download PDF

Info

Publication number
CN111770330B
CN111770330B CN202010522277.6A CN202010522277A CN111770330B CN 111770330 B CN111770330 B CN 111770330B CN 202010522277 A CN202010522277 A CN 202010522277A CN 111770330 B CN111770330 B CN 111770330B
Authority
CN
China
Prior art keywords
quantization
value
image
offset
region
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.)
Active
Application number
CN202010522277.6A
Other languages
Chinese (zh)
Other versions
CN111770330A (en
Inventor
刘智辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information 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 Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202010522277.6A priority Critical patent/CN111770330B/en
Publication of CN111770330A publication Critical patent/CN111770330A/en
Application granted granted Critical
Publication of CN111770330B publication Critical patent/CN111770330B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Abstract

The disclosure relates to an image compression method, an image compression device and electronic equipment, and relates to the technical field of image processing, wherein the method comprises the following steps: after the original image is obtained, a smooth first region and a second region except the first region in the original image are identified and obtained, so that in the process of compressing the original image, a quantization factor with a first quantization value is adopted to quantize frequency domain residual coefficients of a plurality of image units in the first region, and a quantization factor with a second quantization value is adopted to quantize frequency domain residual coefficients of a plurality of image units in the second region. According to the method, after the smooth first region is obtained by identifying the original image, the quantization factor with small distortion degree is adopted to quantize the first region, so that more image details are reserved, and the contour effect of the smooth region is reduced.

Description

Image compression method and device and electronic equipment
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to an image compression method and apparatus, and an electronic device.
Background
Because the data volume of the acquired original image is large and inconvenient to transmit, the image is compressed to remove redundant data information in the image, so that as many information as possible can be represented by as few symbols as possible. However, after the image is compressed, if the high frequency information of the residual coefficient after discrete cosine transform is zeroed due to the quantization process, the contour effect occurs, thereby affecting the quality of the image.
In the related art, the contour effect of the image due to compression is avoided by adjusting the compression parameters in the image compression process. However, the adjustment of the compression parameters may affect the compression strength of the entire image, thereby causing information loss and a contour effect of the image due to compression transition, or causing a large increase in the file size of the image due to an excessively small compression strength, thereby bringing a high cost to the subsequent image processing.
Disclosure of Invention
The disclosure provides an image compression method, an image compression device and electronic equipment, which are used for at least solving the problems that information is seriously lost and a contour effect occurs due to overlarge compression parameters or an image file is overlarge due to the overlarge compression parameters in the image compression process in the related art.
The technical scheme of the disclosure is as follows:
according to a first aspect of embodiments of the present disclosure, there is provided an image compression method, including:
acquiring an original image;
identifying a first area which is smooth from the original image and a second area except the first area;
in the process of compressing the original image, adopting a quantization factor with a value of a first quantization value to quantize the frequency domain residual error coefficients of a plurality of image units in the first area; and
and quantizing the frequency domain residual coefficients of the plurality of image units in the second region by using a quantization factor with a value of a second quantization value, wherein the quantization distortion degree corresponding to the first quantization value is smaller than the quantization distortion degree corresponding to the second quantization value.
As a first possible situation of the embodiment of the present disclosure, the performing quantization processing on the frequency domain residual coefficients of a plurality of image units in the first region by using a quantization factor whose value is a first quantization value includes:
adjusting the value of the quantization factor by setting an adjustment step length within the value range of the quantization factor;
when the quantization factor is adjusted once, the values adjusted by the quantization factor are adopted to quantize the frequency domain residual error coefficients of the plurality of image units in the first area;
and if the number of the image units with the non-zero frequency domain residual error coefficients after quantization is larger than a number threshold, taking the value of the quantized factor after adjustment as the first quantized value, and stopping adjusting the value of the quantized factor.
As a second possible case of the embodiment of the present disclosure, adjusting, within the value range of the quantization factor, the value of the quantization factor by setting an adjustment step size includes:
and in the value range of the quantization factor, adjusting the value of the quantization factor by the adjustment step length according to the sequence of the quantization distortion degrees from large to small.
As a third possible situation of the embodiment of the present disclosure, the quantization factor includes an offset and a quantization step, where in a value range of the quantization factor, adjusting a value of the quantization factor by the adjustment step according to a sequence of the quantization distortion from large to small includes:
in the value range of the offset, adjusting the value of the offset by the adjustment step length of the offset according to the sequence from small to large;
and when the value of the offset reaches the upper limit of the value range of the offset, reducing the value of the quantization step, and repeatedly executing the step of adjusting the value of the offset by the adjustment step of the offset in the value range of the offset according to the sequence of the values from small to large until the value of the quantization step reaches the lower limit of the value range of the quantization step.
As a fourth possible case of the embodiment of the present disclosure, a lower limit of a value range of the offset is determined according to a second quantized value of the offset;
and the upper limit of the value range of the quantization step is determined according to the second quantization value of the quantization step.
As a fifth possible case of the embodiment of the present disclosure, before taking the value obtained after the quantization factor adjustment as the first quantization value if the number of image units having non-zero frequency domain residual coefficients after quantization is greater than a number threshold, the method further includes:
for the first area, the number of image units with non-zero frequency domain residual error coefficients before quantization and/or the total number of the image units are counted;
and determining the number threshold according to the number of the image units with non-zero frequency domain residual error coefficients before quantization and/or the total number of the image units.
As a sixth possible case of the embodiment of the present disclosure, the determining the number threshold according to the number of image units having non-zero frequency domain residual coefficients before quantization and/or the total number of image units includes:
generating a first candidate threshold according to the number of image units with non-zero frequency domain residual error coefficients before quantization;
generating a second candidate threshold according to the total number of the image units;
and taking the smaller one of the first candidate threshold and the second candidate threshold as the number threshold.
As a seventh possible case of the embodiment of the present disclosure, the identifying, from the original image, a smoothed first region includes:
dividing the original image into a plurality of regions;
determining a variance of a luminance component of a plurality of image cells in each of the regions;
and if the brightness component variance is lower than a variance threshold, determining that the corresponding area is the first area.
As an eighth possible case of the embodiment of the present disclosure, if the variance of the luminance component is lower than a variance threshold, determining that the corresponding region is the first region includes:
if the brightness component variance is lower than the variance threshold, determining the brightness component mean of a plurality of image units in the corresponding area;
and if the mean value of the brightness components is lower than a mean threshold value, determining the corresponding area as the first area.
According to the image compression method, after the original image is obtained, a smooth first region and a second region except the first region in the original image are identified, so that in the process of compressing the original image, a quantization factor with a first quantization value is adopted to quantize frequency domain residual coefficients of a plurality of image units in the first region, and a quantization factor with a second quantization value is adopted to quantize frequency domain residual coefficients of a plurality of image units in the second region. According to the method, after the smooth first region is obtained by identifying the original image, the quantization factor with small distortion degree is adopted to quantize the first region, so that more image details are reserved, and the contour effect of the smooth region is reduced.
According to a second aspect of the embodiments of the present disclosure, there is provided an image compression apparatus including:
an acquisition module configured to perform acquiring an original image;
the identification module is configured to identify a first area which is smoothed from the original image and a second area except the first area;
the first processing module is configured to perform quantization processing on frequency domain residual coefficients of a plurality of image units in the first area by using a quantization factor with a first quantization value in the process of compressing the original image; and
a second processing module configured to perform quantization processing on the frequency-domain residual coefficients of the plurality of image units in the second region by using a quantization factor whose value is a second quantization value, wherein the quantization distortion of the first quantization value is smaller than the quantization distortion of the second quantization value.
As a first possible case of the embodiment of the present disclosure, the first processing module includes:
an adjusting unit configured to adjust the value of the quantization factor in a set adjustment step within the value range of the quantization factor;
a quantization unit, configured to perform quantization processing on the frequency domain residual coefficients of the plurality of image units in the first region by using the value adjusted by the quantization factor each time the value of the quantization factor is adjusted;
and the processing unit is configured to take the value of the quantized factor after adjustment as the first quantized value and stop adjusting the value of the quantized factor if the number of image units with non-zero frequency domain residual error coefficients after quantization is larger than a number threshold.
As a second possible case of the embodiment of the present disclosure, the adjusting unit is further configured to:
and in the value range of the quantization factor, adjusting the value of the quantization factor by the adjustment step length according to the sequence of the quantization distortion degrees from large to small.
As a third possible case of the embodiment of the present disclosure, the quantization factor includes an offset and a quantization step size, and the adjusting unit is further configured to:
in the value range of the offset, adjusting the value of the offset by the adjustment step length of the offset according to the sequence from small to large;
and when the value of the offset reaches the upper limit of the value range of the offset, reducing the value of the quantization step, and repeatedly executing the step of adjusting the value of the offset by the adjustment step of the offset in the value range of the offset according to the sequence of the values from small to large until the value of the quantization step reaches the lower limit of the value range of the quantization step.
As a fourth possible case of the embodiment of the present disclosure, a lower limit of the value range of the offset is determined according to the second quantized value of the offset;
and the upper limit of the value range of the quantization step is determined according to the second quantization value of the quantization step.
As a fifth possible case of the embodiment of the present disclosure, the first processing module further includes:
the statistical unit is configured to count the number of image units with non-zero frequency domain residual error coefficients before quantization and/or the total number of the image units in the first region;
a first determining unit configured to determine the number threshold according to the number of image units having non-zero frequency domain residual coefficients before quantization and/or the total number of image units.
As a sixth possible case of the embodiment of the present disclosure, the first determining unit is further configured to:
generating a first candidate threshold according to the number of image units with non-zero frequency domain residual error coefficients before quantization;
generating a second candidate threshold according to the total number of the image units;
and taking the smaller one of the first candidate threshold and the second candidate threshold as the number threshold.
As a seventh possible case of the embodiment of the present disclosure, the identification module further includes:
a dividing unit configured to divide the original image into a plurality of regions;
a second determination unit configured to determine a variance of luminance components of a plurality of image units in each of the regions;
a third determination unit configured to determine a corresponding region as the first region if the luminance component variance is lower than a variance threshold.
As an eighth possible case of the embodiment of the present disclosure, the third determining unit is further configured to:
if the brightness component variance is lower than the variance threshold, determining the brightness component mean of a plurality of image units in the corresponding area;
and if the mean value of the brightness components is lower than a mean threshold value, determining the corresponding area as the first area.
The image compression device of the embodiment identifies and obtains a smooth first region and a second region except the first region in the original image after the original image is obtained, so that in the process of compressing the original image, a quantization factor with a value of a first quantization value is adopted to quantize frequency domain residual coefficients of a plurality of image units in the first region, and a quantization factor with a value of a second quantization value is adopted to quantize frequency domain residual coefficients of a plurality of image units in the second region. According to the method, after the smooth first region is obtained by identifying the original image, the quantization factor with smaller distortion degree is adopted to quantize the first region, so that more image details are reserved, and the contour effect of the smooth region is reduced.
According to a third aspect of an embodiment of the present disclosure, there is provided an electronic apparatus including: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement the image compression method of the first aspect of the embodiments of the present disclosure.
According to a fourth aspect of embodiments of the present disclosure, there is provided a storage medium, wherein instructions that, when executed by a processor of a server, enable an electronic device to perform the image compression method of the first aspect of the embodiments of the present disclosure.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product, which, when executed by a processor of a server, enables the server to perform the image compression method of the first aspect of embodiments of the present disclosure.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a flow chart illustrating a method of image compression according to an exemplary embodiment.
FIG. 2 is a flow chart illustrating another method of image compression according to an exemplary embodiment.
FIG. 3 is an exemplary diagram illustrating a result of a quantization process according to one illustrative embodiment.
FIG. 4 is a flowchart illustrating a method for identifying a first area, according to an example embodiment.
Fig. 5 is a block diagram illustrating an image compression apparatus according to an exemplary embodiment.
FIG. 6 is a block diagram illustrating an electronic device 200 for image compression according to an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in other sequences than those illustrated or described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
In the related art, the process of image compression may include: transform coding, quantization, entropy coding, motion estimation, motion compensation, etc., and the quantization process is mainly modified in the embodiments of the present disclosure, and will be described in detail below.
Fig. 1 is a flowchart illustrating an image compression method according to an exemplary embodiment, and as shown in fig. 1, the image compression method is used in an electronic device, and includes the following steps:
in step S101, an original image is acquired.
The embodiment of the disclosure exemplifies that the image compression method is configured in an image compression apparatus, and the image compression apparatus can be applied to any electronic device, so that the electronic device can execute an image compression function.
The electronic device may be a Personal Computer (PC), a cloud device, a mobile device, and the like, and the mobile device may be a hardware device having various operating systems, such as a mobile phone, a tablet Computer, a Personal digital assistant, a wearable device, and a vehicle-mounted device.
The original image may be an image captured by the electronic device without any processing. The original image may be any one of an RGB (Red, green, blue) image, a grayscale image, a depth image, and the like.
The electronic equipment can be provided with cameras, and the number of the arranged cameras can be one or more. For example, 1, 2, 3, 5, etc. are provided, and are not limited herein. The form of the camera installed in the electronic device is not limited, and for example, the camera may be a camera built in the electronic device, or a camera externally installed in the electronic device; the camera can be a front camera or a rear camera.
The camera on the electronic device may be any type of camera. For example, the camera may be a color camera, a black and white camera, a depth camera, a telephoto camera, a wide-angle camera, etc., which is not limited herein.
Correspondingly, a color image, that is, an RGB image, is obtained by a color camera, a grayscale image is obtained by a black-and-white camera, a depth image is obtained by a depth camera, a tele image is obtained by a tele camera, and a wide image is obtained by a wide camera, which is not limited herein. The cameras in the electronic device may be the same type of camera or different types of cameras. For example, the cameras may be color cameras, or black and white cameras; one of the cameras can be a telephoto camera, and the other cameras can be wide-angle cameras, which are not limited herein.
In step S102, from the original image, a first region where smoothing is obtained and a second region other than the first region are identified.
In the embodiment of the present disclosure, the original image may be divided into a plurality of regions, and for convenience of distinction, a smooth region of the plurality of regions may be named as a first region, and a region other than the first region may be named as a second region. Of course, other nomenclature may be used, and is not limited herein.
For example, an original image may be divided into a plurality of regions using image segmentation, which refers to a process of subdividing a digital image into a plurality of image sub-regions. For example, the original image may be divided into 16 by 16 regions, or 32 by 32 regions, and so on.
Alternatively, after the original image is divided into a plurality of regions, each region may be traversed to determine the variance of the luminance components of a plurality of image cells in each region. When the variance of the luminance component of the region is lower than the variance threshold, it may be determined that the corresponding region is a smooth first region; instead, the corresponding region may be determined to be the second region. The variance threshold may be a preset value used to distinguish whether different regions of the original image are smooth regions.
As an alternative implementation, if the variance of the luminance component in a certain region is lower than the variance threshold, there may be a case where the variance of the luminance component corresponding to different image units in the corresponding region is greatly different. In order to accurately determine whether the region is a smooth first region, the mean value of the luminance components of a plurality of image units in the corresponding region may be further determined, and when the mean value of the luminance components of the plurality of image units is lower than a mean threshold, the corresponding region is determined to be the smooth first region. The average threshold may be a preset value used to distinguish whether different regions of the original image are smooth regions. For example, the luminance component mean threshold may be 200.
In step S103, in the process of compressing the original image, a quantization factor with a first quantization value is used to quantize the frequency domain residual coefficients of the plurality of image units in the first region.
In step S104, the frequency domain residual coefficients of the multiple image units in the second region are quantized by using a quantization factor whose value is a second quantization value, where a quantization distortion degree corresponding to the first quantization value is smaller than a quantization distortion degree corresponding to the second quantization value.
In compressing the original image, the original image may be first transform-coded to transform the original image into a frequency domain, and then the changed coefficients may be subjected to a coding process. The quantization processing means that the transformed frequency domain coefficient is divided by a constant, and the result of quantization is an integral multiple of the quantization step size or more zero values, thereby achieving the purpose of compression. The quantization process is to reduce the image coding length substantially without reducing the visual effect, and to reduce unnecessary information in the visual restoration. The image quantization process is performed on a discrete cosine transformed image unit basis.
It should be explained that the quantization factor reflects the spatial detail compression situation, for example, if the quantization factor is small, most details of the image are preserved, and the code rate is increased. The quantization factor is increased, some details of the image are lost, the code rate is reduced, but the image distortion is enhanced and the quality is also reduced.
Optionally, since the smoothness of the first region is higher than that of the second region, in order to avoid a situation that after the original image is compressed, the first region loses information seriously and generates a contour effect because the quantization factor is too large, in the embodiment of the present disclosure, different quantization factors may be used to respectively perform compression processing on the first region and the second region.
As a possible implementation manner of the present disclosure, in the process of compressing the original image, a quantization factor with a first quantization value may be used to quantize the frequency domain residual coefficients of the plurality of image units in the first region, and a quantization factor with a second quantization value may be used to quantize the frequency domain residual coefficients of the plurality of image units in the second region. The quantization distortion degree corresponding to the first quantization value is smaller than the quantization distortion degree corresponding to the second quantization value, so that the technical problem that information is seriously lost in a smooth first area of an original image in the compression process is solved.
Optionally, in the process of compressing the original image, after quantizing the frequency domain residual coefficients of the plurality of image units in the first region by using the quantization factor whose value is the first quantization value and quantizing the frequency domain residual coefficients of the plurality of image units in the second region by using the quantization factor whose value is the second quantization value, the quantized data may be processed in a scanning processing manner to change the quantized coefficients from two dimensions to one dimensions, and then entropy encoding is performed on the obtained one-dimensional data to obtain a final image compression result.
As another possible implementation manner of the present disclosure, the following formula may be adopted to perform quantization processing on the first region and the second region, where the formula is as follows:
q(x,y)=round(F(x,y)/Q+0.5);
wherein, F (x, y) is a frequency domain coefficient of the original image after frequency domain transformation, Q is a quantization step, a round () function returns a rounded integer value, and Q (x, y) is a value of the original image after quantization.
For example, if the value of a certain pixel point after frequency domain transformation is 205 and the quantization step Q takes 28, Q (x, y) = round (205/28 + 0.5) = round (7.8214) =8.
It should be explained that, in the process of compressing the original image, the sequence of quantization processing for the first region and the second region is not limited, and the frequency domain residual coefficients of a plurality of image units in the first region may be quantized, and then the frequency domain residual coefficients of a plurality of image units in the second region may be quantized; or the second area can be quantized first and then the first area can be quantized; alternatively, the quantization processing may also be performed on the first region and the second region at the same time, which is not limited in this embodiment of the disclosure. Therefore, step S103 and step S104 are not limited to the processes executed sequentially, and step S104 may be executed first and then step S103 is executed, or step S103 and step S104 are executed simultaneously, which is not limited in the embodiment of the present disclosure.
According to the image compression method, after the original image is obtained, a smooth first region and a second region except the first region in the original image are identified, so that in the process of compressing the original image, a quantization factor with a first quantization value is adopted to quantize frequency domain residual coefficients of a plurality of image units in the first region, and a quantization factor with a second quantization value is adopted to quantize frequency domain residual coefficients of a plurality of image units in the second region. According to the method, after the smooth first region is obtained by identifying the original image, the quantization factor with smaller distortion degree is adopted to quantize the first region, so that more image details are reserved, and the contour effect of the smooth region is reduced.
In a possible implementation form of the present disclosure, in a process of compressing an original image, in order to avoid a problem that when a smooth first region is quantized, information is seriously lost due to an excessively large quantization factor value, or a compressed file is too large due to an excessively small quantization factor value, which is not beneficial to subsequent processing, a value of a quantization factor may be adjusted by setting an adjustment step length, so as to determine a value corresponding to a final quantization factor of the first region according to a result of quantization processing performed on the first region by using quantization factors of different values, thereby avoiding a problem that an image information is seriously lost due to an excessively high quantization factor value in the first region of an original image in an image compression process, or a compressed file is too large due to an excessively small quantization factor value.
Fig. 2 is a flowchart illustrating another image compression method according to an exemplary embodiment, and as shown in fig. 2, the step S103 may further include the following steps:
in step S1031, in the process of compressing the original image, the value of the quantization factor is adjusted by setting an adjustment step size within the value range of the quantization factor.
In the embodiment of the present disclosure, in order to avoid a situation that the original image is lost too much or has a contour effect during the compression process, a value range of the quantization factor may be preset, so as to perform quantization processing on the original image according to the quantization factor in the value range.
Optionally, in the process of compressing the original image, the value of the quantization factor may be adjusted by setting an adjustment step size within the value range of the quantization factor, so as to perform quantization processing on the frequency domain residual coefficients of the plurality of image units in the first region according to the adjusted value of the quantization factor.
For example, in the process of compressing the original image, the value range of the quantization factor may be P-6 to P, and the preset adjustment step size may be 1, and at this time, when performing quantization processing on the frequency domain residual coefficients of a plurality of image units in different areas of the original image, the value of the quantization factor may be adjusted downward in a manner of P-1 each time.
Optionally, in the value range of the quantization factor, the value of the quantization factor may be adjusted by a preset adjustment step according to the sequence of the quantization distortion from large to small.
In a possible implementation manner of the embodiment of the present disclosure, the quantization factor may include an offset and a quantization step, and when the value of the quantization factor is adjusted by a preset step size according to a sequence from a large quantization distortion factor to a small quantization distortion factor, the value of the offset may be adjusted by an adjustment step size of the offset within a value range of the offset according to a sequence from a small value to a large value; and when the value of the offset reaches the upper limit of the value range of the offset, reducing the value of the quantization step, and repeatedly executing the step of adjusting the value of the offset by the adjustment step of the offset in the value range of the offset according to the sequence of the values from small to large until the value of the quantization step reaches the lower limit of the value range of the quantization step.
The lower limit of the value range of the offset can be determined according to the second quantized value of the offset; the upper limit of the value range of the quantization step can be determined according to the second quantization value of the quantization step.
For example, the offset value range may be 1/3 to 1/2, and the offset value may be adjusted by a step size of 1/24 of the offset adjustment step size in order of small value within the value range until the offset value reaches 1/2, the quantization step size value is reduced, and the step of adjusting the offset value by the offset adjustment step size within the offset value range of 1/3 to 1/2 in order of small value to large value is repeatedly performed until the quantization step size value reaches the lower limit of the quantization step size value range.
It should be noted that, the range of the offset in the above example is not completely fixed, and may vary according to the residual error of the original image in the frame or between frames.
In step S1032, each time the quantization factor is adjusted, the values adjusted by the quantization factor are used to quantize the frequency domain residual coefficients of the plurality of image units in the first region.
In the embodiment of the disclosure, in the value range of the quantization factor, after the value of the quantization factor is adjusted by a set adjustment step length, the value adjusted by the quantization factor is adopted to perform quantization processing on the frequency domain residual error coefficients of the plurality of image units in the first region.
In a possible case of the embodiment of the present disclosure, in a value range of the offset, a value of the offset is adjusted by an adjustment step size of the offset, and then the adjusted offset is adopted to perform quantization processing on the frequency domain residual coefficients of the plurality of image units in the first region.
In another possible case of the embodiment of the present disclosure, after the value of the quantization step is reduced each time, in the value range of the offset, the value of the offset is adjusted by the adjustment step of the offset according to the order from small to large of the value, and the frequency domain residual coefficients of the plurality of image units in the first region are quantized by using the adjusted offset and the quantization step.
In step S1033, if the number of image units having non-zero frequency domain residual coefficients after quantization is greater than the number threshold, the value of the quantization factor after adjustment is taken as the first quantization value, and the adjustment of the value of the quantization factor is stopped.
It can be understood that, in the process of image compression, the frequency domain coefficient is obtained after the original image is encoded, and then, after the frequency domain coefficient is quantized, an image unit having a zero frequency domain residual coefficient exists.
As an example, referring to fig. 3, the left table in fig. 3 is a frequency domain coefficient of each image unit obtained by encoding a certain original image, and the coefficients in the right table in fig. 3 can be obtained by quantizing each frequency domain coefficient with a certain quantization factor, and the image unit with zero frequency domain residual coefficient can be obtained by quantizing the original image. The original image is quantized to obtain more zero values, so that the aim of image compression can be fulfilled.
As a possible implementation manner of the embodiment of the present disclosure, when determining the number threshold of the image units having the non-zero frequency residual coefficients, the number of the image units having the non-zero frequency residual coefficients before quantization and the total number of the image units may be counted for the first region, so as to determine the number threshold according to the number of the image units having the non-zero frequency residual coefficients before quantization and the total number of the image units.
Alternatively, a first candidate threshold may be generated according to the number of image units having non-zero frequency domain residual coefficients before quantization, a second candidate threshold may be generated according to the total number of image units having non-zero frequency domain residual coefficients before quantization, and then, one of the first candidate threshold and the second candidate threshold having a smaller value may be used as the number threshold.
In the embodiment of the present disclosure, in the value range of the quantization factor, after the value of the quantization factor is adjusted in the setting step, the adjusted quantization factor is adopted to quantize the frequency domain residual coefficients of the plurality of image units in the first region, and if the number of image units having non-zero frequency domain residual coefficients after quantization is greater than the number threshold, the value adjusted by the quantization factor is used as the first quantization value, and the adjustment of the value of the quantization factor is stopped.
It can be understood that, if the number of image units having non-zero frequency domain residual coefficients after quantization is less than the number threshold, it may be said that the first region is compressed too much, which results in excessive information loss of the first region and is easy to generate a contour effect.
In a possible case of the embodiment of the present disclosure, the quantization factor includes an offset and a quantization step, and the offset and the quantization step can be adjusted, so that the frequency domain residual coefficients of the plurality of image units in the first region are quantized by using the adjusted offset and quantization step until the number of image units having non-zero frequency domain residual coefficients after quantization is greater than a number threshold, and then the value obtained after the current offset and quantization step is adjusted is used as a first quantization value, and the adjustment of the offset and quantization step is stopped.
In a possible case, when the quantization step is a certain value in the quantization step range, the value of the offset may be adjusted by an adjustment step of the offset in the value range of the offset in the order from small to large, and the frequency domain residual coefficients of the plurality of image units in the first region are quantized by using the adjusted value of the offset, and if the number of image units having non-zero frequency domain residual coefficients after quantization is greater than the number threshold, the values of the quantization step and the adjusted offset are taken as the first quantization value, and the adjustment of the value of the offset is stopped.
For example, assuming that the range of the quantization step is from Q to Q-6, and the range of the offset is from 1/3 to 1/2, the offset may be adjusted by using the adjustment step of the offset as 1/24 in the order of the values from small to large within the range, and each time the offset is adjusted once, the adjusted offset value is adopted to perform quantization processing on the frequency domain residual coefficients of the plurality of image units in the first region. If the quantization step is Q and the offset is 5/12, after the frequency domain residual coefficients of the plurality of image units in the first area are quantized, and the number of the image units with non-zero frequency domain residual coefficients is greater than a number threshold, the offset is 5/12 and the quantization step is Q as a first quantization value, and the adjustment of the offset is stopped.
In another possible case, when the quantization step is a certain value in the quantization step range, the value of the offset may be adjusted by the adjustment step of the offset in the value range of the offset in the order from small to large, and after the value of the offset is adjusted each time, the adjusted value of the offset is adopted to perform quantization processing on the frequency domain residual coefficients of the plurality of image units in the first region. If the number of the image units with the non-zero frequency domain residual error coefficients after the quantization processing is carried out on the frequency domain residual error coefficients of the plurality of image units in the first area is not more than a number threshold value until the value of the offset reaches the upper limit of the value range of the offset, reducing the value of the quantization step, and repeatedly executing the step of adjusting the value of the offset by the adjustment step of the offset according to the sequence from small to large of the value within the value range of the offset. When the offset value is repeatedly adjusted, the adjusted offset value is adopted each time the offset value is adjusted by the adjustment step length of the offset, the frequency domain residual error coefficients of a plurality of image units in the first area are quantized, if the number of the image units with the non-zero frequency domain residual error coefficients after quantization is larger than the number threshold, the value after the quantization step length is reduced and the adjusted offset value are taken as a first quantization value, and the adjustment of the offset value is stopped.
For example, assuming that the range of the quantization step is Q to Q-6 and the range of the offset is 1/3 to 1/2, the value of the offset can be adjusted by adjusting the adjustment step of the offset to 1/24 in the order from small to large in the range of the quantization step, and each time the offset is adjusted, the adjusted value of the offset is adopted to quantize the frequency domain residual coefficients of the plurality of image units in the first region. If the quantization step is Q and the offset is 1/2, after the frequency domain residual coefficients of the plurality of image units in the first region are quantized, the number of the image units with non-zero frequency domain residual coefficients is not greater than a number threshold, the quantization step is adjusted to Q-1, and the step of adjusting the offset with the adjustment step of the offset being 1/24 according to the sequence of the values from small to large is repeatedly executed. And if the offset value is 11/24, after the frequency domain residual coefficients of the plurality of image units in the first area are quantized, and the number of the image units with the non-zero frequency domain residual coefficients is larger than the number threshold, taking the offset value as 11/24 and the quantization step size as Q-1 as a first quantization value, and stopping adjusting the offset value and the quantization step size.
In another possible case, when the quantization step is a certain value in the quantization step range, the value of the offset may be adjusted by the adjustment step of the offset in the range of the value of the offset in the order from small to large, and after the value of the offset is adjusted each time, the frequency domain residual coefficients of the plurality of image units in the first region are quantized by using the adjusted value of the offset. If the number of the image units with the non-zero frequency domain residual error coefficients after the quantization processing is carried out on the frequency domain residual error coefficients of the plurality of image units in the first area is not more than a number threshold value until the value of the offset reaches the upper limit of the value range of the offset, reducing the value of the quantization step, and repeatedly executing the step of adjusting the value of the offset by the adjustment step of the offset according to the sequence from small to large of the value within the value range of the offset.
And when the value of the offset is repeatedly adjusted, the adjusted offset value is adopted each time the value of the offset is adjusted by the adjustment step size of the offset, the frequency domain residual error coefficients of the plurality of image units in the first area are quantized, and if the number of the image units with the non-zero frequency domain residual error coefficients after quantization is not greater than the number threshold, the value of the quantization step size is continuously reduced. And if the value of the quantization step reaches the lower limit of the value range of the quantization step, adjusting the value of the offset, and if the number of the image units of the non-zero frequency domain residual error coefficients after the frequency domain residual error coefficients of the plurality of image units in the first region are quantized is not greater than the number threshold value by adopting the adjusted value of the offset, stopping the process of adjusting the quantization step and the offset.
In the embodiment of the disclosure, in the process of compressing an original image, the value of a quantization factor is adjusted in a set adjustment step length within the value range of the quantization factor, and each time the value of the quantization factor is adjusted once, the value adjusted by the quantization factor is adopted to quantize the frequency domain residual error coefficients of a plurality of image units in a first region, and if the number of image units having non-zero frequency domain residual error coefficients after quantization is greater than a number threshold, the value adjusted by the quantization factor is used as a first quantization value, and the value adjustment of the quantization factor is stopped. Therefore, the method avoids the serious outline effect caused by information loss due to overlarge values of the quantization factors when the smooth first area is subjected to quantization processing.
On the basis of the foregoing embodiment, in the process of compressing the original image, different quantization factors are used for different regions to perform quantization processing, so as to avoid a problem that information loss is severe in the compression process of a region in which a contour effect is likely to occur, and therefore, after the smooth first region and the smooth second region are identified and obtained from the original image in step S102, the quantization factors in the compression process can be adaptively adjusted for the different regions of the original image.
Fig. 4 is a flowchart illustrating a method for identifying a first area according to an exemplary embodiment, and as shown in fig. 4, the step S102 may include the following steps.
In step S1021, the original image is divided into a plurality of areas.
In a possible implementation manner in the embodiment of the present disclosure, after the original image is acquired, the original image may be divided into a plurality of regions with equal length and width. For example, the original image may be 1000 × 1000 in size, and may be divided into 100 regions of 100 × 100.
In another possible implementation manner in the embodiment of the present disclosure, after the original image is acquired, the original image may also be divided into a plurality of regions with different sizes according to features of image content, so that a specific location (a location of interest) is divided into regions with small enough sizes, and the sizes of the regions in other locations may be relatively large.
It should be noted that, in the embodiment of the present disclosure, when the original image is divided into a plurality of regions, an equal division manner may be adopted, and an unequal division manner may also be adopted, which is not limited herein.
In step S1022, the luminance component variances of a plurality of image units in each region are determined.
The image unit may be a pixel unit of an image. The brightness component variance can measure the brightness difference degree of a plurality of pixel points in each area. For example, the larger the variance of the luminance components of a plurality of image units in each region is, the larger the luminance difference between the pixel points in the region can be determined; the smaller the variance of the luminance components of the plurality of image units in each region is, the smaller the luminance difference between the pixel points in the region can be determined.
In the embodiment of the present disclosure, after the original image is divided into a plurality of regions, the variance of the luminance components of the plurality of image units in each region may be calculated according to the luminance components of the plurality of image units in each region.
In step S1023, it is determined whether the luminance component variance is lower than a variance threshold.
The variance threshold may be a preset value according to different collected original images.
In the embodiment of the disclosure, after determining the variance of the luminance components of the image units in each region of the original image, the variance of the luminance components of each region may be compared with a variance threshold to determine whether the corresponding region is a smooth first region.
In step S1024, if the variance of the luminance component is lower than the variance threshold, the corresponding region is determined as the first region.
In one possible case, the luminance component variance of a plurality of image units in a region of the original image is compared to a variance threshold, and if the luminance component variance is determined to be below the variance threshold, the region may be determined to be a smooth first region.
Optionally, the luminance component variances of a plurality of image units in a certain region of the original image are compared with a variance threshold, and when it is determined that the luminance component variances are lower than the variance threshold, the luminance component means of a plurality of image units in the corresponding region may be further determined, and if the luminance component means is lower than the mean threshold, the corresponding region is determined to be the first region. The average threshold is an average value of the brightness of each pixel, and may be 200, for example.
In step S1025, if the luminance component variance is higher than the variance threshold, the corresponding region is determined to be the second region.
In another possible case, the variance of the luminance components of a plurality of image units in a certain region of the original image is compared with a variance threshold, and if the variance of the luminance components is determined to be higher than the variance threshold, the region can be determined to be a second region.
It can be understood that, when the variance of the luminance components of a plurality of image units in a certain region is higher than the variance threshold, it can be said that the difference between the luminance values of a plurality of pixel points in the region is large, the smoothness of the region is low, and the region can be determined as the second region.
In the embodiment of the present disclosure, after the original image is acquired, the original image is divided into a plurality of regions, and the regions are determined to be smooth first regions or second regions by comparing the luminance component difference values of a plurality of image units in each region with a variance threshold. Therefore, the original image is divided into the smooth first area and the smooth second area, so that the quantization processing is performed by using the quantization factor with smaller distortion degree after the smooth first area, and the phenomena of serious information loss and contour effect in some areas caused by the fact that the same quantization factor is used for performing the quantization processing on the original image are avoided.
In order to implement the above embodiments, the embodiments of the present disclosure propose an image compression apparatus.
Fig. 5 is a block diagram illustrating an image compression apparatus according to an exemplary embodiment. Referring to fig. 5, the image compression apparatus 50 may include: an acquisition module 121, a recognition module 122, a first processing module 123 and a second processing module 124.
Wherein the obtaining module 121 is configured to perform obtaining the original image.
And the identifying module 122 is configured to identify a first region smoothed from the original image and a second region except the first region.
The first processing module 123 is configured to perform quantization processing on the frequency domain residual coefficients of the multiple image units in the first region by using a quantization factor whose value is a first quantization value in the process of compressing the original image.
And a second processing module 124 configured to perform quantization processing on the frequency-domain residual coefficients of the plurality of image units in the second region by using the quantization factor whose value is a second quantization value, wherein the quantization distortion of the first quantization value is smaller than that of the second quantization value.
In a possible implementation form of the embodiment of the present disclosure, the first processing module 123 may include:
the adjusting unit is configured to adjust the value of the quantization factor in a set adjusting step length within the value range of the quantization factor;
the quantization unit is configured to perform quantization processing on the frequency domain residual error coefficients of the plurality of image units in the first area by adopting the values adjusted by the quantization factors every time the quantization factors are adjusted once;
and the processing unit is configured to take the value of the quantized factor after adjustment as a first quantized value and stop adjusting the value of the quantized factor if the number of the image units with the non-zero frequency domain residual error coefficient after quantization is larger than a number threshold.
In another possible implementation form of the embodiment of the present disclosure, the adjusting unit may be further configured to:
and in the value range of the quantization factor, adjusting the value of the quantization factor by adjusting the step length according to the sequence of the quantization distortion degrees from large to small.
In another possible implementation form of the embodiment of the present disclosure, the quantization factor may include an offset and a quantization step size, and the adjusting unit may be further configured to:
in the value range of the offset, adjusting the value of the offset by the adjustment step length of the offset according to the sequence from small to large;
and when the value of the offset reaches the upper limit of the value range of the offset, reducing the value of the quantization step, and repeatedly executing the step of adjusting the value of the offset by the adjustment step of the offset in the value range of the offset according to the sequence from small to large of the value until the value of the quantization step reaches the lower limit of the value range of the quantization step.
In another possible implementation form of the embodiment of the present disclosure, the lower limit of the value range of the offset is determined according to the second quantized value of the offset; and the upper limit of the value range of the quantization step is determined according to the second quantization value of the quantization step.
In another possible implementation form of the embodiment of the present disclosure, the first processing module 123 may further include:
the statistical unit is configured to count the number of image units with non-zero frequency domain residual error coefficients before statistics and/or the total number of the image units in the first area;
a first determining unit configured to determine a number threshold according to the number of image units having non-zero frequency domain residual coefficients before quantization and/or the total number of image units.
In another possible implementation form of the embodiment of the present disclosure, the first determining unit may be further configured to:
generating a first candidate threshold according to the number of image units with non-zero frequency domain residual error coefficients before quantization;
generating a second candidate threshold according to the total number of the image units;
and taking the smaller one of the first candidate threshold and the second candidate threshold as the number threshold.
In another possible implementation form of the embodiment of the present disclosure, the identifying module 122 may further include:
a dividing unit configured to divide an original image into a plurality of regions;
a second determination unit configured to determine a variance of luminance components of the plurality of image units in each region;
a third determination unit configured to determine the corresponding region as the first region if the luminance component variance is lower than the variance threshold.
In another possible implementation form of the embodiment of the present disclosure, the third determining unit may be further configured to:
if the brightness component variance is lower than the variance threshold, determining the brightness component mean of a plurality of image units in the corresponding area;
and if the mean value of the brightness components is lower than the mean value threshold value, determining the corresponding area as the first area.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
The image compression device of the embodiment identifies and obtains a smooth first region and a second region except the first region in the original image after the original image is obtained, so that in the process of compressing the original image, a quantization factor with a value of a first quantization value is adopted to quantize frequency domain residual coefficients of a plurality of image units in the first region, and a quantization factor with a value of a second quantization value is adopted to quantize frequency domain residual coefficients of a plurality of image units in the second region. According to the method, after the smooth first region is obtained by identifying the original image, the quantization factor with small distortion degree is adopted to quantize the first region, so that more image details are reserved, and the contour effect of the smooth region is reduced.
In order to implement the above embodiments, the embodiment of the present disclosure further provides an electronic device.
Wherein, electronic equipment includes:
a processor; a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the image compression method as previously described.
As an example, fig. 6 is a block diagram illustrating an electronic device 200 for image compression according to an exemplary embodiment, where as shown in fig. 6, the electronic device 200 may further include:
a memory 210 and a processor 220, a bus 230 connecting different components (including the memory 210 and the processor 220), the memory 210 storing a computer program, and the processor 220 implementing the image compression method according to the embodiment of the present disclosure when executing the computer program.
Bus 230 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 200 typically includes a variety of electronic device readable media. Such media may be any available media that is accessible by electronic device 200 and includes both volatile and nonvolatile media, removable and non-removable media.
Memory 210 may also include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 240 and/or cache memory 250. The server 200 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 260 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 6, commonly referred to as a "hard drive"). Although not shown in FIG. 6, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 230 by one or more data media interfaces. Memory 210 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the disclosure.
A program/utility 280 having a set (at least one) of program modules 270, including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination thereof may comprise an implementation of a network environment, may be stored in, for example, the memory 210. The program modules 270 generally perform the functions and/or methodologies of the embodiments described in this disclosure.
Electronic device 200 may also communicate with one or more external devices 290 (e.g., keyboard, pointing device, display 291, etc.), with one or more devices that enable a user to interact with the electronic device 200, and/or with any devices (e.g., network card, modem, etc.) that enable the electronic device 200 to communicate with one or more other computing devices. Such communication may occur through input/output (I/O) interfaces 292. Also, the electronic device 200 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the Internet) via the network adapter 293. As shown, the network adapter 293 communicates with the other modules of the electronic device 200 via the bus 230. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processor 220 executes various functional applications and data processing by executing programs stored in the memory 210.
It should be noted that, for the implementation process and the technical principle of the electronic device of the embodiment, reference is made to the foregoing explanation of the image compression method of the embodiment of the present disclosure, and details are not described here again.
The electronic device provided by the embodiment of the disclosure identifies and obtains a smooth first region and a second region except the first region in an original image after the original image is obtained, so that in the process of compressing the original image, a quantization factor with a value of a first quantization value is adopted to quantize frequency domain residual coefficients of a plurality of image units in the first region, and a quantization factor with a value of a second quantization value is adopted to quantize frequency domain residual coefficients of a plurality of image units in the second region. According to the method, after the smooth first region is obtained by identifying the original image, the quantization factor with small distortion degree is adopted to quantize the first region, so that more image details are reserved, and the contour effect of the smooth region is reduced.
In order to implement the above embodiments, the embodiments of the present disclosure further provide a storage medium.
Wherein the instructions in the storage medium, when executed by a processor of the electronic device, enable the electronic device to perform the image compression method as previously described.
To achieve the above embodiments, the present disclosure also provides a computer program product which, when executed by a processor of a server, enables the server to execute the image compression method as described above.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (18)

1. An image compression method, comprising:
acquiring an original image;
identifying a first area which is smooth from the original image and a second area except the first area;
in the process of compressing the original image, adopting a quantization factor with a value as a first quantization value to quantize the frequency domain residual error coefficients of the plurality of image units in the first area; and
quantizing the frequency domain residual coefficients of the plurality of image units in the second region by using a quantization factor with a value of a second quantization value, wherein the quantization distortion degree corresponding to the first quantization value is smaller than the quantization distortion degree corresponding to the second quantization value;
the quantizing the frequency domain residual coefficients of the plurality of image units in the first region by using the quantization factor whose value is the first quantization value includes:
adjusting the value of the quantization factor by a set adjustment step length within the value range of the quantization factor;
performing quantization processing on the frequency domain residual error coefficients of the plurality of image units in the first region by adopting the value adjusted by the quantization factor every time the value of the quantization factor is adjusted;
and if the number of the image units with the non-zero frequency domain residual error coefficients after quantization is larger than a number threshold, taking the value of the quantized factor after adjustment as the first quantized value, and stopping adjusting the value of the quantized factor.
2. The image compression method according to claim 1, wherein adjusting the value of the quantization factor by a set adjustment step size within the value range of the quantization factor comprises:
and in the value range of the quantization factor, adjusting the value of the quantization factor by the adjustment step length according to the sequence of the quantization distortion degrees from large to small.
3. The image compression method according to claim 2, wherein the quantization factor includes an offset and a quantization step, and wherein adjusting the value of the quantization factor by the adjustment step in the order of the quantization distortion degree from large to small in the value range of the quantization factor includes:
within the value range of the offset, adjusting the value of the offset by the adjustment step length of the offset according to the sequence from small value to large value;
and when the value of the offset reaches the upper limit of the value range of the offset, reducing the value of the quantization step, and repeatedly executing the step of adjusting the value of the offset by the adjustment step of the offset according to the sequence of the values from small to large in the value range of the offset until the value of the quantization step reaches the lower limit of the value range of the quantization step.
4. The image compression method according to claim 3,
the lower limit of the value range of the offset is determined according to a second quantized value of the offset;
and the upper limit of the value range of the quantization step is determined according to the second quantization value of the quantization step.
5. The image compression method according to claim 1, wherein before taking the value obtained after the quantization factor adjustment as the first quantization value if the number of image units having non-zero frequency domain residual coefficients after quantization is greater than a number threshold, the method further comprises:
for the first region, counting the total number of image units and/or the number of image units with non-zero frequency domain residual error coefficients before quantization;
and determining the number threshold according to the total number of the image units and/or the number of the image units with non-zero frequency domain residual error coefficients before quantization.
6. The method according to claim 5, wherein said determining the number threshold according to the total number of image units and/or the number of image units having non-zero frequency domain residual coefficients before quantization comprises:
generating a first candidate threshold according to the number of image units with non-zero frequency domain residual error coefficients before quantization;
generating a second candidate threshold according to the total number of the image units;
and taking the smaller one of the first candidate threshold and the second candidate threshold as the number threshold.
7. The image compression method according to any one of claims 1 to 6, wherein the identifying a smoothed first region from the original image comprises:
dividing the original image into a plurality of regions;
determining a variance of a luminance component of a plurality of image cells in each of the regions;
and if the brightness component variance is lower than a variance threshold, determining that the corresponding area is the first area.
8. The image compression method of claim 7, wherein determining the corresponding region as the first region if the variance of the luminance component is lower than a variance threshold comprises:
if the brightness component variance is lower than the variance threshold, determining the brightness component mean value of a plurality of image units in the corresponding area;
and if the mean value of the brightness components is lower than a mean value threshold value, determining the corresponding area as the first area.
9. An image compression apparatus, comprising:
an acquisition module configured to perform acquiring an original image;
the identification module is configured to identify a first area which is smoothed from the original image and a second area except the first area;
the first processing module is configured to perform quantization processing on frequency domain residual coefficients of a plurality of image units in the first area by using a quantization factor with a first quantization value in the process of compressing the original image; and
a second processing module configured to perform quantization processing on the frequency domain residual coefficients of the plurality of image units in the second region by using a quantization factor whose value is a second quantization value, wherein the quantization distortion of the first quantization value is smaller than the quantization distortion of the second quantization value;
wherein the first processing module comprises:
the adjusting unit is configured to adjust the value of the quantization factor in a set adjusting step length within the value range of the quantization factor;
the quantization unit is configured to perform quantization processing on the frequency domain residual coefficients of the plurality of image units in the first area by adopting the values adjusted by the quantization factors every time the quantization factors are adjusted;
and the processing unit is configured to take the value of the quantized factor after adjustment as the first quantized value and stop adjusting the value of the quantized factor if the number of image units with non-zero frequency domain residual error coefficients after quantization is larger than a number threshold.
10. The image compression apparatus according to claim 9, wherein the adjustment unit is further configured to:
and in the value range of the quantization factor, adjusting the value of the quantization factor by the adjustment step length according to the sequence of the quantization distortion degrees from large to small.
11. The image compression apparatus according to claim 10, wherein the quantization factor includes an offset and a quantization step size, and the adjustment unit is further configured to:
in the value range of the offset, adjusting the value of the offset by the adjustment step length of the offset according to the sequence from small to large;
and when the value of the offset reaches the upper limit of the value range of the offset, reducing the value of the quantization step, and repeatedly executing the step of adjusting the value of the offset by the adjustment step of the offset in the value range of the offset according to the sequence of the values from small to large until the value of the quantization step reaches the lower limit of the value range of the quantization step.
12. The image compression apparatus according to claim 11,
the lower limit of the value range of the offset is determined according to a second quantized value of the offset;
and the upper limit of the value range of the quantization step is determined according to the second quantization value of the quantization step.
13. The image compression apparatus according to claim 9, wherein the first processing module further comprises:
the statistical unit is configured to count the total number of image units and/or the number of image units with non-zero frequency domain residual error coefficients before quantization for the first area;
a first determining unit configured to determine the number threshold according to the total number of image units and/or the number of image units having non-zero frequency domain residual coefficients before quantization.
14. The image compression apparatus according to claim 13, wherein the first determination unit is further configured to:
generating a first candidate threshold according to the number of image units with non-zero frequency domain residual error coefficients before quantization;
generating a second candidate threshold according to the total number of the image units;
and taking the smaller one of the first candidate threshold and the second candidate threshold as the number threshold.
15. The image compression apparatus of any of claims 9-14, wherein the identification module further comprises:
a dividing unit configured to divide the original image into a plurality of regions;
a second determination unit configured to determine a variance of luminance components of a plurality of image units in each of the regions;
a third determination unit configured to determine a corresponding region as the first region if the luminance component variance is lower than a variance threshold.
16. The image compression apparatus according to claim 15, wherein the third determination unit is further configured to:
if the brightness component variance is lower than the variance threshold, determining the brightness component mean value of a plurality of image units in the corresponding area;
and if the mean value of the brightness components is lower than a mean value threshold value, determining the corresponding area as the first area.
17. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the image compression method of any one of claims 1-8.
18. A storage medium in which instructions, when executed by a processor of an electronic device, enable the electronic device to perform the image compression method of any one of claims 1-8.
CN202010522277.6A 2020-06-10 2020-06-10 Image compression method and device and electronic equipment Active CN111770330B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010522277.6A CN111770330B (en) 2020-06-10 2020-06-10 Image compression method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010522277.6A CN111770330B (en) 2020-06-10 2020-06-10 Image compression method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN111770330A CN111770330A (en) 2020-10-13
CN111770330B true CN111770330B (en) 2022-11-04

Family

ID=72720464

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010522277.6A Active CN111770330B (en) 2020-06-10 2020-06-10 Image compression method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN111770330B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101043633A (en) * 2006-06-05 2007-09-26 华为技术有限公司 Quantization matrix selecting method, apparatus of coding and coding/decoding method and system
CN104902285A (en) * 2015-05-21 2015-09-09 北京大学 Image coding method
CN105208389A (en) * 2015-09-24 2015-12-30 中国计量学院 Video encoding hard decision quantization method based on content self-adaption deviation model
CN108683915A (en) * 2018-05-11 2018-10-19 北京奇艺世纪科技有限公司 A kind of method, apparatus and electronic equipment of write-in dQP values

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4621574B2 (en) * 2005-10-06 2011-01-26 株式会社東芝 Image coding apparatus and image coding method
US7995649B2 (en) * 2006-04-07 2011-08-09 Microsoft Corporation Quantization adjustment based on texture level
TW201134223A (en) * 2010-03-29 2011-10-01 Univ Nat Taiwan Perceptual video encoding system and circuit thereof
BR112012028568A2 (en) * 2010-05-12 2016-08-02 Nippon Telegraph & Telephone Code amount control method and apparatus
US10085024B2 (en) * 2012-04-13 2018-09-25 Qualcomm Incorporated Lookup table for rate distortion optimized quantization
CN103796015A (en) * 2012-10-31 2014-05-14 朱洪波 Quantization coefficient differential coding adapted to the number of coefficients
CN105787893B (en) * 2016-02-23 2018-11-02 西安电子科技大学 A kind of image noise variance method of estimation based on Integer DCT Transform

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101043633A (en) * 2006-06-05 2007-09-26 华为技术有限公司 Quantization matrix selecting method, apparatus of coding and coding/decoding method and system
CN104902285A (en) * 2015-05-21 2015-09-09 北京大学 Image coding method
CN105208389A (en) * 2015-09-24 2015-12-30 中国计量学院 Video encoding hard decision quantization method based on content self-adaption deviation model
CN108683915A (en) * 2018-05-11 2018-10-19 北京奇艺世纪科技有限公司 A kind of method, apparatus and electronic equipment of write-in dQP values

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
H.265/HEVC中量化算法的优化与实现;常现伟;《中国优秀硕士论文全文数据集》;20141115;全文 *

Also Published As

Publication number Publication date
CN111770330A (en) 2020-10-13

Similar Documents

Publication Publication Date Title
EP1781041B1 (en) JPEG detectors and JPEG image history estimators
CN111988611B (en) Quantization offset information determining method, image encoding device and electronic equipment
US10963995B2 (en) Image processing apparatus and image processing method thereof
US8908989B2 (en) Recursive conditional means image denoising
WO2012149645A1 (en) Method and system for increasing robustness of visual quality metrics using spatial shifting
US20200267396A1 (en) Human visual system adaptive video coding
CN104378636B (en) A kind of video encoding method and device
CN107454413B (en) Video coding method with reserved characteristics
US11030777B2 (en) Adaptive subband coding for lifting transform
WO2016033725A1 (en) Block segmentation mode processing method in video coding and relevant apparatus
Jayachandra et al. Directional variance: a measure to find the directionality in a given image segment
WO2019037471A1 (en) Video processing method, video processing device and terminal
CN111161177A (en) Image self-adaptive noise reduction method and device
CN110740316A (en) Data coding method and device
CN112584153B (en) Video compression method and device based on just noticeable distortion model
CN111770330B (en) Image compression method and device and electronic equipment
CN114051144A (en) Video compression method and device, computer equipment and storage medium
CN113191990B (en) Image processing method, device, electronic equipment and medium
EP3926584A1 (en) Method, computer program and system for detecting changes and moving objects in a video view
US11825088B2 (en) Adaptively encoding video frames based on complexity
Sun et al. Reduced-reference image quality assessment through SIFT intensity ratio
AU2016201449B2 (en) Encoding and decoding using perceptual representations
US9508020B2 (en) Image processing system with artifact suppression mechanism and method of operation thereof
CN113099220B (en) Video conference video image green screen detection method, system and storage medium
US20080095456A1 (en) Adaptive Classification System and Method for Mixed Graphic and Video Sequences

Legal Events

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