Character restoration method and device, storage medium, and electronic device

By using character identifiers to encode and decode in the text area, the problem of excessive data flow caused by lossless compression is solved, and the data transmission and display effect is improved.

CN113127637BActive Publication Date: 2025-09-02ZTE CORP
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN201911419859.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-31
Publication Date
2025-09-02
Estimated Expiration
2039-12-31

AI Technical Summary

Technical Problem

Lossless compression based on text pixel information in the prior art causes excessive data flow, affecting data transmission efficiency and display effect.

Method used

By determining the character identifier in the text area, encode it using the character identifier, and decode it at the receiving end to restore the characters, reducing the amount of data transmitted.

Benefits of technology

Reduce the size of the data stream and improve the data transmission effect and display effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113127637B_ABST
    Figure CN113127637B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for restoring characters, a storage medium, and an electronic device, wherein a method for restoring characters includes: determining a character identifier of a character in a text area, wherein a character identifier is used to uniquely identify a character; encoding at least according to the character identifier, and sending the encoded data to a receiving end, wherein the encoded data is used for the receiving end to decode the encoded data, and restore the character according to the character identifier obtained after decoding, that is, encoding is performed only based on a small amount of information, and then the character is restored by decoding the information obtained. Therefore, the problem of excessive data flow caused by lossless compression based on text pixel information can be solved, thereby reducing the size of the data flow, thereby improving the data transmission effect, and further improving the display effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communications, and in particular to a character restoration method and device, a storage medium, and an electronic device. Background Art

[0002] With the widespread adoption of technologies like cloud computing and virtual desktops, large amounts of remote data need to be transmitted over the network to user terminals for display as quickly and clearly as possible. For example, in common cloud desktop office scenarios, the screen content often contains a large amount of text, often repeated printed text in a specific font, size, color, and typeface. To maintain visual comfort when viewing text on the screen, in typical cloud desktop scenarios, text is compressed using lossless or near-lossless algorithms. These compression algorithms typically rely on encoding the text's pixel information, resulting in excessively large data streams, which in turn affects data transmission efficiency and, in turn, display quality. For example, slow data transmission can cause display lag.

[0003] There is no good solution to the problem of excessive data flow caused by lossless compression based on text pixel information in related technologies. Summary of the Invention

[0004] Embodiments of the present invention provide a method and device for restoring characters, a storage medium, and an electronic device, so as to at least solve the problem of excessive data flow caused by lossless compression based on text pixel information in related technologies.

[0005] According to one embodiment of the present invention, a method for restoring characters is provided, comprising: determining a character identifier of a character in a text area, wherein one character identifier is used to uniquely identify one character; encoding at least according to the character identifier, and sending the encoded data to a receiving end, wherein the encoded data is used for the receiving end to decode the encoded data, and restore the character according to the character identifier obtained after decoding.

[0006] According to another embodiment of the present invention, another method for restoring characters is provided, including: receiving encoded data and decoding it to obtain at least character identifiers of characters in a text area, wherein one character identifier is used to uniquely identify one character; and restoring the character based on the character identifier obtained after decoding.

[0007] According to another embodiment of the present invention, a character restoration device is provided, comprising: a determination module, configured to determine a character identifier of a character in a text area, wherein one character identifier is configured to uniquely identify one character;

[0008] The first sending module is used to encode at least according to the character identifier and send the encoded data to the receiving end, wherein the encoded data is used for the receiving end to decode the encoded data and restore the character according to the character identifier obtained after decoding.

[0009] According to another embodiment of the present invention, another character restoration device is provided, comprising: a first receiving module, configured to receive and decode encoded data to obtain at least character identifiers of characters in a text area, wherein each character identifier is configured to uniquely identify each character;

[0010] The restoration module is used to restore the character according to the character identifier obtained after decoding.

[0011] According to another embodiment of the present invention, a character restoration system is also provided, including a sending end and a receiving end, characterized in that after determining the character identifier of the character in the text area, the sending end encodes the character at least according to the character identifier and sends the encoded data to the receiving end, wherein one character identifier is used to uniquely identify one character; the receiving end decodes the encoded data and restores the character according to the character identifier obtained after decoding.

[0012] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when run.

[0013] According to another embodiment of the present invention, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any one of the above method embodiments.

[0014] Through the embodiments of the present invention, since the character identifiers of the characters in the text area are determined, wherein one of the character identifiers is used to uniquely identify one of the characters; encoding is performed at least according to the character identifier, and the encoded data is sent to the receiving end, wherein the encoded data is used for the receiving end to decode the encoded data and restore the character according to the character identifier obtained after decoding, that is, encoding is performed only based on a small amount of information, and then the character is restored by decoding the information. Therefore, the problem of excessive data flow caused by lossless compression based on text pixel information can be solved, thereby reducing the size of the data flow, thereby improving the data transmission effect, and then improving the display effect. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0016] Figure 1 This is a hardware structure block diagram of a display terminal for a character restoration method according to an embodiment of the present invention;

