Program text processing method and device
By converting the text components in the program into text component pictures and cropping according to the crop position, the problem of inconsistent text display is solved, the consistency of text display effects between the program playback terminal and the production terminal is achieved, and the text display effect is improved.
Patent Information
- Application Number
- CN202010743567.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-29
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2040-07-29
AI Technical Summary
In the LED display industry, the problem of inconsistent text display of text components leads to inconsistent text display effect of program playback terminal and the text display effect of program production terminal, affecting the text display effect.
By converting the text component in the program into a text component picture, determining the crop position according to the text component, cropping the text component picture, obtaining the text picture, and replacing the text component with a text picture, so that the program playback terminal can play text content in the form of a picture.
Ensure that the text display effect of the program playback terminal is consistent with the text display effect during program production, and improve the text display effect.
Smart Images

Figure CN114064945B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of multimedia control and playback, and in particular to a program text processing method and a program text processing device. Background Art
[0002] In the LED display industry, text components are the most commonly used program elements, but due to objective reasons for font parsing and drawing at different terminals (such as program production terminals, program playback terminals, etc.), the text display of text components is inconsistent. In the prior art, the program production terminal generally sends the program including the text component to the program playback terminal, and then the program playback terminal draws the text according to the text style in the text component. When turning the page, it automatically calculates and cuts the long text into multiple short texts. However, due to problems such as font parsing, it is impossible to ensure that the text display effect of the program playback terminal is consistent with the text display effect of the program production terminal, which greatly affects the text display effect. Summary of the invention
[0003] Therefore, in order to overcome the defects and shortcomings in the prior art, the embodiments of the present invention provide a program text processing method and a program text processing device to ensure that the text display effect of the program playback terminal is consistent with the text display effect during program production, thereby improving the text display effect.
[0004] On the one hand, an embodiment of the present invention provides a program text processing method, including: converting a text component in a program into a text component image; determining a cropping position of the text component image according to the text component; cropping the text component image according to the cropping position to obtain at least one text image; and replacing the text component with the at least one text image.
[0005] The program text processing method provided in this embodiment converts the text components in the program into text component images, determines the cropping position according to the text components, crops the text component images to obtain text images, and replaces the text components with text images. In this way, the program playback terminal can play the text content in the form of images to ensure that the text display effect of the program playback terminal is consistent with the text display effect when the program is produced, thereby improving the text display effect.
[0006] In one embodiment of the present invention, the text component includes a text box and text located in the text box; the conversion of the text component in the program into a text component image is specifically as follows: the text component is converted according to the width of the text box and the attributes of the text in the text box to obtain the text component image, wherein the width of the text component image is the same as the width of the text box, and the attributes of the text in the text component image are the same as the attributes of the text in the text box.
[0007] In one embodiment of the present invention, the text component includes a text box and text located in the text box; determining the cropping position of the text component image based on the text component specifically includes: judging whether the attributes of the text in the text box are consistent; and when the attributes of the text in the text box are consistent, determining the cropping position of the text component image according to the height of the text box and the line height of the text in the text box.
[0008] In one embodiment of the present invention, determining the cropping position of the text component image based on the height of the text box and the line height of the text in the text box specifically includes: rounding down the ratio of the height of the text box to the line height of the text in the text box to obtain the number of cropping lines; multiplying the number of cropping lines and the line height of the text in the text box to obtain the cropping height; and determining the cropping position based on the cropping height.
[0009] In one embodiment of the present invention, the cropping position includes a first cropping position; determining the cropping position of the text component image based on the text component also includes: when the attributes of the text in the text box are inconsistent, adding the starting position of the text component image to the height of the text box as a first alternative cropping position; obtaining the first pixel color of multiple pixels at the first alternative cropping position in the text component image; when the first pixel color is consistent, using the first alternative cropping position as the first cropping position; and when the first pixel color is inconsistent, subtracting a preset distance from the first alternative cropping position as a second alternative cropping position, and obtaining the second pixel color of multiple pixels at the second alternative cropping position in the text component image, and when the second pixel color is consistent, using the second alternative cropping position as the first cropping position.
[0010] In one embodiment of the present invention, the first cropping position plus the height of the text box is used as the third alternative cropping position; the third pixel color of multiple pixels at the third alternative cropping position in the text component image is obtained; when the third pixel color is consistent, the third alternative cropping position is used as the second cropping position; and when the third pixel color is inconsistent, the third alternative cropping position is subtracted from the preset distance to use as the fourth alternative cropping position, and the fourth pixel color of multiple pixels at the fourth alternative cropping position in the text component image is obtained, and when the fourth pixel color is consistent, the fourth alternative cropping position is used as the second cropping position.
[0011] In one embodiment of the present invention, obtaining the first pixel color of multiple pixels at the first alternative cropping position in the text component image specifically includes: randomly selecting a preset number of pixels at the first alternative cropping position on the text component image; and scanning to obtain the pixel colors of the preset number of pixels as the first pixel color.
[0012] In one embodiment of the present invention, the text processing method further includes: if the text component image is cropped to obtain multiple text images, in response to the multiple text images being height-inconsistent, reorganizing the multiple text images into a highly consistent text image sequence.
[0013] On the other hand, an embodiment of the present invention provides a program text processing device, including: a conversion module, used to convert text components in a program into text component images; a determination module, used to determine the cropping position of the text component image according to the text component; a cropping module, used to crop the text component image according to the cropping position to obtain at least one text image; and a replacement module, used to replace the text component with the at least one text image.
[0014] The program text processing device of this embodiment is provided with a conversion module, a determination module, a cropping module and a replacement module, so that the text components in the program can be converted into text component images, the cropping position can be determined according to the text components to crop the text component images to obtain text images, and the text components can be replaced with text images. In this way, the program playback terminal can play the text content in the form of images to ensure that the text display effect of the program playback terminal is consistent with the text display effect when the program is produced, thereby improving the text display effect.
[0015] In one embodiment of the present invention, the program text processing device also includes: a reorganization module for, if the text component image is cropped to obtain multiple text images, in response to the multiple text images having inconsistent heights, reorganizing the multiple text images into a highly consistent text image sequence.
[0016] On the other hand, an embodiment of the present invention provides a program text processing system, comprising: a memory and a processor connected to the memory, the processor storing a computer program, and the processor executing the program text processing method as described above when running the computer program.
[0017] On the other hand, an embodiment of the present invention provides a computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, and the stored computer program can implement the program text processing method as described above when executed by a processor.
[0018] One or more of the above-mentioned technical solutions may have the following advantages or beneficial effects: by converting the text components in the program into text component images, determining the cropping position according to the text components to crop the text component images to obtain text images, and replacing the text components with text images, the program playback terminal may play the text content in the form of images to ensure that the text display effect of the program playback terminal is consistent with the text display effect during program production, thereby improving the text display effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0020] Figure 1 A flowchart of a program text processing method provided by the first embodiment of the present invention.
[0021] Figure 2 for Figure 1 Schematic diagram of the process of step 200.
[0022] Figure 3 for Figure 2 Schematic diagram of the process of step 220a.
[0023] Figure 4 for Figure 1 Another flowchart diagram of step 200 in FIG.
[0024] Figure 5 for Figure 1 A partial flow chart of step 200 in FIG.
[0025] Figure 6 for Figure 4 Schematic diagram of the process of step 230.
[0026] Figure 7 Another flowchart of a program text processing method provided by the first embodiment of the present invention.
[0027] Figure 8a and Figure 8b This is a schematic diagram of the effect of simple text.
[0028] Figure 8c to Figure 8g This is a schematic diagram of the effect of complex text.
[0029] Fig. 9 The figure is a flowchart of the program text processing process.
[0030] Fig.10 for Fig. 9 Flowchart of the detailed processing of complex text in .
[0031] Fig.11 A schematic diagram of modules of a program text processing device provided in the second embodiment of the present invention.
[0032] Fig.12 A schematic diagram of modules of another program text processing device provided in the second embodiment of the present invention.
[0033] Fig.13 A schematic diagram of the structure of a program text processing system provided in the third embodiment of the present invention.
[0034] Fig.14 A schematic structural diagram of a computer-readable storage medium provided for the fourth embodiment of the present invention. DETAILED DESCRIPTION
[0035] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0036] [First embodiment]
[0037] like Figure 1 As shown, a program text processing method provided by the first embodiment of the present invention includes the following steps:
[0038] S100, converting the text component in the program into a text component image;
[0039] S200, determining a cropping position of the text component image according to the text component;
[0040] S300, cropping the text component image according to the cropping position to obtain at least one text image; and
[0041] S400, replacing the text component with the at least one text image.
[0042] Among them, the text component, for example, includes a text box and text located in the text box; step S100 of converting the text component in the program into a text component image is specifically: converting the text component according to the width of the text box and the attributes of the text in the text box to obtain the text component image, wherein the width of the text component image is the same as the width of the text box, and the attributes of the text in the text component image are the same as the attributes of the text in the text box.
[0043] See also Figure 2 , step S200 specifically includes:
[0044] S210, determining whether the attributes of the text in the text box are consistent; and
[0045] S220a, when the attributes of the text in the text box are consistent, determining the cropping position of the text component image according to the height of the text box and the line height of the text in the text box.
[0046] See also Figure 3 , wherein step S220a of determining the cropping position of the text component image according to the height of the text box and the line height of the text in the text box specifically includes:
[0047] S221, performing a rounding operation on the ratio of the height of the text box to the line height of the text in the text box to obtain the number of lines to be cropped;
[0048] S222, performing a multiplication operation on the number of cropped lines and the line height of the text in the text box to obtain a cropping height; and
[0049] S223: Determine the cutting position according to the cutting height.
[0050] See also Figure 4 , step S200 further includes the steps of:
[0051] S220b, when the attributes of the text in the text box are inconsistent, adding the starting position of the text component image to the height of the text box is used as a first candidate cropping position;
[0052] S230, obtaining first pixel colors of a plurality of pixels at the first candidate cropping position in the text component image;
[0053] S240: When the colors of the first pixels are consistent, use the first candidate cropping position as the first cropping position; and
[0054] S250, when the first pixel color is inconsistent, subtract a preset distance from the first alternative cropping position to serve as the second alternative cropping position, and obtain the second pixel color of multiple pixels at the second alternative cropping position in the text component image, and when the second pixel color is consistent, use the second alternative cropping position as the first cropping position.
[0055] See also Figure 5 , step S200 also includes the steps of:
[0056] S260, adding the height of the text box to the first cropping position to obtain a third candidate cropping position;
[0057] S270, obtaining a third pixel color of a plurality of pixels at the third candidate cropping position in the text component image;
[0058] S280, when the third pixel colors are consistent, using the third candidate cropping position as the second cropping position; and
[0059] S290, when the third pixel color is inconsistent, subtract the preset distance from the third alternative cropping position to serve as the fourth alternative cropping position, and obtain the fourth pixel color of multiple pixels at the fourth alternative cropping position in the text component image, and when the fourth pixel color is consistent, use the fourth alternative cropping position as the second cropping position.
[0060] Among them, see Figure 6 , step S230 includes:
[0061] S231, randomly selecting a preset number of pixels at the first candidate cropping position on the text component image;
[0062] S232, scanning and obtaining pixel colors of the preset number of pixels as the first pixel colors.
[0063] See also Figure 7 , the program text processing method also includes the steps of:
[0064] S500: If a plurality of the text images are obtained by cropping the text component image, in response to inconsistency in the heights of the plurality of text images, reorganize the plurality of text images into a text image sequence with a consistent height.
[0065] The program text processing method provided in this embodiment can be implemented, for example, by a server. In order to facilitate a clearer understanding of this embodiment, Figure 8a to Figure 8g , Fig. 9 and Fig.10 , the program text processing method of this embodiment is described in detail.
[0066] Specifically, the user edits the program on the client, i.e., the program editing page of the personal computer browser software, saves the program after editing, and sends the program to the server. The program includes text components, and of course may also include other media, such as pictures, videos, weather components, etc., but the embodiments of the present invention are not limited thereto.
[0067] See also Fig. 9The server converts the text component in the program into a text component image, that is, converts the text component into a large image. Specifically, the text component includes a text box and the text in the text box. The text component is converted into a text component image according to the width of the text box and the properties of the text in the text box. The width of the obtained text component image is consistent with the width of the text box, and the text in the text component image has the same text properties as the text in the text box.
[0068] Based on the above, it is determined whether the properties of the text in the text box are consistent. When the properties of the text in the text box are consistent, the text component is considered to be a simple text (such as Figure 8a As shown in the figure, the font, size and other text attributes of the text are consistent); when the attributes of the text in the text box are inconsistent, the text component is considered to be complex text (such as Figure 8c As shown, there are inconsistencies in the text attributes such as font and font size of the text. The cropping position of the text component image is determined by different processing methods according to different text types (simple text and complex text). In this way, the determination rate of the cropping position can be increased, and the efficiency of program text processing can be improved.
[0069] Specifically, when the attributes of the text in the text box are consistent, that is, the text component is as follows Figure 8a For simple text as shown, a first operation such as rounding down is performed on the ratio of the height of the text box to the line height of the text to obtain the number of lines to be cropped, and a second operation such as multiplication is performed on the number of lines to be cropped and the line height of the text to obtain the crop height. The first operation and the second operation here may also be other operations, and this embodiment is not limited thereto. Determine the crop position according to the crop height (such as Figure 8b The position of A shown in the figure); taking the cropping position A as the starting point, repeat the above calculation steps to determine the next cropping position, until the final cropping position is the final position of the text component image (i.e. the height of the large image), and all cropping positions are determined. In this way, the problem of text being truncated when cropping the image according to the cropping position can be avoided.
[0070] See also Fig.10 , when the properties of the text in the text box are inconsistent, that is, the text component is as follows Figure 8c When the complex text shown Figure 8c For example, the height of the text box can be located at a part of the text component image (for example Figure 8dThe position where B is located in the image) is used as the first alternative cropping position. Scan the pixel color at the first alternative position, for example, scan the pixel color within the straight line range of the position where B is located. Specifically, a preset number of pixels at the first alternative cropping position on the text component image can be randomly selected to obtain the pixel colors of the preset number of pixels, and then the consistency of the pixel colors of the preset number of pixels can be determined. The scanning efficiency is greatly improved by randomly taking points for scanning and verification. When the pixel colors are inconsistent, for example, there are noises, that is, the color of the scanned pixel is inconsistent with the background color of the text component image, that is, there is text at the first alternative cropping position, the first alternative cropping position is reduced by a preset distance as the second alternative cropping position (such as Figure 8e The position where C is located, that is, the first alternative cropping position is moved up by a preset distance as the second alternative cropping position), the preset distance can be, for example, one pixel, of course, this embodiment is not limited to this; then scan the pixel color at the second alternative cropping position, determine that the pixel color is consistent, that is, there is no text at the second alternative cropping position, and use the second alternative cropping position as the first cropping position.
[0071] Then, see Figure 8f , taking the first cropping position (the position where C is located) as the starting point, determine the third candidate cropping position (such as Figure 8f The pixel color at the third candidate cropping position is scanned, and when the pixel color is inconsistent with the background color (e.g., transparent) of the text component image, the third candidate cropping position is reduced by the preset distance as the fourth candidate cropping position (e.g., Figure 8g The fourth candidate cropping position is scanned, and the pixel color at the fourth candidate cropping position is determined to be consistent, that is, there is no text at the fourth candidate cropping position. The fourth candidate cropping position is used as the second cropping position. Repeat the above steps until the final cropping position is determined to be the final position of the text component image, that is, the large image, and all cropping positions are determined. In this way, the problem of text being truncated when cropping the image according to the cropping position can be avoided.
[0072] Finally, at least one text image obtained after cropping replaces the text component in the program, thereby completing the processing of the program text.
[0073] Further, when the height of at least one of the cropped text images is inconsistent, the text images are reorganized into a text image sequence with a consistent height, and the height of the text image can be, for example, consistent with the height of the text box. It is worth mentioning here that this step can be performed before replacing the text component with the text image, or before replacing the text component with the text image.
[0074] It is worth mentioning here that, whether it is simple text or complex text, the method for determining the cropping position is not limited to the method exemplified in the above embodiment, and it can also be implemented by other methods as long as there is no text at the determined cropping position.
[0075] To sum up, the program text processing method of this embodiment converts the text components in the program into text component images, determines the cropping position according to the text components to crop the text component images to obtain text images, and replaces the text components with text images. In this way, the program playback terminal can play the text content in the form of images to ensure that the text display effect of the program playback terminal is consistent with the text display effect during program production, thereby improving the text display effect.
[0076] [Second embodiment]
[0077] like Fig.11 As shown, the second embodiment of the present invention provides a program text processing device 100. The program text processing device 100 includes, for example, a conversion module 110, a determination module 120, a cutting module 130 and a replacement module 140.
[0078] The conversion module 110 is used to convert the text components in the program into text component images.
[0079] The determination module 120 is used to determine the cropping position of the text component image according to the text component.
[0080] The cropping module 130 is used to crop the text component image according to the cropping position to obtain at least one text image.
[0081] The replacement module 140 is used to replace the text component with the at least one text image.
[0082] like Fig.12 As shown, the program text processing device 100 of this embodiment also includes: a reorganization module 150, which is used to reorganize the multiple text images into a highly consistent text image sequence in response to the inconsistency of the heights of the multiple text images if the text component image is cropped to obtain multiple text images.
[0083] The specific working process and technical effects of the modules in the program text processing device 100 in this embodiment refer to the description of the first embodiment above, which will not be repeated here.
[0084] [Third embodiment]
[0085] like Fig.13As shown, the third embodiment of the present invention provides a program text processing system 200. The program text processing system 200 includes, for example, a memory 220 and a processor 210 connected to the memory 220. The memory 220 may be, for example, a non-volatile memory on which a computer program 221 is stored. The processor 210 may be, for example, an embedded processor. When the processor 210 runs the computer program 221, the program text processing method in the first embodiment described above is executed.
[0086] The specific working process and technical effects of the program text processing system 200 in this embodiment refer to the description of the first embodiment mentioned above.
[0087] [Fourth embodiment]
[0088] like Fig.14 As shown, the fourth embodiment of the present invention provides a computer-readable storage medium 300. The computer-readable storage medium 300 is, for example, a non-volatile memory, which is, for example: a magnetic medium (such as a hard disk, a floppy disk, and a magnetic tape), an optical medium (such as a CDROM disk and a DVD), a magneto-optical medium (such as an optical disk), and a hardware device specially constructed to store and execute computer-executable instructions (such as a read-only memory (ROM), a random access memory (RAM), a flash memory, etc.). Computer-executable instructions 310 are stored on the computer-readable storage medium 300. The computer-readable storage medium 300 can be executed by one or more processors or processing devices to execute the computer-executable instructions 310 to implement the program text processing method in the aforementioned first embodiment.
[0089] In addition, it can be understood that the aforementioned embodiments are only exemplary descriptions of the present invention. Under the premise that the technical features do not conflict, the structures do not contradict, and the purpose of the present invention is not violated, the technical solutions of the various embodiments can be arbitrarily combined and used in combination.
[0090] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0091] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0092] In addition, each functional unit / module in each embodiment of the present invention may be integrated into one processing unit / module, or each unit / module may exist physically separately, or two or more units / modules may be integrated into one unit / module. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of hardware plus software functional units / modules.
[0093] The above-mentioned integrated unit / module implemented in the form of a software functional unit / module can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for enabling one or more processors of a computer device (which can be a personal computer, a server, or a network device, etc.) to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store program codes.
[0094] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A program text processing method, characterized in that: include: Converting a text component in a program into a text component image, wherein the text component includes a text box and text in the text box; Determining a cropping position of the text component image according to the text component; Cropping the text component image according to the cropping position to obtain at least one text image; as well as Replacing the text component with the at least one text image; The cropping position includes a first cropping position; and determining the cropping position of the text component image according to the text component includes: Determine whether the attributes of the text in the text box are consistent; When the attributes of the text in the text box are inconsistent, the starting position of the text component image plus the height of the text box is used as the first candidate cropping position; Obtaining first pixel colors of a plurality of pixels at the first candidate cropping position in the text component image; When the colors of the first pixels are consistent, using the first candidate cropping position as the first cropping position; and When the first pixel color is inconsistent, the first alternative cropping position is subtracted by a preset distance to serve as the second alternative cropping position, and the second pixel color of multiple pixels at the second alternative cropping position in the text component image is obtained, and when the second pixel color is consistent, the second alternative cropping position is used as the first cropping position.
2. The program text processing method according to claim 1, characterized in that: The text component includes a text box and text in the text box; the text component in the conversion program is a text component picture specifically: The text component is converted according to the width of the text box and the properties of the text in the text box to obtain the text component image, wherein the width of the text component image is the same as the width of the text box, and the properties of the text in the text component image are the same as the properties of the text in the text box.
3. The program text processing method according to claim 1, characterized in that: The text component includes a text box and text in the text box; and determining the cropping position of the text component image according to the text component specifically includes: When the attributes of the text in the text box are consistent, the cropping position of the text component image is determined according to the height of the text box and the line height of the text in the text box.
4. The program text processing method according to claim 3, characterized in that: The step of determining the cropping position of the text component image according to the height of the text box and the line height of the text in the text box specifically includes: The ratio of the height of the text box to the line height of the text in the text box is rounded down to obtain the number of lines to be cropped; Performing a multiplication operation on the number of cropped rows and the row height of the text in the text box to obtain a cropping height; and The cutting position is determined according to the cutting height.
5. The program text processing method according to claim 1, characterized in that: The cropping position also includes a second cropping position; the step of determining the cropping position of the text component image according to the text component further includes: adding the height of the text box to the first cropping position to obtain a third candidate cropping position; Obtaining a third pixel color of a plurality of pixels at the third candidate cropping position in the text component image; When the third pixel colors are consistent, using the third candidate cropping position as the second cropping position; and When the third pixel color is inconsistent, the third alternative cropping position is subtracted from the preset distance to serve as the fourth alternative cropping position, and the fourth pixel color of multiple pixels at the fourth alternative cropping position in the text component image is obtained, and when the fourth pixel color is consistent, the fourth alternative cropping position is used as the second cropping position.
6. The program text processing method according to claim 1, characterized in that: The obtaining of the first pixel colors of a plurality of pixels at the first candidate cropping position in the text component image specifically includes: Randomly selecting a preset number of pixels at the first candidate cropping position on the text component image; The pixel colors of the preset number of pixels are scanned and obtained as the first pixel colors.
7. The program text processing method according to claim 1, characterized in that: Also includes: If a plurality of the text images are obtained by cropping the text component image, in response to the inconsistency of the heights of the plurality of text images, the plurality of text images are reorganized into a text image sequence with a consistent height.
8. A program text processing device, characterized in that: include: A conversion module, used for converting a text component in a program into a text component image, wherein the text component includes a text box and text in the text box; A determination module, used to determine a cropping position of the text component image according to the text component; A cropping module, used for cropping the text component image according to the cropping position to obtain at least one text image; as well as A replacement module, used for replacing the text component with the at least one text image; The cropping position includes a first cropping position; and the determining module is specifically configured to: Determine whether the attributes of the text in the text box are consistent; When the attributes of the text in the text box are inconsistent, the starting position of the text component image plus the height of the text box is used as the first candidate cropping position; Obtaining first pixel colors of a plurality of pixels at the first candidate cropping position in the text component image; When the colors of the first pixels are consistent, using the first candidate cropping position as the first cropping position; and When the first pixel color is inconsistent, the first alternative cropping position is subtracted by a preset distance to serve as the second alternative cropping position, and the second pixel color of multiple pixels at the second alternative cropping position in the text component image is obtained, and when the second pixel color is consistent, the second alternative cropping position is used as the first cropping position.
9. The program text processing device according to claim 8, characterized in that: Also includes: The reorganization module is used for, if the text component image is cropped to obtain multiple text images, in response to the multiple text images having inconsistent heights, reorganizing the multiple text images into a text image sequence with consistent heights.
Citation Information
Patent Citations
Text anti-crawler method, server and display terminal
CN110851682A