Image compression method and electronic device

By determining the central region and applying different compression ratios in the image compression method, the quality degradation caused by the compression of details in the central region of the image in the existing technology is solved, and a higher quality image display effect is achieved.

CN119484851BActive Publication Date: 2025-12-19HISENSE VISUAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410825613.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2025-12-19
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

Existing image compression methods employ fixed encoding strategies, which result in the compression of details in the central region of the image, leading to a decrease in image quality and a lower display effect.

Method used

The system determines whether the image to be compressed is the first image based on its identifier. If it is not the first image, the system determines the central region based on the previous frame and compresses the central region and other regions using different compression ratios, with the compression ratio of the central region being lower than that of other regions.

Benefits of technology

It reduces information loss during image compression, improving image quality and display effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119484851B_ABST
    Figure CN119484851B_ABST
Patent Text Reader

Abstract

The application provides an image compression method and an electronic device, which are used for reducing the loss of image information in the compression process of the image, improving the image quality and display effect. The method comprises the following steps: determining whether the to-be-compressed image is the first image based on the identification of the to-be-compressed image; if not, obtaining a center region in the to-be-compressed image based on the to-be-compressed image and a previous frame image of the to-be-compressed image, wherein the compression ratio of the center region is smaller than the compression ratio of other regions in the to-be-compressed image except the center region; obtaining an updated center region in the to-be-compressed image by using the resolution of the center region in the to-be-compressed image and the resolution of the preset compressed image; and compressing the updated center region by using a first compression ratio and compressing other regions in the to-be-compressed image except the updated center region by using a second compression ratio to obtain a compressed image, wherein the first compression ratio is smaller than the second compression ratio.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, and in particular to an image compression method and an electronic device. BACKGROUND

[0002] In the field of virtual reality, high-quality image transmission is a key factor for user experience. However, due to the limitation of network bandwidth and the constraint of device hardware resources, the transmitted image data needs to be appropriately compressed.

[0003] Although the image compression techniques in the prior art, such as JPEG, MJPEG, and HEVC, can effectively reduce the amount of image data, they use a fixed encoding strategy, that is, a uniform compression ratio is applied to the entire image for compression. This results in the details of the central region of the image being compressed, that is, the image information is lost in the compression process of the image, leading to a decrease in image quality and a low display effect. SUMMARY

[0004] The present application provides an image compression method and an electronic device for reducing the loss of image information in the compression process of the image and improving the image quality and display effect.

[0005] In a first aspect, an image compression method is provided, which comprises:

[0006] After receiving a to-be-compressed image, it is determined whether the to-be-compressed image is a first image based on the identification of the to-be-compressed image.

[0007] If it is determined that the to-be-compressed image is not the first image, a central region in the to-be-compressed image is obtained based on the to-be-compressed image and a previous frame image located in front of the to-be-compressed image, wherein the compression ratio of the central region is smaller than the compression ratio of other regions in the to-be-compressed image except the central region.

[0008] The size of the central region in the to-be-compressed image is adjusted using the resolution of the central region and the resolution of the pre-set compressed image, to obtain an updated central region in the to-be-compressed image.

[0009] The updated central region is compressed using a first compression ratio, and other regions in the to-be-compressed image except the updated central region are compressed using a second compression ratio, to obtain a compressed image, and the compressed image is output, wherein the first compression ratio is smaller than the second compression ratio.

[0010] In a second aspect, an electronic device is provided, which comprises a processor and a memory, and the processor and the memory are connected through a bus.

[0011] The memory stores a computer program, and the processor is configured to execute the following operations based on the computer program:

[0012] When the to-be-compressed image is received, it is determined whether the to-be-compressed image is a first image based on an identifier of the to-be-compressed image.

[0013] If it is determined that the to-be-compressed image is not the first image, a central region in the to-be-compressed image is obtained based on the to-be-compressed image and a previous frame image located before the to-be-compressed image, wherein a compression ratio of the central region is smaller than a compression ratio of other regions in the to-be-compressed image except the central region.

[0014] The size of the central region is adjusted using a resolution of the central region in the to-be-compressed image and a resolution of a compressed image set in advance, to obtain an updated central region in the to-be-compressed image.

[0015] The updated central region is compressed using a first compression ratio, and other regions in the to-be-compressed image except the updated central region are compressed using a second compression ratio, to obtain a compressed image, and the compressed image is output, wherein the first compression ratio is smaller than the second compression ratio.

[0016] According to a third aspect provided in an embodiment of the present application, a computer storage medium is provided, which stores a computer program for executing the method according to the first aspect.