[0017] Figure 2 is a flow chart of a character restoration method according to an embodiment of the present invention;

[0018] Figure 3 is a flow chart of another character restoration method according to an embodiment of the present invention;

[0019] Figure 4 is a structural block diagram of a character restoration device according to an embodiment of the present invention;

[0020] Figure 5 is a structural block diagram of another character restoration device according to an embodiment of the present invention;

[0021] Figure 6 is a structural diagram of a text compression system based on pixel features according to an optional embodiment of the present invention;

[0022] Figure 7 is a structural block diagram of an encoding end according to an optional embodiment of the present invention;

[0023] Figure 8 is a structural block diagram of a decoding end according to an optional embodiment of the present invention;

[0024] Figure 9 is a flow chart of a method at an encoding end according to an optional embodiment of the present invention;

[0025] Figure 10 is a schematic diagram of character splitting according to an optional embodiment of the present invention;

[0026] Figure 11 4 is a flowchart of a method at a decoding end according to an optional embodiment of the present invention. DETAILED DESCRIPTION

[0027] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that, unless there is a conflict, the embodiments and features in the embodiments of the present application can be combined with each other.

[0028] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0029] Example 1

[0030] The method embodiment provided in the first embodiment of the present application can be executed in a display terminal, a mobile terminal, a computer terminal, a conference terminal or a similar computing device. Taking running on a display terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a display terminal of a character restoration method according to an embodiment of the present invention. Figure 1 As shown, the display terminal 10 may include one or more ( Figure 1 Only one is shown in the figure) processor 102 (processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA and other processing devices) and a memory 104 for storing data. Optionally, the above-mentioned display terminal may also include a transmission device 106 for communication functions and an input and output device 108. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above display terminal. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.

[0031] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the character restoration method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above-mentioned method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories can be connected to the display terminal 10 via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0032] The transmission device 106 is configured to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by the communication provider of the display terminal 10. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module, which is configured to communicate with the Internet wirelessly.

[0033] In this embodiment, a character restoration method running on the above-mentioned display terminal or computer terminal is provided. Figure 2 is a flow chart of a character restoration method according to an embodiment of the present invention, such as Figure 2 As shown, the process includes the following steps:

[0034] Step S202, determining a character identifier of a character in the text area, wherein a character identifier is used to uniquely identify a character;

[0035] Step S204: Encode at least according to the character identifier and send the encoded data to the receiving end, wherein the encoded data is used for the receiving end to decode the encoded data and restore the character according to the character identifier obtained after decoding.

[0036] Through the above steps, the character identifiers of the characters in the text area are determined, wherein one character identifier is used to uniquely identify one character, and encoding is performed at least according to the character identifier, and the encoded data is sent to the receiving end, wherein the encoded data is used for the receiving end to decode the encoded data and restore the character according to the character identifier obtained after decoding. Encoding is performed only according to a small amount of character identifier information, and then the character is restored by decoding the character identifier information. Therefore, the problem of excessive data flow caused by lossless compression based on text pixel information can be solved, so as to achieve the technical effect of reducing the data flow size, thereby improving the data transmission effect, and then improving the display effect.

[0037] Optionally, the execution subject of the above steps may be a terminal, etc., but is not limited thereto.

[0038] Optionally, determining the character identifier of the character in the text area includes: extracting the character features of the character in the text area as the character identifier, wherein the character features include the character height, character width and character pixel matrix distribution of the character; or, determining the character identifier of the character in the text area includes: extracting the character features of the character in the text area, wherein the character features include the character height, character width and character pixel matrix distribution of the character; matching pre-set character feature information according to the character features, determining the index of the character feature of the character in the character feature information, and using the index of the character feature as the character identifier.

[0039] It should be noted that the character identifier is mainly used to uniquely identify a character, which can be the character feature of the extracted character, or the character feature in a pre-set character information library, for example, it can be the index corresponding to the pre-cached character information library. Since the use of character identifiers for encoding and transmission is far less than the transmission resources consumed by lossless compression of text in related technologies, the transmission burden is greatly reduced. In addition, after the character identifier is decoded by the receiving end of the data, the receiving end of the data can also obtain the character represented by the character identifier based on the same pre-set character information library, and then fill in the character according to the rendering information of the character, and finally restore the character that is the same as the character displayed by the sending end.

