Cloud desktop image processing method, image processing method, device and storage medium

By chunking the cloud desktop images and classifying them according to the pixel color values, using lossless and lossy compression methods to process different areas, the problems of cloud desktop image display quality and transmission bandwidth balance are solved, and more efficient image processing effects are achieved.

CN115908165BActive Publication Date: 2025-08-29ALIBABA (CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211363136.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-02
Publication Date
2025-08-29
Estimated Expiration
2042-11-02

AI Technical Summary

Technical Problem

The prior art is difficult to balance the display quality and transmission network bandwidth in cloud desktop image processing, especially in mixed images, the same encoding method cannot take into account the image quality and transmission efficiency of the image.

Method used

The image to be processed is divided into multiple image blocks, and the content is classified according to the pixel color value of the image block. Lossless compression is adopted for the target type (text and/or graphics) image blocks, and lossless compression is performed on non-target type image blocks according to the smoothness adaptation quality parameters to ensure that the compression rate of different areas is consistent with the content.

Benefits of technology

By distinguishing the content type and smoothness of the image block, the screen display quality and compressed data volume in different areas are achieved, and the display quality and network transmission efficiency of cloud desktop images are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115908165B_ABST
    Figure CN115908165B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a method for processing a cloud desktop image and an image processing method, device, and storage medium. In the present application, the cloud desktop image is divided into a plurality of image blocks, and the image blocks are classified by content according to the color value of the pixels of the image blocks; the target type of image blocks are losslessly compressed to ensure the display quality of the target type of image blocks; based on the smoothness of the non-target type of image blocks, the non-target type of image blocks are losslessly compressed using a quality parameter adapted for the smoothness, which can reduce the size of the compressed data while ensuring the display quality of the image blocks. Therefore, the present application uses different image compression methods to process image blocks with different content types, so that the compression rate of different areas is adapted to the content of the area, and can take into account the picture display quality and the size of the compressed data of different areas of the image, and thus take into account the picture display quality and network transmission bandwidth of the cloud desktop.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a cloud desktop image processing method, an image processing method, a device, and a storage medium. Background Art

[0002] A virtual desktop, also known as a cloud desktop, typically involves installing a cloud desktop transmission protocol client (referred to as a cloud desktop client) on a thin client. The client and the cloud desktop server exchange desktop data using the Remote Desktop Protocol. The cloud desktop server compresses the cloud desktop image and transmits it to the cloud desktop client, which decompresses it and presents it to the user through the local display system.

[0003] Different encoding methods determine the display quality of desktop images and the network bandwidth required for transmission. High compression rates for desktop images affect display quality, while low compression rates reduce network bandwidth. Therefore, balancing desktop image display quality and network bandwidth is a technical issue requiring continued research and improvement in this field. Summary of the Invention

[0004] Multiple aspects of the present application provide a cloud desktop image processing method and an image processing method, device, and storage medium to achieve a balance between image display quality and transmission network bandwidth.

[0005] The present invention provides a method for processing a cloud desktop image, including:

[0006] Divide the cloud desktop image to be updated into multiple image blocks;

[0007] performing content classification on each of the plurality of image blocks according to color values ​​of pixels of the plurality of image blocks to determine content types of the plurality of image blocks;

[0008] For a first image block whose content type is a non-target type, determining a smoothness of the first image block according to color values ​​of pixels of the first image block;

[0009] performing lossy compression on the first image block using a quality parameter adapted for the smoothness according to the smoothness of the first image block, so as to obtain a compressed first image block, wherein the smoothness is inversely correlated with the quality parameter;

[0010] performing lossless compression on a second image block having a content type of a target type to obtain a compressed second image block; the target type includes: a text type and / or a graphic type;

[0011] The compressed first image block, the compressed second image block, the position of the first image block in the cloud desktop image, and the position of the second image block in the cloud desktop image are sent to the cloud desktop client for the cloud desktop client to render the cloud desktop image.

[0012] The present invention provides an image processing method, including:

[0013] Divide the image to be processed into multiple image blocks;

[0014] performing content classification on each of the plurality of image blocks according to color values ​​of pixels of the plurality of image blocks to determine content types of the plurality of image blocks;

[0015] For a first image block whose content type is a non-target type, determining a smoothness of the first image block according to color values ​​of pixels of the first image block;

[0016] performing lossy compression on the first image block using a quality parameter adapted to the smoothness according to the smoothness of the first image block, wherein the smoothness is inversely correlated with the quality parameter;

[0017] Lossless compression is performed on the second image block whose content type is a target type; the target type includes: a text type and / or a graphic type.

[0018] An embodiment of the present application further provides a computing device, comprising: a memory and a processor; wherein the memory is used to store a computer program;

[0019] The processor is coupled to the memory and is configured to execute the computer program to perform the steps in the above image processing method.

[0020] An embodiment of the present application further provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the above-mentioned image processing method.

[0021] In an embodiment of the present application, the cloud desktop image to be updated can be used as an image to be processed, and divided into multiple image blocks, and the image blocks can be classified by content according to the color value of the pixels of the image blocks; for image blocks of target type (text type and / or graphic type), lossless compression is used for compression, which can retain the sharper edges of the text / graphic area and ensure the display quality of the target type image blocks; for image blocks of non-target type, lossy compression is performed based on the smoothness of the non-target type image blocks using a quality parameter adapted for smoothness, which can reduce the size of the compressed data while ensuring the display quality of the image blocks. Therefore, this embodiment uses different image compression methods to process image blocks of different content types, so that the compression rate of different areas can be adapted to the content of the area, and the image display quality and compressed data size of different areas of the image can be taken into account, thereby taking into account the image display quality and network transmission bandwidth of the cloud desktop. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0023] Figure 1 Schematic diagram of the flow of traditional image compression method;

[0024] Figure 2 A schematic diagram of target pixels and comparison pixels of a captured pixel block;

[0025] Figure 3 is a flow chart of another traditional image compression method;

[0026] Figure 4 A schematic diagram of the structure of the cloud desktop system provided in an embodiment of the present application;

[0027] Figure 5 A schematic diagram of image segmentation provided in an embodiment of the present application;

[0028] Figure 6 A flowchart of an image processing method provided in an embodiment of the present application;

[0029] Figure 7a A detailed flowchart of the image processing method provided in an embodiment of the present application;

[0030] Figure 7b A flowchart of a method for processing a cloud desktop image provided in an embodiment of the present application;

[0031] Figure 8 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0032] To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0033] The Simple Protocol for Independent Computing Environment (SPICE) is a cloud desktop transmission protocol. The SPICE protocol calculates the smoothness of desktop images and classifies them into different categories based on their smoothness, distinguishing between high, medium, and low smoothness. Image smoothness reflects the smoothness of the image content: higher smoothness indicates more natural pixel transitions and less distinct boundaries. Conversely, lower smoothness indicates less natural pixel transitions and more distinct boundaries.

[0034] In the SPICE protocol, images with medium and low smoothness levels are compressed using QUIC coding, and images with high smoothness levels are compressed using the Lempel-Ziv (LZ) algorithm or global LZ (GLZ) coding.

[0035] QUIC encoding is a predictive coding algorithm and a proprietary SPICE lossless image compression technology based on the Sfalic algorithm. The LZ algorithm works by replacing a string with a single token. Whenever the LZ algorithm recognizes a new string, it outputs it and adds it to a table or dictionary. The GLZ algorithm exploits recurring patterns in images, fully utilizing image reconstruction and shrinking the image to reduce physical bandwidth during transmission.

[0036] The following is an example of the smoothness calculation process of the image provided by the SPICE protocol. Figure 1 As shown in Figure 1, the smoothness calculation process of the image provided by the SPICE protocol mainly includes the following steps:

[0037] S1. In an image to be processed, a plurality of pixel blocks are collected, each pixel block including a target pixel and three comparison pixels adjacent to the target pixel.

[0038] The three comparison pixels adjacent to the target pixel may be pixels located on the right, bottom, and lower right side of the target pixel. Figure 2 As shown, each rectangle represents a pixel, and the resolution of the image to be processed is 30*6. Figure 2 For the image to be processed shown in FIG, target pixels can be collected every 15 pixels (e.g. Figure 2 The black block in the figure is shown), and the three contrast pixels adjacent to the target pixel are sampled, as shown in Figure 2 As shown in the gray rectangle in . The last row of pixels in the image to be processed is not sampled, mainly because there are no contrasting pixels on the bottom and lower right sides of the pixels in the last row.

[0039] S2. For any pixel block A, the color value of the target pixel in the pixel block A in each color channel may be compared with the color value of each comparison pixel in the corresponding color channel to obtain a comparison result of the pixel block A.

[0040] The color channels of a pixel may be red, yellow, and blue (R / G / B) channels, and the color values ​​of the pixel in the color channels may be the values ​​of the pixel in the R / G / B channels, respectively. Accordingly, the values ​​of the target pixel in the R / G / B channels in pixel block A may be compared with the values ​​of each comparison pixel in the corresponding color channel to obtain a comparison result for pixel A.

[0041] S3. Determine the smoothness score of pixel block A according to the comparison result of pixel block A.

[0042] In the SPICE protocol, the smoothness score of an image is inversely correlated with the smoothness of the image, that is, the smaller the smoothness score of an image, the better the smoothness of the image.

[0043] S4. Accumulate and average the smoothness scores of all pixel blocks of the image to be processed to obtain an average smoothness score of the image to be processed.

[0044] S5. Determine the smoothness level of the image to be processed according to the average smoothness score of the image to be processed.

