Text image generation and display method and device

By converting text information into text images and generating halftone images and area segmentation masks, dynamically alternately displaying segmented images, solving the problem that the prior art cannot prevent text information copying, and achieving high security display of text information.

CN119722699APending Publication Date: 2025-03-28ALIBABA (CHINA) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411657512.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

The prior art is difficult to prevent text information from being copied on the basis of keeping text information readable, especially not to prevent copying by screenshots or other means.

Method used

By converting text information into text images and generating halftone images and area segmentation masks, the segmented images are displayed dynamically alternately to improve the security of text information.

Benefits of technology

While maintaining the readability of text information, it effectively prevents text information from being copied, improves the security of text information, and reduces the success rate of OCR tools and illegal replication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119722699A_ABST
    Figure CN119722699A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a text image generation and display method and device. In the embodiment of the invention, text information is acquired; the text information is converted into a text image, the text in the text image is at least one first color, and the background in the text image is a second color; generating a halftone image according to the text image, and generating a region segmentation mask corresponding to the text image; segmenting the halftone image according to the region segmentation mask to generate at least two segmented images; and dynamically and alternately displaying the at least two segmented images according to a set frequency. Through the method, the text information is prevented from being copied on the basis of keeping the text information readable, and the safety of the text information is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and more specifically, to a method and device for generating and displaying a text image. Background Art

[0002] With the rapid development of information technology, information security has become one of the core issues in the digital age, especially in areas involving the processing of sensitive text information, such as financial transactions, government administration, medical health records, and intellectual property protection. Ensuring the confidentiality of sensitive text information and preventing leakage has become a vital task. Display devices face many security challenges when displaying sensitive text information on the screen, especially the popularity of copying technology, which makes the displayed sensitive text information easy to be obtained and disseminated without authorization. Common copying technologies include direct text copying, taking photos, screen recording, screenshots, and other means.

[0003] In the prior art, a screen anti-theft camera method based on pulse width modulation (PWM) brightness adjustment is adopted. Specifically, the brightness of the display screen is adjusted by adjusting the duty cycle of the PWM signal, the controllable display screen is divided into different partitions, and a power supply PWM signal with a specific frequency and phase is generated for each partition. The PWM signal is adjusted and optimized by utilizing the visual persistence characteristic of the human eye for images, so as to ensure that the displayed content on the display screen cannot be completely captured by the camera without interfering with the normal viewing of the human eye. The above method is only applicable to specific display screens and devices, and excessive adjustment may cause problems such as uneven screen brightness or flickering, affecting the normal use and viewing of users, and can only prevent copying by taking photos, but cannot prevent copying by taking screenshots.

[0004] In summary, how to prevent text information from being copied while keeping the text information readable is a problem that needs to be solved at present. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a method and device for generating and displaying a text image, which can prevent the text information from being copied while keeping the text information readable, thereby improving the security of the text information.

[0006] In a first aspect, an embodiment of the present invention provides a method for generating and displaying a text image, the method comprising:

[0007] Get text information;

[0008] Converting the text information into a text image, wherein the text in the text image is in at least one first color and the background in the text image is in a second color;

[0009] Generating a halftone image according to the text image, and generating a region segmentation mask corresponding to the text image;

[0010] Segmenting the halftone image according to the region segmentation mask to generate at least two segmented images;

[0011] The at least two segmented images are dynamically and alternately displayed according to a set frequency.

[0012] Optionally, converting the text information into a text image specifically includes:

[0013] The text information is input into a set text-to-image conversion tool to generate a text-to-image.

[0014] Optionally, generating a halftone image according to the text image specifically includes:

[0015] Converting the text image into a grayscale image;

[0016] Traversing each target pixel in the grayscale image, and calculating the radius of the target area corresponding to each target pixel;

[0017] Determine the scattered points corresponding to each target pixel according to the radius of the target area;

[0018] The halftone image is generated based on the plurality of scattered points.

[0019] Optionally, converting the text image into a grayscale image specifically includes:

[0020] Traversing each target pixel in the text image, and determining the RGB value of each target pixel;

[0021] The grayscale value of each target pixel is determined according to the RGB value of each target pixel.

[0022] Optionally, determining the grayscale value of each target pixel according to the RGB value of each target pixel specifically includes:

[0023] Determine a first weight, a second weight, and a third weight corresponding to the RGB values ​​respectively;

[0024] Determine a first product, a second product and a third product respectively, wherein the first product is the product of the R value in the RGB value and the first weight, the second product is the product of the G value in the RGB value and the second weight, and the third product is the product of the B value in the RGB value and the third weight;

