Layer Adaptive Stretching Method and Device for Comic Translation
Through layer extraction tools and distance threshold judgment, the background bubbles of text content in Chinese comics are automatically adjusted, which solves the disadvantages of manual adjustment in the existing technology, realizes automatic adjustment, reduces manual participation and saves manpower.
Patent Information
- Application Number
- CN202210379558.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-12
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2042-04-12
AI Technical Summary
When the existing comic translation tools are translated into Japanese comics in Chinese, they need to manually adjust the background bubbles of the text content, and lack machine processing solutions, resulting in more manual participation.
Use the layer extraction tool to extract text layers and bubble layers from the to-processed picture, set the distance threshold to determine the shape of the bubble layer, and convert or translate it to make the bubble layer contained within the picture range.
It realizes automatic adjustment of text content background bubbles, reduces manual participation, saves manpower, and improves translation efficiency.
Smart Images

Figure CN114742923B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular, to a layer adaptive stretching method, device, computer device and storage medium for comic translation. Background Art
[0002] For a long time, the work of comic translation has followed a process with a relatively long cycle and a large amount of repetitive manual labor. It is necessary to manually extract and translate the text information in the picture, erase the original text in the picture, and then embed the translated text one by one, and adjust the font and layout to fit the original picture before exporting. With the continuous development of the domestic comic market, related tools for assisting manual translation have gradually emerged in the field of comic translation, which mainly involve the original text detection of comic files, rapid text erasure, translation of different languages for the translated text, multiple font style selections, etc., to help manual workers reduce the cumbersome work of operating Photoshop step by step.
[0003] Although the existing translation tools have reduced some manual work, it is still necessary for manual workers to continuously correct the results of the translation tools. The existing comic translation tools still have the following problems:
[0004] In the process of translating Chinese comics into Japanese comics, due to the different typesetting methods and starting positions of the two, it is necessary to adaptively adjust the background bubbles corresponding to their text content. However, in the existing technology, the adjustment of the background bubbles completely relies on the manual adjustment and drawing of designers, and there is no corresponding machine processing solution.
[0005] Therefore, there is an urgent need for a method and device that can automatically adjust the background bubbles of text content through a machine. Summary of the Invention
[0006] The embodiments of the present invention provide a layer adaptive stretching method, device, computer device and storage medium for comic translation, so as to solve the technical problem that in the existing comic translation tools, the adjustment of the background bubbles corresponding to the text content completely relies on the manual adjustment and drawing of designers, and there is no corresponding machine processing solution.
[0007] To achieve the above object, in the first aspect of the embodiments of the present invention, a layer adaptive stretching method for comic translation is provided, including:
[0008] Based on a layer extraction tool, extract a text layer and the coordinate information of the text layer from the picture to be processed;
[0009] Set a distance threshold, and extract the bubble layer corresponding to the text layer according to the judgment condition;
[0010] Determine the shape of the bubble layer based on the coordinate information of the bubble layer, so as to determine whether it is necessary to convert the bubble layer and the text layer separately;
[0011] If the coordinate information of the converted bubble layer exceeds the coordinate range of the to-be-processed picture, translate the center points of the text layer and the bubble layer so that the bubble layer is included within the range of the to-be-processed picture.
[0012] Optionally, in a possible implementation manner of the first aspect, the determination condition includes:
[0013] The coordinate range of the bubble layer includes the coordinate range of the text layer, and the distance between the center points of the two layers is less than the distance threshold.
[0014] Optionally, in a possible implementation manner of the first aspect, after extracting the bubble layer corresponding to the text layer according to the determination condition, it includes:
[0015] Filter the text layer according to the similarity matching method;
[0016] Set the retained text layer to be invisible, retain the text content and coordinates of the layer, and record the bubble layer corresponding to the text layer.
[0017] Optionally, in a possible implementation manner of the first aspect, determine the shape of the bubble layer based on the coordinate information of the bubble layer, so as to determine whether it is necessary to convert the bubble layer and the text layer separately, including:
[0018] Calculate the width value and height value of the bubble layer according to the coordinate information of the bubble layer;
[0019] If the width value is greater than the height value, it is determined that the bubble layer is in a horizontal form.
[0020] Optionally, in a possible implementation manner of the first aspect, after determining that the bubble layer is in a horizontal form, it includes:
[0021] When it is determined that the bubble layer is in a horizontal form, convert the position coordinates of the bubble layer and the text layer corresponding to the bubble layer by swapping the width value and height value.
[0022] In the second aspect of the embodiments of the present invention, there is provided a layer adaptive stretching device for comic translation, including:
[0023] A text layer extraction module, configured to extract a text layer and the coordinate information of the text layer from a to-be-processed picture based on a layer extraction tool;
[0024] The bubble layer extraction module is used to set a distance threshold and extract the bubble layer corresponding to the text layer according to the judgment condition;
[0025] The layer conversion module is used to judge the shape of the bubble layer according to the coordinate information of the bubble layer, so as to judge whether it is necessary to convert the bubble layer and the text layer respectively;
[0026] The layer translation module is used to translate the center points of the text layer and the bubble layer if the coordinate information of the converted bubble layer exceeds the coordinate range of the to-be-processed picture, so that the bubble layer is included within the range of the to-be-processed picture.
[0027] Optionally, in a possible implementation manner of the second aspect, the bubble layer extraction module includes:
[0028] The judgment unit is used for the coordinate range of the bubble layer to include the coordinate range of the text layer, and the distance between the center points of the two layers is less than the distance threshold.
[0029] Optionally, in a possible implementation manner of the second aspect, the device further includes:
[0030] The filtering module is used to filter the text layer according to the similarity matching method;
[0031] The layer retention module is used to set the retained text layer to be invisible, retain the text content and coordinates of the layer, and record the bubble layer corresponding to the text layer.
[0032] In the third aspect of the embodiments of the present invention, a computer device is provided, including a memory and a processor, the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the steps in the above-mentioned various method embodiments are implemented.
[0033] In the fourth aspect of the embodiments of the present invention, a readable storage medium is provided, in which a computer program is stored, and when the computer program is executed by a processor, it is used to implement the steps of the methods in the first aspect and various possible designs of the first aspect of the present invention.
[0034] The layer adaptive stretching method, device, computer device and storage medium for comic translation provided by the present invention extract a text layer and the coordinate information of the text layer from a picture to be processed through a layer extraction tool; set a distance threshold, and extract a bubble layer corresponding to the text layer according to a judgment condition; judge the shape of the bubble layer according to the coordinate information of the bubble layer, so as to judge whether it is necessary to perform conversions on the bubble layer and the text layer respectively; if the coordinate information of the converted bubble layer exceeds the coordinate range of the picture to be processed, translate the center points of the text layer and the bubble layer so that the bubble layer is included within the range of the picture to be processed. The present invention can automatically adjust the background bubbles of text content by machine, no longer relying on manual adjustment and drawing by designers, reducing manual participation and saving manpower. Description of the Drawings
[0035] Figure 1 Schematic diagrams before and after layer adjustment;
[0036] Figure 2 Flowchart of the first implementation manner of the layer adaptive stretching method for comic translation;
[0037] Figure 3 Structural diagram of the first implementation manner of the layer adaptive stretching device for comic translation;
[0038] Figure 4 Flowchart for extracting the text layer and the corresponding bubble layer. Detailed Implementation Manner
[0039] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0040] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order different from those illustrated or described herein.
[0041] It should be understood that in various embodiments of the present invention, the sequence numbers of the processes do not imply the order of execution, and the order of execution of the processes should be determined by their functions and internal logics, and should not constitute any limitation to the implementation processes of the embodiments of the present invention.
[0042] It should be understood that in the present invention, "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0043] It should be understood that in the present invention, "a plurality of" means two or more. "And / or" is merely a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "Including A, B, and C" and "including A, B, C" mean that all of A, B, and C are included. "Including A, B, or C" means including any one of A, B, and C. "Including A, B, and / or C" means including any one, any two, or all three of A, B, and C.
[0044] It should be understood that in the present invention, "B corresponding to A", "B corresponding to A relatively", "A corresponding to B relatively", or "B corresponding to A relatively" means that B is associated with A, and B can be determined according to A. Determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information. The matching of A and B means that the similarity between A and B is greater than or equal to a preset threshold.
[0045] Depending on the context, as used herein, "if" can be interpreted as "when...", "while...", "in response to determining", or "in response to detecting".
[0046] The technical solutions of the present invention will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.
[0047] The object of the present invention: In the process of translating Chinese comics into Japanese comics, the machine is used to automatically adjust the text area and the corresponding background bubbles, so that the adjusted text area and background bubbles are adapted to the Japanese comic style. Specifically, as Figure 1 shown, the Chinese comic before adjustment is on the left, and the Japanese comic after adjustment is on the right.
[0048] Embodiment 1:
[0049] The present invention provides a layer adaptive stretching method for comic translation, as Figure 2 shown in its flowchart, including:
[0050] Step S1: Based on a layer extraction tool, extract the text layer and the coordinate information of the text layer from the picture to be processed.
[0051] In this step, the layer extraction tool includes but is not limited to psd-tools, psdparse, pytoshop, etc. (These three tools are all implemented based on the Python development language. In addition, there are relevant parsing tools for other development languages such as Java and JavaScript; the type of visible layer and the coordinate information of the visible layer can be extracted from the picture to be processed (psd and psb format materials) through this layer extraction tool. The visible layers include the type of text layer, ordinary layer, layer group, etc.; each layer has corresponding coordinate range information bbox = [x1, y1, x2, y2], where (x1, y1) represents the upper left corner coordinates of the layer area, and (x2, y2) represents the lower right corner coordinates, so as to obtain the text content text of the text layer and the corresponding coordinate range information text-box.
[0052] Step S2: Set a distance threshold, and extract the bubble layer corresponding to the text layer according to the judgment condition.
[0053] In step S2, after obtaining the text layer of the picture to be processed, for each text layer a, it is necessary to find the corresponding bubble layer b according to the judgment condition. The bubble layer is a non-text and visible layer, and the bubble layer must meet the following conditions: the coordinate range layer_box of the bubble layer b contains the coordinate range text_box of the text layer a, and the distance between the center points of the two layers is less than the distance threshold distance. This distance threshold is set manually according to the actual situation. Otherwise, it means that the bubble layer corresponding to the text layer a is not found.
[0054] Step S3: Judge the shape of the bubble layer according to the coordinate information of the bubble layer, so as to judge whether it is necessary to convert the bubble layer and the text layer respectively.
[0055] In this step, before judging the bubble layer, a pair of text layer and bubble layer extracted through steps S1 and S2 needs to be established, which includes the text content text and the coordinate range information text_box of the text layer. The coordinate range information layer_bubble.bbox attribute of the bubble layer is its coordinate information, where the bubble is identified by layer_bubble. The coordinate range information of both is in the form of [x1, y1, x2, y2], that is, the upper-left coordinate (x1, y1) and the lower-right coordinate (x2, y2) of the layer area. Then, according to the coordinate range information layer_bubble.bbox of the bubble layer, the center point position center, width value w, and height value h of the layer are calculated, and the shape of the bubble is judged according to the width value and height value of the bubble layer, that is: if the width value is greater than the height value, the shape of the bubble layer is horizontal, and conversion is required. The reason for this conversion is that Chinese comics use horizontal layout and are arranged from left to right in sequence; while Japanese comics use vertical layout and are arranged from top to bottom in sequence. Therefore, during the process of translating Chinese comics into Japanese comics, the horizontal bubble layer needs to be converted into a vertical direction. During the conversion process, the center point position center of the bubble layer remains unchanged, and the width value and height value are swapped to convert the bubble layer, and the coordinate range information of the converted bubble layer is obtained. At the same time, the text layer corresponding to the bubble layer needs to be converted in the same rule to obtain the coordinate range information of the converted text layer. The above conversion method of the bubble layer uses the method of swapping the width value w and height value h of the bubble layer, but it is not limited to this method. The scaling strategy can also be set according to the actual situation, which can not only change the direction of the bubble, but also expand and shrink the bubble layer by a certain proportion according to the length comparison between the original text and the translated text. This proportion is related to the length ratio of the original text and the translated text.
[0056] Step S4: If the coordinate information of the converted bubble layer exceeds the coordinate range of the to-be-processed picture, then translate the center points of the text layer and the bubble layer so that the bubble layer is included within the range of the to-be-processed picture.
[0057] In this step, if the coordinate information of the converted bubble layer or text layer exceeds the coordinate range of the picture, then perform a truncation operation on the converted coordinates or perform a translation of the center points of the coordinates of the text layer and the bubble layer so that they are included within the image range. For example: if the right side of the bubble layer or the corresponding text layer exceeds the picture range, then move the center point position coordinates of the bubble layer or the corresponding text layer to the left until the entire layer is within the picture range.
[0058] In one embodiment, after extracting the bubble layer corresponding to the text layer according to the judgment condition, the following steps are included: filtering the text layer according to the similarity matching method; setting the retained text layer to be invisible, retaining the text content and coordinates of the layer, and recording the bubble layer corresponding to the text layer.
[0059] In this step, the text layer is filtered. This module is based on specific business designs, such as filtering by performing similarity matching (such as specific methods like edit distance, vector similarity, etc.) through a given translation original text, or filtering by whether there is a corresponding bubble layer. Finally, the finally retained text layer is set to be invisible, and the text content and coordinates of the layer are retained, and the bubble layer corresponding to the text layer is recorded.
[0060] In addition, in the psd material to be processed in this application, the text part is of the text layer type, and both the bubble layer and the text layer are separate layers. For materials that do not meet the above conditions, the solutions are as follows: If the text layer is a rasterized ordinary layer, the extraction of the text layer content can be changed from direct extraction to extracting the text information of each layer through ocr text recognition; if the bubble layer is not a separate layer, the original bubble position can be extracted through a bubble segmentation model and a drawn bubble can be used for covering.
[0061] The layer adaptive stretching method for comic translation provided by the present invention, the layer adaptive stretching method, device, computer device and storage medium for comic translation provided by the present invention, through a layer extraction tool, extract the text layer from the picture to be processed, and the coordinate information of the text layer; set a distance threshold, and extract the bubble layer corresponding to the text layer according to the judgment condition; judge the shape of the bubble layer according to the coordinate information of the bubble layer, so as to judge whether it is necessary to perform conversions on the bubble layer and the text layer respectively; if the coordinate information of the converted bubble layer exceeds the coordinate range of the picture to be processed, then translate the center points of the text layer and the bubble layer so that the bubble layer is included within the range of the picture to be processed. The present invention can automatically adjust the background bubbles of the text content by machine, no longer relying on manual adjustment and drawing by designers, reducing manual participation and saving manpower.
[0062] Embodiment 2:
[0063] An embodiment of the present invention further provides a layer adaptive stretching device for comic translation, as Figure 3 shown, including:
[0064] A text layer extraction module, configured to extract a text layer from a picture to be processed, and the coordinate information of the text layer, based on a layer extraction tool;
[0065] The bubble layer extraction module is used to set a distance threshold and extract the bubble layer corresponding to the text layer according to the judgment condition;
[0066] The layer conversion module is used to judge the shape of the bubble layer according to the coordinate information of the bubble layer, so as to judge whether it is necessary to convert the bubble layer and the text layer separately;
[0067] The layer translation module is used to translate the center points of the text layer and the bubble layer if the coordinate information of the converted bubble layer exceeds the coordinate range of the to-be-processed picture, so that the bubble layer is included within the range of the to-be-processed picture.
[0068] In one embodiment, the bubble layer extraction module includes:
[0069] The judgment unit is used for the coordinate range of the bubble layer to include the coordinate range of the text layer, and the distance between the center points of the two layers is less than the distance threshold.
[0070] In one embodiment, the device further includes:
[0071] The filtering module is used to filter the text layer according to the similarity matching method;
[0072] The layer retention module is used to set the retained text layer to be invisible, retain the text content and coordinates of the layer, and record the bubble layer corresponding to the text layer.
[0073] The layer adaptive stretching device for comic translation provided by the present invention, the layer adaptive stretching method, device, computer device and storage medium for comic translation provided by the present invention, by using a layer extraction tool to extract the text layer from the to-be-processed picture and the coordinate information of the text layer; setting a distance threshold and extracting the bubble layer corresponding to the text layer according to the judgment condition; judging the shape of the bubble layer according to the coordinate information of the bubble layer, so as to judge whether it is necessary to convert the bubble layer and the text layer separately; if the coordinate information of the converted bubble layer exceeds the coordinate range of the to-be-processed picture, then translate the center points of the text layer and the bubble layer so that the bubble layer is included within the range of the to-be-processed picture. The present invention can automatically adjust the background bubbles of the text content by machine, no longer relying on manual adjustment and drawing by designers, reducing manual participation and saving manpower.
[0074] Embodiment 3:
[0075] An embodiment of the present invention also provides a layer adaptive stretching device for comic translation, specifically as follows:
[0076] 1. Text and corresponding bubble information extraction module
[0077] This module proposes a method for extracting text information and corresponding bubble information based on PSD materials. This method is an independent framework embedded in the proposed typesetting framework for translated Japanese manga based on PSD materials as a module. As Figure 4 shown in the flowchart of this module:
[0078] The specific method of the module is as follows:
[0079] 1) Input the PSD material, and use layer extraction tools such as psd_tools to extract the type of each visible layer and the coordinate information of the layer. For example, the type of the text layer is 'type', the type of the ordinary layer is 'pixel', the type of the layer group is 'group', etc.; each layer has corresponding coordinate information bbox = [x1, y1, x2, y2], where (x1, y1) represents the upper left corner coordinates of the area, and (x2, y2) represents the lower right corner coordinates;
[0080] 2) Obtain the text content text of the text layer and the corresponding coordinate information text_box;
[0081] 3) Set the distance threshold distance. For each text layer a, find another non-text and visible layer b, on the condition that the coordinate layer_box of this layer b completely contains the coordinate text_box of the text layer a, and the distance between the center points of the two layers is less than the threshold distance, otherwise the bubble layer corresponding to the text layer a is not found;
[0082] 4) Filter the text layer. This module is designed according to specific business, for example, filter by similarity matching (such as specific methods like edit distance, vector similarity, etc.) through the given original translation, or filter by whether there is a corresponding bubble layer, etc.;
[0083] 5) Set the finally retained text layer to be invisible, and retain the text content and coordinates of this layer, and record the bubble layer corresponding to this text layer;
[0084] Note that the proposed solution in this part requires that the text part in the PSD material is of the text layer type, and both the bubble and the text layer are separate layers. For materials that do not meet the above conditions, the solutions are as follows:
[0085] If the text layer is a rasterized ordinary layer, the extraction of the text layer content can be changed from direct extraction to text information extraction layer by layer through OCR text recognition;
[0086] If the bubble layer is not a separate layer, the original bubble position can be extracted through a bubble segmentation model and a drawn bubble can be used for covering.
[0087] The bubble direction scaling in the solution of this article can be operated according to the actual situation.
[0088] In addition, if the original text of this part is any non-Japanese language such as Chinese or English, and the target language is Japanese, the mapping solution from the original text to the target language needs to be determined according to the actual situation. If there is an original text-translation dictionary, it can be matched by searching. If there is no original text-translation dictionary, strategies can be set by oneself, such as directly using a language translation interface for translation and grammar correction, etc.
[0089] 2. Bubble layer vertical stretching module
[0090] This module proposes a method for adaptive stretching of bubbles based on psd materials, mainly to solve the style adaptation of translated bubbles for Japanese manga types. The specific method is as follows:
[0091] 1) Based on the text and bubble layer information extracted in 1, establish a pair of text and bubble layer. The text information includes the text content text and the text coordinate information text_box. The bubble is represented by layer_bubble, and it has the layer_bubble.bbox attribute as its coordinate information. The coordinate information is represented by the upper-left and lower-right coordinates in the form of [x1, y1, x2, y2];
[0092] 2) According to layer_bubble.bbox, the center point center, width w, and height h of the bubble layer can be calculated. According to w and h, judge the shape of the bubble. If w>h, that is, the bubble is in a horizontal form, conversion is required. Here, the center point center remains unchanged, and the width w and height h are swapped to scale the bubble layer, and the position coordinates of the scaled bubble are obtained. At the same time, the position coordinates of the corresponding text layer of the bubble layer need to be transformed according to the same rule;
[0093] 3) If the scaled coordinate information exceeds the coordinate range of the image, perform a truncation operation on the scaled coordinates or perform a central translation of the text coordinates and bubble coordinates so that they are included within the image range.
[0094] Note that in this module, the scaling method of the bubble adopts the method of swapping the width w and height h of the bubble, but it does not limit the only strategy. The scaling strategy can be set according to the actual situation, which can not only change the direction of the bubble, but also expand and shrink the bubble according to the length comparison between the original text and the translation.
[0095] Among them, the readable storage medium can be a computer storage medium or a communication medium. The communication medium includes any medium that facilitates the transmission of a computer program from one place to another. The computer storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer. For example, the readable storage medium is coupled to the processor, so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an Application Specific Integrated Circuits (ASIC). In addition, the ASIC can be located in a user device. Of course, the processor and the readable storage medium can also exist as discrete components in a communication device. The readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0096] The present invention also provides a program product, which includes execution instructions stored in a readable storage medium. At least one processor of the device can read the execution instructions from the readable storage medium, and the execution of the execution instructions by at least one processor enables the device to implement the methods provided by the above various embodiments.
[0097] In the above embodiments of the terminal or the server, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, a Digital Signal Processor (DSP), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in combination with the present invention can be directly embodied as being executed and completed by a hardware processor, or by a combination of hardware and software modules in the processor.
[0098] 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 them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for layer adaptive stretching in comic translation, characterized in that, it includes: Based on a layer extraction tool, extract the text layer from the image to be processed, as well as the coordinate information of the text layer; Set a distance threshold, and extract the bubble layer corresponding to the text layer according to the judgment condition; Judge the shape of the bubble layer according to the coordinate information of the bubble layer, so as to judge whether it is necessary to convert the bubble layer and the text layer separately; If the coordinate information of the converted bubble layer exceeds the coordinate range of the image to be processed, then translate the center points of the text layer and the bubble layer so that the bubble layer is included within the range of the image to be processed.
2. The method for layer adaptive stretching in comic translation according to claim 1, characterized in that, the judgment condition includes: The coordinate range of the bubble layer includes the coordinate range of the text layer, and the distance between the center points of the two layers is less than the distance threshold.
3. The method for layer adaptive stretching in comic translation according to claim 1, characterized in that, After extracting the bubble layer corresponding to the text layer according to the judgment condition, it includes: Filter the text layer according to the similarity matching method; Set the retained text layer to be invisible, and retain the text content and coordinates of the layer, and record the bubble layer corresponding to the text layer at the same time.
4. The method for layer adaptive stretching in comic translation according to claim 2 or 3, characterized in that, Judging the shape of the bubble layer according to the coordinate information of the bubble layer, so as to judge whether it is necessary to convert the bubble layer and the text layer separately, includes: According to the coordinate information of the bubble layer, calculate the width value and height value of the bubble layer; If the width value is greater than the height value, it is judged that the bubble layer is in a horizontal form.
5. The method for layer adaptive stretching in comic translation according to claim 4, characterized in that, After judging that the bubble layer is in a horizontal form, it includes: When it is judged that the bubble layer is in a horizontal form, convert the position coordinates of the bubble layer and the text layer corresponding to the bubble layer by swapping the width value and the height value.
6. A device for layer adaptive stretching in comic translation, characterized in that, it includes: A text layer extraction module, which is used to extract the text layer from the image to be processed based on a layer extraction tool, as well as the coordinate information of the text layer; A bubble layer extraction module, which is used to set a distance threshold and extract the bubble layer corresponding to the text layer according to the judgment condition; A layer conversion module, which is used to judge the shape of the bubble layer according to the coordinate information of the bubble layer, so as to judge whether it is necessary to convert the bubble layer and the text layer separately; A layer translation module, which is used to translate the center points of the text layer and the bubble layer if the coordinate information of the converted bubble layer exceeds the coordinate range of the image to be processed, so that the bubble layer is included within the range of the image to be processed.
7. The device for layer adaptive stretching in comic translation according to claim 6, It is characterized in that the bubble layer extraction module includes: a judgment unit, configured to determine that the coordinate range of the bubble layer includes the coordinate range of the text layer, and the distance between the center points of the two layers is less than the distance threshold.
8. The layer adaptive stretching device for comic translation according to claim 6, It is characterized in that the device further includes: a filtering module, configured to filter the text layer according to a similarity matching method; a layer retention module, configured to set the retained text layer to be invisible, retain the text content and coordinates of the layer, and record the corresponding bubble layer of the text layer.
9. A computer device, including a memory and a processor, the memory stores a computer program that can run on the processor, It is characterized in that when the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
10. A computer-readable storage medium, on which a computer program is stored, It is characterized in that when the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
A cartoon form conversion method and device
CN109741426A
Text picture translation method and device, electronic equipment and readable storage medium
CN114237468A