[0045] In the embodiment of the present application, the smoothness level can be divided into three levels: high, medium, and low smoothness. Among them, high smoothness means that the smoothness of the image is less than or equal to the set first smoothness threshold; low smoothness means that the smoothness of the image is greater than or equal to the set second smoothness threshold. Among them, the first smoothness threshold is less than the second smoothness threshold. Medium smoothness means that the smoothness of the image is greater than the first smoothness threshold and less than the second smoothness threshold. In the embodiment of the present application, the specific values ​​of the first smoothness threshold and the second smoothness threshold are not limited. In some embodiments, the first smoothness threshold may be -0.03; the second smoothness threshold is 0.02. Then, the average smoothness score of the high smoothness image is less than -0.03; the average smoothness score of the low smoothness image is greater than 0.02; the smoothness score of the medium smoothness image is greater than -0.03 and less than 0.02.

[0046] S6. Compress the image to be processed using a compression method corresponding to the smoothness level of the image to be processed.

[0047] The following is an example of how to determine the smoothness level of the image to be processed in steps S2-S5, taking the first smoothness threshold as -0.03 and the second smoothness threshold as 0.02 as an example. Figure 3 As shown, determining the smoothness level of the image to be processed specifically includes:

[0048] 301. Randomly select a comparison pixel y from the comparison pixels corresponding to the pixel block A that have not been compared with the target pixel x.

[0049] 302. Determine whether the values ​​of the target pixel x and the comparison pixel y in the R / G / B channels are all equal. If yes, proceed to step 303; if no, proceed to step 304.

[0050] 303 . Determine that the smoothness score of the pixel block A obtained by comparing the target pixel x with the comparison pixel y is 0.5, and then execute step 307 .

[0051] 304. Determine whether the difference between the R / G / B channel values ​​of the target pixel x and the comparison pixel y is greater than or equal to 8. If yes, proceed to step 305; if no, proceed to step 306.

[0052] 305 . Determine that the smoothness score of the pixel block obtained by comparing the target pixel x with the comparison pixel y is 1, and then execute step 307 .

[0053] 306 . Determine that the smoothness score of the pixel block obtained by comparing the target pixel x with the comparison pixel y is −0.25, and then execute step 307 .

[0054] 307 , determine whether all three comparison pixels of pixel block A have been compared with the target pixel x. If yes, execute step 308 ; if not, return to step 301 .

[0055] 308 . Determine whether the smoothness scores of the pixel block A obtained by comparing the target pixel x with the three comparison pixels are all 0.5; if so, execute step 309 ; if not, execute step 310 .

[0056] 309 . Determine that the smoothness score of pixel block A is 0, and proceed to step 311 .

[0057] 310 . Sum the smoothness scores of the pixel block A obtained for the target pixel x and the three compared pixels, and use the sum as the smoothness score of the pixel block A. Then continue to step 311 .

[0058] 311. Determine whether the smoothness scores of all pixel blocks of the image to be processed have been calculated; if yes, execute step 312; if no, execute step 313.

[0059] 312 . Calculate the average smoothness score of the smoothness scores of all pixel blocks of the image to be processed as the smoothness score of the image to be processed, and proceed to step 314 .

[0060] 313. Randomly select a pixel block from the pixel blocks whose smoothness scores have not been calculated as the pixel block A, and return to step 301.

[0061] 314. Determine whether the smoothness score of the image to be processed is less than -0.03. If yes, proceed to step 315. If no, proceed to step 316.

[0062] 315. Determine whether the smoothness score of the image to be processed is greater than or equal to 0.02. If yes, proceed to step 317. If no, proceed to step 318.

[0063] 316. Determine that the image to be processed has a high smoothness level.

[0064] 317. Determine that the image to be processed has a low smoothness level.

[0065] 318. Determine that the image to be processed has a medium smoothness level.

[0066] Furthermore, after determining the smoothness level of the image to be processed, the image to be processed can be compressed using a compression method corresponding to the smoothness level of the image to be processed. For example, in the SPICE protocol, QUIC encoding can be used to compress images with medium and low smoothness levels; LZ or GLZ encoding algorithms can be used to compress images with high smoothness levels, and so on.

[0067] According to the SPCIE protocol described in the above embodiment, image compression is performed based on image smoothness. This method performs calculations on the entire image. If the image contains multiple types of content, it cannot accurately classify and distinguish the images. For example, in practical applications, mixed images often contain text and / or graphics with natural images. Natural images refer to images directly captured by image acquisition devices. Mixed images include computer desktop images and scanned images. Because these images contain text / graphics with sharp edges, compressing mixed images using the same encoding method cannot achieve a balance between image quality and transmission bandwidth. For example, using the same lossless compression method to compress mixed images will result in a large amount of compressed image data, requiring a large transmission bandwidth. If the transmission bandwidth is low, image transmission efficiency will be affected. Using the same lossy method to compress mixed images will result in blurred edges of text / graphics in the mixed image, affecting the display quality of the text and / or graphics in the mixed image and resulting in poor visual effects. This is because the human eye is very sensitive to distortion in image edge areas.

[0068] In response to the technical problem that the above-mentioned image compression method cannot take into account both display quality and network bandwidth, in some embodiments of the present application, the image to be processed can be divided into multiple image blocks, and the image blocks can be classified according to the color value of the pixels of the image blocks; for the image blocks of the target type (text type and / or graphic type), lossless compression is used for compression, which can retain the sharper edges of the text / graphic area and ensure the display quality of the image blocks of the target type; for the image blocks of the non-target type, lossy compression is performed based on the smoothness of the non-target type image blocks using a quality parameter adapted for smoothness, which can reduce the size of the compressed data while ensuring the display quality of the image blocks. Therefore, this embodiment uses different image compression methods to process image blocks of different content types, so that the compression rate of different areas can be adapted to the content of the area, and the image display quality and compressed data size of different areas of the image can be taken into account, thereby taking into account the image display quality and network transmission bandwidth of the cloud desktop.

[0069] The following describes in detail the technical solutions provided by various embodiments of the present application in conjunction with the accompanying drawings.

[0070] It should be noted that the same reference numerals denote the same objects in the following drawings and embodiments, and therefore, once an object is defined in one drawing or embodiment, it does not need to be further discussed in the subsequent drawings and embodiments.

[0071] Figure 4 This is a schematic diagram of the structure of the cloud desktop system provided in the embodiment of the present application. Figure 4 As shown, the system mainly includes: a cloud desktop client 10 and a cloud desktop server 20.