[0017] In the above embodiments of the present application, it is determined whether the to-be-compressed image is a first image based on an identifier of the to-be-compressed image; if it is determined that the to-be-compressed image is not the first image, a central region in the to-be-compressed image is obtained based on the to-be-compressed image and a previous frame image located before the to-be-compressed image; the size of the central region is adjusted using a resolution of the central region in the to-be-compressed image and a resolution of a compressed image set in advance, to obtain an updated central region in the to-be-compressed image; the updated central region is compressed using a first compression ratio, and other regions in the to-be-compressed image except the updated central region are compressed using a second compression ratio, to obtain a compressed image, and the first compression ratio is smaller than the second compression ratio. Thus, in the embodiments of the present application, the central region in the image can be determined, and the compression ratio of the central region is set to be smaller than the compression ratio of other regions in the to-be-compressed image, so that the loss of image information in the compression process of the image is reduced, and the image quality and display effect are improved. BRIEF DESCRIPTION OF DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, the accompanying drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0019] Figure 1 An application scenario schematic diagram of the image compression method provided by the embodiments of the present application is exemplarily shown.

[0020] Figure 2 One of the flow schematic diagrams of the image compression method provided by the embodiments of the present application is exemplarily shown.

[0021] Figure 3 A flow schematic diagram of determining the center region provided by the embodiments of the present application is exemplarily shown.

[0022] Figure 4 A schematic diagram of the center region provided by the embodiments of the present application is exemplarily shown.

[0023] Figure 5 A schematic diagram of adjusting the intermediate non-compression provided by the embodiments of the present application is exemplarily shown.

[0024] Figure 6 A schematic diagram of adjusting the center region provided by the embodiments of the present application is exemplarily shown.

[0025] Figure 7 A schematic diagram of the image compression provided by the embodiments of the present application is exemplarily shown.

[0026] Figure 8 A schematic diagram of rasterizing the to-be-compressed image provided by the embodiments of the present application is exemplarily shown.

[0027] Figure 9 A schematic diagram of the pixel shader provided by the embodiments of the present application is exemplarily shown.

[0028] Figure 10 The second flow schematic diagram of the image compression method provided by the embodiments of the present application is exemplarily shown.

[0029] Figure 11 A schematic diagram of the image compression device provided by the embodiments of the present application is exemplarily shown.

[0030] Figure 12 A structural diagram of the electronic device provided by the embodiments of the present application is exemplarily shown. DETAILED DESCRIPTION

[0031] In order to make the purposes, the embodiments and the advantages of the present application more clear, the following will clearly and completely describe the exemplary embodiments of the present application in combination with the drawings of the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only a part of the embodiments of the present application, but not all the embodiments of the present application.

[0032] Based on the exemplary embodiments described in the present application, all the other embodiments obtained by those skilled in the art without making creative efforts are within the scope of the claims of the present application. In addition, although the disclosure in the present application is introduced according to one or several examples, it should be understood that each aspect of the disclosure can also constitute a complete embodiment independently.

[0033] It should be noted that the brief description of the terms in the present application is only for the convenience of understanding the following described embodiments, but is not intended to limit the embodiments of the present application. Unless otherwise specified, these terms should be understood according to their ordinary and general meanings.

[0034] The terms "first", "second", and the like in the specification of the present application and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover but not exclusive inclusion, for example, the product or equipment including a series of components does not necessarily limit to the clearly listed components, but can include other components not clearly listed or inherent to these products or equipment.

[0035] The term "module" used in the present application refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic or a combination of hardware or / and software code capable of performing functions related to the element.

[0036] The idea of the embodiments of the present application is summarized as follows.

[0037] The image compression technology in the prior art adopts a fixed coding strategy, that is, a uniform compression ratio is applied to the entire image to compress the image. The details of the center region of the image are compressed, that is, the image information is lost in the compression process of the image, resulting in a decline in the quality of the image and a low display effect.

[0038] Based on the existing technology, the image quality is reduced and the display effect is low due to the loss of image information in the compression process of the image. The present application provides an image compression method, which determines whether the to-be-compressed image is the first image based on the identification of the to-be-compressed image; if it is determined that the to-be-compressed image is not the first image, the center region in the to-be-compressed image is obtained based on the to-be-compressed image and the previous frame image located in the to-be-compressed image; the resolution of the center region in the to-be-compressed image and the resolution of the pre-set compressed image are used to adjust the center region to obtain the updated center region in the to-be-compressed image; the first compression ratio is used to compress the updated center region, and the second compression ratio is used to compress the other regions in the to-be-compressed image except the updated center region to obtain the compressed image, and the first compression ratio is smaller than the second compression ratio. Therefore, in the embodiment of the present application, the center region in the image can be determined, and the compression ratio of the center region is set to be smaller than that of the other regions in the to-be-compressed image, so that the loss of image information in the compression process of the image is reduced, and the image quality and display effect are improved.

[0039] As shown in Figure 1 , an application scenario of an image compression method, which includes a server 110, a camera 120 and a terminal device 130.