[0025] The sum of the first product, the second product and the third product is determined as the grayscale value of each target pixel.

[0026] Optionally, traversing each target pixel in the grayscale image and calculating the radius of the target area corresponding to each target pixel specifically includes:

[0027] Traversing each target pixel in the grayscale image, and determining a target area corresponding to each target pixel, wherein the target area includes each target pixel and other pixels whose distance to each target pixel is less than or equal to a set step size;

[0028] Obtaining the grayscale values ​​of all pixels in the target area and determining the average grayscale value of the target area;

[0029] The radius of the target area is determined according to the average gray value.

[0030] Optionally, determining the scattered points corresponding to each target pixel according to the radius of the target area specifically includes:

[0031] Acquire the coordinates of the target pixel and the coordinates of the other pixels in the target area, and in response to the coordinates of the other pixels meeting the setting rule, set the color of the other pixels to the first color; in response to the coordinates of the other pixels not meeting the setting rule, set the color of the other pixels to the second color, wherein the setting rule is determined according to the coordinates of the target pixel and the radius of the target area;

[0032] The scattered points corresponding to the target pixel are determined according to the set colors of the other pixels.

[0033] Optionally, the generating a region segmentation mask corresponding to the text image specifically includes:

[0034] Generate a unit mask image, wherein each pixel in the unit mask image is at least two random colors;

[0035] The unit mask image is enlarged to the size of the text image to generate the region segmentation mask.

[0036] Optionally, segmenting the halftone image according to the region segmentation mask to generate at least two segmented images specifically includes:

[0037] Traversing each target pixel of the region segmentation mask, in response to the target pixel being the second color, setting the target pixel at the same position of one of the segmented images to the second color, and setting the target pixels at the same position of the remaining segmented images to the first color.

[0038] In a second aspect, an embodiment of the present invention provides a device for generating and displaying a text image, the device comprising:

[0039] An acquisition unit, used for acquiring text information;

[0040] A conversion unit, configured to convert the text information into a text image, wherein the text in the text image is in at least one first color and the background in the text image is in a second color;

[0041] A generating unit, configured to generate a halftone image according to the text image, and generate a region segmentation mask corresponding to the text image;

[0042] a segmentation unit, configured to segment the halftone image according to the region segmentation mask to generate at least two segmented images;

[0043] The display unit is used to dynamically and alternately display the at least two segmented images according to a set frequency.

[0044] Optionally, the conversion unit is specifically used for:

[0045] The text information is input into a set text-to-image conversion tool to generate a text-to-image.

[0046] Optionally, the generating unit is specifically used for:

[0047] Converting the text image into a grayscale image;

[0048] Traversing each target pixel in the grayscale image, and calculating the radius of the target area corresponding to each target pixel;

[0049] Determine the scattered points corresponding to each target pixel according to the radius of the target area;

[0050] The halftone image is generated based on the plurality of scattered points.

[0051] Optionally, the generating unit is specifically used for:

[0052] Traversing each target pixel in the text image, and determining the RGB value of each target pixel;

[0053] The grayscale value of each target pixel is determined according to the RGB value of each target pixel.

[0054] Optionally, the generating unit is specifically used for:

[0055] Determine a first weight, a second weight, and a third weight corresponding to the RGB values ​​respectively;

[0056] Determine a first product, a second product and a third product respectively, wherein the first product is the product of the R value in the RGB value and the first weight, the second product is the product of the G value in the RGB value and the second weight, and the third product is the product of the B value in the RGB value and the third weight;

[0057] The sum of the first product, the second product and the third product is determined as the grayscale value of each target pixel.

[0058] Optionally, the generating unit is specifically used for:

[0059] Traversing each target pixel in the grayscale image, and determining a target area corresponding to each target pixel, wherein the target area includes each target pixel and other pixels whose distance to each target pixel is less than or equal to a set step size;

[0060] Obtaining the grayscale values ​​of all pixels in the target area and determining the average grayscale value of the target area;

[0061] The radius of the target area is determined according to the average gray value.

[0062] Optionally, the generating unit is specifically used for:

[0063] Acquire the coordinates of the target pixel and the coordinates of the other pixels in the target area, and in response to the coordinates of the other pixels meeting the setting rule, set the color of the other pixels to the first color; in response to the coordinates of the other pixels not meeting the setting rule, set the color of the other pixels to the second color, wherein the setting rule is determined according to the coordinates of the target pixel and the radius of the target area;

[0064] The scattered points corresponding to the target pixel are determined according to the set colors of the other pixels.

[0065] Optionally, the generating unit is specifically used for:

[0066] Generate a unit mask image, wherein each pixel in the unit mask image is at least two random colors;