[0072] The cloud desktop client 10 and the cloud desktop server 20 may be connected wirelessly or by wire. Optionally, the cloud desktop client 10 and the cloud desktop server can be connected through a mobile network and communication. Accordingly, the network standard of the mobile network can be 2G (such as Global System for Mobile Communications (GSM)), 2.5G (such as General Packet Radio Service (GPRS)), 3G (such as Wideband Code Division Multiple Access (WCDMA), Time Division-Synchronous Code Division Multiple Access (TD-SCDMA), Code Division Multiple Access 2000 (CDMA2000), Universal Mobile Telecommunications System (UTMS)), 4G (such as Long Term Evolution (LTE), 4G+ (such as upgraded version of Long Term Evolution (LTE-Advanced, LTE-A)), 5G, World Interoperability for Microwave Access (WiMax), etc. Optionally, the cloud desktop client 10 and the cloud desktop server 20 can also be connected to each other through Bluetooth, WiFi, infrared, etc.

[0073] In the embodiments of the present application, the cloud desktop server 20 refers to a server device that provides cloud desktop services. The cloud desktop server 20 is a computer device capable of managing cloud desktops, responding to cloud desktop service requests from the cloud desktop client 10, and providing cloud desktop-related services to users. It generally possesses the ability to undertake and guarantee services. Cloud desktop services that can be deployed by the cloud desktop server 20 include, but are not limited to, cloud desktops, cloud desktop operating systems, cloud desktop management and control services, and cloud desktop protocol services.

[0074] The cloud desktop server 20 can be a single server device, a cloud-based server array, or a virtual machine (VM) running in a cloud-based server array. In addition, the cloud desktop server 20 can also refer to other computing devices with corresponding service capabilities, such as a computer or other cloud desktop client device (running a service program).

[0075] The cloud desktop client 10 refers to a device or software functional module that can access the cloud desktop server 20 through a wireless network, such as a mobile phone, notebook, tablet computer, POS machine, thin host, etc. Of course, the cloud desktop client 10 can also be a soft cloud desktop client corresponding to the cloud desktop. For a cloud desktop client 10 with a physical device, a thin client (a device similar to a TV set-top box) can be used to connect the display and keyboard and mouse. The cloud desktop client 10 can also install the client program corresponding to the cloud desktop, and access the virtual machine host of the cloud desktop server 20 through a unique communication protocol (such as the desktop transmission protocol, etc.) to achieve interactive operations, thereby achieving an experience effect consistent with that of a physical cloud desktop client (such as a computer, etc.). At the same time, the cloud desktop not only supports the replacement of traditional computers, but also supports other mobile devices such as mobile phones and tablets to access on the Internet.

[0076] The cloud desktop client 10 and the cloud desktop server 20 interact with desktop data through the remote desktop protocol. The cloud desktop server 20 compresses the cloud desktop image and transmits it to the cloud desktop client 10. The cloud desktop client 10 decompresses it and presents it to the user through the local display system. Different encoding methods of desktop images determine the display quality of the desktop image and the size of the transmission network bandwidth. In an embodiment of the present application, in order to take into account both display quality and network bandwidth, the cloud desktop server 20 can distinguish the content of the desktop image to be updated by dividing it into blocks, and perform different encoding and compression on different content type areas of the same desktop image. The following is an illustrative description of the specific implementation method of the cloud desktop server 20 for compressing the desktop image.

[0077] like Figure 4 As shown, the cloud desktop server 20 can perform image compression processing on the cloud desktop image to be updated as the image to be processed. Specifically, the cloud desktop server 20 can divide the cloud desktop image to be updated into multiple image blocks. Multiple refers to 2 or more. The number of image blocks is determined by the size of the image to be processed and the size of a single image block. The size of the image can be determined by the number of pixels in the length and width of the image. For example, the length and width of the image are 242*256. 242 and 256 are the number of pixels in the length and width of the image, respectively.

[0078] The smaller the size of a single image block, the higher the accuracy of its content type identification. However, since the smaller the size of a single image block, the greater the number of image blocks, the greater the computational effort and the lower the computational speed. Therefore, the size of a single image block can be flexibly set based on the required accuracy and computational speed for content type identification.

[0079] In some embodiments, the cloud desktop server 20 may divide the cloud desktop image into multiple image blocks according to the set image block size. Optionally, if the length or width of the cloud desktop image is not an integer multiple of the length or width of the image block, the size of the rightmost or bottommost image block of the cloud desktop image may be the actual area size. For example, Figure 5 As shown, the size of the cloud desktop image is 242*256, and the size of a single image block is 64*64. Based on the size of a single image block of 64*64, the cloud desktop image can be divided into 16 image blocks, namely image blocks 1-16. For areas whose length or width is less than 64*64, the actual size of the area is used as the size of the image block divided from the area. For example, Figure 5 The sizes of image blocks 4, 8, 12 and 16 are 50*64, and the size of the image blocks is 64*64.

[0080] Typically, text or graphics have simple colors and dramatic texture changes, while images have rich colors and more gradual texture changes. Therefore, the color information of text or graphics differs from that of images. A graphic is a spatial shape that can be demarcated by its outline. A graphic is a limited, recognizable shape that is a part of space and lacks spatial extension.

[0081] The color information based on text or graphics is different from the color information of images, such as Figure 4 As shown, based on the multiple image blocks into which the cloud desktop image is cut, the cloud desktop server 20 can classify the content of the multiple image blocks according to the color values ​​of the pixels of the multiple image blocks to determine the content types of the multiple image blocks, that is, determine the content type of each image block. The color value of the pixel can be represented by the RGB value of the pixel. In an embodiment of the present application, the content type of the image block is divided into target type and non-target type. The target type may include: text type and / or graphic type. The non-target type refers to other content types other than the target type, such as image type. The non-target type is neither a text type nor a graphic type.

[0082] Since the target type has simple colors and drastic texture changes, the cloud desktop server 20 can perform lossless compression on the image blocks of the target type.

[0083] In the embodiments of the present application, the specific implementation method for lossless compression of the target type of image blocks is not limited. Optionally, the cloud desktop server 20 may use a predetermined lossless compression algorithm to losslessly compress the target type of image blocks. Lossless compression algorithms include, but are not limited to, the LZ algorithm, the GLZ algorithm, the LZ4 algorithm, the LZW (Lenpel-Ziv & Welch) algorithm, or the Huffman algorithm.

[0084] Because image blocks may have varying degrees of smoothness, using the same compression ratio to compress image blocks of varying smoothness can result in blurring of less smooth blocks, impacting image quality. However, using a lower compression ratio can result in larger data volumes for smoother blocks, impacting network transmission bandwidth and efficiency. To further balance display quality and network transmission bandwidth, the cloud desktop server 20 can distinguish between non-target image blocks by their smoothness.

[0085] The more natural the pixel color transition of an image is, the smoother the image is. Figure 4 As shown, for image blocks with non-target content types, the cloud desktop server 20 can determine the smoothness of the non-target image blocks based on the color values ​​of the pixels of the non-target image blocks; and based on the smoothness of the non-target image blocks, use the quality parameters adapted to the smoothness to perform lossy compression on the non-target image blocks.

[0086] The quality parameter, also known as the quality factor, reflects the image quality. A larger quality parameter indicates a smaller image compression loss and a lower image compression ratio. In this embodiment, smoothness and the quality parameter are inversely correlated. That is, the higher the smoothness of an image block, the lower the adapted quality parameter, and the higher the compression ratio of the image block.

[0087] In the embodiment of the present application, the specific implementation method of lossy compression of non-target image blocks is not limited. Optionally, the cloud desktop server 20 can use a set lossy compression algorithm to perform lossy compression on the non-target image blocks based on the smoothness of the non-target image blocks and the quality parameters adapted to the smoothness, so that the quality parameters of the compressed image blocks are adapted to the smoothness of the image blocks. Lossy compression algorithms include, but are not limited to, Joint Photographic Experts Group (JPEG) algorithm or JPEG2000, etc.

[0088] In this embodiment, the cloud desktop server can divide the cloud desktop image to be updated into multiple image blocks, and classify the image blocks according to the color value of the pixels of the image blocks; for the target type (text type and / or graphic type) image blocks, lossless compression is used for compression, which can retain the sharper edges of the text / graphic area and ensure the display quality of the target type image blocks; for the non-target type image blocks, lossy compression is performed based on the smoothness of the non-target type image blocks using a quality parameter adapted for smoothness, which can reduce the size of the compressed data while ensuring the display quality of the image blocks. Therefore, this embodiment uses different image compression methods to process image blocks with different content types, so that the compression rate of different areas can be adapted to the content of the area, and the image display quality and compressed data size of different areas of the image can be taken into account, thereby taking into account the image display quality and network transmission bandwidth of the cloud desktop.

[0089] After the cloud desktop server 20 compresses the multiple image blocks of the cloud desktop image using an adaptive image compression method, Figure 4 As shown, the cloud desktop server 20 can send the compressed target type image blocks and the position of the target type image blocks in the cloud desktop image, as well as the compressed non-target type image blocks and the position of the non-target type image blocks in the cloud desktop image, to the cloud desktop client 10.

[0090] Accordingly, the cloud desktop client 10 can render the compressed cloud desktop image based on the positions of the target type image blocks and the positions of the non-target type image blocks in the cloud desktop image. Specifically, the cloud desktop client 10 can splice the compressed target type image blocks and the non-target type image blocks based on the positions of the target type image blocks and the non-target type image blocks in the cloud desktop image to obtain a compressed cloud desktop image; and then render the compressed cloud desktop image to update the desktop image.

[0091] The above system embodiment uses the desktop image as an example to illustrate the application scenario of the present embodiment. Of course, the image processing method provided in the present embodiment can also be adapted to other application scenarios. For example, it can be applied to application scenarios such as loading network images on a terminal. The following is an illustrative description of the specific implementation of the image processing method provided in the present embodiment in conjunction with the method embodiment.

[0092] Figure 6 This is a flow chart of the image processing method provided in the embodiment of the present application. Figure 6 As shown, the method mainly includes:

[0093] 601. Divide the image to be processed into multiple image blocks.

[0094] 602. Perform content classification on the multiple image blocks according to color values ​​of pixels of the multiple image blocks to determine content types of the multiple image blocks.

[0095] 603 . For a first image block whose content type is a non-target type, determine the smoothness of the first image block according to color values ​​of pixels of the first image block.

[0096] 604. Perform lossy compression on the first image block using a quality parameter adapted to the smoothness according to the smoothness of the first image block; the smoothness is inversely correlated with the quality parameter.

[0097] 605. Losslessly compress the second image block whose content type is a target type; the target type includes: text type and / or graphic type.

[0098] In this embodiment, the image to be processed is any frame image that needs to be compressed. In a cloud desktop application scenario, the image to be processed may be a desktop image to be updated. In step 601, the image to be processed may be divided into multiple image blocks. Multiple refers to two or more image blocks.

[0099] Generally speaking, the color of text or graphic (Graph) information is simple and the texture changes dramatically, while the color of image (Image) information is rich and the texture changes relatively slowly. Therefore, the color information of text or graphics is different from the color information of images. Therefore, in step 602, the content of multiple image blocks can be classified according to the color values ​​of the pixels of the multiple image blocks to determine the content type of the multiple image blocks, that is, to determine the content type of each image block. The color value of the pixel can be represented by the RGB value of the pixel. In an embodiment of the present application, the content type of the image block is divided into target type and non-target type. The target type may include: text type and / or graphic type. The non-target type refers to other content types other than the target type, such as image type. The non-target type is neither a text type nor a graphic type.

[0100] In the embodiments of the present application, the specific implementation method for content classification of image blocks is not limited. For multiple image blocks, the content classification method for each image block is the same. The following uses image block B among the multiple image blocks as an example to illustrate several implementation methods for content classification of image blocks. Image block B is any image block among the multiple image blocks.

[0101] Implementation method 1: Since the colors of text or graphic information are simple, while the colors of image information are rich, in some embodiments, the number of colors contained in image block B can be determined based on the color values ​​of the pixels of image block B. In embodiments where color values ​​are represented by RGB values, the number of colors contained in image block B can be determined based on the RGB values ​​of the pixels of image block B. For any two pixels, if the RGB values ​​of the two pixels have different color values ​​on the color channels, the colors of the two pixels are determined to be different. For example, if two pixels have the same color values ​​on the R and G color channels but different color values ​​on the B channel, the colors of the two pixels are determined to be different. For another example, if two pixels have the same color value on the R channel but different color values ​​on the G and B color channels, the colors of the two pixels can also be determined to be different.

[0102] Since text or graphic information has simple colors, if the number of colors in image block B is less than or equal to the set color number threshold, the content type of image block B is determined to be the target type. In this embodiment of the present application, for image blocks of the target type, no further distinction is made between text type and graphic type.

[0103] In the embodiment of the present application, the specific value of the color quantity threshold is not limited. Optionally, the color quantity threshold can be any integer between 50 and 60. Preferably, the color quantity threshold can be 50.

[0104] Implementation 2: When displaying an image, text rendering will exhibit certain font rendering characteristics. Text rendering methods may include grayscale rendering or sub-pixel rendering.

[0105] Grayscale rendering controls the brightness of the pixels on the font outline to achieve the original font shape. Sub-pixel rendering utilizes the principle that each pixel on an LCD screen is a mixture of the color and brightness of three RGB sub-pixels to create a complete pixel color. This method uses three sub-pixels to represent the font outline points to achieve the original shape.

[0106] Subpixel refers to the smallest unit of resolution on the imaging surface of an area array camera, with pixels as the smallest unit. The distance between pixel centers ranges from a few to more than ten microns. The subpixel concept was developed to maximize image information and improve resolution. This means there are additional pixels between two physical pixels, called subpixels, which are calculated using computational methods.

[0107] The inventors of this application have discovered that font rendering characteristics are primarily reflected in the color type of the font pixels. The color type of a pixel refers to the color of the pixel, such as black, white, gray, red, green, and blue. For example, with grayscale font rendering, the pixels of the text are generally gray pixels, and the color values ​​in the red channel are all different. For another example, with sub-pixel font rendering, the color types of consecutive pixels of the text meet certain distribution characteristics, etc. Therefore, before determining whether an image block X meets specific font rendering characteristics, it is necessary to determine the color type of each pixel in the pixel block.

[0108] In some embodiments, the color type of the pixels in image block B can be determined based on the color values ​​of the pixels in image block B. Specifically, for any pixel X in image block B, the color type of pixel X can be determined based on the color values ​​of pixel X in each color channel (e.g., the three R / G / B channels). The following describes exemplary implementations of determining the color type of pixel X, using several optional implementations.

[0109] Implementation 2.1: The difference between the color values ​​of pixel X in each color channel (e.g., R / G / B channels) can be determined based on the color value of pixel X in each color channel (e.g., R / G / B channels). The difference between the color values ​​of pixel X in each color channel can be represented by the absolute value of the difference between the color values ​​of pixel X in each of the channels. The difference between the color values ​​of pixel X in the R / G / B channels can be represented by the absolute value of the difference between the R value and the G value of pixel X (i.e., RG), and the absolute value of the difference between the G value and the B value of pixel X (i.e., GB).

[0110] Furthermore, if the difference between the color values ​​of pixel X in each color channel is less than a set color difference upper limit, the color type of any pixel X is determined to be a gray pixel. The color difference upper limit is greater than 0 and less than or equal to 10. If the color difference upper limit is 10, it can be said that if the RGB value of pixel X is RG < 10 and GB < 10; or RG < 10 and |RB < 10, then the pixel X is determined to be a gray pixel.

[0111] Implementation 2.2: If the color value of pixel X in each color channel (e.g., R / G / B channels) is greater than a set first upper limit, the color type of pixel X is determined to be a white pixel. Where 220 ≤ the first upper limit < 255. If the first upper limit is 220, then if the color value of pixel X in each of the RGB channels is greater than 220, that is, pixel X satisfies R>220, G>220, and B>220, pixel X is determined to be a white pixel.

[0112] Implementation 2.3: If the color value of pixel X in each color channel is less than the first lower limit, the color type of pixel X is determined to be a black pixel. Here, the color difference upper limit < the first lower limit < the first upper limit. For example, the first lower limit can be 100.

[0113] Embodiment 2.4: If the color value of pixel X in the red channel is greater than the color value of the green channel, and the color value of pixel X in the red channel is greater than the color value of the blue channel, the color type of pixel X is determined to be a red pixel. That is, if the R value of pixel X is greater than the G value, and the R value of pixel X is greater than the B value, the color type of pixel X is determined to be a red pixel.

[0114] Embodiment 2.5: If the color value of pixel X in the blue channel is greater than the color value in the green channel, and the color value of pixel X in the blue channel is greater than the color value in the red channel, the color type of pixel X is determined to be a blue pixel. That is, if the B value of pixel X is greater than the G value, and the B value of pixel X is greater than the R value, the color type of pixel X is determined to be a blue pixel.

[0115] The method for determining the color type of a pixel shown in the above embodiment is for illustrative purposes only and does not constitute a limitation. In the embodiments of the present application, the above embodiments 2.1-2.5 can be executed in parallel or sequentially. When embodiments 2.1-2.5 are executed sequentially, the order in which embodiments 2.1-2.5 are executed is not limited. Alternatively, embodiments 2.1-2.5 can be executed sequentially, and so on. When embodiments 2.1-2.5 are executed sequentially, if pixel X meets the determination conditions of the previous execution, the subsequent embodiments will not be executed.

[0116] Pixel X is any pixel in the image block B. Therefore, the color types of all pixels in the image block B can be determined in the same manner.

[0117] Furthermore, whether image block B has the target font rendering characteristics can be determined based on the color type of the pixels in image block B. Accordingly, if image block B has the target font rendering characteristics, the content type of image block B is determined to be the target type. Specifically, the content type of image block B can be determined to be text.

[0118] In the embodiment of the present application, the target font rendering feature refers to the rendering feature of the text when the text is rendered using a specific text rendering method.

[0119] For example, for the grayscale rendering mode, the target font rendering feature is implemented as a grayscale font rendering feature. The grayscale font rendering feature can be implemented as follows: the color types of M consecutive pixels are all gray pixels, and the color values ​​of the red channel of the consecutive M gray pixels are all different. In an embodiment of the present application, the specific value of M is determined by the number of pixels occupied by a stroke of the text. Generally, M>2 and is an integer. In some embodiments, M=3 or M=4, etc. If M=3, the grayscale font rendering feature can be implemented as follows: there are 3 consecutive pixels P1 (RGB values ​​are R1, G1, B1), pixel P2 (RGB values ​​are R2, G2, B2) and pixel P3 (RGB values ​​are R3, G3, B3) in the image block, and the 3 consecutive pixels P1, P2 and P3 are all gray pixels, and R1≠R2≠R3.

[0120] Accordingly, based on the color type of the pixels in image block B, it can be determined whether image block B contains M consecutive pixels whose color type is all gray. If the image block contains M consecutive gray pixels, and the color values ​​of the red channel of these M consecutive gray pixels are all different, then it is determined that image block B has grayscale font rendering characteristics, that is, it has the target font rendering characteristics. Furthermore, the content type of image block B can be determined to be the target type.

[0121] For another example, in some embodiments, the font rendering method is a sub-pixel font rendering method. Accordingly, the target font rendering feature can be implemented as a sub-pixel font rendering feature. The applicant has found that the sub-pixel font rendering feature can be expressed as: (1) there is a distribution of color types of N consecutive pixels, which meets the first color distribution requirement of the sub-pixel font rendering feature; and / or, (2) there is a distribution of color types of K consecutive pixels, which meets the second color distribution requirement of the sub-pixel font rendering feature. Wherein, K>N>2, and K and N are both integers. Wherein, the first color distribution requirement and the second color distribution requirement are respectively related to the values ​​of N and K.

[0122] Accordingly, one implementation of determining whether image block B has the target font rendering feature based on the color type of the pixels of image block B may be implemented by performing at least one of the following determination operations:

[0123] Judgment operation 1: Based on the color types of the pixels of the image block B, determine whether the image block B has a color type distribution of N consecutive pixels that meets the first color type distribution requirement of the sub-pixel font rendering feature.

[0124] Judgment operation 2: Based on the color types of the pixels of image block B, determine whether image block B has a distribution of K consecutive pixels of color types that meets the second color type distribution requirement of the sub-pixel font rendering feature; wherein K>N>2, and K and N are both integers.

[0125] Correspondingly, if the judgment result of at least one judgment operation is yes, it is determined that the image block B has the sub-pixel font rendering feature, that is, has the target font rendering feature.

[0126] It should be noted that the above-mentioned judgment operations 1 and 2 can be performed selectively or in combination. If judgment operations 1 and 2 are performed in combination, and the judgment operation 1 and 2 are both judged to be yes, it is determined that image block B has the sub-pixel font rendering feature, that is, it has the target font rendering feature.

[0127] The first and second color distribution requirements are related to the values ​​of N and K, respectively. The values ​​of N and K are determined by the number of pixels occupied by any stroke of the text. The following uses N=3 and K=4 as an example to illustrate the first and second color distribution requirements.

[0128] The inventors of this application have found that when N=3, the first color type distribution requirement of the sub-pixel font rendering feature can be realized as follows:

[0129] Feature 1: There are three consecutive pixels P1, P2, and P3, whose color types are: P1 is a white pixel, P2 is a red pixel, and P3 is a black pixel;

[0130] Feature 2: There are three consecutive pixels P4, P5, and P6, whose color types are: P4 is a white pixel, P5 is a red pixel, and P6 is a black pixel.

[0131] Correspondingly, if the image block B satisfies the above characteristics 1 and 2 at the same time, it is determined that the image block B meets the first color type distribution requirement.

[0132] Based on this, when N=3, the above-mentioned judgment operation 1 can be implemented as follows: based on the color types of the pixels of image block B, determine whether image block B has three consecutive pixels whose color types are, in order, white, red, and black; and based on the color types of the pixels of image block B, determine whether image block B has three consecutive pixels whose color types are, in order, black, blue, and white. Accordingly, if the judgment result is that image block B has three consecutive pixels whose color types are, in order, white, red, and black, and image block B has three consecutive pixels whose color types are, in order, black, blue, and white, it is determined that the distribution of the color types of the three consecutive pixels in image block B meets the first color type distribution requirement of the sub-pixel font rendering feature. Furthermore, it can be determined that image block B has the sub-pixel font rendering feature, and the content type of image block B can be determined to be the target type.

[0133] The inventors of the present application have also discovered that when K=4 in the above-mentioned determination operation 2, the second color type distribution requirement of the sub-pixel font rendering feature can be realized as at least one of the following features:

[0134] Feature 3: There are four consecutive pixels P1, P2, P3, and P4, whose color types are: P1 is a white pixel, P2 is a red pixel, P3 is a blue pixel, and P4 is a white pixel;

[0135] Feature 4: There are three consecutive pixels P4, P5, P6, and P7, whose color types are: P4 is a black pixel, P5 is a blue pixel, P6 is a red pixel, and P7 is a black pixel.

[0136] Correspondingly, if the image block B satisfies any one of the above features 3 and 4 or satisfies features 3 and 4 simultaneously, it is determined that the image block B meets the second color type distribution requirement.

[0137] Based on this, when K = 4, the above-mentioned determination operation 2 can be implemented as follows: based on the color types of the pixels in image block B, determining whether image block B has four consecutive pixels with a color type distribution of: white pixel, red pixel, blue pixel, and white pixel; and based on the color types of the pixels in image block B, determining whether image block B has four consecutive pixels with a color type distribution of: black pixel, blue pixel, red pixel, and black pixel. Accordingly, if the determination result is: image block B has four consecutive pixels with a color type distribution of: white pixel, red pixel, blue pixel, and white pixel, and / or image block B has four consecutive pixels with a color type distribution of: black pixel, blue pixel, red pixel, and black pixel, it is determined that the color type distribution of image block B has four consecutive pixels, which meets the second color type distribution requirement of the sub-pixel font rendering feature. Furthermore, it can be determined that image block B has the sub-pixel font rendering feature, and the content type of image block B can be determined to be the target type.

[0138] The above embodiment shows that the implementation method of content classification of image blocks is only an illustrative description and does not constitute a limitation. It should be noted that the above implementation methods 1 and 2 of content classification of image blocks can be implemented selectively or in combination. When the above implementation methods 1 and 2 are implemented in combination, implementation methods 1 and 2 can be executed in parallel or in series. When implementation methods 1 and 2 are executed in series, the order of execution of implementation methods 1 and 2 is not limited. Considering that the amount of calculation for determining the number of colors of an image block is smaller than the amount of calculation for determining whether an image block has the target font rendering feature, when implementation methods 1 and 2 are executed in series, implementation method 1 can be executed first, and implementation method 1 can be used to filter out some image blocks whose content type is the target type; for image blocks that cannot be determined as the target type by implementation method 1, implementation method 2 can be used to further determine the content type of the image block.

[0139] Specifically, if the determination result of the first embodiment is that the number of colors contained in image block B is greater than the set color number threshold, the second embodiment can be used to determine whether the content type of image block B is the target type. For more details on the implementation, please refer to the relevant content of the second embodiment, which will not be repeated here.

[0140] Through the above step 602 and its specific implementation, it can be determined whether the content type of the image block is the target type or the non-target type, that is, the image block that cannot be determined as the target type is the non-target type image block.

[0141] In the embodiments of the present application, for ease of description and distinction, non-target image blocks are defined as first image blocks, and target image blocks are defined as second image blocks. The number of first image blocks and second image blocks can be one or more. "More than one" means two or more. The number of first image blocks and second image blocks is determined by the content of the image to be processed.

[0142] After determining the content types of the plurality of image blocks, since the target type has simple colors and drastic texture changes, in step 605 , the image blocks of the target type may be losslessly compressed.

[0143] For image blocks with non-target content, since their smoothness may vary, using the same compression ratio for all blocks with varying smoothness can result in blurring of the less smooth blocks, affecting image quality. A compression ratio that is too low can lead to larger data volumes for the smoother blocks, impacting network transmission bandwidth and efficiency. To further balance display quality and network transmission bandwidth, non-target image blocks can be differentiated by their smoothness.

[0144] Since the more natural the pixel color transition of an image is, the smoother the image is, therefore, in step 603, for an image block whose content type is a non-target type, the smoothness of the non-target type image block can be determined based on the color values ​​of the pixels of the non-target type image block.

[0145] In some embodiments, for any non-target type image block C, multiple pixel blocks can be obtained from the image block C. Multiple refers to 2 or more. Each pixel block includes: a target pixel and multiple comparison pixels. For a specific implementation of obtaining multiple pixel blocks, please refer to the above Figure 1-Figure 3 In this embodiment, the image block C is Figure 1Further, for any pixel block D, the smoothness of the pixel block D is determined based on the color values ​​of the target pixel of the pixel block D in each color channel and the color values ​​of the comparison pixel of the pixel block D in each color channel. Figure 1-Figure 3 The content related to determining the smoothness of the pixel block X in is not repeated here.

[0146] Furthermore, based on the smoothness of the multiple pixel blocks of the image block C, the average smoothness of the multiple pixel blocks is calculated as the smoothness of the image block C. For the specific implementation of this step, please refer to the above Figure 1-Figure 3 The content related to determining the smoothness of the image to be processed is not repeated here.

[0147] After the smoothness of each non-target image block is determined, in step 604 , lossy compression is performed on the non-target image block using quality parameters adapted to the smoothness according to the smoothness of the non-target image block.

[0148] Refer to the above Figure 1-Figure 3 , the smoothness of the image block can be distinguished by the smoothness level of the image block. Figure 1-Figure 3 , you can use the above Figure 1-Figure 3 Determine the average smoothness score of the above-mentioned image block C to characterize the smoothness of the image block C. The higher the average smoothness score of the image block, the lower the smoothness of the image block. Accordingly, step 604 can be implemented as follows: determine the smoothness level of the image block C based on the average smoothness score of the non-target type image block C. For the classification of smoothness levels, please refer to the above Figure 1-Figure 3 The relevant content in will not be repeated here.

[0149] Furthermore, a quality parameter corresponding to the smoothness level can be used to perform lossy compression on image block C. The quality parameter is inversely correlated with the smoothness level. That is, the higher the smoothness level, the smaller the quality parameter. For example, for image blocks with a high smoothness level, a lossy compression algorithm and a first quality parameter can be used to perform lossy compression on the image blocks with a high smoothness level. For image blocks with medium or low smoothness levels, a lossy compression algorithm and a second quality parameter can be used to perform lossy compression on the image blocks with medium or low smoothness levels. The first quality parameter is smaller than the second quality parameter. For example, the lossy compression algorithm can be the JPEG algorithm, the first quality parameter can be 85, the second quality parameter can be 95, and so on.

[0150] It is worth noting that in the embodiment of the present application, step 605 and steps 603-604 can be executed in parallel or sequentially. When steps 603-605 are executed sequentially, the order in which steps 605 and steps 603-604 are executed is not limited. Optionally, step 605 can be executed first, followed by steps 603-604. Of course, steps 603-604 can also be executed first, followed by step 605. Alternatively, step 603 can be executed first, followed by steps 604 and 605, and so on.

[0151] In this embodiment, the image to be processed can be divided into multiple image blocks, and the image blocks can be classified by content based on the color values ​​of the pixels of the image blocks; for image blocks of target type (text type and / or graphic type), lossless compression is used for compression, which can retain the sharper edges of the text / graphic area and ensure the display quality of the target type image blocks; for image blocks of non-target type, lossy compression is performed based on the smoothness of the non-target type image blocks using a quality parameter adapted for smoothness, which can reduce the size of the compressed data while ensuring the display quality of the image blocks. Therefore, this embodiment uses different image compression methods to process image blocks of different content types, so that the compression rate of different areas can be adapted to the content of the area, and the image display quality and compressed data size of different areas of the image can be taken into account, thereby taking into account the image display quality and network transmission bandwidth of the cloud desktop.

[0152] The image processing method provided in the above embodiment can be applied to a server-side device, and the server-side device can use the image processing method provided in the above embodiment to compress the image, and send the compressed image to other devices (such as user terminals, etc.) for display. Therefore, the size of the compressed image affects the image transmission efficiency. In an embodiment of the present application, in order to improve the image transmission efficiency, after determining the content type of each image block of the image to be processed, for the second image block whose content type is the target type, the adjacent second image blocks can be merged according to the position of the second image block in the image to be processed to obtain a merged second image block. The number of merged second image blocks can be one or more, which is specifically determined by the content distribution of the image to be processed.

[0153] Of course, for first image blocks whose content type is not the target type, adjacent first image blocks with the same smoothness level can be merged based on the position of the first image block in the image to be processed and the smoothness of the first image block to obtain a merged first image block. The number of merged second image blocks can be one or more, depending on the content distribution of the image to be processed.

[0154] Accordingly, step 604 may be implemented as follows: based on the smoothness level of the merged first image block, lossy compression is performed on the merged first image block using a quality parameter adapted to the smoothness level of the merged first image block. A greater smoothness level corresponds to a higher smoothness level, and the smoothness level is inversely correlated with the quality parameter.

[0155] Accordingly, the above step 605 may be implemented as: performing lossless compression on the merged second image block.

[0156] The position of each image block in the image to be processed can be represented by the vertex coordinates of the image block in the image to be processed, or by the center coordinates of the image block and the size of the image block, or by the coordinates of the upper left vertex of the image block and the size of the image block, etc. Therefore, the above-mentioned merging of adjacent second image blocks and merging of adjacent first image blocks at the same smoothness level can reduce the amount of image block position information transmitted when transmitting the compressed image to be processed, thereby improving the transmission efficiency of the compressed image to be processed.

[0157] Based on the above-mentioned compressed and merged first image block and the compressed and merged second image block, the compressed and merged first image block and the merged first image block at the position of the image to be processed, as well as the compressed and merged second image block and the merged second image block at the position of the image to be processed, can be sent to the terminal.

[0158] Accordingly, the terminal can render the compressed and merged first image block and the compressed and merged second image block according to the position of the merged first image block in the image to be processed and the position of the merged second image block in the image to be processed to update the desktop image.

[0159] In order to facilitate the understanding of the logic of the above image processing method, the following Figure 7a The specific embodiment shown is exemplified. Figure 7a As shown, the method mainly includes the following steps:

[0160] 701. Divide the image to be processed into multiple image blocks.

[0161] 702. Determine whether the image block traversal is complete. If yes, go to step 715; if no, go to step 703.

[0162] 703. Randomly select an image block B from the image blocks that have not been traversed.

[0163] 704. Determine the number of colors contained in image block B according to the color values ​​of the pixels in image block B.

[0164] 705 . Determine whether the number of colors in image block B is less than or equal to 50. If yes, go to step 706 ; if no, go to step 707 .

[0165] 706 : Determine that the content type of image block B is the target type, and return to step 702 .

[0166] 707. Determine whether the pixels in image block B have been traversed. If yes, go to step 710; if no, go to step 708.

[0167] 708. Randomly select a pixel X from the pixels in the image block B that have not been traversed yet.

[0168] 709. Determine the color type of pixel X based on the color values ​​of the R / G / B channels of pixel X. Then, return to step 707.

[0169] 710. Determine whether image block B has the target font rendering feature based on the color type of the pixels in image block B. If yes, execute step 706; if not, execute step 711.

[0170] 711. Determine an average smoothness score of image block B based on color values ​​of pixels of image block B.

[0171] For the specific implementation of step 711, please refer to the above Figure 1-Figure 3 In step 711, the image block B is Figure 1-Figure 3 The image to be processed in .

[0172] 712. Determine whether the average smoothness score of image block B is less than -0.03. If yes, proceed to step 713. If no, proceed to step 714.

[0173] 713. Determine that the smoothness level of the image block B is a high smoothness level; and return to step 702.

[0174] 714. Determine that the smoothness level of the image block B is a medium-low smoothness level; and return to step 702.

[0175] 715. Merge adjacent target-type image blocks, and merge adjacent non-target-type image blocks at the same smoothness level.

[0176] 716. Classify and compress the merged image blocks. Specific implementations can be found in the above steps 604 and 605, which will not be described in detail here.

[0177] The image to be processed in the image processing method provided in the above embodiment is any frame image that needs to be compressed. In a cloud desktop application scenario, the image to be processed may be a cloud desktop image to be updated. The image processing method provided in the embodiment of the present application is exemplified below, taking the case where the image to be processed is a cloud desktop image to be updated as an example.

[0178] Figure 7b This is a flow chart of a method for processing cloud desktop images provided in an embodiment of the present application. Figure 7b As shown, the method for processing the cloud desktop image includes:

[0179] S71: Divide the cloud desktop image to be updated into multiple image blocks.

[0180] S72: Perform content classification on the multiple image blocks according to the color values ​​of the pixels of the multiple image blocks to determine the content types of the multiple image blocks.

[0181] S73 . For a first image block whose content type is a non-target type, determine the smoothness of the first image block according to color values ​​of pixels of the first image block.

[0182] S74 . Perform lossy compression on the first image block using a quality parameter adapted for the smoothness according to the smoothness of the first image block to obtain a compressed first image block; the smoothness is inversely correlated with the quality parameter.

[0183] S75 . Losslessly compress the second image block whose content type is the target type to obtain a compressed second image block; the target type includes: text type and / or graphic type.

[0184] S76. Send the compressed first image block, the compressed second image block, the position of the first image block in the cloud desktop image, and the position of the second image block in the cloud desktop image to the cloud desktop client, so that the cloud desktop client can render the compressed cloud desktop image.

[0185] Among them, the compressed cloud desktop image is a compressed image of the cloud desktop image to be updated in step S71. In this embodiment, in the cloud desktop application scenario, the cloud desktop image to be updated can be divided into multiple image blocks, and the image blocks can be classified according to the color value of the pixels of the image blocks; for the image blocks of the target type (text type and / or graphic type), lossless compression is used for compression, which can retain the sharper edges of the text / graphic area and ensure the display quality of the image blocks of the target type; for the image blocks of the non-target type, lossy compression is performed based on the smoothness of the image blocks of the non-target type using a quality parameter adapted for smoothness, which can reduce the amount of compressed data while ensuring the display quality of the image blocks. Therefore, in this embodiment, different image compression methods are used for processing image blocks of different content types, so that the compression rate of different areas can be adapted to the content of the area, and the image display quality and compressed data size of different areas of the image can be taken into account, thereby taking into account the image display quality and network transmission bandwidth of the cloud desktop.

[0186] Among them, regarding the specific implementation of steps S71-S76, please refer to the relevant content of the above embodiment, which will not be repeated here.

[0187] It should be noted that the execution entity of each step of the method provided in the above embodiment can be the same device, or the method can be executed by different devices. For example, the execution entity of steps 601 and 602 can be device A; for another example, the execution entity of step 601 can be device A, and the execution entity of step 602 can be device B; and so on.

[0188] In addition, some of the processes described in the above embodiments and the accompanying drawings include multiple operations that appear in a specific order. However, it should be clearly understood that these operations may not be executed in the order in which they appear in this document or may be executed in parallel. The sequence numbers of the operations, such as 601, 602, etc., are merely used to distinguish between different operations and do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel.

[0189] Accordingly, an embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the above-mentioned cloud desktop image processing method and / or image processing method.

[0190] Figure 8 This is a schematic diagram of the structure of the computing device provided in the embodiment of the present application. Figure 8 As shown, the computing device mainly includes: a memory 80a and a processor 80b. The memory 80a is used to store computer programs.

[0191] The processor 80b is coupled to the memory 80a and is configured to execute a computer program for: dividing an image to be processed into a plurality of image blocks; performing content classification on the plurality of image blocks according to the color values ​​of the pixels of the plurality of image blocks to determine the content types of the plurality of image blocks; determining, for a first image block whose content type is a non-target type, the smoothness of the first image block according to the color values ​​of the pixels of the first image block; and performing lossy compression on the first image block using a quality parameter adapted for the smoothness according to the smoothness of the first image block; the smoothness is inversely correlated with the quality parameter; and performing lossless compression on a second image block whose content type is a target type; the target type includes: text type and / or graphic type.

[0192] Optionally, when the processor 80b classifies the contents of multiple image blocks according to the color values ​​of the pixels of the multiple image blocks, it is specifically used to: determine, for any image block among the multiple image blocks, the number of colors contained in any image block according to the color values ​​of the pixels of any image block; if the number of colors contained in any image block is less than or equal to a set color number threshold, determine that the content type of any image block is the target type.

[0193] Furthermore, when the processor 80b classifies the contents of multiple image blocks according to the color values ​​of the pixels of the multiple image blocks, it is also used to: if the number of colors contained in any image block is greater than a set color number threshold, determine the color type of the pixels of any image block according to the color value of the pixels of any image block; determine whether any image block has the target font rendering characteristics according to the color type of the pixels of any image block; if the judgment result is yes, determine that the content type of any image block is the target type.

[0194] In other embodiments, when the processor 80b classifies the contents of multiple image blocks according to the color values ​​of the pixels of the multiple image blocks, it is specifically used to: determine the color type of the pixels of any image block according to the color value of the pixels of any image block; determine whether any image block has the target font rendering characteristics according to the color type of the pixels of any image block; if the judgment result is yes, determine that the content type of any image block is the target type.

[0195] Optionally, when the processor 80b determines the color type of the pixels of any image block based on the color values ​​of the pixels of any image block, it is specifically used to: for any pixel of any image block, determine the color type of any pixel based on the color values ​​of any pixel in each color channel.

[0196] Optionally, when the processor 80b determines the color type of any pixel according to the color value of any pixel in each color channel, it is specifically configured to perform the following operations:

[0197] Determine the difference between the color values ​​of any pixel in each color channel according to the color value of any pixel in each color channel; if the difference between the color values ​​of any pixel in each color channel is less than a set color difference upper limit, determine the color type of any pixel as a gray pixel;

[0198] Accordingly, if the color value of any pixel in each color channel is greater than the first upper limit value, the color type of any pixel is determined to be a white pixel;

[0199] If the color value of any pixel in each color channel is less than the first lower limit, the color type of any pixel is determined to be a black pixel; the color difference upper limit < the first lower limit < the first upper limit;

[0200] If the color value of any pixel in the red channel is greater than the color value of the green channel, and the color value of any pixel in the red channel is greater than the color value of the blue channel, the color type of any pixel is determined to be a red pixel;

[0201] If the color value of any pixel in the blue channel is greater than the color value in the green channel, and the color value of any pixel in the blue channel is greater than the color value in the red channel, the color type of any pixel is determined to be a blue pixel.

[0202] In some embodiments, the target font rendering feature includes a grayscale font rendering feature. Accordingly, when determining whether any image block has the target font rendering feature based on the color type of the pixels in any image block, the processor 80b is specifically configured to: determine, based on the color type of the pixels in any image block, whether any image block contains M consecutive pixels whose color type is all gray pixels; where M is an integer greater than 2; and if any image block contains M consecutive gray pixels, and the color values ​​of the red channel of the M consecutive gray pixels are all different, then the image block is determined to have the grayscale font rendering feature.

[0203] In some other embodiments, the target font rendering feature includes a sub-pixel font rendering feature. Accordingly, when the processor 80b determines whether any image block has the target font rendering feature based on the color type of the pixels of any image block, it is specifically configured to perform at least one of the following determination operations:

[0204] According to the color types of the pixels of any image block, determining whether there are N consecutive pixels in any image block whose color types meet the first color type distribution requirement of the sub-pixel font rendering feature;

[0205] Determining, based on the color types of pixels in any image block, whether there are K consecutive pixels in any image block whose color types meet a second color type distribution requirement of the sub-pixel font rendering feature; where K>N>2, and K and N are both integers;

[0206] If the judgment result of at least one judgment operation is yes, it is determined that any image block has the sub-pixel font rendering feature.

[0207] In some embodiments, N=3. Accordingly, when determining whether any image block has a color type distribution of N consecutive pixels that meets the first color type distribution requirement of the sub-pixel font rendering feature, the processor 80b is specifically configured to: determine, based on the color types of the pixels of any image block, whether any image block has three consecutive pixels whose color types are, in sequence, white, red, and black; and determine, based on the color types of the pixels of any image block, whether any image block has three consecutive pixels whose color types are, in sequence, black, blue, and white; if the determination result is that any image block has three consecutive pixels whose color types are, in sequence, white, red, and black, and any image block has three consecutive pixels whose color types are, in sequence, black, blue, and white, it is determined that any image block has three consecutive pixels whose color type distribution meets the first color type distribution requirement of the sub-pixel font rendering feature.

[0208] In some other embodiments, K=4. Accordingly, when determining whether any image block has a color type distribution of K consecutive pixels that meets the second color type distribution requirement of the sub-pixel font rendering feature, the processor 80b is specifically configured to: determine, based on the color types of the pixels in any image block, whether any image block has a color type distribution of four consecutive pixels that is: white pixel, red pixel, blue pixel, and white pixel; and determine, based on the color types of the pixels in any image block, whether any image block has a color type distribution of four consecutive pixels that is: black pixel, blue pixel, red pixel, and black pixel; and if the determination result is: any image block has a color type distribution of four consecutive pixels that is: white pixel, red pixel, blue pixel, and white pixel, and / or any image block has a color type distribution of four consecutive pixels that is: black pixel, blue pixel, red pixel, and black pixel, then it is determined that any image block has a color type distribution of four consecutive pixels that meets the second color type distribution requirement of the sub-pixel font rendering feature.

[0209] In an embodiment of the present application, when the processor 80b determines the smoothness of the first image block based on the color values ​​of the pixels of the first image block, it is specifically used to: obtain multiple pixel blocks from the first image block; each pixel block includes a target pixel and multiple comparison pixels; for any pixel block, determine the smoothness of any pixel block based on the color values ​​of the target pixels of any pixel block in each color channel and the color values ​​of the comparison pixels of any pixel block in each color channel; based on the smoothness of the multiple pixel blocks, calculate the average smoothness of the multiple pixel blocks as the smoothness of the first image block.

[0210] Accordingly, when the processor 80b performs lossy compression on the first image block based on the smoothness of the first image block using the quality parameter adapted for smoothness, the processor 80b is specifically configured to: if the smoothness of the first image block is less than or equal to the set upper limit of smoothness, determine that the smoothness type of the first image block is the first level of smoothness (such as a high smoothness level); perform lossy compression on the first image block using the quality parameter adapted for the first level of smoothness; if the smoothness of the first image block is greater than the set upper limit of smoothness, determine that the smoothness type of the first image block is the second level of smoothness (a medium-low smoothness level); perform lossy compression on the first image block using the quality parameter adapted for the second level of smoothness; the quality parameter adapted for the second level of smoothness is greater than the quality parameter adapted for the first level of smoothness.

[0211] In some embodiments, the processor 80b is further configured to: merge adjacent second image blocks according to positions of the second image blocks in the image to be processed to obtain a merged second image block; merge adjacent first image blocks having the same smoothness level according to positions of the first image blocks in the image to be processed and the smoothness of the first image blocks to obtain a merged first image block;

[0212] Accordingly, when the processor 80b performs lossy compression on the first image block based on the smoothness of the first image block and using a quality parameter adapted to the smoothness, it is specifically configured to: perform lossy compression on the merged first image block based on the smoothness level of the merged first image block and using a quality parameter adapted to the smoothness level of the merged first image block; wherein, the greater the smoothness, the higher the smoothness level, and the smoothness level is inversely correlated with the quality parameter.

[0213] Correspondingly, when performing lossless compression on the second image block whose content type is the target type, the processor 80b is specifically configured to: perform lossless compression on the merged second image block.

[0214] Optionally, the processor 80b is further used to: send the compressed and merged first image block, the compressed and merged second image block, the position of the merged first image block in the image to be processed, and the position of the merged second image block in the image to be processed to the terminal through the communication component 80c of the computing device, so that the terminal can render the compressed and merged first image block and the compressed and merged second image block according to the position of the merged first image block in the image to be processed and the position of the merged second image block in the image to be processed.

[0215] In some embodiments, the processor 80b is further used to: divide the cloud desktop image to be updated into multiple image blocks; perform content classification on the multiple image blocks according to the color values ​​of the pixels of the multiple image blocks to determine the content types of the multiple image blocks; for a first image block whose content type is a non-target type, determine the smoothness of the first image block according to the color values ​​of the pixels of the first image block; based on the smoothness of the first image block, perform lossy compression on the first image block using a quality parameter adapted for smoothness to obtain a compressed first image block; the smoothness is inversely correlated with the quality parameter; perform lossless compression on the second image block whose content type is a target type to obtain a compressed second image block; the target type includes: text type and / or graphic type; and send the compressed first image block, the compressed second image block, the position of the first image block in the cloud desktop image, and the position of the second image block in the cloud desktop image to the cloud desktop client for the cloud desktop client to render the compressed cloud desktop image.

[0216] In some optional embodiments, such as Figure 8 As shown, the computing device may further include: a power supply component 80d and other components. In some embodiments, the computing device may be implemented as a terminal device such as a computer or a mobile phone. Accordingly, the computing device may further include: a display component 80e and an audio component 80f and other optional components. Figure 8 Only some components are shown schematically, and it does not mean that the computing device must include Figure 8 The components shown do not necessarily mean that the computing device can only include Figure 8 Components shown.

[0217] The computing device provided by this embodiment can divide the image to be processed into multiple image blocks, and classify the image blocks according to the color values ​​of the pixels of the image blocks; for the image blocks of the target type (text type and / or graphic type), a lossless compression method is used for compression, which can retain the sharper edges of the text / graphic area and ensure the display quality of the target type image blocks; for the image blocks of the non-target type, lossy compression is performed based on the smoothness of the non-target type image blocks using a quality parameter adapted for the smoothness, which can reduce the size of the compressed data while ensuring the display quality of the image blocks. Therefore, this embodiment uses different image compression methods to process image blocks of different content types, which can make the compression rate of different areas adapt to the content of the area, and can take into account the picture display quality and the size of the compressed data of different areas of the image, and thus can take into account the picture display quality and network transmission bandwidth of the cloud desktop.

[0218] In an embodiment of the present application, the memory is used to store computer programs and can be configured to store various other data to support operations on the device where it is located. The processor can execute the computer program stored in the memory to implement the corresponding control logic. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0219] In the embodiment of the present application, the processor can be any hardware processing device that can execute the logic of the above method. Optionally, the processor can be a central processing unit (CPU), a graphics processing unit (GPU) or a microcontroller unit (MCU); it can also be a programmable device such as a field programmable gate array (FPGA), a programmable array logic device (PAL), a general array logic device (GAL), a complex programmable logic device (CPLD); or an advanced reduced instruction set (RISC) processor (Advanced RISC Machines, ARM) or a system on chip (System on Chip, SOC), etc., but is not limited thereto.