[0040] In a possible application scenario, the camera 120 obtains a to-be-compressed image and sends the to-be-compressed image to the server 110. The server 110 receives the to-be-compressed image and determines whether the to-be-compressed image is the first image based on the identification of the to-be-compressed image. If the server 110 determines that the to-be-compressed image is not the first image, the center region in the to-be-compressed image is obtained based on the to-be-compressed image and the previous frame image located in the to-be-compressed image, wherein the compression ratio of the center region is smaller than that of the other regions in the to-be-compressed image except the center region. Then the server 110 adjusts the size of the center region in the to-be-compressed image by using the resolution of the center region in the to-be-compressed image and the resolution of the pre-set compressed image to obtain the updated center region in the to-be-compressed image. The first compression ratio is used to compress the updated center region, and the second compression ratio is used to compress the other regions in the to-be-compressed image except the updated center region to obtain the compressed image, and the compressed image is sent to the terminal device 130 for display.

[0041] Among them, Figure 1 The server 110 in the server 110, the camera 120 and the terminal device 130 can interact with each other through the communication network, and the communication network can adopt wireless communication mode or wired communication mode.

[0042] For example, the server 110 can access the network through cellular mobile communication technology, such as the 5th Generation Mobile Networks (5G) technology, to communicate with the camera 120 and the terminal device 130, respectively.

[0043] Optionally, the server 110 can access the network through short-range wireless communication technology, such as the Wireless Fidelity (Wi-Fi) technology, to communicate with the camera 120 and the terminal device 130, respectively.

[0044] It should be understood by those skilled in the art that the camera 120, the server 110, and the terminal device 130 shown are intended to represent the operation of the camera 120, the server 110, and the terminal device 130 involved in the technical solution of the present application. Rather than implying a limitation on the number, type, or location of the camera 120, the server 110, and the terminal device 130. It should be noted that if additional modules are added to the illustrated environment or individual modules are removed therefrom, the underlying concept of the example embodiments of the present application will not change.

[0045] It should be noted that the image compression method proposed in the present application is not only applicable to the application scenarios shown, but also applicable to any image compression device. Figure 1 The application scenarios described above are only shown to facilitate understanding of the method and principle of the present application, and the embodiments of the present application are not limited in this respect.

[0046] The image compression method in the example embodiments of the present application will be described below with reference to the above-described application scenarios and the accompanying drawings. It should be noted that the above-described application scenarios are only shown to facilitate understanding of the method and principle of the present application, and the embodiments of the present application are not limited in this respect.

[0047] The image compression method in the example embodiments of the present application will be described below with reference to the above-described application scenarios and the accompanying drawings. It should be noted that the above-described application scenarios are only shown to facilitate understanding of the method and principle of the present application, and the embodiments of the present application are not limited in this respect. Figure 2 As shown in FIG. 1, the image compression method can include the following steps:

[0048] Step 201: When the to-be-compressed image is received, it is determined whether the to-be-compressed image is the first image based on the identification of the to-be-compressed image. If not, step 202 is performed, and if yes, step 203 is performed.

[0049] In one embodiment, step 201 can be implemented as follows: if the identifier of the image to be compressed is a first specified identifier, it is determined that the image to be compressed is the first image; if it is determined that the identifier of the image to be compressed is a second specified identifier, it is determined that the image to be compressed is not the first image.

[0050] The first specified identifier and the second specified identifier in the embodiments of the present application are 1 and 0 respectively, but the first specified identifier and the second specified identifier in the embodiments of the present application are not limited thereto, and the first specified identifier and the second specified identifier in the embodiments of the present application can be limited according to actual conditions.

[0051] Step 202: obtaining a central region in the image to be compressed based on the image to be compressed and a previous frame image located in front of the image to be compressed, wherein a compression ratio of the central region is smaller than a compression ratio of other regions in the image to be compressed except the central region.

[0052] Next, a flowchart of a method for determining the central region of the image to be compressed in step 202 is shown in FIG. 2. Figure 3 As shown in FIG. 2, the flowchart for determining the central region can include the following steps:

[0053] Step 301: obtaining a difference image based on the image to be compressed and the previous frame image located in front of the image to be compressed.

[0054] In one embodiment, step 301 can be implemented as follows: converting the image to be compressed and the previous frame image located in front of the image to be compressed into a gray-scale image, and subtracting a gray-scale value of each pixel point in the image to be compressed from a gray-scale value of each pixel point in the previous frame image located in front of the image to be compressed to obtain the difference image.

[0055] Step 302: performing a binaryzation process on the difference image to obtain a binary image.

[0056] In one embodiment, step 302 can be implemented as follows: setting a pixel value of each pixel point in the difference image with a pixel value less than a specified threshold value to 0, and setting a pixel value of each pixel point in the difference image with a pixel value greater than the specified threshold value to 255 to obtain the binary image.

[0057] It should be noted that the specified threshold value in the embodiments of the present application can be set according to actual conditions, but the specific value of the specified threshold value in the embodiments of the present application is not limited thereto.

[0058] Step 303: obtaining the central region based on a white region in the binary image.

[0059] In one embodiment, step 303 can be implemented as follows: obtaining the center region according to the maximum horizontal position coordinate, the minimum horizontal position coordinate, the maximum vertical position coordinate and the minimum vertical position coordinate of each pixel in the white region.