[0040] Optionally, the character feature information pre-set according to the character feature matching is determined to determine the index of the character feature of the character in the character feature information, including: matching a specified character feature in the character feature information according to the character feature of the character until the complete character feature of the character is matched, wherein the specified character feature includes: a character feature whose height is the same as the character height of the character, a width greater than or equal to the character width, and a pixel matrix distribution is the same as the character pixel matrix distribution of the character; and determining the index of the complete character feature in the character feature information according to the matched complete character feature.

[0041] Optionally, the encoded data is also used to instruct the receiving end to determine the rendering information of the character according to the character identifier obtained after decoding the encoded data, and restore the character according to the rendering information, wherein the rendering information is pre-set.

[0042] Optionally, the method also includes: encoding according to the character position information of the character in the text area, and sending the encoded data to the receiving end, wherein the encoded data is also used for the receiving end to decode the encoded data and determine the position of the character based on the character position information obtained after decoding.

[0043] It should be noted that the position information of the characters can also be carried in the encoded data, and then the receiving end of the data can decode the position information of the characters, and thus restore the position of the characters at the receiving end. In this way, the text display at the data sending end and the text display at the data receiving end can have basically the same layout.

[0044] Optionally, before determining the character identifiers of the characters in the text area, the method further includes: identifying the text area in the image; and splitting the characters in the text area to obtain a plurality of separate characters.

[0045] This embodiment also provides a character restoration method, which can be applied to a data receiving end, such as a receiving end with a decoding function. Figure 3 is a flow chart of another character restoration method according to an embodiment of the present invention. Figure 3 Shown, including:

[0046] Step S301, receiving the encoded data and decoding it to obtain at least a character identifier of a character in the text area, wherein one character identifier is used to uniquely identify one character;

[0047] Step S303: restore the character according to the character identifier obtained after decoding.

[0048] Through the above steps, the encoded data is received and decoded to obtain at least the character identifier of the character in the text area, wherein one character identifier is used to uniquely identify one character, and the character is restored according to the character identifier obtained after decoding. The character is encoded only based on a small amount of character identifier information, and then the character is restored by decoding the character identifier information. Therefore, the problem of excessive data flow caused by lossless compression based on text pixel information can be solved, thereby achieving the technical effect of reducing the data flow size, thereby improving the data transmission effect, and then improving the display effect.

[0049] It should be noted that the encoded data carries the character identifiers of the characters in the text area.

[0050] Optionally, the character identifier is the character feature of the character in the text area, wherein the character feature includes the character height, character width and character pixel matrix distribution of the character; or, the character identifier is the index of the character feature of the character in pre-set character feature information, wherein the character feature includes the character height, character width and character pixel matrix distribution of the character.

[0051] Optionally, the index of the character feature of the character in the pre-set character feature information is determined in the following manner: matching the specified character feature in the character feature information according to the character feature of the character until the complete character feature of the character is matched, wherein the specified character feature includes: a character feature whose height is the same as the character height of the character, a width greater than or equal to the character width, and a pixel matrix distribution is the same as the character pixel matrix distribution of the character; determining the index of the complete character feature in the character feature information based on the matched complete character feature.

[0052] Optionally, restoring the character based on the character identifier obtained after decoding includes: after decoding the encoded data, determining the rendering information of the character based on the character identifier obtained after decoding, and restoring the character based on the rendering information, wherein the rendering information is pre-set.

[0053] Optionally, the method further includes: receiving the encoded data and decoding it, and obtaining character position information of the character in the text area; and determining the position of the character based on the decoded character position information. It should be noted that the encoded data carries the character position information of the character in the text area.

[0054] In this embodiment, a character restoration device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments. The details already described will not be repeated here. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0055] Figure 4 is a structural block diagram of a character restoration device according to an embodiment of the present invention. Figure 4 As shown, the device includes:

[0056] A determination module 42 is configured to determine a character identifier of a character in a text area, wherein a character identifier is used to uniquely identify a character;

[0057] The first sending module 44 is used to encode at least according to the character identifier and send the encoded data to the receiving end, wherein the encoded data is used for the receiving end to decode the encoded data and restore the character according to the character identifier obtained after decoding.

[0058] Through the above steps, the character identifiers of the characters in the text area are determined, wherein one character identifier is used to uniquely identify one character, and encoding is performed at least according to the character identifier, and the encoded data is sent to the receiving end, wherein the encoded data is used for the receiving end to decode the encoded data and restore the character according to the character identifier obtained after decoding. Encoding is performed only according to a small amount of character identifier information, and then the character is restored by decoding the character identifier information. Therefore, the problem of excessive data flow caused by lossless compression based on text pixel information can be solved, so as to achieve the technical effect of reducing the data flow size, thereby improving the data transmission effect, and then improving the display effect.