[0220] In an embodiment of the present application, the communication component is configured to facilitate wired or wireless communication between the device in which it is located and other devices. The device in which the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G, 5G or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component can also be implemented based on near field communication (NFC) technology, radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology or other technologies.

[0221] In an embodiment of the present application, the display component may include a liquid crystal display (LCD) and a touch panel (TP). If the display component includes a touch panel, the display component may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.

[0222] In embodiments of the present application, a power supply assembly is configured to provide power to various components of the device in which it is located. The power supply assembly may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which the power supply assembly is located.

[0223] In an embodiment of the present application, the audio component may be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC), and when the device where the audio component is located is in an operating mode, such as call mode, recording mode, and voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal may be further stored in a memory or sent via a communication component. In some embodiments, the audio component further includes a speaker for outputting an audio signal. For example, for a device with a language interaction function, voice interaction with a user can be achieved through the audio component.

[0224] It should be noted that the descriptions such as "first" and "second" in this article are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence, nor do they limit "first" and "second" to different types.

[0225] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0226] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0227] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0228] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0229] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0230] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0231] Computer storage media is readable storage media, also known as computer-readable media. Computer-readable storage media include both permanent and non-permanent, removable and non-removable media that can be implemented using any method or technology to store information. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.

[0232] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a..." does not preclude the presence of additional identical elements in the process, method, commodity, or apparatus comprising the aforementioned elements.