[0060] The coordinates of the center region in the embodiments of the present application are (maximum horizontal position coordinate, maximum vertical position coordinate), (maximum horizontal position coordinate, minimum vertical position coordinate), (minimum horizontal position coordinate, maximum vertical position coordinate) and (minimum horizontal position coordinate, minimum vertical position coordinate) respectively.

[0061] As shown in FIG. 4, it is a schematic diagram of the center region in the embodiments of the present application. As can be seen from FIG. 4, the center region in the embodiments of the present application is the smallest region containing all the white pixels, i.e., the region surrounded by the gray lines is the center region. Figure 4 Figure 4

[0062] In one embodiment, the method for determining the center region of the image to be compressed further comprises the following steps: obtaining each image located before the image to be compressed by a specified number of frames; grouping the target images in order to obtain a plurality of image sets, wherein any one image set comprises two images, and the target images comprise the image to be compressed and each image located before the image to be compressed by a specified number of frames; converting each image in any one image set into a gray-scale image; subtracting the gray-scale value of each pixel in the previous frame image in the image set from the gray-scale value of each pixel in the latter frame image in the image set to obtain a difference image corresponding to the any one image set; obtaining a target difference image according to the gray-scale value of each pixel in each difference image corresponding to each image set; performing binaryzation processing on the target difference image to obtain a binary image; and obtaining the center region based on the white region in the binary image.

[0063] For example, the target images comprise image 1, image 2, image 3, image 4, image 5 and image 6. Then the corresponding image sets are (image 1, image 2), (image 3, image 4) and (image 5, image 6) respectively.

[0064] In one embodiment, the target difference image is obtained by the following method:

[0065] For any one group of pixels with the same position in each difference image, the gray-scale value of the pixel at the position in the target difference image is obtained based on the average value of the gray-scale values of the pixels; and the target difference image is obtained according to the gray-scale value of the pixel at the position in the target difference image.

[0066] ​​It should be noted that the manner of binarizing the target difference image to obtain a binary image in the embodiments of the present application is the same as the manner of binarizing the difference image described above, and the manner of determining the central region is the same as described above, and the embodiments of the present application will not be described again. The specified frame number in the embodiments of the present application can be set according to actual conditions, and the embodiments of the present application do not limit the specified frame number.

[0067] Step 203: determining a specified region in the to-be-compressed image as the central region;

[0068] In the embodiments of the present application, the entire to-be-compressed image is determined as the central region.

[0069] However, the specified region in the embodiments of the present application is not limited, and the specified region in the embodiments of the present application can be set according to actual conditions.

[0070] Step 204: adjusting the size of the central region in the to-be-compressed image by using the resolution of the central region in the to-be-compressed image and the resolution of the compressed image set in advance, to obtain an updated central region in the to-be-compressed image;

[0071] Next, the manner of adjusting the size of the central region in the embodiments of the present application will be described in detail, as shown in FIG. 5, which is a flowchart of adjusting the central region, and can include the following steps: Figure 5

[0072] Step 501: determining a first region threshold and a second region threshold according to the resolution of the compressed image;

[0073] In one embodiment, step 501 can be specifically implemented as: multiplying an image length in the resolution of the compressed image by a first specified value to obtain the first region threshold; and multiplying an image width in the resolution of the compressed image by a second specified value to obtain the second region threshold.

[0074] It should be noted that the first specified value and the second specified value in the embodiments of the present application can be the same or different. The specific values can be set according to actual conditions, and the first specified value and the second specified value in the embodiments of the present application can be 1. However, the first specified value and the second specified value in the embodiments of the present application are not limited.

[0075] Step 502: determining whether the central region meets a specified condition by using the resolution of the central region in the to-be-compressed image, the first region threshold and the second region threshold, if yes, performing step 503, and if no, performing step 504; ​

[0076] In one embodiment, step 502 can be implemented as: if the image length in the resolution of the center region is greater than the first region threshold, or the image width in the resolution of the center region is greater than the second region threshold, determining that the center region satisfies the specified condition; or, if the image length in the resolution of the center region is not greater than the first region threshold, and the image width in the resolution of the center region is not greater than the second region threshold, determining that the center region does not satisfy the specified condition.

[0077] Step 503: obtaining the updated center region based on the resolution of the compressed image, the first region threshold and the second region threshold.

[0078] The updated center region in the embodiments of the present application includes length and width, wherein the length of the updated center region can be determined in the following two ways:

[0079] Way one: if the image length of the resolution of the compressed image is less than the first region threshold, determining the image length as the length of the updated center region.

[0080] Way two: if the image length of the resolution of the compressed image is not less than the first region threshold, determining the first region threshold as the length of the updated center region.

[0081] The width of the updated center region can be determined in the following two ways:

[0082] Way one: if the image width of the resolution of the compressed image is less than the second region threshold, determining the image width as the width of the updated center region.