[0067] The unit mask image is enlarged to the size of the text image to generate the region segmentation mask.

[0068] Optionally, the segmentation unit is specifically used for:

[0069] Traversing each target pixel of the region segmentation mask, in response to the target pixel being the second color, setting the target pixel at the same position of one of the segmented images to the second color, and setting the target pixels at the same position of the remaining segmented images to the first color.

[0070] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a memory and a processor, the memory being used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement a method as described in the first aspect or any possible embodiment of the first aspect.

[0071] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement a method as described in the first aspect or any possible embodiment of the first aspect.

[0072] In an embodiment of the present invention, text information is obtained; the text information is converted into a text image, wherein the text in the text image is at least one first color and the background in the text image is a second color; a halftone image is generated according to the text image, and a region segmentation mask corresponding to the text image is generated; the halftone image is segmented according to the region segmentation mask to generate at least two segmented images; and the at least two segmented images are dynamically and alternately displayed at a set frequency. Through the above method, the text information is prevented from being copied while keeping the text information readable, thereby improving the security of the text information. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] The above and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:

[0074] Figure 1 is a flow chart of a method for generating and displaying a text image in an embodiment of the present invention;

[0075] Figure 2 is a flow chart of a method for generating a halftone image from a text image in an embodiment of the present invention;

[0076] Figure 3 is a schematic diagram of a halftone image in an embodiment of the present invention;

[0077] Figure 4 is a schematic diagram of a region segmentation mask in an embodiment of the present invention;

[0078] Figure 5 is a schematic diagram of image segmentation in an embodiment of the present invention;

[0079] Figure 6 is another schematic diagram of segmenting an image in an embodiment of the present invention;

[0080] Figure 7 is a schematic diagram of a device for generating and displaying a text image in an embodiment of the present invention;

[0081] Figure 8is a schematic diagram of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

[0082] The present application is described below based on embodiments, but the present application is not limited to these embodiments. In the detailed description of the present application below, some specific details are described in detail. It is possible for those skilled in the art to fully understand the present application without the description of these details. In order to avoid confusing the essence of the present application, known methods, processes, flows, components and circuits are not described in detail.

[0083] In addition, persons of ordinary skill in the art will appreciate that the drawings provided herein are for illustration purposes and are not necessarily drawn to scale.

[0084] Unless the context clearly requires otherwise, the words "include", "comprising" and similar words throughout the application should be interpreted as including rather than exclusive or exhaustive; that is, the meaning is "including but not limited to".

[0085] In the description of this application, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, the meaning of "plurality" is two or more.

[0086] In the prior art, text information copying refers to the process of generating an identical copy of the original information. The copying can be done by direct text copying, taking photos, screen recording, screenshots, and other means. The above text copying is to copy the selected text content to the clipboard; the above photo taking is to take photos of the real object or the screen to create a copy of the image; the above screen recording is to record the activities on the screen to form a video file; the above screenshot is to capture the screen currently displayed and save it as an image; if a text image carrying text information is generated, optical character recognition (OCR) can be performed, wherein the OCR is a technology that converts text in an image into electronic text. OCR technology can automatically recognize and convert text images obtained by scanning or taking photos into editable and searchable data formats.

[0087] In the prior art, a screen anti-theft method based on pulse width modulation (PWM) brightness adjustment is used to prevent the text information displayed on the screen from being copied. Specifically, the brightness of the display screen is adjusted by adjusting the duty cycle of the PWM signal, the controllable display screen is divided into different partitions, and a power supply PWM signal with a specific frequency and phase is generated for each partition. The PWM signal is adjusted and optimized by using the visual persistence characteristics of the human eye to the image, ensuring that the content displayed on the display screen cannot be completely captured by the camera without interfering with the normal viewing of the human eye; the above method is only applicable to specific display screens and devices, that is, it depends on specific hardware, specifically on the PWM controller and partition function of the device. The PWM controller and partition function between different devices may be different, resulting in the above method being unable to be implemented or having poor effect on some devices; and excessive adjustment may cause problems such as uneven screen brightness or flickering, affecting the normal use and viewing of users, and it can only prevent copying by taking photos, but cannot prevent copying by taking screenshots. Therefore, how to prevent text information from being copied while keeping the text information readable is a problem that needs to be solved at present.

[0088] In order to solve the above problems, a method for generating and displaying text images is proposed in the embodiment of the present invention. Figure 1 As shown, the method includes:

[0089] Step S101: Obtain text information.

[0090] Specifically, the text information is information that needs to be displayed on the screen, including words and symbols.

[0091] Step S102: Convert the text information into a text image.