[0059] Optionally, the determination module includes: an extraction module for extracting character features of the character in the text area as the character identifier, wherein the character features include the character height, character width and character pixel matrix distribution of the character; or

[0060] Optionally, the determination module includes:

[0061] An extraction module is used to extract character features of the character in the text area, wherein the character features include character height, character width and character pixel matrix distribution of the character;

[0062] The matching module is used for matching the pre-set character feature information according to the character feature, determining the index of the character feature of the character in the character feature information, and using the index of the character feature as the character identifier.

[0063] Optionally, the matching module includes:

[0064] a matching submodule, configured to match a specified character feature in the character feature information according to the character feature of the character until the complete character feature of the character is matched, wherein the specified character feature includes: a character feature having a height that is the same as the character height of the character, a width that is greater than or equal to the character width, and a pixel matrix distribution that is the same as the character pixel matrix distribution of the character;

[0065] The determination submodule is configured to determine the index of the complete character feature in the character feature information according to the matched complete character feature.

[0066] Optionally, the encoded data is also used to instruct the receiving end to determine the rendering information of the character according to the character identifier obtained after decoding the encoded data, and restore the character according to the rendering information, wherein the rendering information is pre-set.

[0067] Optionally, the device also includes: a second sending module, which is used to encode the character according to the character position information of the character in the text area and send the encoded data to the receiving end, wherein the encoded data is also used for the receiving end to decode the encoded data and determine the position of the character based on the character position information obtained after decoding.

[0068] Optionally, the device further includes: a recognition module for recognizing the text area in the image before determining the character identifier of the character in the text area; and a splitting module for splitting the characters in the text area to obtain multiple separate characters.

[0069] In this embodiment, another character restoration device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments. The details already described will not be repeated here. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0070] Figure 5 is a structural block diagram of another character restoration device according to an embodiment of the present invention, such as Figure 5 As shown, the device includes:

[0071] A first receiving module 51 is configured to receive and decode the encoded data to obtain at least a character identifier of a character in the text area, wherein each character identifier is used to uniquely identify a character;

[0072] The restoration module 53 is used to restore the character according to the character identifier obtained after decoding.

[0073] Through the above steps, the encoded data is received and decoded to obtain at least the character identifier of the character in the text area, wherein one character identifier is used to uniquely identify one character, and the character is restored according to the character identifier obtained after decoding. The character is encoded only based on a small amount of character identifier information, and then the character is restored by decoding the character identifier information. Therefore, the problem of excessive data flow caused by lossless compression based on text pixel information can be solved, thereby achieving the technical effect of reducing the data flow size, thereby improving the data transmission effect, and then improving the display effect.

[0074] Optionally, the character identifier is the character feature of the character in the text area, wherein the character feature includes the character height, character width and character pixel matrix distribution of the character; or, the character identifier is the index of the character feature of the character in pre-set character feature information, wherein the character feature includes the character height, character width and character pixel matrix distribution of the character.

[0075] Optionally, the index of the character feature of the character in the pre-set character feature information is determined in the following manner: matching the specified character feature in the character feature information according to the character feature of the character until the complete character feature of the character is matched, wherein the specified character feature includes: a character feature whose height is the same as the character height of the character, a width greater than or equal to the character width, and a pixel matrix distribution is the same as the character pixel matrix distribution of the character; determining the index of the complete character feature in the character feature information based on the matched complete character feature.

[0076] Optionally, the restoration module includes: a restoration submodule for determining rendering information of the character according to the character identifier obtained after decoding the encoded data, and restoring the character according to the rendering information, wherein the rendering information is pre-set.

[0077] Optionally, the device further includes: a second receiving module for receiving and decoding the encoded data, and obtaining character position information of the character in the text area; and a determining module for determining the position of the character based on the character position information obtained after decoding.

[0078] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0079] An embodiment of the present invention also provides a character restoration system, including a sending end and a receiving end, wherein, after determining the character identifier of the character in the text area, the sending end encodes at least according to the character identifier and sends the encoded data to the receiving end, wherein one character identifier is used to uniquely identify one character; the receiving end decodes the encoded data and restores the character according to the character identifier obtained after decoding.

[0080] It should be noted that for optional implementations of this embodiment, please refer to other implementations of this embodiment, which will not be described in detail here.

[0081] Alternative Implementation

[0082] An embodiment of the present invention provides a method for encoding text areas in content to be encoded on a screen, which is used to solve the problem of low text compression rate in current applications that require the transmission of a large number of text pixels, thereby achieving the goal of low bandwidth, low complexity, and high definition in applications such as virtual desktops, video conferencing shared auxiliary streams, and IPTV.