[0083] Way two: if the image width of the resolution of the compressed image is not less than the second region threshold, determining the second region threshold as the width of the updated center region.

[0084] Step 504: obtaining the updated center region based on the resolution of the compressed image.

[0085] In one embodiment, step 504 can be implemented as: determining the image length in the resolution of the compressed image as the length of the updated center region; and determining the image width in the resolution of the compressed image as the width of the updated center region.

[0086] This application also provides another method for adjusting the size of the central region. In one embodiment, the image length in the resolution of the compressed image is multiplied by a third specified value to obtain the third region threshold; and the image width in the resolution of the compressed image is multiplied by a fourth specified value to obtain the fourth region threshold; wherein the third specified value is less than the first specified value, and the fourth specified value is less than the second specified value; if the image length in the resolution of the central region is greater than the third region threshold, or the image width in the resolution of the central region is greater than the fourth region threshold, then the third region threshold is determined as the image length of the updated central region, and the fourth region threshold is determined as the image width of the updated central region; if the image length in the resolution of the central region is less than the third region threshold, and the image width in the resolution of the central region is less than the fourth region threshold, then the central region is determined as the updated central region.

[0087] It should be noted that the third and fourth specified values ​​in the embodiments of this application can be set according to the specific actual situation, and the specific values ​​of the third and fourth specified values ​​are not limited in this embodiment.

[0088] like Figure 6 The diagram shown illustrates the adjustment of the central area. Figure 6 As can be seen, region a is the central region. After adjusting region a, region b is obtained, which is the updated central region.

[0089] Step 205: Compress the updated central region using a first compression ratio, and compress other regions in the image to be compressed except for the updated central region using a second compression ratio to obtain a compressed image, and output the compressed image, wherein the first compression ratio is smaller than the second compression ratio.

[0090] In one embodiment, the first compression ratio and the second compression ratio are obtained in the following manner:

[0091] Using a pre-defined correspondence between the resolution of the central region and the compression ratios of each image, the image compression ratio corresponding to the updated central region in the image to be compressed is determined. This image compression ratio includes both the first compression ratio and the second compression ratio. Table 1 shows the correspondence between the parameters of each image region and the compression ratios of each image.

[0092]

[0093] Table 1

[0094] For example, if the resolution of the updated central region in the image to be compressed is b, the corresponding first compression ratio M and the second compression ratio N are determined.

[0095] If the first compression ratio is 0, it means that the updated central region is not compressed, thereby minimizing the image loss.

[0096] The compression method in the embodiments of the present application can realize the compression of the image by means of D3d11 or opengl tools. The present application does not limit the image compression method in this embodiment, and the specific method can be set according to the actual situation. The compression method is briefly introduced below by taking D3d11 as an example. As shown in Figure 7 It can be seen from Figure 7 that the image compression includes an input assembly stage, a vertex shader stage, a rasterization stage, a pixel shader stage and an output merging stage. Among them:

[0097] Input assembly stage: set the rendering view of D3d11 to 1280*1280, and set the vertex position coordinates (normalized coordinate system) and the corresponding texture coordinates of the compressed image according to the image resolution to be scaled, the image resolution after scaling and the size of the central dynamic region, and set the primitive topology type to triangle.

[0098] Vertex shader stage: since the input is the vertex coordinates of the compressed image, which is in the normalized coordinate system, no additional operation is needed in the vertex shader, and only the input vertex position and texture coordinates are transmitted to the next stage.

[0099] Rasterization stage: after the viewport transformation in the rasterization stage, the geometric figure is converted into a two-dimensional pixel for display on the screen.

[0100] As shown in Figure 8 , it is a schematic diagram of the rasterization of the image to be compressed in the embodiments of the present application. The geometric figure in the diagram is converted into a two-dimensional pixel.

[0101] Pixel shader stage: for each triangle in the two-dimensional pixel image after the rasterization stage, there is a corresponding triangle in the texture image. In the pixel shader, each pixel in the two-dimensional pixel image is assigned a value according to the texture image. If the size of the triangle is the same, the pixel can be directly assigned a value. If the size of the triangle is different, the corresponding pixels in the texture triangle need to be sampled and then assigned a value.

[0102] As shown in Figure 9As shown, triangle x in the image to be compressed corresponds one-to-one with triangle x′ in the scaled image, where triangles 1-18 correspond to triangles 1'-18' respectively. From Figure 8 It can be seen from this that Figure 8 Triangles 9 and 9', and triangles 10 and 10' in the data were not scaled (i.e., the updated center area is shown). Figure 9 (The example shown is based on not compressing the updated central region; the other triangles are scaled according to their respective proportions.)

[0103] To further understand the methods in this application, such as Figure 10 The diagram shown is a flowchart of the image compression method in this application, which may include the following steps:

[0104] Step 1001: Upon receiving the image to be compressed, determine whether the image to be compressed is the first image based on its identifier. If yes, proceed to step 1002; otherwise, proceed to step 1003.