[0233] The above contents are merely embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.

Claims

1. A method for processing a cloud desktop image, characterized in that: include: Divide the cloud desktop image to be updated into multiple image blocks; Performing content classification on each of the plurality of image blocks according to color values ​​of pixels of the plurality of image blocks to determine content types of the plurality of image blocks includes: For any image block among the multiple image blocks, determine the color type of the pixels of the image block according to the color values ​​of the pixels of the image block; determine whether the image block has the target font rendering feature according to the color type of the pixels of the image block; if the determination result is yes, determine that the content type of the image block is the target type; For a first image block whose content type is a non-target type, obtaining a plurality of pixel blocks from the first image block; each pixel block includes a target pixel and a plurality of comparison pixels; For any pixel block, determining the smoothness of the any pixel block according to the color values ​​of the target pixel of the any pixel block in each color channel and the color values ​​of the comparison pixel of the any pixel block in each color channel; Calculating, according to the smoothness of the plurality of pixel blocks, an average smoothness of the plurality of pixel blocks as the smoothness of the first image block; performing lossy compression on the first image block using a quality parameter adapted for the smoothness according to the smoothness of the first image block, so as to obtain a compressed first image block, wherein the smoothness is inversely correlated with the quality parameter; performing lossless compression on a second image block having a content type of a target type to obtain a compressed second image block; the target type includes: a text type and / or a graphic type; The compressed first image block, the compressed second image block, the position of the first image block in the cloud desktop image, and the position of the second image block in the cloud desktop image are sent to the cloud desktop client so that the cloud desktop client can render the compressed cloud desktop image.