[0092] The text in the text image is in at least one first color, and the background in the text image is in a second color.

[0093] Specifically, the text information is input into a set text-to-image conversion tool to generate a text image.

[0094] In a possible implementation, it is assumed that the text information is converted into a text image I with a white background and black text content. r , the text image I r The length is H and the width is W. Through the text image conversion tool, the text information is accurately presented in the text image.

[0095] In a possible implementation, the color of the text content may be red, green, etc., or may be colored text composed of two or more colors. The color of the background may be yellow, purple, orange, etc., whichever is different from the color of the text content. The specific color is determined according to actual conditions and is not limited in the embodiments of the present invention.

[0096] Step S103: generating a halftone image according to the text image, and generating a region segmentation mask corresponding to the text image.

[0097] In a possible implementation, the specific flow chart of generating a halftone image according to the text image is as follows: Figure 2 As shown, specifically including:

[0098] Step S201: convert the text image into a grayscale image.

[0099] Specifically, each target pixel in the text image is traversed to determine the RGB value of each target pixel; and the grayscale value of each target pixel is determined according to the RGB value of each target pixel.

[0100] In a possible implementation, determining the grayscale value of each target pixel according to the RGB value of each target pixel specifically includes: determining a first weight, a second weight, and a third weight corresponding to the RGB values, respectively; determining a first product, a second product, and a third product, respectively, wherein the first product is the product of the R value in the RGB value and the first weight, the second product is the product of the G value in the RGB value and the second weight, and the third product is the product of the B value in the RGB value and the third weight; and determining the sum of the first product, the second product, and the third product as the grayscale value of each target pixel.

[0101] For example, assuming that the coordinates of each target pixel are (x, y), and the corresponding RGB value of the target pixel is (r1, g1, b1), the grayscale value of each target pixel is determined according to the standard weighted formula g(x, y) = 0.299×r1+0.587×g1+0.114×b1, where the first weight is 0.299, the second weight is 0.587, and the third weight is 0.114. The values ​​of the weights are determined according to actual conditions and are only for exemplary purposes.

[0102] Step S202: traverse each target pixel in the grayscale image and calculate the radius of the target area corresponding to each target pixel.

[0103] Specifically, traverse each target pixel in the grayscale image to determine the target area corresponding to each target pixel, wherein the target area includes each target pixel and other pixels whose distance to each target pixel is less than or equal to a set step size; obtain the grayscale values ​​of all pixels in the target area to determine the average grayscale value of the target area; and determine the radius of the target area according to the average grayscale value.

[0104] For example, the target pixel coordinates are (x, y), and with (x, y) as the center, other pixels whose distance from each target pixel is less than or equal to the set step size D constitute the target area corresponding to each target pixel. The sum of the grayscale values ​​of all pixels in the target area is:

[0105]

[0106] Then, the average gray value of the target area is determined as:

[0107]

[0108] The radius of the target area is determined by the average gray value:

[0109]

[0110] Step S203: determining the scattered points corresponding to each target pixel according to the radius of the target area.

[0111] Specifically, the coordinates of the target pixel and the coordinates of the other pixels in the target area are obtained, and in response to the coordinates of the other pixels meeting the set rules, the colors of the other pixels are set to the first color; in response to the coordinates of the other pixels not meeting the set rules, the colors of the other pixels are set to the second color, wherein the set rules are determined based on the coordinates of the target pixel and the radius of the target area; and the scattered points corresponding to the target pixel are determined based on the colors of the other pixels after the setting.

[0112] For example, the coordinates (x, y) of the target pixel and the coordinates (p, q) of the other pixels in the target area are obtained, wherein the coordinate values ​​of each other pixel are different and are uniformly expressed as (p, q) here, and the specific values ​​are determined according to the actual situation; each other pixel is judged whether it meets the following set rules:

[0113]

[0114] Among them, x≤p≤x+D, y≤q≤y+D.

[0115] In one possible implementation, in response to the coordinates of the other pixels meeting a set rule, the colors of the other pixels are set to the first color; assuming that the first color of the text content is black, the colors of the other pixels are set to black; if the first color of the text content is another color, the colors of the other pixels are set to the same color as the first color of the text content.

[0116] In one possible implementation, in response to the coordinates of the other pixels not meeting the set rules, the colors of the other pixels are set to the second color; assuming that the second color of the background is white, the colors of the other pixels are set to white; if the second color of the background is other colors, the colors of the other pixels are set to the same color as the second color of the background.

[0117] In the embodiment of the present invention, multiple scattered points can be determined by the above method.

[0118] Step S204: Generate the halftone image according to the plurality of scattered points.