[0105] Step 1002: Determine a specified region in the image to be compressed as the central region, wherein the compression ratio of the central region is less than the compression ratio of other regions in the image to be compressed besides the central region;

[0106] Step 1003: Obtain a difference image based on the image to be compressed and the previous frame image;

[0107] Step 1004: Perform binarization processing on the difference image to obtain a binary image;

[0108] Step 1005: Obtain the central region based on the white region in the binary image;

[0109] Step 1006: Determine the first region threshold and the second region threshold based on the resolution of the compressed image;

[0110] Step 1007: Using the resolution of the central region in the image to be compressed, the first region threshold, and the second region threshold, determine whether the central region meets the specified conditions. If yes, proceed to step 1008; otherwise, proceed to step 1009.

[0111] Step 1008: Based on the resolution of the compressed image, the first region threshold, and the second region threshold, obtain the updated center region;

[0112] Step 1009: Based on the resolution of the compressed image, obtain the updated center region;

[0113] Step 1010: compressing the updated center region by using a first compression ratio, and compressing other regions in the image to be compressed except the updated center region by using a second compression ratio, to obtain a compressed image, and outputting the compressed image.

[0114] Based on the same inventive concept, the image compression method as described above can also be implemented by an image compression device. The image compression device has similar effects to the aforementioned method, and will not be described here again.

[0115] Figure 11 A structural schematic diagram of an image compression device according to an embodiment of the present disclosure.

[0116] As shown in Figure 11 , the image compression device 1100 of the present disclosure can include a judging module 1110, a first center region determining module 1120, a second center region determining module 1130, and an image compression module 1140.

[0117] The judging module 1110 is configured to determine whether the image to be compressed is the first image based on an identifier of the image to be compressed when the image to be compressed is received.

[0118] The first center region determining module 1120 is configured to, if it is determined that the image to be compressed is not the first image, obtain a center region in the image to be compressed based on the image to be compressed and a previous frame image located before the image to be compressed, wherein a compression ratio of the center region is smaller than a compression ratio of other regions in the image to be compressed except the center region; or

[0119] The second center region determining module 1130 is configured to adjust a size of the center region in the image to be compressed by using a resolution of the center region in the image to be compressed and a resolution of a pre-set compressed image, to obtain an updated center region in the image to be compressed.

[0120] The image compression module 1140 is configured to compress the updated center region by using a first compression ratio, and compress other regions in the image to be compressed except the updated center region by using a second compression ratio, to obtain a compressed image, and output the compressed image, wherein the first compression ratio is smaller than the second compression ratio.

[0121] In one embodiment, the first center region determining module 1120 is specifically configured to:

[0122] obtain a difference image based on the image to be compressed and the previous frame image located before the image to be compressed;

[0123] binarize the difference image to obtain a binary image;

[0124] obtain the center region based on a white region in the binary image.

[0125] In one embodiment, the second center region determining module 1130 is specifically configured to:

[0126] determine a first region threshold and a second region threshold according to a resolution of the compressed image;

[0127] determine whether the center region satisfies a specified condition by using the resolution of the center region in the image to be compressed, the first region threshold and the second region threshold;

[0128] if yes, obtain the updated center region based on the resolution of the compressed image, the first region threshold and the second region threshold; or

[0129] if no, obtain the updated center region based on the resolution of the compressed image.

[0130] In one embodiment, the second center region determining module 1130 performs the determination of the first region threshold and the second region threshold according to the resolution of the compressed image, and is specifically configured to:

[0131] multiply an image length in the resolution of the compressed image by a first specified value to obtain the first region threshold, and multiply an image width in the resolution of the compressed image by a second specified value to obtain the second region threshold;

[0132] The second center region determining module 1130 performs the determination of whether the center region satisfies the specified condition by using the resolution of the center region in the image to be compressed, the first region threshold and the second region threshold, and is specifically configured to:

[0133] if an image length in the resolution of the center region is greater than the first region threshold or an image width in the resolution of the center region is greater than the second region threshold, it is determined that the center region satisfies the specified condition; or

[0134] if the image length in the resolution of the center region is not greater than the first region threshold and the image width in the resolution of the center region is not greater than the second region threshold, it is determined that the center region does not satisfy the specified condition.

[0135] In an embodiment, the second center region determining module 1130 determines the updated center region based on the resolution of the compressed image, the first region threshold and the second region threshold, specifically for:

[0136] if the image length of the resolution of the compressed image is less than the first region threshold, determining the image length as the length of the updated center region; or,

[0137] if the image length of the resolution of the compressed image is not less than the first region threshold, determining the first region threshold as the length of the updated center region; or,

[0138] if the image width of the resolution of the compressed image is less than the second region threshold, determining the image width as the width of the updated center region; or,

[0139] if the image width of the resolution of the compressed image is not less than the second region threshold, determining the second region threshold as the width of the updated center region.

[0140] determining the updated center region according to the length of the updated center region and the width of the updated center region.