[0083] The technical idea of ​​the embodiment of the present invention is to identify and cluster the text areas in the content to be encoded on the screen, identify and split the row distribution characteristics of the clustered text areas, and then split and extract features of the characters in each natural text line, and then match the split character feature information with the characters in the cache, and then compress the cache hit information and the pixel information of the miss area to restore the original pixel presentation of the font on the client.

[0084] The pixel-feature-based text compression method and system described in the embodiments of the present invention, Figure 6 is a structural diagram of a text compression system based on pixel features according to an optional embodiment of the present invention, such as Figure 6 As shown, the text compression system based on pixel features in the embodiment of the present invention includes the following structures: an encoding end and a decoding end (or a restoration end), wherein the encoding end encodes and sends the code stream to the decoding end. Figure 7 is a structural block diagram of an encoding end according to an optional embodiment of the present invention, such as Figure 7 As shown, the encoding module consists of the following modules:

[0085] The text and image region recognition module is used to identify the text region and image region in each frame of the desktop image. The distinction between these two regions is used to adopt different encoding and compression methods.

[0086] The text clustering module is used to cluster the text areas with similar background colors into continuous large areas to facilitate text segmentation and recognition;

[0087] The text line feature analysis and splitting module is used to split the clustered text areas into natural text lines for subsequent text segmentation and recognition;

[0088] The character splitting module is used to split the natural lines of text after the above splitting into individual characters for subsequent character feature analysis and extraction. This module is a newly added module.

[0089] The character feature analysis and extraction module is used to extract the character features of the single characters that have been split above, and then use them for subsequent matching with the characters in the cache. This module is a newly added module.

[0090] The text character recognition module matches the extracted character features with the character features in the cache to find the matching character information for subsequent compression. This module is a newly added module.

[0091] The encoding module compresses and encodes the character matching information and the remaining pixel information for restoration at the decoding end. This module also adds encoding and compression of character hit information.

[0092] Figure 8 is a structural block diagram of a decoding end according to an optional embodiment of the present invention, such as Figure 8 As shown, the decoding end consists of:

[0093] The data decoding module is responsible for decoding the code stream transmitted by the encoding end. The module also adds decoding of character hit data.

[0094] The data recovery module determines whether it is necessary to fill the original character pixels in the corresponding cache based on the hit information according to the decoded data. This module has newly added the restoration of the original pixel of the character;

[0095] The text compression method based on pixel feature caching according to an embodiment of the present invention comprises the following steps:

[0096] The first step is to distinguish the regional distribution of text content based on the pixel distribution characteristics of each region, including pixel gradient information, pixel type information, and the approximation of major pixels, for each frame of screen content.

[0097] The second step is to cluster the detected text areas according to the background color values, so that the text areas with similar background colors are clustered into one or several continuous large areas;

[0098] The third step is to use some methods to analyze the row distribution information of the text in the text area clustered by background color, and split the pixels in each text area into natural rows;

[0099] The fourth step is to perform simple character splitting on each line of the identified text content in each separate text area. The main methods are vertical histogram projection method and local extreme value method. The character splitting does not require complete accuracy.

[0100] Step 5: Match the characters that have been initially split from the previous step in the cache according to the split results from left to right. For characters that are not matched in the cache and sporadic pixels, the lossless algorithm already in the encoding module can be used to compress them.

[0101] The data compressed according to the above method is passed as input to the lossless coding algorithm for compression and transmission.

[0102] Compared with related technologies, the method and device described in the embodiments of the present invention can significantly improve the compression efficiency in usage scenarios such as cloud desktops, shared auxiliary streams of video conferences, IPTV, etc. that require the transmission of a large number of text pixels, thereby improving the smoothness of application use.

[0103] In order to further illustrate the technical means and effects adopted by the present invention to achieve the predetermined purpose, the compression method proposed by the present invention is described in detail below with reference to the accompanying drawings.

[0104] First, before the cloud desktop runs, the common characters, fonts, font sizes, typefaces, colors, font rendering methods, etc. in the operating system are analyzed, and unique, distinguishable feature information and character rendering pixel matrix data are generated for each combination. These are loaded into the process when the cloud desktop server and client are started, and are used to match and identify text characters during the use of the cloud desktop.

[0105] The feature information of a character may include the width w and height h of the character. The cumulative value of the character pixels in the vertical direction within the width range of 0 to w is represented by the sum1 array, and the cumulative value of the character pixels in the horizontal direction within the height range of 0 to h is represented by the sum2 array. The feature information may also include the matrix distribution matrix of the character pixels in the w*h matrix (a w*h matrix formed by background being 0 and text pixels being 1). With this as the feature information, unique and distinguishable feature information can be achieved for different characters, fonts, font sizes, font types, colors, and rendering methods. The meanings of the subsequent feature values ​​sum1, sum2, and matrix all correspond to this.