[0119] Specifically, assuming that the text content in the text image is "halftone technology is widely used in printers", the generated halftone image is as follows: Figure 3 As shown, each word in the “halftone technology is widely used in printers” is composed of multiple scattered dots.

[0120] In an embodiment of the present invention, the technology for generating a halftone image based on the text image is called halftone technology. The halftone technology is a technology that uses scattered dots of different sizes, shapes or distribution densities to simulate continuous tones when printing or displaying images. In black and white images, changes in the size of scattered dots can be used to represent different grayscale levels. In color images, colors are reproduced by combining scattered dots of different colors. The reason why halftone technology can be realized is that it utilizes the low-pass characteristics of the human eye. When the human visual system observes an image, the human eye regards the spatially close parts of the image as a whole, and tends to average the areas around the pixels instead of analyzing each image one by one. Therefore, halftone technology has the ability to be clearly visible to the human eye and interfere with OCR recognition, which can reduce the possibility of text information being parsed by automated tools.

[0121] In a possible implementation, in addition to the above Figure 2 In addition to the method of determining the above-mentioned halftone image, the halftone image can also be generated by using halftone techniques such as ordered dithering and error diffusion.

[0122] In a possible implementation, a region segmentation mask corresponding to the text image is generated based on the text image, specifically including: generating a unit mask image, wherein each pixel in the unit mask image is at least two random colors; and enlarging the unit mask image to the size of the text image to generate the region segmentation mask.

[0123] For example, a unit mask image with a length of H / n and a width of W / n is set, and at least two colors are randomly set for each pixel in the unit mask image. Assume that each pixel in the unit mask image is randomly black and white, that is, the unit mask image is composed of black and white; the unit mask image is enlarged by n times, that is, the unit mask image is enlarged to the size of the text image, and the region segmentation mask is generated. The region segmentation mask has a length of H and a width of W. The region segmentation mask is as follows: Figure 6 As shown, the value of n is determined according to actual conditions and is not limited in the embodiments of the present invention.

[0124] In a possible implementation, the region segmentation mask may include three colors or more than three colors, and the region segmentation mask may be in any shape or in any arrangement, which is determined according to actual conditions.

[0125] Step S104: segment the halftone image according to the region segmentation mask to generate at least two segmented images.

[0126] Specifically, each target pixel of the region segmentation mask is traversed, and in response to the target pixel being the second color, the target pixel at the same position of one of the segmented images is set to the second color, and the target pixels at the same position of the remaining segmented images are set to the first color.

[0127] For example, suppose two segmented images are generated, namely segmented image I s1 and segmented image I s2 , wherein the segmented image I s1 like Figure 4 As shown, the segmented image I s2 like Figure 5 As shown, each target pixel of the region segmentation mask is traversed. If the color of the region segmentation mask at the target pixel is white, the segmented image I s1 The pixel at this position is set to white, that is, set to the background color, I s2 The pixel at this position is set to black; if the color of the target pixel in the region segmentation mask is black, the segmented image I s1 The pixel at this position is set to black, I s2 The pixel at this position is set to white.

[0128] In a possible implementation, if the number of colors constituting the region segmentation mask is three or more, the number of the segmented images is three or more, and the number of colors of the region segmentation mask is equal to the number of the segmented images.

[0129] In one possible implementation, the method of segmenting a halftone image using the region segmentation mask can be called random region segmentation, which is a method of segmenting an image into multiple irregular regions, each region containing a portion of text content, so that a single image is incomplete and incoherent text information.

[0130] Step S105 : dynamically and alternately displaying the at least two segmented images at a set frequency.

[0131] Specifically, the segmented image I is quickly switched according to the set frequency. s1 and the segmented image I s2 , for example, the segmented image I s1 and the segmented image I s2 As a two-frame composite video, according to the flicker fusion frequency principle and the visual persistence principle, when the image switching rate exceeds the flicker fusion threshold of the human eye, the visual system cannot distinguish a single flicker, but perceives the continuously changing image sequence as a stable, fused whole. The visual persistence refers to the phenomenon that when the human eye observes an object, after the object is removed, it can still retain a short-term image on the retina. The above phenomenon is the basic principle for animation, movies, and LED screens to continuously display dynamic images. Therefore, the rapidly switching images will give people the impression of continuous motion. Under this high-speed switching, although two different images are actually displayed alternately, the human eye will regard them as continuous images. However, when performing the copy operation, due to the instantaneous and random display of each area, what is captured by taking pictures, recording the screen, etc. is an incomplete segmented image I s1 Or segmented image I s2 , it is difficult to capture the complete text content at the same time, which reduces the recognition accuracy of OCR tools for text images and reduces the success rate of illegal copying, further enhancing the anti-copying ability of text information.