[0141] In an embodiment, the second center region determining module 1130 determines the updated center region based on the resolution of the compressed image, specifically for:

[0142] determining the image length in the resolution of the compressed image as the length of the updated center region; and,

[0143] determining the image width in the resolution of the compressed image as the width of the updated center region.

[0144] determining the updated center region according to the length of the updated center region and the width of the updated center region.

[0145] In an embodiment, the first center region determining module 1120 is further configured to:

[0146] if it is determined that the image to be compressed is the first image, determining a specified region in the image to be compressed as the center region.

[0147] In an embodiment, the apparatus further comprises:

[0148] a compression ratio determining module 1150 configured to determine the first compression ratio and the second compression ratio by:

[0149] Determine the image compression ratio corresponding to the resolution of the updated central region in the image to be compressed, using the preset correspondence between the resolution of the central region and the image compression ratio, wherein the image compression ratio includes the first compression ratio and the second compression ratio.

[0150] After introducing the image compression method and device according to an exemplary embodiment of the present application, next, an electronic device according to another exemplary embodiment of the present application is introduced.

[0151] Those skilled in the art can understand that each aspect of the present application can be implemented as a system, a method or a program product. Therefore, each aspect of the present application can be specifically implemented as a complete hardware embodiment, a complete software embodiment (including firmware, microcode, etc.), or an embodiment combining hardware and software, which can be collectively referred to as "circuitry", "module" or "system".

[0152] In some possible embodiments, the electronic device according to the present application can include at least one processor and at least one computer storage medium. The computer storage medium stores program codes which, when executed by the processor, cause the processor to perform the steps of the image compression method according to various exemplary embodiments of the present application described above in the specification. For example, the processor can perform steps 201-205 as shown in Figure 2

[0153] The electronic device 1200 according to this embodiment of the present application will be described below with reference to Figure 12 Figure 12 The electronic device 1200 shown is merely an example and should not impose any limitation on the function and use range of the embodiments of the present application.

[0154] As shown in Figure 12 The components of the electronic device 1200 can include, but are not limited to, the above-mentioned at least one processor 1201, the above-mentioned at least one computer storage medium 1202, and a bus 1203 connecting different system components including the computer storage medium 1202 and the processor 1201.

[0155] The bus 1203 represents one or more of several types of bus structures, including a computer storage medium bus or a computer storage medium controller, a peripheral bus, a processor bus, or a local bus using any of the bus structures.

[0156] ​​The computer storage media 1202 can include readable media in the form of volatile computer storage media (e.g., random access computer storage media (RAM) 1221 and / or cache memory 1222), and non-volatile computer storage media (e.g., read only memory (ROM) 1223).

[0157] The computer storage media 1202 can also include program / utility 1225 having one or more programs / modules 1224, e.g., for operating systems and / or for application programs. Each of the operating systems and application programs (or some combination thereof) can include elements of the programming and utility 1225. Each of the programs maybe embodied on different computer storage media, such as the computer storage media 1202, the removable computer storage media 1203, and / or the computer storage media 1204.

[0158] The electronic device 1200 can also communicate with one or more external devices 1204 such as a keyboard or pointing device, using the I / O interface 1205. Additionally, the electronic device 1200 can communicate with one or more devices using the network adapter 1206. In this regard, the network adapter 1206 can enable the electronic device 1200 to communicate with other electronic devices using any one or more of a number of wired protocols or wireless protocols, e.g., Bluetooth®, 802.11, 802.16, 802.20, 802.15, 3G, 4G, CDMA, GPRS, TDMA, and the like. The network adapter 1206 can also allow the electronic device 1200 to communicate over one or more networks to exchange information with other electronic devices. The one or more networks can include a local area network (LAN), a wide area network (WAN), and / or the Internet, for example. The network adapter 1206 can be implemented as a wireless adapter, a wired adapter, or a combination of wireless and wired adapters.

[0159] In some possible embodiments, various aspects of the image compression method provided by the present application can also be implemented as a program product, including a program code, for causing a computer device to perform the steps of the image compression method according to various exemplary embodiments of the present application described above in the specification, when the program product is run on the computer device.

[0160] Obviously, various modifications and changes can be made to the present application by those skilled in the art without departing from the spirit and scope of the present application. Thus, it is intended that the present application encompass such modifications and changes as fall within the scope of the appended claims and their equivalents.

Claims

1. An image compression method characterized by, The method comprises: When receiving a to-be-compressed image, determining whether the to-be-compressed image is a first image based on an identifier of the to-be-compressed image; If it is determined that the to-be-compressed image is not the first image, obtaining a central region in the to-be-compressed image based on the to-be-compressed image and a previous frame image located in front of the to-be-compressed image, wherein a compression ratio of the central region is smaller than a compression ratio of other regions in the to-be-compressed image except the central region; Determining a first region threshold and a second region threshold according to a resolution of a compressed image preset in advance; Determining whether the central region meets a specified condition by using the resolution of the central region in the to-be-compressed image, the first region threshold and the second region threshold; If yes, obtaining an updated central region in the to-be-compressed image based on the resolution of the compressed image, the first region threshold and the second region threshold; or If no, obtaining the updated central region in the to-be-compressed image based on the resolution of the compressed image; Compressing the updated central region by using a first compression ratio and compressing other regions in the to-be-compressed image except the updated central region by using a second compression ratio to obtain a compressed image, and outputting the compressed image, wherein the first compression ratio is smaller than the second compression ratio.