[0106] The pixel dot matrix data of the character rendering is used to restore the data at the decoding end.

[0107] The text compression transmission solution includes an encoding module and a decoding module. The following describes the encoding and decoding ends respectively.

[0108] Figure 9 is a flow chart of a method of an encoding end according to an optional embodiment of the present invention. The encoding end process is as follows Figure 9 As shown, the following steps are included:

[0109] Step 401: For the changed areas of the desktop, the gradient characteristics of the pixel distribution of the original screen data and the pixel color information, such as the type of pixel color and the similarity of the top 2 pixels, are used to filter out the text area and image area, and cluster the text areas according to the similarity of the background color to provide reliability for the next step of row feature analysis.

[0110] Step 402: For each text region clustered in step 401, use histogram projection and local extreme value method to accurately identify the true distribution of text lines. Figure 10 is a schematic diagram of character splitting according to an optional embodiment of the present invention, see Figure 10 Line1 and Line4 in the figure, where Line1 is the upper boundary line of the row and Line4 is the lower boundary line of the row. Histogram projection and local extreme values ​​are already mature in the prior art and will not be described in detail.

[0111] Step 403: Based on each natural text line extracted in step 402, separate the individual characters according to vertical histogram projection and local extremum method or combined with connected domain. The vertical histogram projection, local extremum method and connected domain calculation used in this step are existing technologies and will not be described in detail. Figure 10 The vertical lines in the image are used to obtain the width w' of each character. It should be noted that the characters split in this step do not need to be completely accurate and can be over-split.

[0112] Step 404: Based on the characters initially split in step 403, the actual upper and lower boundary positions of the characters are extracted according to the foreground color distribution. Figure 10 The upper boundary of character A is Line1, and the lower boundary is Line3. The character height h' eigenvalue is obtained, and then the sum1' array, sum2' array, and matrix' matrix feature information within the range of w'*h' are calculated.

[0113] Step 405: Based on the h', w', sum1', sum2', and matrix' feature information extracted in step 404, match with the character cache information loaded in the cache. It should be noted here that except for the h' feature value, the remaining feature values ​​of the initially split characters may only be local information in the complete character. Therefore, the character can be matched in the range of h'=h and w'≤w during matching. It is required that in the range of 0~w', sum1'[i]=sum[1], in the range of 0~h', sum2'[i]≤sum2[i], and matrix'[i][j]=matrix[i][j].

[0114] According to the above requirements, the characters split in step 402 are integrated according to the complete characters after matching until w'==w, sum1'=sum1, sum2'=sum2, matrix'=matrix, and the character matching is completed. At this time, the starting coordinates of the upper left corner of the character and the index value index corresponding to the matching character in the cache are recorded for subsequent encoding; otherwise, if the character matching fails, it is necessary to record the upper left corner coordinates of the character, the width and height of the character, and the original pixels of the character for subsequent encoding.

[0115] Step 406: Compress and package the coordinate information and index of the hit character extracted in step 405. Compress and package the coordinate information and original pixel information of the missed character. The packaged data is then sent to the remote end for remote decoding. In this step, the hit and miss data must be distinguished for identification by the decoding end.

[0116] Figure 11 is a flowchart of a method of a decoding end according to an optional embodiment of the present invention. The decoding end process is as follows Figure 11 As shown, the following steps are included:

[0117] Step 501: The decoder first analyzes the packet type of the code stream transmitted by the encoder to determine whether the current packet is a lossless compressed data packet. If so, it indicates that text compression information is present. Otherwise, no text packet analysis or recovery is involved.

[0118] Step 502: further analyzing the type of text compression to determine whether there are data packets with matching characters and data packets with missing characters.

[0119] Step 503: Based on the results of the analysis in 502, if there is a data packet with a hit character, the upper left corner coordinates of the hit character, the index value in the corresponding cache, etc. are parsed; if there is a data packet with no hit character, the character position information, character size information, character original pixel value, etc. are parsed;

[0120] Step 504: Based on the step in 503, the original pixels of the hit characters are extracted from the cache and filled into the corresponding positions, while the missed characters are directly filled according to the decoded pixel values ​​and coordinate information. This step completes the restoration of the text pixels.

[0121] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0122] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when running.

[0123] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:

[0124] S1, determining a character identifier of a character in a text area, wherein one character identifier is used to uniquely identify one character;

[0125] S2, encode at least according to the character identifier, and send the encoded data to the receiving end, wherein the encoded data is used for the receiving end to decode the encoded data and restore the character according to the character identifier obtained after decoding.