2. An image processing method, characterized in that: include: Divide the image to be processed into multiple image blocks; Performing content classification on each of the plurality of image blocks according to color values ​​of pixels of the plurality of image blocks to determine content types of the plurality of image blocks includes: For any image block among the multiple image blocks, determine the color type of the pixels of the image block according to the color values ​​of the pixels of the image block; determine whether the image block has the target font rendering feature according to the color type of the pixels of the image block; if the determination result is yes, determine that the content type of the image block is the target type; For a first image block whose content type is a non-target type, obtaining a plurality of pixel blocks from the first image block; each pixel block includes a target pixel and a plurality of comparison pixels; For any pixel block, determining the smoothness of the any pixel block according to the color values ​​of the target pixel of the any pixel block in each color channel and the color values ​​of the comparison pixel of the any pixel block in each color channel; Calculating, according to the smoothness of the plurality of pixel blocks, an average smoothness of the plurality of pixel blocks as the smoothness of the first image block; performing lossy compression on the first image block using a quality parameter adapted to the smoothness according to the smoothness of the first image block, wherein the smoothness is inversely correlated with the quality parameter; Lossless compression is performed on the second image block whose content type is a target type; the target type includes: a text type and / or a graphic type.

3. The method according to claim 2, characterized in that The performing content classification on the plurality of image blocks respectively according to the color values ​​of the pixels of the plurality of image blocks to determine the content types of the plurality of image blocks includes: For any image block among the multiple image blocks, determine the number of colors contained in the any image block based on the color values ​​of the pixels of the any image block; if the number of colors contained in the any image block is less than or equal to a set color number threshold, determine that the content type of the any image block is the target type.