2. The method of claim 1, wherein, The obtaining of the central region in the to-be-compressed image based on the to-be-compressed image and the previous frame image located in front of the to-be-compressed image comprises: Obtaining a difference image according to the to-be-compressed image and the previous frame image located in front of the to-be-compressed image; Performing a binaryzation process on the difference image to obtain a binary image; Obtaining the central region based on a white region in the binary image.

3. The method of claim 1, wherein, The determination of the first region threshold and the second region threshold according to the resolution of the compressed image preset in advance comprises: Multiplying an image length in the resolution of the compressed image by a first specified value to obtain the first region threshold, and multiplying an image width in the resolution of the compressed image by a second specified value to obtain the second region threshold; The determination of whether the central region meets the specified condition by using the resolution of the central region in the to-be-compressed image, the first region threshold and the second region threshold comprises: If an image length in the resolution of the central region is greater than the first region threshold or an image width in the resolution of the central region is greater than the second region threshold, it is determined that the central region meets the specified condition; or If the image length in the resolution of the central region is not greater than the first region threshold and the image width in the resolution of the central region is not greater than the second region threshold, it is determined that the central region does not meet the specified condition.

4. The method of claim 1, wherein, The obtaining of the updated central region based on the resolution of the compressed image, the first region threshold and the second region threshold comprises: if the image length of the resolution of the compressed image is less than the first region threshold, determining the image length as the length of the updated central region; or, if the image length of the resolution of the compressed image is not less than the first region threshold, determining the first region threshold as the length of the updated central region; or, if the image width of the resolution of the compressed image is less than the second region threshold, determining the image width as the width of the updated central region; or, if the image width of the resolution of the compressed image is not less than the second region threshold, determining the second region threshold as the width of the updated central region; obtaining the updated central region according to the length of the updated central region and the width of the updated central region.

5. The method of claim 1, wherein, The obtaining the updated central region based on the resolution of the compressed image comprises: determining the image length in the resolution of the compressed image as the length of the updated central region; and determining the image width in the resolution of the compressed image as the width of the updated central region. obtaining the updated central region according to the length of the updated central region and the width of the updated central region.

6. The method of claim 1, wherein, The method further comprises: if it is determined that the image to be compressed is the first image, determining a specified region in the image to be compressed as the central region.

7. The method of claim 1, wherein, The first compression ratio and the second compression ratio are obtained in the following manner: determining, by using a pre-set correspondence between resolutions of central regions and image compression ratios, an image compression ratio corresponding to the resolution of the updated central region in the image to be compressed, wherein the image compression ratio comprises the first compression ratio and the second compression ratio.

8. An electronic device, comprising: The device comprises a processor and a memory, and the processor and the memory are connected through a bus; The memory stores a computer program, and the processor is configured to execute the following operations based on the computer program: when receiving an image to be compressed, determining whether the image to be compressed is a first image based on an identifier of the image to be compressed; if it is determined that the image to be compressed is not a first image, obtaining a central region in the image to be compressed based on the image to be compressed and a previous image of the image to be compressed, wherein a compression ratio of the central region is less than a compression ratio of other regions in the image to be compressed except the central region; determining a first region threshold and a second region threshold according to a pre-set resolution of a compressed image; determining whether the central region meets a specified condition by using the resolution of the central region in the image to be compressed, the first region threshold and the second region threshold; if yes, obtaining an updated central region in the image to be compressed based on the resolution of the compressed image, the first region threshold and the second region threshold; or if no, obtaining the updated central region in the image to be compressed based on the resolution of the compressed image. Compress the updated central region by using a first compression ratio, and compress other regions in the image to be compressed except the updated central region by using a second compression ratio to obtain a compressed image, and output the compressed image, wherein the first compression ratio is less than the second compression ratio.

9. The electronic device of claim 8, wherein, The processor performs the resolution of the compressed image to obtain the updated central region, and is specifically configured to: determine the image length in the resolution of the compressed image as the length of the updated central region; and determine the image width in the resolution of the compressed image as the width of the updated central region. obtain the updated central region according to the length of the updated central region and the width of the updated central region. determine the image length in the resolution of the compressed image as the length of the updated central region; and determine the image width in the resolution of the compressed image as the width of the updated central region. obtain the updated central region according to the length of the updated central region and the width of the updated central region.

Citation Information

Patent Citations

  • Image compression method and device, storage medium and electronic equipment

    CN112839223A

  • Compressing and decompressing an image based on gaze point

    WO2018092147A1