[0132] Through the above-mentioned embodiments, in usage scenarios that are highly dependent on information security, such as sharing of confidential information within an enterprise, browsing of internal files, etc., while ensuring work efficiency and user experience, ensure that sensitive information is not illegally copied and disseminated. The embodiments of the present invention do not rely on specific hardware functions. The halftone technology and the dynamic display strategy based on random area segmentation are mainly based on image processing and display logic at the software level. The halftone technology may affect the clarity of the text to a certain extent, but through the careful design of the dot matrix distribution, the basic readability of the text information can be maintained, and it has an effective resistance to OCR recognition. Compared with the screen flickering and uneven brightness that may be caused by PWM brightness adjustment, the embodiments of the present invention have relatively little impact on the user's daily reading experience.

[0133] In a possible implementation, the above-mentioned halftone and dynamic display strategy based on random area segmentation may also be performed on graphic content, and the specific processing steps are similar to those of the text information, and only the process of converting text information into text image is reduced.

[0134] In an embodiment of the present invention, a device for generating and displaying a text image is provided, such as Figure 7 As shown, it specifically includes: an acquisition unit 701, a conversion unit 702, a generation unit 703, a segmentation unit 704 and a display unit 705;

[0135] Among them, the acquisition unit 701 is used to acquire text information; the conversion unit 702 is used to convert the text information into a text image, wherein the text in the text image is at least one first color, and the background in the text image is a second color; the generation unit 703 is used to generate a halftone image based on the text image, and generate a region segmentation mask corresponding to the text image; the segmentation unit 704 is used to segment the halftone image according to the region segmentation mask to generate at least two segmented images; the display unit 705 is used to dynamically and alternately display the at least two segmented images according to a set frequency.

[0136] Furthermore, the conversion unit is specifically used for:

[0137] The text information is input into a set text-to-image conversion tool to generate a text-to-image.

[0138] Furthermore, the generating unit is specifically used for:

[0139] Converting the text image into a grayscale image;

[0140] Traversing each target pixel in the grayscale image, and calculating the radius of the target area corresponding to each target pixel;

[0141] Determine the scattered points corresponding to each target pixel according to the radius of the target area;

[0142] The halftone image is generated based on the plurality of scattered points.

[0143] Furthermore, the generating unit is specifically used for:

[0144] Traversing each target pixel in the text image, and determining the RGB value of each target pixel;

[0145] The grayscale value of each target pixel is determined according to the RGB value of each target pixel.

[0146] Furthermore, the generating unit is specifically used for:

[0147] Determine a first weight, a second weight, and a third weight corresponding to the RGB values ​​respectively;

[0148] Determine a first product, a second product and a third product respectively, wherein the first product is the product of the R value in the RGB value and the first weight, the second product is the product of the G value in the RGB value and the second weight, and the third product is the product of the B value in the RGB value and the third weight;

[0149] The sum of the first product, the second product and the third product is determined as the grayscale value of each target pixel.

[0150] Furthermore, the generating unit is specifically used for:

[0151] Traversing each target pixel in the grayscale image, and determining a target area corresponding to each target pixel, wherein the target area includes each target pixel and other pixels whose distance to each target pixel is less than or equal to a set step size;

[0152] Obtaining the grayscale values ​​of all pixels in the target area and determining the average grayscale value of the target area;

[0153] The radius of the target area is determined according to the average gray value.

[0154] Furthermore, the generating unit is specifically used for:

[0155] Acquire the coordinates of the target pixel and the coordinates of the other pixels in the target area, and in response to the coordinates of the other pixels meeting the setting rule, set the color of the other pixels to the first color; in response to the coordinates of the other pixels not meeting the setting rule, set the color of the other pixels to the second color, wherein the setting rule is determined according to the coordinates of the target pixel and the radius of the target area;

[0156] The scattered points corresponding to the target pixel are determined according to the set colors of the other pixels.

[0157] Furthermore, the generating unit is specifically used for:

[0158] Generate a unit mask image, wherein each pixel in the unit mask image is at least two random colors;

[0159] The unit mask image is enlarged to the size of the text image to generate the region segmentation mask.

[0160] Furthermore, the segmentation unit is specifically used for:

[0161] Traversing each target pixel of the region segmentation mask, in response to the target pixel being the second color, setting the target pixel at the same position of one of the segmented images to the second color, and setting the target pixels at the same position of the remaining segmented images to the first color.