[0126] Through the above steps, the character identifiers of the characters in the text area are determined, wherein one character identifier is used to uniquely identify one character, and encoding is performed at least according to the character identifier, and the encoded data is sent to the receiving end, wherein the encoded data is used for the receiving end to decode the encoded data and restore the character according to the character identifier obtained after decoding. Encoding is performed only according to a small amount of character identifier information, and then the character is restored by decoding the character identifier information. Therefore, the problem of excessive data flow caused by lossless compression based on text pixel information can be solved, so as to achieve the technical effect of reducing the data flow size, thereby improving the data transmission effect, and then improving the display effect.

[0127] Optionally, specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0128] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0129] An embodiment of the present invention further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0130] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0131] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:

[0132] S1, determining a character identifier of a character in a text area, wherein one character identifier is used to uniquely identify one character;

[0133] S2, encode at least according to the character identifier, and send the encoded data to the receiving end, wherein the encoded data is used for the receiving end to decode the encoded data and restore the character according to the character identifier obtained after decoding.

[0134] Through the above steps, the character identifiers of the characters in the text area are determined, wherein one character identifier is used to uniquely identify one character, and encoding is performed at least according to the character identifier, and the encoded data is sent to the receiving end, wherein the encoded data is used for the receiving end to decode the encoded data and restore the character according to the character identifier obtained after decoding. Encoding is performed only according to a small amount of character identifier information, and then the character is restored by decoding the character identifier information. Therefore, the problem of excessive data flow caused by lossless compression based on text pixel information can be solved, so as to achieve the technical effect of reducing the data flow size, thereby improving the data transmission effect, and then improving the display effect.

[0135] Optionally, specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0136] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when running.

[0137] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:

[0138] S1, receiving the encoded data and decoding it to obtain at least a character identifier of a character in the text area, wherein each character identifier is used to uniquely identify the character;

[0139] S2, restoring the character according to the character identifier obtained after decoding.

[0140] Through the above steps, the encoded data is received and decoded to obtain at least the character identifier of the character in the text area, wherein one character identifier is used to uniquely identify one character, and the character is restored according to the character identifier obtained after decoding. The character is encoded only based on a small amount of character identifier information, and then the character is restored by decoding the character identifier information. Therefore, the problem of excessive data flow caused by lossless compression based on text pixel information can be solved, thereby achieving the technical effect of reducing the data flow size, thereby improving the data transmission effect, and then improving the display effect.

[0141] Optionally, specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0142] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0143] An embodiment of the present invention further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0144] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0145] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:

[0146] S1, receiving the encoded data and decoding it to obtain at least a character identifier of a character in the text area, wherein each character identifier is used to uniquely identify the character;

[0147] S2, restoring the character according to the character identifier obtained after decoding.

[0148] Through the above steps, the encoded data is received and decoded to obtain at least the character identifier of the character in the text area, wherein one character identifier is used to uniquely identify one character, and the character is restored according to the character identifier obtained after decoding. The character is encoded only based on a small amount of character identifier information, and then the character is restored by decoding the character identifier information. Therefore, the problem of excessive data flow caused by lossless compression based on text pixel information can be solved, thereby achieving the technical effect of reducing the data flow size, thereby improving the data transmission effect, and then improving the display effect.

[0149] Optionally, specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0150] Obviously, those skilled in the art will appreciate that the various modules or steps of the present invention described above can be implemented using a general-purpose computing device, centralized on a single computing device, or distributed across a network of multiple computing devices. Alternatively, they can be implemented using program code executable by a computing device, which can then be stored in a storage device and executed by the computing device. In some cases, the steps shown or described can be performed in a different order than that shown, or can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0151] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the principles of the present invention are intended to be within the scope of protection of the present invention.

Claims

1. A character restoration method, characterized in that: include: Determining an index of a character feature of a character in a text area as a character identifier of the character, wherein the index of the character feature is determined by matching the character feature with a specified character feature in pre-set character feature information, the specified character feature including a character feature having a width greater than or equal to a width of the character, a height the same as a character height of the character, and a pixel matrix distribution the same as a character pixel matrix distribution of the character, and one character identifier is used to uniquely identify one character; Encoding is performed at least according to the character identifier, and the encoded data is sent to a receiving end, wherein the encoded data is used for the receiving end to decode the encoded data and restore the character according to the character identifier obtained after decoding.

2. The method according to claim 1, characterized in that The step of determining the index of the character feature of the character in the text area as the character identifier of the character includes: Extracting character features of the characters in the text area, wherein the character features include character height, character width, and character pixel matrix distribution of the characters; matching pre-set character feature information according to the character features, determining the index of the character features of the characters in the character feature information, and using the index of the character features as the character identifier.