4. The method according to claim 2, characterized in that The performing content classification on the plurality of image blocks respectively according to the color values ​​of the pixels of the plurality of image blocks to determine the content types of the plurality of image blocks further includes: If the number of colors included in any one of the image blocks is greater than a set color number threshold, determining the color type of the pixels of the any one of the image blocks according to the color values ​​of the pixels of the any one of the image blocks; determining, according to a color type of pixels of the any image block, whether the any image block has a target font rendering feature; If the judgment result is yes, it is determined that the content type of any one of the image blocks is the target type.

5. The method according to claim 3 or 4, characterized in that Determining the color type of the pixels of any one image block based on the color values ​​of the pixels of any one image block includes: determining, based on the color values ​​of any one pixel in each color channel, a difference between the color values ​​of the any one pixel in the any one image block in each color channel; and determining that the color type of the any one pixel is a gray pixel if the difference between the color values ​​of the any one pixel in each color channel is less than a set color difference upper limit; If the color value of any pixel in each color channel is greater than a first upper limit, determining that the color type of any pixel is a white pixel; If the color value of any pixel in each color channel is less than the first lower limit, determine that the color type of any pixel is a black pixel; the color difference upper limit < the first lower limit < the first upper limit; If the color value of any pixel in the red channel is greater than the color value of the green channel, and the color value of any pixel in the red channel is greater than the color value of the blue channel, determine that the color type of any pixel is a red pixel; If the color value of any pixel in the blue channel is greater than the color value in the green channel, and the color value of any pixel in the blue channel is greater than the color value in the red channel, the color type of any pixel is determined to be a blue pixel.