[0162] Figure 8 Schematic diagram of the structure of the electronic device in the embodiment of the present invention. Figure 8 As shown, it includes a general computer hardware structure, which at least includes a processor 801 and a memory 802. The processor 801 and the memory 802 are connected via a bus 803. The memory 802 is suitable for storing instructions or programs executable by the processor 801. The processor 801 can be an independent microprocessor or a collection of one or more microprocessors. Thus, the processor 801 executes the instructions stored in the memory 802, thereby executing the method flow of the embodiment of the present invention as described above to realize the processing of data and the control of other devices. The bus 803 connects the above-mentioned multiple components together, and at the same time connects the above-mentioned components to the display controller 804 and the display device and the input / output (I / O) device 805. The input / output (I / O) device 805 can be a mouse, a keyboard, a modem, a network interface, a touch input device, a somatosensory input device, a printer, and other devices known in the art. Typically, the input / output device 805 is connected to the system through an input / output (I / O) controller 806.

[0163] Among them, the instructions stored in the memory 802 are executed by at least one processor 801 to achieve: obtaining text information; converting the text information into a text image, wherein the text in the text image is at least one first color and the background in the text image is a second color; generating a halftone image based on the text image, and generating a region segmentation mask corresponding to the text image; segmenting the halftone image according to the region segmentation mask to generate at least two segmented images; and dynamically and alternately displaying the at least two segmented images at a set frequency.

[0164] Specifically, the electronic device includes: one or more processors 801 and a memory 802, Figure 8 Take a processor 801 as an example. The processor 801 and the memory 802 may be connected via a bus or other means. Figure 8 In the example, the bus connection is used. The memory 802 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The processor 801 executes various functional applications and data processing of the device by running the non-volatile software programs, instructions and modules stored in the memory 802, that is, the above-mentioned method for determining text image generation and display is realized.

[0165] The memory 802 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store a list of options, etc. In addition, the memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 802 may optionally include a memory remotely arranged relative to the processor 801, and these remote memories may be connected to an external device 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 combinations thereof.

[0166] One or more modules are stored in the memory 802, and when executed by one or more processors 801, the method for generating and displaying a text image in any of the above method embodiments is executed.

[0167] As will be appreciated by those skilled in the art, various aspects of the embodiments of the present invention may be implemented as a system, method or computer program product. Therefore, various aspects of the embodiments of the present invention may take the form of a complete hardware implementation, a complete software implementation (including firmware, resident software, microcode, etc.), or an implementation that combines software aspects with hardware aspects, which may generally be referred to herein as a "circuit," "module," or "system." In addition, various aspects of the embodiments of the present invention may take the form of a computer program product implemented in one or more computer-readable media having a computer-readable program code implemented thereon.

[0168] Any combination of one or more computer-readable media can be utilized. Computer-readable media can be computer-readable signal media or computer-readable storage media. Computer-readable storage media can be, for example, (but not limited to) electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or apparatuses, or any suitable combination of the foregoing. More specific examples (non-exhaustive enumeration) of computer-readable storage media will include the following: an electrical connection with one or more wires, a portable computer floppy disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of an embodiment of the present invention, a computer-readable storage medium can be any tangible medium that can contain or store a program used by an instruction execution system, device or apparatus or a program used in conjunction with an instruction execution system, device or apparatus.

[0169] A computer readable signal medium may include a propagated digital signal having a computer readable program code implemented therein, such as in baseband or as part of a carrier wave. Such propagated signals may take any of a variety of forms, including but not limited to electromagnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any of the following computer readable media: not a computer readable storage medium, and may communicate, propagate, or transmit a program used by or in conjunction with an instruction execution system, device, or apparatus.

[0170] Program code embodied on a computer readable medium may be transmitted using any appropriate medium including, but not limited to, wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0171] The computer program code for performing operations for various aspects of the embodiments of the present invention can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, Smalltalk, C++, etc., and conventional process programming languages ​​such as "C" programming language or similar programming languages. The program code can be executed completely on the user's computer, partially on the user's computer as a stand-alone software package; partially on the user's computer and partially on a remote computer; or completely on a remote computer or server. In the latter case, the remote computer can be connected to the user's computer through any type of network including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., by using the Internet of an Internet service provider).

[0172] The flowchart legend and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present invention described above describe various aspects of the embodiment of the present invention.It will be understood that each block of the flowchart legend and / or block diagram and the combination of the blocks in the flowchart legend and / or block diagram can be implemented by computer program instructions.These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that the instructions (executed by the processor of the computer or other programmable data processing device) create a device for implementing the function / action specified in the flowchart and / or block diagram block or block.

