Text image encoding and decoding method, device and system
By binarizing the computer-generated text images and adding font library marking bits, the problem of large amount of data transmission in text images is solved, and the data volume is reduced and the display effect is improved.
Patent Information
- Application Number
- CN202010554757.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-17
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2040-06-17
AI Technical Summary
Computer-generated text images have a large amount of data when transmitted, mainly because the text edge contains pixels of red and yellow colors, resulting in an increase in data volume.
By binarizing the text image, the pixel points on the edge of the text are filtered out to obtain a pure black and white binary text image, and the font library marking bits are added during the encoding process to mark the font library used, reducing the amount of data.
It effectively reduces the amount of data of text images, improves transmission efficiency, and accurately determines the font type during decoding and performs targeted sharpening processing, improving the display effect.
Smart Images

Figure CN111882491B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a text image encoding and decoding method, device and system. Background Art
[0002] Computer-generated text images usually appear black visually. But in fact, in order to make the displayed text softer and smoother, pixels of various colors, such as red and yellow, are usually filled in the jagged edges of the text before the text is displayed. This makes the pixels on the edges of the text not completely black, especially the oblique strokes such as left and right strokes in Chinese characters, which often have red, yellow and other colors.
[0003] Thus, when these text images are transmitted, the amount of data of these text images during transmission is relatively large because the transmitted pixels include pixels of colors such as red and yellow, rather than completely black and white pixels. Summary of the invention
[0004] The embodiment of the present application provides a text image encoding and decoding method, device and system, which can solve the problem of large data volume of computer-generated text images during transmission. The technical solution is as follows:
[0005] According to a first aspect of an embodiment of the present application, a text image encoding method is provided, the method comprising:
[0006] Obtain computer-generated text images;
[0007] Binarizing the text image to obtain a binary text image;
[0008] Encoding the binary text image to obtain a text encoding code stream;
[0009] The text encoding code stream is sent to a decoding device.
[0010] The text image decoding method of the embodiment of the present application can filter out the pixels at the edge of the text by binarizing the computer-generated text image to obtain a pure black and white binary text image, thereby reducing the data volume of the text image. Further, the amount of data transmitted can be reduced when the binary text image is encoded and transmitted.
[0011] In one embodiment, before sending the text encoding code stream to a decoding device, the method further includes:
[0012] A font mark is added to the text encoding code stream, and the font mark is used to mark the font used by the text in the text image.
[0013] In one embodiment, when the characters in the character image use at least two character libraries, adding a character library mark bit to the character encoding code stream includes:
[0014] Adding at least two font mark bits in the text encoding code stream, each font mark bit is used to mark a font;
[0015] The priorities of the at least two font markers are set according to the number of characters in each font used in the text image.
[0016] In one embodiment, before adding the font mark bit to the text encoding code stream, the method further includes:
[0017] The font library used by the text in the text image is determined according to the usage scenario of the text image, and the usage scenario of the text image includes: a text desktop image generated by a server, a text image in a desktop image generated by a server, or an ordinary text image.
[0018] In one embodiment, the binarization processing of the text image includes: performing grayscale processing on the text image to obtain a text grayscale image;
[0019] Get the grayscale threshold;
[0020] The pixel values of the pixels in the text grayscale image that are greater than the grayscale threshold are set to 255, and the pixel values of the pixels in the text grayscale image that are less than or equal to the grayscale threshold are set to 0.
[0021] According to a second aspect of an embodiment of the present application, a text image decoding method is provided, the method comprising:
[0022] Receiving a text encoding code stream sent by an encoding device;
[0023] Determine the font library used for the text according to the text encoding code stream;
[0024] Decoding the text encoding code stream to obtain a binary text image;
[0025] The binary text image is sharpened according to the determined character library to obtain a text image to be displayed.
[0026] The text image decoding method of the embodiment of the present application can receive a text encoding code stream sent by an encoding device. The text encoding code stream is obtained by binarizing a computer-generated text image and has a small amount of data.
[0027] In one embodiment, determining the font library used for the text according to the text encoding code stream includes:
[0028] Identifying a font marker in the text encoding code stream;
[0029] Reading the marking information of the marking position of the font library;
[0030] The font library used by the text is determined according to the marking information.
[0031] In one embodiment, the sharpening process of the binary text image according to the determined character library includes:
[0032] Comparing each character in the binary character image with the characters in the character library determined according to the marking information, and determining the font type used by each character in the binary character image through the comparison;
[0033] The text in the binary text image using the font type is sharpened using a sharpening method corresponding to the font type.
[0034] The text image decoding method of the embodiment of the present application can determine the character library used from the text encoding code stream, and use the character library to determine the font type used by each character in the binary text image, and then use the sharpening method corresponding to the font type to sharpen the characters using the font type in the binary text image, so that the sharpening is more targeted and the sharpening effect is better.
[0035] In one embodiment, the method of comparing each character in the binary character image with characters in a character library determined according to the marking information includes:
[0036] Performing text recognition on the binary text image;
[0037] Extract feature information of each recognized text;
[0038] Matching the feature information of each recognized character with the characters in the character library determined according to the marking information;
[0039] When a feature-matched character is matched in the character library, the font type corresponding to the feature-matched character is determined as the font type of the corresponding recognized character.
[0040] In one embodiment, when it is identified that the character encoding code stream includes at least two character library markers, the feature comparison of the feature information of each identified character with the characters in the character library determined according to the marker information includes:
[0041] Sorting the character library determined according to the mark information according to the priority order of the at least two character library mark bits;
[0042] For each recognized character, the feature information of the recognized character is matched with the characters in each character library in sequence according to the order of the character library.
[0043] According to a third aspect of an embodiment of the present application, there is provided a coding device, the coding device comprising a memory and a processor;
[0044] The memory is used to store a computer program, and the computer program can be executed by the processor to implement the text image encoding method as described in the first aspect above.
[0045] According to a fourth aspect of an embodiment of the present application, a decoding device is provided, the decoding device comprising a memory and a processor;
[0046] The memory is used to store a computer program, and the computer program can be executed by the processor to implement the text image encoding method described in the second aspect.
[0047] According to a fifth aspect of an embodiment of the present application, a text image encoding and decoding system is provided, which includes an encoding device as described in the third aspect above and a decoding device as described in the fourth aspect above.
[0048] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0050] Figure 1 is a flowchart of a text image encoding method provided by an embodiment of the present application;
[0051] Figure 2 is a flowchart of another text image encoding method provided by an embodiment of the present application;
[0052] Figure 3 is a flowchart of a text image decoding method provided by an embodiment of the present application;
[0053] Figure 4 is a flowchart of another text image decoding method provided by an embodiment of the present application;
[0054] Figure 5 It is a structural schematic diagram of a text image encoding device provided in an embodiment of the present application;
[0055] Figure 6 It is a structural schematic diagram of a text image decoding device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0057] The embodiment of the present application provides a text image encoding method, which is applied to an encoding device, and the encoding device may be a terminal device or a network server, such as Figure 1 As shown, the text image encoding method may include the following steps:
[0058] Step 101: Obtain a text image.
[0059] In the embodiment of the present application, the text image refers to a text image with black characters on a white background generated by a computer. The text image is subjected to image sharpening before display to achieve visual softness, and its edges are not just black pixels. The encoding device first obtains the text image generated by the computer.
[0060] Step 102: binarize the text image to obtain a binary text image.
[0061] After the encoding device acquires the text image, it performs binarization processing on the text image to obtain a binary text image.
[0062] Specifically, the encoding device can perform grayscale processing on the acquired text image to obtain a text grayscale image, obtain a grayscale threshold, set the pixel values of pixels in the text grayscale image that are greater than the grayscale threshold to 255, and set the pixel values of pixels in the text grayscale image that are less than or equal to the grayscale threshold to 0.
[0063] The grayscale threshold may be a fixed value pre-set based on experience, and its value may be adjusted. For example, a function of setting the grayscale threshold may be provided on the encoding device, and the grayscale threshold may be adjusted or set through the function.
[0064] The grayscale threshold may also be the average grayscale value of the current text grayscale image. If the grayscale threshold is the average grayscale value of the current text grayscale image, it is necessary to calculate the average grayscale value of the text grayscale image after obtaining the text grayscale image, and then determine the calculated average grayscale value as the grayscale threshold, and then set the pixel value of the pixel point in the text grayscale image according to the grayscale threshold to achieve binarization of the acquired text image.
[0065] After binarization processing according to the above scheme, a pure black and white binary text image will be obtained.
[0066] Step 103: Encode the binary text image to obtain a text encoding code stream.
[0067] After the encoding device obtains the binary text image, it encodes the binary text image to obtain a text encoding code stream. Specifically, any applicable text encoder can be used to encode the binary text image through an appropriate text encoding algorithm.
[0068] Step 104: Send the text encoding code stream to the decoding device.
[0069] After the encoding device encodes the binary text image to obtain a text encoding code stream, the text encoding code stream is sent to the decoding device, and the decoding device decodes the text encoding code stream.
[0070] The text image encoding method provided in the embodiment of the present application obtains a text image generated by a computer, and performs binarization processing on the text image to obtain a binary text image. The binarization processing can filter out the pixels at the edge of the text to obtain a pure black and white binary text image, thereby reducing the data volume of the text image; then, the binary text image is encoded to obtain a text encoding code stream. At this time, the data volume of the obtained text encoding code stream is also small, and when the text encoding code stream is sent to a decoding device, the amount of transmitted data can be reduced.
[0071] Based on the above Figure 1 Corresponding to the text image encoding method provided in the embodiment, the embodiment of the present application provides another text image encoding method, which is applied to an encoding device, and the encoding device can be a terminal device or a network server, such as Figure 2 As shown, the text image encoding method may include the following steps:
[0072] Step 201: Acquire a text image.
[0073] Step 202: binarize the text image to obtain a binary text image.
[0074] Step 203: Encode the binary text image to obtain a text encoding code stream.
[0075] Step 204: Add a font marker to the text encoding code stream.
[0076] After the encoding device encodes the binary text image to obtain the text encoding code stream, a font mark is added to the text encoding code stream, and the font mark is used to mark the font used by the text in the text image. Specifically, the text in the current frame text image may use only one font or at least two fonts.
[0077] If the text in the current frame text image uses only one font library, after obtaining the text encoding code stream of the text image, a font library mark bit is added to the text encoding code stream, and the font library mark bit is used to mark the font library used by the text in the current frame text image.
[0078] If the text in the current frame text image uses at least two fonts, then after obtaining the text encoding code stream of the text image, at least two font mark bits are added to the text encoding code stream, and each font mark bit is used to mark a font. In one embodiment, a priority can be set between the at least two font mark bits. For example, the priority of the at least two font mark bits can be set according to the number of characters in each font used in the current frame text image. Specifically, the fonts used by the text in the current frame text image can be stored in font mark bits corresponding to different priorities from large to small according to the number of characters using the font. For example, the more characters using the corresponding font, the higher the priority of the font. In practical applications, what is stored in the font mark bit can be, for example, an identifier for distinguishing between fonts.
[0079] In an optional implementation, before the encoding device adds the font mark bit to the obtained text encoding code stream, it further performs the step of determining the font used by the text in the current frame text image. In this step, the encoding device can determine the font used by the text in the text image according to the usage scenario of the current frame text image, wherein the usage scenario of the text image includes: a text desktop image generated by a server, a text image in a desktop image generated by a server, or an ordinary text image.
[0080] Specifically, when determining the font used by the text in the current frame text image, different processing schemes can be used according to different usage scenarios. For the scenario of text desktop images generated by the server and text images in desktop images generated by the server, that is, the desktop image transmission scenario in the cloud desktop or desktop virtualization scenario, in this scenario, the text image currently being processed is the desktop image or part of the desktop image generated by the server according to the user's operation. The text image is used to be encoded by the server and sent to the client or zero terminal. Therefore, the current server can identify the font currently used by the user according to the operation instructions currently executed by the user.
[0081] For ordinary text images, that is, ordinary image encoding and transmission scenarios, in this scenario, the encoding device can recognize the text in the current frame text image to determine its corresponding font library. Specifically, the encoding device can compare the text in the current frame text image with various font libraries to determine the font library used by the text in the current frame text image.
[0082] Step 205: Send the text encoding code stream with the font mark added to the decoding device.
[0083] After the encoding device adds the font mark bit to the obtained text encoding code stream, the text encoding code stream with the added font mark bit is sent to the decoding device, and the decoding device decodes the text encoding code stream.
[0084] The above steps 201 to 203 are Figure 1 Steps 101 to 103 in the corresponding embodiments correspond to each other one by one, and the specific implementation process can refer to steps 101 to 103.
[0085] The text image encoding method provided in the embodiment of the present application obtains a text image generated by a computer, performs binarization processing on the text image to obtain a binarized text image, and the pixel points at the edge of the text can be filtered out by binarization processing to obtain a pure black and white binary text image, thereby reducing the data volume of the text image, and the data volume of the text encoding code stream obtained by this encoding is greatly reduced, thereby reducing the data volume of the encoding code stream transmission. Moreover, before the text encoding code stream is transmitted to the decoding device, a font mark bit can be added to mark the font used by the text in the text image, so that it can be pre-confirmed during encoding which font library is used for the text in the text image, so as to facilitate the knowledge of the type of text in the text image during decoding.
[0086] Based on the above Figure 1 Corresponding to the text image encoding method provided in the embodiment, the embodiment of the present application provides a text image decoding method, which is applied to a decoding device, and the decoding device can be a terminal device or a network server, such as Figure 3 As shown, the text image decoding method may include the following steps:
[0087] Step 301: Receive a text encoding code stream sent by an encoding device.
[0088] The decoding device receives a text encoding code stream sent by the encoding device, and the text encoding code stream is obtained by encoding the text image after binarization processing by the encoding device.
[0089] Step 302: Decode the text encoding code stream to obtain a binary text image.
[0090] The decoding device decodes the received text encoding code stream to obtain a binary text image.
[0091] Step 303: sharpening the binary text image to obtain a text image to be displayed.
[0092] After the decoding device obtains the binary text image, it performs sharpening processing on the binary text image to obtain the text image to be displayed.
[0093] The text image decoding method provided in this embodiment is applied to a decoding device, which decodes the text encoding code stream sent by the encoding device to obtain a binary text image, and sharpens the binary text image so that the text image can be restored to a normal display effect without affecting the user's viewing.
[0094] Based on the above Figure 2 Corresponding to the text image encoding method provided in the embodiment, the embodiment of the present application provides another text image decoding method, which is applied to a decoding device, and the decoding device can be a terminal device or a network server, such as Figure 4 As shown, the text image decoding method may include the following steps:
[0095] Step 401: Receive a text encoding code stream sent by an encoding device.
[0096] The decoding device receives a text encoding code stream sent by the encoding device, and the text encoding code stream is obtained by encoding the text image after binarization processing by the encoding device.
[0097] Step 402: Determine the font library used for the text according to the text encoding code stream.
[0098] After receiving the text encoding code stream, the decoding device determines the font library used by the text according to the text encoding code stream. Specifically, the decoding device first identifies the font library mark bit in the text encoding code stream, then reads the mark information of the font library mark bit, and then determines the font library used by the text according to the mark information. In other words, the decoding device can determine the font library used by the text in the current encoded image after extracting the mark information in the font library mark bit from the encoding code stream. The number of font libraries can be one or more.
[0099] Step 403: Decode the text encoding code stream to obtain a binary text image.
[0100] After receiving the text encoding code stream, the decoding device decodes the text encoding code stream to obtain a binary text image. Specifically, the decoding device can decode the current encoding code stream according to the text decoding method corresponding to the text encoding method used by the current encoded image. The image obtained after decoding is the binary text image obtained by the encoding device in step 102 or step 202. In the binary text image, since the encoding device filters out some pixels on the edge of the text when performing the binarization processing, the edge of the text in the binary text image will appear jagged. Therefore, these binary text images cannot be directly displayed to the user and need to be further sharpened.
[0101] Step 404: sharpening the binary text image to obtain a text image to be displayed.
[0102] After the decoding device obtains the binary text image, it performs sharpening processing on the binary text image. Specifically, the binary text image can be sharpened according to the character library determined in step 402 to obtain the text image to be displayed.
[0103] In this step, the decoding device compares each character in the binary text image with the characters in the character library determined according to the mark information of the character library mark bit, and determines the font type used by each character in the binary text image through the comparison. That is to say, the decoding device first performs character recognition on the current frame binary text image, and compares the font type of each recognized character. The specific comparison method can be:
[0104] Performing text recognition on the binary text image;
[0105] Extracting feature information of each recognized character, the feature information may be, for example, geometric feature information of the character;
[0106] Matching the feature information of each recognized character with the characters in the character library determined according to the tag information, such as matching the geometric features of the characters;
[0107] When a feature-matched character is matched in the character library, the font type corresponding to the feature-matched character is determined as the font type of the corresponding recognized character.
[0108] In the above text feature matching process, if it is recognized that the text encoding code stream includes at least two font mark bits, the corresponding font is determined, and the font determined according to the mark information is sorted according to the priority order of the at least two font mark bits; for each recognized text, according to the font sorting, the feature information of the recognized text is sequentially matched with the text in each font. Specifically, the text feature matching is first performed in the font with the highest priority. If the corresponding text is not matched, the text feature matching is continued in the next font according to the priority order, and so on, until the corresponding text is matched.
[0109] After the decoding device determines the font type used by each character in the binary text image, the text using the font type in the binary text image is sharpened using a sharpening method corresponding to the font type. For example, the binary text image includes the two characters "Image", the font type used by the character "Image" is type 1, and the font type used by the character "Image" is type 2. The sharpening method corresponding to type 1 is the gradient operator method, and the sharpening method corresponding to type 2 is the second-order derivative operator method. Then, the decoding device uses the gradient operator method to sharpen the character "Image", and uses the second-order derivative operator method to sharpen the character "Image".
[0110] After the sharpening process of all characters in the entire binary character image is completed, the final character image to be displayed is obtained.
[0111] The text image decoding method provided in this embodiment is applied to a decoding device. The decoding device receives a text encoding code stream sent by an encoding device, determines the font library used by the text according to the text encoding code stream, decodes the text encoding code stream to obtain a binary text image, and sharpens the binary text image according to the determined font library to obtain a text image to be displayed. By decoding and sharpening the text encoding code stream sent by the encoding device, the text image can be restored to a normal display effect without affecting the user's viewing. During the processing, the font library used can be determined from the text encoding code stream, and the font type used by each text in the binary text image can be determined using the font library, and then the text using the font type in the binary text image is sharpened using a sharpening method corresponding to the font type. The sharpening process is flexible and more targeted, and the sharpening effect is better.
[0112] Based on the above Figure 1 and Figure 2 The text image encoding method described in the corresponding embodiment is as follows: an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application.
[0113] The present application embodiment provides a text image encoding device, such as Figure 5 As shown, the text image encoding device 50 includes: an acquisition module 501, a binarization processing module 502, an encoding module 503 and a sending module 504.
[0114] The acquisition module 501 is used to acquire a text image generated by a computer.
[0115] The binarization processing module 502 is used to perform binarization processing on the text image acquired by the acquisition module 501 to obtain a binarized text image. In one embodiment, the binarization processing module 502 can perform binarization processing on the text image by the following method: grayscale processing is performed on the text image to obtain a text grayscale image; a grayscale threshold is obtained; the pixel values of the pixels in the text grayscale image that are greater than the grayscale threshold are set to 255, and the pixel values of the pixels in the text grayscale image that are less than or equal to the grayscale threshold are set to 0.
[0116] The encoding module 503 is used to encode the binary text image obtained by the binarization processing module 502 to obtain a text encoding code stream.
[0117] The sending module 504 is used to send the text encoding code stream obtained by the encoding module 503 to the decoding device.
[0118] In one embodiment, the encoding module 503 is further used to add a font mark bit to the obtained text encoding code stream, and the font mark bit is used to mark the font used by the text in the text image obtained by the obtaining module 501.
[0119] In one embodiment, when the number of fonts used by the text in the text image acquired by the acquisition module 501 is at least two, the encoding module 503 is specifically used to add at least two font mark bits in the obtained text encoding code stream, each font mark bit is used to mark a font, and then set priorities for the at least two font mark bits according to the number of characters in each font used in the text image.
[0120] In one embodiment, the encoding module 503 is also used to determine the font used by the text in the text image according to the usage scenario of the text image before adding the font mark bit in the text encoding code stream. The usage scenario of the text image includes: a text desktop image generated by a server, a text image in a desktop image generated by a server, or an ordinary text image.
[0121] The text image encoding device 50 provided in the embodiment of the present application obtains a text image generated by a computer, performs binarization processing on the text image to obtain a binarized text image, and the pixel points at the edge of the text can be filtered out by the binarization processing to obtain a pure black and white binary text image, thereby reducing the data volume of the text image, and the data volume of the text encoding code stream obtained by this encoding is greatly reduced, thereby reducing the data volume of the encoding code stream transmission. Before the text encoding code stream is transmitted to the decoding device, a font mark bit can also be added to mark the font used by the text in the text image, so that it can be confirmed in advance during encoding which font library is used for the text in the text image, so as to facilitate the knowledge of the type of text in the text image during decoding.
[0122] Based on the above Figure 3 and Figure 4 Corresponding to the text image decoding method described in the embodiment, the embodiment of the present application provides a text image decoding device, which can be used to execute the method embodiment of the present application. Figure 6 As shown, the text image decoding device 06 includes: a receiving module 601, a character library determination module 602, a decoding module 603 and a sharpening module 604.
[0123] The receiving module 601 is used to receive the text encoding code stream sent by the encoding device 05.
[0124] The character library determination module 602 is used to determine the character library used by the text according to the character encoding code stream received by the receiving module 601 .
[0125] The decoding module 603 is used to decode the text encoding code stream received by the receiving module 601 to obtain a binary text image.
[0126] The sharpening module 604 is used to perform sharpening processing on the binary text image obtained by the decoding module 603 according to the character library determined by the character library determination module 602 to obtain a text image to be displayed.
[0127] In one embodiment, the font determination module 602 can determine the font used by the text by the following method: identifying the font mark bit in the text encoding code stream; reading the mark information of the font mark bit; and determining the font used by the text according to the mark information.
[0128] In one embodiment, the sharpening module 604 can sharpen the binary text image obtained by the decoding module 603 by the following method: compare each character in the binary text image with the characters in the character library determined according to the marking information, and determine the font type used by each character in the binary text image through the comparison; use the sharpening method corresponding to the font type to sharpen the characters in the binary text image that use the font type.
[0129] In one embodiment, the sharpening module 604 may use the following method to perform text comparison: perform text recognition on a binary text image; extract feature information of each recognized text; perform text feature matching on the feature information of each recognized text with the text in the character library determined based on the tag information; when a feature-matched text is matched in the character library, determine the font type corresponding to the feature-matched text as the font type of the corresponding recognized text.
[0130] In one embodiment, when it is recognized that the text encoding code stream includes at least two font mark bits, the sharpening module 604 is specifically used to sort the font determined according to the mark information according to the priority order of the at least two font mark bits, and for each recognized text, according to the sorting of the font, match the feature information of the recognized text with the text in each font in turn.
[0131] The text image decoding device provided in the embodiment of the present application receives the text encoding code stream sent by the encoding device, determines the font library used by the text according to the text encoding code stream, decodes the text encoding code stream to obtain a binary text image, and sharpens the binary text image according to the determined font library to obtain the text image to be displayed. By decoding and sharpening the text encoding code stream sent by the encoding device, the text image can be restored to a normal display effect without affecting the user's viewing. During the processing, the font library used can be determined from the text encoding code stream, and the font type used by each text in the binary text image can be determined using the font library, and then the text using the font type in the binary text image is sharpened using a sharpening method corresponding to the font type. The sharpening process is flexible and more targeted, and the sharpening effect is better.
[0132] The embodiment of the present application also provides a coding device, which includes a memory and a processor, wherein the memory is used to store a computer program, and the computer program can be executed by the processor to implement the above Figure 1 or Figure 2 The text image encoding method described in the corresponding embodiment.
[0133] The present application also provides a decoding device, which includes a memory and a processor, wherein the memory is used to store a computer program, and the computer program can be executed by the processor to implement the above Figure 3 or Figure 4 The text image encoding method described in the corresponding embodiment.
[0134] An embodiment of the present application also provides a text image encoding and decoding system, which includes the encoding device and the decoding device of the above embodiment.
[0135] Based on the text image encoding method and text image decoding method described in the above embodiments, the present application embodiment further provides a computer-readable storage medium, for example, the non-temporary computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc. The storage medium stores computer instructions for executing the text image encoding method and text image decoding method described in the above embodiments, which will not be described in detail here.
[0136] Those skilled in the art will readily appreciate other embodiments of the present application after considering the description and practicing the contents disclosed herein. The present application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims of the present application.
[0137] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A text image encoding method, characterized in that: The method comprises: Obtain computer-generated text images; Binarizing the text image to obtain a binary text image; Encoding the binary text image to obtain a text encoding code stream; The character encoding code stream is sent to a decoding device, so that the decoding device receives the character encoding code stream sent by the encoding device, determines the font library used by the character according to the character encoding code stream, decodes the character encoding code stream to obtain a binary character image, and performs sharpening processing on the binary character image according to the determined font library to obtain a character image to be displayed; Before sending the text encoding code stream to a decoding device, the method further includes: A font mark is added to the text encoding code stream, and the font mark is used to mark the font used by the text in the text image.
2. The method according to claim 1, characterized in that When the characters in the character image use at least two character libraries, adding a character library mark bit to the character encoding code stream includes: Adding at least two font mark bits in the text encoding code stream, each font mark bit is used to mark a font; The priorities of the at least two font markers are set according to the number of characters in each font used in the text image.
3. The method according to claim 1, characterized in that: Before adding the font mark bit to the text encoding code stream, the method further includes: The font library used by the text in the text image is determined according to the usage scenario of the text image, and the usage scenario of the text image includes: a text desktop image generated by a server, a text image in a desktop image generated by a server, or an ordinary text image.
4. The method according to any one of claims 1 to 3, characterized in that The binarization processing of the text image comprises: Performing grayscale processing on the text image to obtain a text grayscale image; Get the grayscale threshold; The pixel values of the pixel points in the text grayscale image that are greater than the grayscale threshold are set to 255, and the pixel values of the pixel points in the text grayscale image that are less than or equal to the grayscale threshold are set to 0.
5. A text image decoding method, characterized in that: include: Receiving a text encoding code stream sent by an encoding device; Determine the font library used for the text according to the text encoding code stream; Decoding the text encoding code stream to obtain a binary text image; sharpening the binary text image according to the determined character library to obtain a text image to be displayed; The character library used for determining the character according to the character encoding code stream comprises: Identifying a font marker in the text encoding code stream; Reading the marking information of the marking position of the font library; The font library used by the text is determined according to the marking information.
6. The method according to claim 5, characterized in that The sharpening process of the binary text image according to the determined character library comprises: Comparing each character in the binary character image with the characters in the character library determined according to the marking information, and determining the font type used by each character in the binary character image through the comparison; The text in the binary text image using the font type is sharpened using a sharpening method corresponding to the font type.
7. The method according to claim 6, characterized in that The method of comparing each character in the binary character image with the characters in the character library determined according to the marking information comprises: Performing text recognition on the binary text image; Extract feature information of each recognized word; Matching the feature information of each recognized character with the characters in the character library determined according to the marking information; When a feature-matched character is matched in the character library, the font type corresponding to the feature-matched character is determined as the font type of the corresponding recognized character.
8. The method according to claim 7, characterized in that When it is identified that the character encoding code stream includes at least two character library markers, the feature comparison of the feature information of each identified character with the characters in the character library determined according to the marker information includes: Sorting the character library determined according to the mark information according to the priority order of the at least two character library mark bits; For each recognized character, according to the order of the character library, the feature information of the recognized character is matched with the characters in each character library in turn.
9. A coding device, characterized in that: The encoding device includes a memory and a processor; The memory is used to store a computer program, and the computer program can be executed by the processor to implement the text image encoding method as described in any one of claims 1 to 4, and send the text encoding code stream encoded according to the encoding method to a decoding device, so that the decoding device receives the text encoding code stream sent by the encoding device, and determines the font library used for the text according to the text encoding code stream, and decodes the text encoding code stream to obtain a binary text image, and sharpens the binary text image according to the determined font library to obtain a text image to be displayed.
10. A decoding device, characterized in that: The decoding device includes a memory and a processor; The memory is used to store a computer program, and the computer program can be executed by the processor to implement the text image encoding method according to any one of claims 6 to 8.
11. A text image encoding and decoding system, characterized in that: The text image encoding and decoding system includes the encoding device described in claim 9 and the decoding device described in claim 10.