6. The method according to claim 3 or 4, characterized in that The target font rendering feature includes a grayscale font rendering feature; and judging whether any image block has the target font rendering feature according to the color type of the pixels of any image block includes: According to the color types of the pixels of any one of the image blocks, determining whether any one of the image blocks has M consecutive pixels whose color types are all gray pixels; wherein M>2 and is an integer; If any one of the image blocks has M consecutive gray pixels, and the color values ​​of the M consecutive gray pixels in the red channel are all different, it is determined that the any one of the image blocks has the grayscale font rendering feature.

7. The method according to claim 3 or 4, characterized in that The target font rendering feature includes: a sub-pixel font rendering feature; and judging whether any image block has the target font rendering feature according to the color type of the pixels of any image block includes performing at least one of the following judging operations: determining, based on the color types of the pixels of any one of the image blocks, whether a distribution of color types of N consecutive pixels in the any one of the image blocks satisfies a first color type distribution requirement of the sub-pixel font rendering feature; Determining, based on the color types of pixels of any one of the image blocks, whether a distribution of color types of K consecutive pixels in the any one of the image blocks satisfies a second color type distribution requirement of the sub-pixel font rendering feature; wherein K>N>2, and K and N are both integers; If the judgment result of the at least one judgment operation is yes, it is determined that any one of the image blocks has the sub-pixel font rendering feature.

8. The method according to claim 7, characterized in that N=3; determining, based on the color types of the pixels of any one of the image blocks, whether a distribution of color types of N consecutive pixels in any one of the image blocks satisfies the first color type distribution requirement of the sub-pixel font rendering feature, includes: According to the color types of the pixels of any one of the image blocks, determining whether the color types of three consecutive pixels in the any one of the image blocks are white pixels, red pixels, and black pixels in sequence; as well as, According to the color types of the pixels of any one of the image blocks, determining whether the color types of three consecutive pixels in the any one of the image blocks are black pixels, blue pixels, and white pixels in sequence; If the judgment result is that any image block has three consecutive pixels of color types, which are white pixel, red pixel and black pixel in sequence, and any image block has three consecutive pixels of color types, which are black pixel, blue pixel and white pixel in sequence, it is determined that the distribution of color types of three consecutive pixels in any image block meets the first color type distribution requirement of the sub-pixel font rendering feature.

9. The method according to claim 7, characterized in that K=4; the determining, based on the color types of the pixels of any one of the image blocks, whether there is a distribution of K consecutive pixels of color types in any one of the image blocks that meets the second color type distribution requirement of the sub-pixel font rendering feature, includes: determining, according to the color types of the pixels of any one of the image blocks, whether there are four consecutive pixels in the image block whose color types are distributed as follows: a white pixel, a red pixel, a blue pixel, and a white pixel; determining, according to the color types of the pixels of any one of the image blocks, whether there are four consecutive pixels in any one of the image blocks whose color types are distributed as follows: black pixel, blue pixel, red pixel, and black pixel; If the judgment result is: any image block has 4 consecutive pixels whose color type distribution is: white pixel, red pixel, blue pixel and white pixel, and / or any image block has 4 consecutive pixels whose color type distribution is: black pixel, blue pixel, red pixel and black pixel, it is determined that any image block has 4 consecutive pixels whose color type distribution meets the second color type distribution requirement of the sub-pixel font rendering feature.

10. The method according to claim 2, characterized in that Also includes: merging adjacent second image blocks according to positions of the second image blocks in the image to be processed to obtain a merged second image block; Merging adjacent first image blocks with the same smoothness level according to the positions of the first image blocks in the image to be processed and the smoothness of the first image blocks to obtain a merged first image block; The performing lossy compression on the first image block by using the quality parameter adapted to the smoothness according to the smoothness of the first image block includes: performing lossy compression on the merged first image block according to the smoothness level of the merged first image block, using a quality parameter adapted to the smoothness level of the merged first image block; wherein a greater smoothness level indicates a higher smoothness level, and the smoothness level is inversely correlated with the quality parameter; The performing lossless compression on the second image block having the target content type includes: performing lossless compression on the merged second image block; The method further comprises: The compressed and merged first image block, the compressed and merged second image block, the position of the merged first image block in the image to be processed, and the position of the merged second image block in the image to be processed are sent to the terminal, so that the terminal renders the compressed and merged first image block and the compressed and merged second image block according to the position of the merged first image block in the image to be processed and the position of the merged second image block in the image to be processed.

11. A computing device, characterized in that include: A memory and a processor; wherein the memory is used to store a computer program; The processor is coupled to the memory and configured to execute the computer program to perform the steps of the method according to any one of claims 1 to 10.

12. A computer-readable storage medium storing computer instructions, characterized in that: When the computer instructions are executed by one or more processors, the one or more processors are caused to perform the steps of the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Data transmission equipment in remote service and method for transmitting data

    CN103067449A

  • Virtual desktop image processing method and related device

    CN114339305A