[0173] These computer program instructions may also be stored in a computer-readable medium that can direct a computer, other programmable data processing device, or other apparatus to operate in a particular manner, so that the instructions stored in the computer-readable medium produce an article of manufacture including instructions for implementing the functions / actions specified in the flowchart and / or block diagram blocks or blocks.

[0174] The computer program instructions may also be loaded onto a computer, other programmable data processing device or other apparatus so that a series of operable steps are performed on the computer, other programmable device or other apparatus to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide a process for implementing the functions / actions specified in the flowchart and / or block diagram block or blocks.

[0175] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

[0176] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portals for users to choose to authorize or refuse. Users' refusal to process personal information other than the necessary information required for basic functions will not affect the user's use of basic functions.

Claims

1. A method for generating and displaying a text image, characterized in that: The method comprises: Get text information; Converting the text information into a text image, wherein the text in the text image is in at least one first color and the background in the text image is in a second color; Generating a halftone image according to the text image, and generating a region segmentation mask corresponding to the text image; Segmenting the halftone image according to the region segmentation mask to generate at least two segmented images; The at least two segmented images are dynamically and alternately displayed according to a set frequency.

2. The method according to claim 1, characterized in that The converting the text information into a text image specifically includes: The text information is input into a set text-to-image conversion tool to generate a text-to-image.

3. The method according to claim 1, characterized in that Generating a halftone image according to the text image specifically includes: Converting the text image into a grayscale image; Traversing each target pixel in the grayscale image, and calculating the radius of the target area corresponding to each target pixel; Determine the scattered points corresponding to each target pixel according to the radius of the target area; The halftone image is generated based on the plurality of scattered points.

4. The method according to claim 3, characterized in that The converting the text image into a grayscale image specifically includes: Traversing each target pixel in the text image, and determining the RGB value of each target pixel; The grayscale value of each target pixel is determined according to the RGB value of each target pixel.

5. The method according to claim 4, characterized in that Determining the grayscale value of each target pixel according to the RGB value of each target pixel specifically includes: Determine a first weight, a second weight, and a third weight corresponding to the RGB values ​​respectively; Determine a first product, a second product and a third product respectively, wherein the first product is the product of the R value in the RGB value and the first weight, the second product is the product of the G value in the RGB value and the second weight, and the third product is the product of the B value in the RGB value and the third weight; The sum of the first product, the second product and the third product is determined as the grayscale value of each target pixel.

6. The method according to claim 3, characterized in that The traversing each target pixel in the grayscale image and calculating the target area radius corresponding to each target pixel specifically includes: Traversing each target pixel in the grayscale image, and determining a target area corresponding to each target pixel, wherein the target area includes each target pixel and other pixels whose distance to each target pixel is less than or equal to a set step size; Obtaining the grayscale values ​​of all pixels in the target area and determining the average grayscale value of the target area; The radius of the target area is determined according to the average gray value.

7. The method according to claim 6, characterized in that The step of determining the scattered points corresponding to each target pixel according to the target area radius specifically includes: Acquire the coordinates of the target pixel and the coordinates of the other pixels in the target area, and in response to the coordinates of the other pixels meeting the setting rule, set the color of the other pixels to the first color; in response to the coordinates of the other pixels not meeting the setting rule, set the color of the other pixels to the second color, wherein the setting rule is determined according to the coordinates of the target pixel and the radius of the target area; The scattered points corresponding to the target pixel are determined according to the set colors of the other pixels.

8. The method according to claim 1, characterized in that The generating a region segmentation mask corresponding to the text image specifically includes: Generate a unit mask image, wherein each pixel in the unit mask image is at least two random colors; The unit mask image is enlarged to the size of the text image to generate the region segmentation mask.

9. The method according to claim 1, characterized in that: The step of segmenting the halftone image according to the region segmentation mask to generate at least two segmented images specifically includes: Traversing each target pixel of the region segmentation mask, in response to the target pixel being the second color, setting the target pixel at the same position of one of the segmented images to the second color, and setting the target pixels at the same position of the remaining segmented images to the first color.

10. A device for generating and displaying text images, characterized in that: The device comprises: An acquisition unit, used for acquiring text information; A conversion unit, configured to convert the text information into a text image, wherein the text in the text image is in at least one first color and the background in the text image is in a second color; A generating unit, configured to generate a halftone image according to the text image, and generate a region segmentation mask corresponding to the text image; a segmentation unit, configured to segment the halftone image according to the region segmentation mask to generate at least two segmented images; The display unit is used to dynamically and alternately display the at least two segmented images according to a set frequency.

11. An electronic device comprising a memory and a processor, characterized in that: The memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.