3. The method according to claim 2, characterized in that The step of matching the preset character feature information according to the character feature to determine the index of the character feature of the character in the character feature information includes: Matching a specified character feature in the character feature information according to the character feature of the character until the complete character feature of the character is matched; The index of the complete character feature in the character feature information is determined according to the matched complete character feature.

4. The method according to any one of claims 1 to 3, characterized in that The encoded data is also used to instruct the receiving end to determine the rendering information of the character according to the character identifier obtained after decoding the encoded data, and restore the character according to the rendering information, wherein the rendering information is pre-set.

5. The method according to claim 1, wherein The method further comprises: The character is also encoded according to the character position information in the text area, and the encoded data is sent to the receiving end, wherein the encoded data is also used for the receiving end to decode the encoded data and determine the position of the character based on the character position information obtained after decoding.

6. The method according to claim 1, wherein Before determining the index of the character feature of the character in the text area as the character identifier of the character, the method further includes: Identify text areas in images; The characters in the text area are split to obtain a plurality of separate characters.

7. A character restoration method, characterized in that: include: Receive the encoded data and decode it to obtain at least a character identifier of a character in a text area, wherein the character identifier is an index of a character feature of the character, and the index of the character feature is determined by matching the character feature with a specified character feature in pre-set character feature information, wherein the specified character feature includes a character feature having a width greater than or equal to the width of the character, a height the same as the character height of the character, and a pixel matrix distribution the same as the character pixel matrix distribution of the character, and one character identifier is used to uniquely identify one character; The character is restored according to the character identifier obtained after decoding.

8. The method according to claim 7, characterized in that The character identifier is an index of the character feature of the character in the preset character feature information, wherein the character feature includes the character height, character width and character pixel matrix distribution of the character.

9. The method according to claim 8, characterized in that Matching a specified character feature in the character feature information according to the character feature of the character until the complete character feature of the character is matched; The index of the complete character feature in the character feature information is determined according to the matched complete character feature.

10. The method according to any one of claims 7 to 9, characterized in that Restoring the character according to the character identifier obtained after decoding includes: After decoding the encoded data, rendering information of the character is determined according to the character identifier obtained after decoding, and the character is restored according to the rendering information, wherein the rendering information is preset.

11. The method according to claim 7, characterized in that The method further comprises: receiving the encoded data and decoding it, and also obtaining character position information of the character in the text area; The position of the character is determined according to the character position information obtained after decoding.

12. A character restoration device, characterized in that: include: a determination module, configured to determine an index of a character feature of a character in a text area as a character identifier of the character, wherein the index of the character feature is determined by matching the character feature with a specified character feature in pre-set character feature information, the specified character feature including a character feature having a width greater than or equal to the width of the character, a height the same as the character height of the character, and a pixel matrix distribution the same as the character pixel matrix distribution of the character, and one character identifier is used to uniquely identify one character; The first sending module is used to encode at least according to the character identifier and send the encoded data to the receiving end, wherein the encoded data is used for the receiving end to decode the encoded data and restore the character according to the character identifier obtained after decoding.

13. A character restoration device, characterized in that: include: A first receiving module is configured to receive and decode the encoded data, and obtain at least an index of a character feature of a character in a text area as a character identifier of the character, wherein the index of the character feature is determined by matching the character feature with a specified character feature in pre-set character feature information, the specified character feature including a character feature having a width greater than or equal to the width of the character, a height the same as the character height of the character, and a pixel matrix distribution the same as the character pixel matrix distribution of the character, and one character identifier is used to uniquely identify one character; The restoration module is used to restore the character according to the character identifier obtained after decoding.

14. A character restoration system, comprising a sending end and a receiving end, characterized in that: After determining that the index of the character feature of the character in the text area is the character identifier of the character, the transmitting end performs encoding at least according to the character identifier and sends the encoded data to the receiving end, wherein the index of the character feature is determined by matching the character feature with a specified character feature in pre-set character feature information, the specified character feature includes a character feature having a width greater than or equal to the width of the character, a height the same as the character height of the character, and a pixel matrix distribution the same as the character pixel matrix distribution of the character, and one character identifier is used to uniquely identify one character; The receiving end decodes the encoded data and restores the character according to the character identifier obtained after decoding.

15. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1 to 6 when run, or the computer program is configured to execute the method described in any one of claims 7 to 11 when run.

16. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method described in any one of claims 1 to 6, or the computer program is configured to execute the method described in any one of claims 7 to 11 when run.

Citation Information

Patent Citations

  • Communication system, server device, client device, and non-transitory computer readable medium

    CN106354450A