Text region determination method and device, electronic equipment and storage medium

By determining the target subject area and text area that match the text in the graphic layout, the problem of low matching of the text area in traditional technology is solved, the correlation between the text and the area and the graphic layout effect are improved, and the user experience and The display attractiveness of the content.

CN118587712APending Publication Date: 2024-09-03XINGIN INFORMATION TECH (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410630523.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-21
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

The traditional image and text typesetting method matches the length of the text by detecting the blank area of ​​the image, resulting in a low matching degree between the text and the text area, and does not consider the correlation between the text content and the area.

Method used

By obtaining the target image and target text, determine the target subject area that matches the text, and determine the target text area in the image based on the text and subject area, ensuring that the size of the text area matches the length of the text, and combined with the correlation of the subject area, improve The association between text and region.

Benefits of technology

It improves the matching between text and text area, ensures the relevance of text content and area, and improves the effect and user experience of graphic layout. Especially in the display of graphic notes and live broadcast cover images, it increases attraction and popularity. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587712A
    Figure CN118587712A
Patent Text Reader

Abstract

The invention discloses a text region determination method and device, electronic equipment and a storage medium. The method comprises the steps of obtaining a target image and a target text; based on the target text, determining a target main body area matched with the target text from the target image; the target text area is determined in the target image based on the target text and the target main body area, the target text area is used for displaying the target text, and the matching degree between the text and the text area for displaying the text is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, device, electronic device and storage medium for determining a text area. Background Art

[0002] Graphic typesetting refers to displaying text in an image. Traditional graphic typesetting detects the blank area of ​​the image and then determines the text area in the image to display the text based on whether the size of the blank area matches the length of the text. However, the above method results in a low degree of matching between the text and the corresponding text area. Summary of the invention

[0003] The present application provides a method, device, electronic device and storage medium for determining a text region, which improves the matching degree between a text and a corresponding text region.

[0004] In a first aspect, the present application provides a method for determining a text region, the method comprising:

[0005] Get the target image and target text;

[0006] Based on the target text, determining a target subject area matching the target text from the target image;

[0007] Based on the target text and the target body area, a target text area is determined in the target image, wherein the target text area is used to display the target text.

[0008] In a second aspect, the present application provides a device for determining a text region, the device comprising: an acquisition unit and a processing unit;

[0009] An acquisition unit, used for acquiring a target image and a target text;

[0010] A processing unit, configured to determine, based on the target text, a target body region matching the target text from the target image;

[0011] The processing unit is further used to determine a target text area in the target image based on the target text and the target body area, wherein the target text area is used to display the target text.

[0012] In a third aspect, the present application provides an electronic device, comprising: a processor and a memory, the processor being connected to the memory, the memory being used to store a computer program, and the processor being used to execute the computer program stored in the memory, so that the electronic device performs the method of the first aspect.

[0013] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program enables a computer to execute the method of the first aspect.

[0014] In a fifth aspect, the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and is computer-operable to cause the computer to execute the method of the first aspect.

[0015] Implementing this application has the following beneficial effects:

[0016] First, a target image and a target text are obtained; then, based on the target text, a target main body area matching the target text is determined from the target image; then, based on the target text and the target main body area, a target text area is determined in the target image, wherein the target text area is used to display the target text. That is to say, the present application determines the final target text area by combining the target main body area and the target text. At this time, the size of the target text area matches the length of the target text. Since the target main body area is correlated with the target text, the target text area is determined in combination with the target main body area, so that the target text area is correlated with the target main body area, and then the target text is correlated with the target text area. That is, the target text area determined at this time takes into account the content of the target text, which improves the matching degree between the text and the corresponding text area compared to only considering whether the size of the blank area matches the length of the text. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 A schematic diagram of a system for determining a text area provided in an embodiment of the present application;

[0019] Figure 2 A schematic diagram of a text area determination scenario provided in an embodiment of the present application;

[0020] Figure 3 A schematic diagram of another text area determination scenario provided in an embodiment of the present application;

[0021] Figure 4 A flowchart of a method for determining a text area provided in an embodiment of the present application;

[0022] Figure 5 A schematic diagram of determining a target subject area provided in an embodiment of the present application;

[0023] Figure 6A schematic diagram of a method for determining a target text area provided in an embodiment of the present application;

[0024] Figure 7 A schematic diagram of obtaining a new target image based on a target image provided in an embodiment of the present application;

[0025] Figure 8 A block diagram of the functional units of a device for determining a text area provided in an embodiment of the present application;

[0026] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0028] The terms "first", "second", "third" and "fourth" etc. in the specification, claims and drawings of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0029] Reference to "embodiments" herein means that a particular feature, result, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0030] From the above background technology, it can be seen that the current traditional graphic typesetting method is to detect the blank area of ​​the image, and then determine the text area for displaying the text in the image based on whether the size of the blank area matches the length of the text. However, this method does not consider the correlation between the content of the text and the text area, resulting in a low degree of matching between the text and the corresponding text area.

[0031] Therefore, the present application obtains a target image and a target text; then, based on the target text, determines a target body area that matches the target text from the target image; then, based on the target text and the target body area, determines a target text area in the target image, wherein the target text area is used to display the target text. That is to say, the present application determines the final target text area by combining the target body area and the target text. At this time, the size of the target text area matches the length of the target text. Since there is a correlation between the target body area and the target text, the target text area is determined in combination with the target body area, so that the target text area is associated with the target body area, and then the target text is associated with the target text area. That is, the target text area determined at this time takes into account the content of the target text, and compared with only considering whether the size of the blank area matches the length of the text, the matching degree between the text and the corresponding text area is improved.

[0032] See also Figure 1 , Figure 1 A schematic diagram of a system for determining a text region provided in an embodiment of the present application.

[0033] Figure 1 The text area determination system shown includes a client and a text area determination device, wherein the client can be a smart phone, tablet computer, laptop computer, desktop computer, smart TV, desktop computer, smart watch, smart car and other smart terminals, which is not specifically limited in this application; the text area determination device can be a server, such as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, as well as basic cloud computing services such as big data and artificial intelligence platforms, which is not specifically limited in this application.

[0034] A target application software may be installed on the client, and the user may publish media content (such as audio and video, pure images, pure text, graphic notes, etc.) through the target application software on the client. This application is mainly explained by taking graphic notes as an example; a first virtual function button corresponding to the method for determining the text area of ​​this application is provided on the target application software. When the user publishes a graphic note, if the user wants to perform graphic layout on the cover image of the graphic note to be published, that is, perform graphic layout based on the target image and target text of this application, then the target image is equivalent to the cover image of the graphic note to be published, and the target text is determined based on the text in the graphic note to be published (which will be explained in detail below, not explained here), then the user may touch the first virtual function button, and correspondingly, the text area determination device obtains the target image and target text from the client, and then the text area determination device executes the text area determination method of this application based on the target image and target text to obtain the typeset image, that is, the new cover image of the note to be published, as follows:

[0035] The device for determining the text area determines a target body area matching the target text from a target image based on the target text; then the device for determining the text area determines a target text area in the target image based on the target text and the target body area, wherein the target text area is used to display the target text; then the device for determining the text area displays the target text in the target text area (such as overlay display, fill display, floating display, etc., which is not specifically limited in this application) to obtain a new target image, i.e., a typeset image; finally, the device for determining the text area sends the typeset image to the client, and accordingly, the client publishes a graphic note, and the cover image of the graphic note is the typeset image.

[0036] To facilitate understanding, the main scenarios involved in the embodiments of the present application are introduced below.

[0037] First, see Figure 2 , Figure 2 A schematic diagram of a text area determination scenario provided in an embodiment of the present application.

[0038] When a user publishes a picture and text note, for example, if the user wants to publish an image and text, if there is only one image, the cover image displayed by the published picture and text note can default to the image; if there are multiple images, the cover image can default to one of the multiple images (for example, the first image among the multiple images, i.e., the first image, which is not specifically limited in this application); however, for users (especially advertising users), the cover image is a key factor in attracting other users and is crucial to the popularity of the picture and text note. Therefore, this application corresponds to setting the above-mentioned first virtual function button on the target application software of the client to satisfy the user's desire to intelligently generate a cover image for the picture and text note, i.e., to perform picture and text typeset based on the image and text, obtain the typeset image, and then use the typeset image as the new cover image, thereby improving the click-through rate of the picture and text note.

[0039] For example, Figure 2 As shown, if the user wants to publish the target image and target text through the client, the user can check the first virtual function button, and then the user touches the second virtual function button (with the publishing function), and accordingly, the client sends the target image and target text to the text area determination device; then the text area determination device executes the text area determination method of the present application based on the target image and the target text (no further details are given here), and obtains the typeset image, that is, the new target image; then the text area determination device sends the new target image to the client, and the new target image includes the target text. Accordingly, after the client receives the new target image, the publication of the graphic note is completed, and the client displays the cover image of the graphic note as the new target image (such as Figure 2 shown).

[0040] Of course, in an optional embodiment, based on Figure 2 For example, see Figure 3 , Figure 3 A schematic diagram of another text area determination scenario provided in an embodiment of the present application, such as Figure 3As shown, if the user checks the first virtual function button and then touches the second virtual function button, the device for determining the text area receives the target image (i.e., the target image) and the target text from the client accordingly; then the device for determining the text area can also first generate a new target text based on the target image and the target text. For example, first obtain an image description of the target image; then splice the image description, the target text, and a preset prompt word to obtain a spliced ​​text, wherein the preset prompt word is used to indicate that a text of a target type is generated based on the image description and the target text corresponding to the target image, wherein the target type can be, for example, an advertisement-type copy, which is not specifically limited in this application; then generate a new target text based on the spliced ​​text and the target image, for example, encode the target image to obtain a first feature vector, and encode the spliced ​​text to obtain a second feature vector; then fuse the first feature vector and the second feature vector to obtain a first fused vector; then normalize the first fused vector to obtain a fourth feature vector; then based on the fourth feature vector, determine the first query matrix, the first key matrix, and the first value matrix corresponding to the first feature vector, and determine the second query matrix, the second key matrix, and the second value matrix corresponding to the second feature vector. key matrix and the second value matrix; then the first key matrix and the second key matrix are fused to obtain the third key matrix, and the first query matrix and the second query matrix are fused to obtain the third query matrix, and the first value matrix and the second value matrix are fused to obtain the fourth query matrix; then the attention mechanism is performed based on the third query matrix, the third key matrix and the third value matrix to obtain the third eigenvector; then the third eigenvector and the first fusion vector are fused to obtain the second fusion vector; then the second fusion vector is normalized to obtain the fifth eigenvector; then the features corresponding to the target image and the features corresponding to the target text in the fifth eigenvector are respectively input into the feedforward neural network to obtain the sixth eigenvector and the seventh eigenvector respectively; then the sixth eigenvector, the seventh eigenvector and the second fusion vector are fused to obtain the target eigenvector; then the target eigenvector is decoded to obtain a new target text. At this time, the generated new target text not only combines the features of the target image and the target text, but also belongs to the target type of copywriting. Then, when the graphic typesetting is performed based on the new target text and the target image, it can not only meet the reasonable layout of the typesetting, but also meet the matching degree between the text content and the image.

[0041] Then, the device for determining the text area executes the text area determination method of the present application based on the new target text and the target image (no further details will be given here) to obtain a typeset image, i.e., a new target image; then, the device for determining the text area sends the new target image to the client, and the new target image includes the new target text. Accordingly, after the client receives the new target image, the publication of the graphic note is completed, and the cover image of the graphic note displayed by the client is the new target image (e.g., Figure 3 It should be noted that this application Figure 2 and Figure 3 The styles and layouts of the first virtual function button and the second virtual function button shown are only examples, and this application does not specifically limit them. Figure 2 and Figure 3 The layout and styles of other elements shown in the figure are only examples and are not specifically limited in this application.

[0042] It can be seen that the user can use the first virtual function button to layout the image and text according to the text area determination method of the present application to obtain a new image, and then use the new image as the cover image of the picture and text note for publication. Compared with the user making the cover image for publication, the user experience is improved; in addition, the cover image generated according to the text area determination method of the present application combines the image and text features, ensuring the matching degree between the text and the final text filling area, which can make the presentation effect of the cover image better, more easily attract the interest of other users, and enhance the popularity of the picture and text note itself, thereby satisfying the popularity needs of users (especially advertising users).

[0043] Second, live broadcast scene. In the embodiment of the present application, the live broadcast user (hereinafter referred to as "anchor") can broadcast live through the client, for example, it can also be broadcast live through the target application software on the client. When the anchor is broadcasting live, the live broadcast cover image and live broadcast title can be set through the client. Correspondingly, the client sends the live broadcast cover image and live broadcast title to the text area determination device. At this time, the live broadcast cover image is equivalent to the target image in the embodiment of the present application, and the live broadcast title is equivalent to the target text in the embodiment of the present application. Then the text area determination device determines the target text area corresponding to the live broadcast title in the live broadcast cover image based on the text area determination method of the embodiment of the present application (the principle is similar to the target text area for determining the target text, which will not be repeated here), and then the text area determination device can display the live broadcast title in the target text area of ​​the live broadcast cover image (such as superimposed display, filled display, floating display, etc., which is not specifically limited in this application), and obtain a new live broadcast cover image, that is, at this time, the new live broadcast cover image includes the live broadcast title, and then the text area determination device sends the new live broadcast cover image to the client, and then displays the live broadcast cover to the user through the client as the new live broadcast cover image, which can increase the attractiveness of the live broadcast to other users.

[0044] See also Figure 4 , Figure 4 A flowchart of a method for determining a text area provided in an embodiment of the present application is provided. The method is applied to the apparatus for determining a text area in the above embodiment. The method includes but is not limited to the following steps S401-S403:

[0045] S401: Acquire a target image and a target text.

[0046] As in the above scenario embodiment, the user can publish media content through the client. For example, when the media content is a picture and text note, the picture and text note includes text and images. In this case, the target image and target text correspond to the image and text in the picture and text note to be published, respectively, or the target text is a text generated based on the image and text in the picture and text note to be published. That is to say, after obtaining the target image and target text, a new target text can be generated based on the target image and target text (the principle of generating a new target text here is similar to the principle of generating a new target text mentioned above, which will not be repeated here), and then the subsequent steps execute the text area determination method of the present application based on the new target text and target image, which will not be elaborated here.

[0047] S402: Based on the target text, determine a target body area matching the target text from the target image.

[0048] In an embodiment of the present application, a device for determining a text area obtains multiple subject areas by performing subject detection or target detection on a target image. Exemplarily: first, the target image is divided into regions to obtain multiple regions; then, for a first region, X bounding boxes corresponding to the first region are predicted, wherein the center of each bounding box is located in the first region, the first region is any one of the multiple regions, and each bounding box is used to predict whether there is a subject in the first region, X>0; then the size and position of each bounding box are determined, wherein the size of each bounding box includes width and height, and the position of each bounding box is determined based on the center coordinates (including horizontal and vertical coordinates) of the bounding box, the horizontal coordinate of the center coordinate of each bounding box is the horizontal offset from the upper left vertex of the first region, and the vertical coordinate of the center coordinate of each bounding box is the vertical offset from the upper left vertex of the first region.

[0049] Then, based on the size and position of each bounding box, the confidence corresponding to each bounding box is predicted, wherein the confidence is used to characterize whether there is a subject in the bounding box. Specifically: based on the size and position of each bounding box, the features in each bounding box can be extracted; then based on the features in each bounding box, it is predicted whether there is a preset subject in each bounding box; if not, the confidence corresponding to each bounding box is determined to be 0; if so, the confidence corresponding to each bounding box is determined to be the intersection-and-union ratio of each bounding box and the bounding box where the subject is actually located, that is, the ratio of the intersection area of ​​each bounding box and the bounding box where the preset subject is actually located to the union area of ​​each bounding box and the bounding box where the preset subject is actually located.

[0050] And classify the first area to obtain the probability that the first area belongs to each category in the preset multiple category bodies, and then use the highest probability as the classification probability of the first area; then based on the classification probability of the first area and the confidence corresponding to each bounding box, obtain the target confidence of each bounding box, such as the product of the two. Then based on the target confidence of each bounding box corresponding to each area, each bounding box corresponding to each area is screened to obtain multiple target bounding boxes. Specifically: first, the bounding boxes whose target confidence is lower than the first threshold among the X bounding boxes corresponding to each area are deleted to obtain multiple first bounding boxes; then the multiple first bounding boxes are sorted from large to small according to the target confidence to obtain a sorted bounding box list; then the first bounding box with the highest target confidence is selected from the bounding box list; then the intersection and union ratio of the first bounding box with the highest target confidence and the remaining first bounding boxes in the bounding box list is determined (that is, the intersection of the first bounding box and each first bounding box remaining in the bounding box list The ratio of the area of ​​each first bounding box to the area of ​​the union of each first bounding box and each remaining first bounding box in the bounding box list); then the first bounding box whose intersection-and-union ratio is greater than the second threshold is deleted from the bounding box list, and the first bounding box with the largest target confidence is selected from the remaining first bounding boxes in the bounding box list repeatedly until the bounding box list is empty, to obtain multiple second bounding boxes, wherein the intersection-and-union ratio corresponding to each second bounding box is less than the second threshold; then based on the multiple second bounding boxes, the corresponding multiple subject areas can be obtained; of course, the present application can also adopt other algorithms for subject detection or target detection, such as the YOLO target detection model, which is not specifically limited in the present application.

[0051] Then, feature extraction is performed on each main body region to obtain the image feature of each main body region, and feature extraction is performed on the target text to obtain the text feature of the target text. Of course, optionally, after determining multiple main body regions, since each main body region corresponds to a bounding box, the position of the bounding box corresponding to each main body region can be used to obtain the regional image corresponding to each main body region; then the regional image corresponding to each main body region and the target text are input into a feature extraction model, such as a multimodal neural network model (Contrastive Language-Image Pre-Training, CLIP), the feature extraction model includes an image encoder and a text encoder, then the image encoder extracts features from the regional image of each main area to obtain image features corresponding to each main area, and the text encoder extracts features from the target text to obtain text features corresponding to the target text; then based on the image features and text features of each main area, the similarity between each main area and the target text is determined, specifically, the image features and text features are mapped to feature spaces of the same dimension to obtain new image features and new text features, and then the similarity between the new image features and the new text features is calculated (the calculation principle of the similarity can be, for example, cosine similarity, which is not specifically limited in this application), that is, the similarity between each main area and the target text is obtained; then based on the similarity corresponding to each main area, the target main area is determined, for example, the main area with the largest similarity is determined as the target main area.

[0052] For easier understanding, see Figure 5 , Figure 5 An embodiment of the present application provides a schematic diagram for determining a target subject area.

[0053] like Figure 5 As shown, based on the above subject detection algorithm, the target image is subjected to subject detection to obtain a subject set, namely BOX, which includes multiple subject areas, namely: bbox1 (i.e. Figure 5 The TV shown), bbox2 (i.e. Figure 5 The computer shown), bbox3 (i.e. Figure 5 The cup shown), bbox4 (i.e. Figure 5 Then, image features are extracted for each main area in the BOX set to obtain the image feature set BOX embSpecifically: extract the image features of bbox1 in BOX to obtain the corresponding image feature vector, namely emb1; extract the image features of bbox2 to obtain the corresponding image feature vector, namely emb2; extract the image features of bbox3 to obtain the corresponding image feature vector, namely emb3; and extract the image features of bbox4 to obtain the corresponding image feature vector, namely emb4; then perform feature extraction on the target text to obtain the corresponding text feature vector, namely TEXT emb ; Then calculate the text feature vector TEXT emb The similarity between the image feature vectors corresponding to each subject area is obtained by the similarity set SIM emb , specifically: calculate TEXT emb The similarity s1 between the image feature vector emb1 is calculated by TEXT emb The similarity s2 between the image feature vector emb2 is calculated by TEXT emb The similarity s3 with the image feature vector emb3, and the calculation of TEXT emb The similarity s4 between the image feature vector emb4; then based on the function argmax(SIM emb ), indicating that the maximum similarity is determined from the similarity set, that is, the result is s1, and then the main area corresponding to s1, that is, bbox1, is determined as the target main area. That is to say, for example, if the target text is "The first place in the IQ tax of home appliances: TV", then the main area most similar to the target text is Figure 5 The area where the TV is located as shown by bbox1.

[0054] S403: Determine a target text area in the target image based on the target text and the target main body area.

[0055] In an embodiment of the present application, the target text area is used to display the target text, that is, after the target text area is determined, the target text can be displayed in the target text area of ​​the target image, for example, the target text can be overlaid, filled, or suspended in the target text area according to the preset typesetting information corresponding to the target text. The present application does not limit the specific display form, and thus a new target image can be obtained; of course, if a new target text is generated based on the target text and the target image, the new target text is displayed in the target text area of ​​the target image to obtain a new target image; further, the text area determination device can also send a new target image to the client, and then the client completes the publication of the media content based on the new target image, so that the cover image of the published media content is the new target image.

[0056] Exemplarily, step S403 may determine the target text box size that matches the target text based on the typesetting information of the target text, wherein the target text typesetting information may be pre-configured or selected by the user, that is, the text area determination device obtains it from the client, and this application does not make specific limitations. The typesetting information may include, for example, font size, font, font color, character spacing, alignment (such as center alignment, justification, left alignment, right alignment, etc.), line spacing, etc., and then determine the target text box size that matches the target text based on the typesetting information of the target text and the length of the target text; then grayscale the target image to obtain a grayscale image;

[0057] Then, based on the target text box size, a target standard text box corresponding to the target text box size is determined; then, the target standard text box is moved in the grayscale image to obtain multiple third candidate text areas, for example, according to a preset step size, the target standard text box located in the upper left corner of the grayscale image is moved in the grayscale image in a target direction, for example, first in a horizontal direction and then in a vertical direction, or first in a vertical direction and then in a horizontal direction, which is not limited in the present application, and then multiple third candidate text areas can be obtained, that is, the size of the target text box of each third candidate text area; then, the multiple third candidate text areas are screened to obtain multiple fourth candidate text areas, wherein each fourth candidate text area belongs to a first target area, and the first target area is an area in the grayscale image whose grayscale value is a first preset value, that is, the grayscale value of each pixel in each fourth candidate text area in the grayscale image is the first preset value; then, the distance between each fourth candidate text area and the target main area is determined, and the fourth candidate text area with the smallest distance is determined as the target text area.

[0058] It can be seen that compared with the prior art that directly selects a text filling area that matches the length of the text in the blank area of ​​the image, the embodiment of the present application first directly determines the corresponding target text box size based on the length of the text, and then moves the target standard text box corresponding to the target text box size in the grayscale image to obtain multiple third candidate text areas, and then selects multiple fourth candidate text areas with grayscale values ​​of the first preset value, and then selects the area closest to the target main area from the multiple fourth candidate text areas as the target main area. This not only takes into account the correlation between the text and the filling area, but also solves the problem of low correlation between the text filling area and the text content in the prior art, and will not block the target main area related to the text, thereby ensuring the typesetting effect of the image.

[0059] Of course, in an optional embodiment, step S403 may also include but is not limited to the following steps S11-S13:

[0060] S11. Generate multiple first candidate text regions on the target image.

[0061] Exemplarily, a plurality of preset font sizes are obtained, i.e., a plurality of font sizes that can be displayed for text; then, based on the typesetting information of the target text and each font size, a standard text box corresponding to each font size is determined; then, based on a preset moving step length, the standard text box corresponding to each font size is moved in the target image to obtain the plurality of first candidate text areas, wherein each first candidate text area belongs to the target area, and the target area includes the area of ​​the target image excluding the target main area. For example, for the standard text box corresponding to each font size, each standard text box located in the upper left corner of the target image is first moved in the target image in a target direction according to a preset moving step length, such as first moving in a horizontal direction and then in a vertical direction, or first moving in a vertical direction and then in a horizontal direction, i.e., the target direction may include a horizontal direction and / or a vertical direction, etc., which is not limited in the present application, and then a plurality of fifth candidate text areas may be obtained; then, the plurality of fifth candidate text areas are screened to obtain a plurality of first candidate text areas, wherein each first candidate text area belongs to the target area, and the target area includes the area of ​​the target image excluding the target main area. Of course, in the same way, the grayscale image of the target image can also be determined, and then based on a preset moving step size, each standard text box located in the upper left corner of the grayscale image is moved in the grayscale image in the target direction to obtain multiple sixth candidate text areas, and then the multiple sixth candidate text areas are screened to obtain multiple first candidate text areas. At this time, each first candidate text area belongs to the target area, and the target area is an area other than the target main area and whose grayscale value is the first preset value. The present application does not specifically limit the principle of generating multiple first candidate text areas.

[0062] In this embodiment, the multiple first candidate text areas generated all belong to areas outside the target main area, rather than blank areas in the prior art. This not only ensures that the target main area related to the target text is not blocked, but also increases the diversity of the positions filled by the target text, thereby improving the typesetting effect.

[0063] In an optional embodiment, before obtaining multiple first candidate text regions, the target image may be firstly saliency calculated to obtain a saliency map corresponding to the target image. Exemplarily, a visual saliency detection algorithm based on deep learning may be used, such as inputting the target image into a constructed full convolutional neural network for feature extraction to obtain a feature map, and then classifying each pixel in the feature map to obtain a classification probability that each pixel belongs to a saliency region, and then obtaining a saliency map based on the classification probability that each pixel belongs to a saliency region; of course, other algorithms may also be used, such as a spectral residual algorithm (SR), a saliency extraction algorithm based on hyperimage segmentation and regional contrast (GR), a saliency detection algorithm based on local features and global features (CA), a saliency detection algorithm based on histogram contrast (HC), a frequency-tuned algorithm (FT), etc., which are not specifically limited in the present application; then the saliency map is binarized to obtain a first binarized image; and then a region in the first binarized image whose grayscale value is a first preset value is determined as the above-mentioned target region.

[0064] In this embodiment, compared to directly determining the candidate text area in the blank area, the present application calculates the saliency of the target image to obtain a saliency map, and then binarizes the saliency map, that is, the saliency map is screened according to saliency, and the grayscale value of the area with lower significance is adjusted to a first preset value, so that a saliency area (that is, the grayscale value is the second preset value) and a non-saliency area (that is, the grayscale value is the first preset value) can be obtained, and then the saliency area is determined as the target area, so that each of the first candidate text areas screened out is located in the saliency area, and the blank areas are not necessarily all saliency areas. Filling the text into the saliency area can increase the image's attractiveness to users, promote users to browse the corresponding media content based on the text, and increase the popularity of the media content.

[0065] In an optional embodiment, before obtaining multiple first candidate text regions, the target image may be subjected to color analysis to obtain the color value of each pixel; then the target region is determined based on the color value of each pixel. For example, the color difference value between the color value of each pixel and the font color is determined, and then the region corresponding to the pixel whose color difference value is greater than or equal to the preset color difference threshold is determined as the target region; in an optional embodiment, one or more seventh candidate text regions may be determined based on the color value of each pixel, wherein the color value of each pixel in each seventh candidate text region is the same, and then each seventh candidate text region is determined as the target region; in an optional embodiment, the color difference value between the color value corresponding to each seventh candidate text region and the font color is determined, and then the seventh candidate text region whose color difference value is greater than or equal to the preset color difference threshold is determined as the target region, which can avoid the font color of the target text being similar to the background color corresponding to the target text region, thereby ensuring the prominence of the target text in the target image.

[0066] In an optional embodiment, for the case where the saliency of the target body area is low, in the process of binarizing the saliency map, the pixel value of the target body area will become the first preset value. Therefore, in order to further improve the situation where the target body area is blocked by the target text, after obtaining the first binary image, it is also possible to detect whether the grayscale value of the target body area in the first binary image is the first preset value (i.e., 0). If not, the area in the first binary image whose grayscale value is the first preset value is determined as the target area. If so, the grayscale value of the target body area in the first binary image is adjusted to the second preset value (i.e., 255) to obtain the second binary image, and then the area in the second binary image whose grayscale value is the first preset value is determined as the target area. Then, the text area determined in the target area will not block the target body area and also has saliency, thereby ensuring the effect of graphic typesetting.

[0067] S12. Determine a target text box size that matches the target text based on the typesetting information of the target text.

[0068] In an embodiment of the present application, the layout information of the target text may include font size, font, font color, alignment, line spacing, etc., and the target text box size matching the target text may be determined based on the layout information and the length of the target text.

[0069] S13: Determine a target text region from a plurality of first candidate text regions based on a target text box size and a target main body region.

[0070] In an embodiment of the present application, the above-mentioned multiple first candidate text areas can be screened based on the target text box size to obtain multiple second candidate text areas, wherein the size of each candidate text area is greater than or equal to the target text box size, or in other words, the area of ​​each second candidate text area is greater than or equal to the area formed by the target text box size. It should be noted that the shape of the text area of ​​the present application can be a rectangle, a circle, other polygons, etc., and the present application does not make specific limitations. For example, when it is a rectangle, the target text box size includes the length and width of the rectangle, then the length and width of each second candidate text area are respectively greater than or equal to the length and width in the target text box size, and the same is true for other shapes, which will not be explained one by one. Then, determine the distance between each second candidate text area and the target main area, such as determining the distance between the center of each second candidate text area and the center of the target main area, such as the Euclidean distance; then determine the target text area based on the distance between each second candidate text area and the target main area, such as determining the second candidate text area with the smallest distance as the target text area.

[0071] In an optional embodiment, when determining the target body region based on the similarity corresponding to each body region, the body region with a similarity greater than a third threshold value can also be determined as the target body region, and the number of the target body regions is one or more. Therefore, when the number of the target body regions is multiple, the distance between each second candidate text region and each target body region can be determined, and then when determining the target text region based on the distance between each second candidate text region and the target body region, the target distance corresponding to each second candidate text region can be determined based on the distance between each second candidate text region and each target body region, such as the target distance being the average distance between each second candidate text region and multiple target body regions, and then the second candidate text region with the smallest target distance is determined as the target text region.

[0072] Of course, if there are multiple second candidate text regions with the shortest distance, the second candidate text region with the largest area among the multiple second candidate text regions with the shortest distance can be determined as the target text region. Alternatively, when there are multiple second candidate text regions with the shortest distance, the area of ​​each second candidate text region with the shortest distance among the multiple second candidate text regions with the shortest distance can be determined, and the area of ​​the target main body region can be determined, and then the difference between the area of ​​the target main body region and the area of ​​each second candidate text region with the shortest distance can be determined, and then the candidate text region with the smallest absolute value of the difference among the multiple second candidate text regions with the shortest distance can be determined as the target text region, that is, the candidate text region with an area closer to the target main body region can be further selected, so as to make the layout of the target text and the target main body region more harmonious, and improve the effect of graphic typesetting.

[0073] In this embodiment, the text area closest to the target body area is selected as the target text area, that is, the target text is filled near the relevant target body area, which improves the matching degree or correlation between the text and the placement area. That is, the final target text area not only considers the relevance to the target text content, but also is located in a prominent area, which can further improve the effect of graphic typesetting.

[0074] For easier understanding, see Figure 6 , Figure 6 A schematic diagram of a target text area determination method provided in an embodiment of the present application.

[0075] like Figure 6 As shown, subject detection is performed on the target image to obtain multiple subject areas, wherein the principle of subject detection is not repeated here; then image feature extraction is performed on each subject area, and text feature extraction is performed on the target text, and then similarity calculation is performed on the extracted text features and the extracted image features of each subject area to obtain the similarity corresponding to each subject area (the principle is not repeated here); then based on the similarity corresponding to each subject area, the target subject area is screened out from the multiple subject areas, for example, the target subject area is the area with the greatest similarity; and saliency calculation is performed on the target image to obtain a saliency map (the principle is not repeated here); then the saliency map is binarized to obtain a binary image. The binary image is then converted into a binary image; a plurality of first candidate text regions are generated in the region where the grayscale value of the binary image is a first preset value (the principle is not described in detail here); based on the target text, the plurality of first candidate text regions are screened to obtain a plurality of second candidate text regions, for example, the size of each second candidate text region is greater than or equal to the target text box size corresponding to the target text; finally, based on the determined target main region, a target text region is determined from the plurality of second candidate text regions, for example, the target text region may be the text region that is closest to the target main region in the plurality of second candidate text regions, and then the target text may be filled in the target text region of the target image to obtain a new target image.

[0076] For further understanding, see Figure 7 , Figure 7 A schematic diagram of obtaining a new target image based on a target image provided in an embodiment of the present application.

[0077] like Figure 7As shown, a saliency calculation is performed on the target image to obtain a saliency map, and then the saliency map is binarized to obtain a binarized image. Then, in the binarized image, the target area is determined to be an area with a grayscale value of a first preset value, that is, an area that is black in the binarized image. Then, according to the principle of generating multiple first candidate text areas, text areas are listed in the target area to obtain multiple first candidate text areas (i.e. Figure 7 The rectangular area shown should indicate that Figure 7 The first candidate text regions shown are only some examples made for ease of understanding and are not limited), and then a target text region (assuming that Figure 7 The target text is then filled in the target text area corresponding to the target image (i.e. Figure 7 The first place in IQ tax for home appliances shown is the TV), and a new image is obtained.

[0078] It can be seen that in the embodiments of the present application, the target image is first subjected to subject detection to obtain a plurality of subject regions, and then the similarity between each subject region and the target text is determined, and then the subject region with the greatest similarity is determined as the target subject region, that is, there is a correlation between the target subject region and the target text; further, the target image is sequentially saliency calculated and binarized to obtain a first binarized image, and in the case where the pixel value of the target subject region in the first binarized image is a first preset value, the grayscale value of the target subject region is adjusted to a second preset value to obtain a second binarized image, and then a plurality of first candidate text regions are generated for the target region whose grayscale value in the second binarized image is the first preset value, which is equivalent to each first candidate text region being in the target region. The non-salient area of ​​the marked image can make the final layout of the text outside the salient area, which is easier to attract the user's attention, and compared with the prior art that is limited to the blank area, the diversity of positions is increased; further, multiple first candidate text areas are screened, so that the target text area not only matches the length of the target text, but also is closest to the target main area, that is, it ensures that the filling position of the target text is within a relatively close range of the target main area, and improves the matching degree between the target text and the placement area, that is, the target text area, that is, the final target text filling position is not only correlated with the target main area, but also located in the salient area, so that the final layout image and the target text are more integrated, and the ability to attract user attention is also stronger.

[0079] See also Figure 8 , Figure 8 This is a functional unit block diagram of a text area determination device provided in an embodiment of the present application. The text area determination device 800 includes: an acquisition unit 801 and a processing unit 802;

[0080] An acquisition unit 801 is used to acquire a target image and a target text;

[0081] A processing unit 802 is used to determine a target body area matching the target text from the target image based on the target text;

[0082] The processing unit 802 is further configured to determine a target text area in the target image based on the target text and the target body area;

[0083] The processing unit 802 is further configured to fill the target text area with the target text.

[0084] In one embodiment of the present application, in terms of determining a target body region matching the target text from a target image based on the target text, the acquisition unit 801 is specifically configured to:

[0085] Perform subject detection on the target image to obtain multiple subject areas;

[0086] Obtain image features of each subject area;

[0087] Obtain text features of the target text;

[0088] Determine the similarity between each subject region and the target text based on the image features and text features of each subject region;

[0089] Based on the similarity corresponding to each subject region, the target subject region is determined.

[0090] In one embodiment of the present application, in determining the target text area in the target image based on the target text and the target body area, the processing unit 802 is specifically configured to:

[0091] Generating a plurality of first candidate text regions on the target image;

[0092] Determine a target text box size matching the target text based on the typesetting information of the target text;

[0093] A target text region is determined from a plurality of first candidate text regions based on a target text box size and a target body region.

[0094] In one embodiment of the present application, in terms of generating a plurality of first candidate text regions on a target image, the processing unit 802 is specifically configured to:

[0095] Get multiple preset font sizes;

[0096] Based on the typesetting information of the target text and each font size, determining a standard text box corresponding to each font size;

[0097] Based on a preset moving step, the standard text box corresponding to each font size is moved in the target image to obtain multiple first candidate text areas, wherein each first candidate text area belongs to a target area, and the target area includes an area of ​​the target image excluding a target main area.

[0098] In one embodiment of the present application, before obtaining a plurality of first candidate text regions, the processing unit 802 is specifically configured to:

[0099] Perform saliency calculation on the target image to obtain a saliency map corresponding to the target image;

[0100] Binarizing the saliency map to obtain a first binarized image;

[0101] An area in the first binary image whose grayscale value is a first preset value is determined as a target area.

[0102] In one embodiment of the present application, in determining a region in the first binary image whose grayscale value is a first preset value as a target region, the processing unit 802 is specifically configured to:

[0103] Detecting whether the grayscale value of the target main body area in the first binary image is a first preset value;

[0104] If not, determining the region with the gray value of the first preset value in the first binary image as the target region;

[0105] If so, adjusting the grayscale value of the target subject area in the first binary image to a second preset value to obtain a second binary image;

[0106] An area in the second binary image whose grayscale value is a first preset value is determined as a target area.

[0107] In one embodiment of the present application, in determining the target text region from a plurality of first candidate text regions based on the target text box size and the target body region, the processing unit 802 is specifically configured to:

[0108] Based on the target text box size, the plurality of first candidate text regions are screened to obtain a plurality of second candidate text regions, wherein the size of each second candidate text region is greater than or equal to the target text box size;

[0109] Determining the distance between each second candidate text region and the target body region;

[0110] The second candidate text region with the smallest distance is determined as the target text region.

[0111] In a specific implementation, the acquisition unit 801 and the processing unit 802 described in the embodiment of the present invention may execute other implementations described in the embodiment of the method for determining a text region provided by the embodiment of the present invention, which will not be described in detail herein.

[0112] See also Fig. 9 , Fig. 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig. 9 As shown, the electronic device 900 includes a transceiver 901, a processor 902 and a memory 903. They are connected via a bus 904. The memory 903 is used to store computer programs and data, and can transmit the data stored in the memory 903 to the processor 902.

[0113] The processor 902 is used to read the computer program in the memory 903 and perform the following operations:

[0114] Controlling the transceiver 901 to obtain a target image and a target text;

[0115] Based on the target text, determining a target subject area matching the target text from the target image;

[0116] Based on the target text and the target main body area, determining the target text area in the target image;

[0117] Fill the target text area with the target text.

[0118] In one embodiment of the present application, in determining the target body area matching the target text from the target image based on the target text, the processor 902 is specifically configured to perform the following steps:

[0119] Perform subject detection on the target image to obtain multiple subject areas;

[0120] Obtain image features of each subject area;

[0121] Obtain text features of the target text;

[0122] Determine the similarity between each subject region and the target text based on the image features and text features of each subject region;

[0123] Based on the similarity corresponding to each subject region, the target subject region is determined.

[0124] In one embodiment of the present application, in determining the target text area in the target image based on the target text and the target body area, the processor 902 is specifically configured to perform the following steps:

[0125] Generating a plurality of first candidate text regions on the target image;

[0126] Determine a target text box size matching the target text based on the typesetting information of the target text;

[0127] A target text region is determined from a plurality of first candidate text regions based on a target text box size and a target body region.

[0128] In one embodiment of the present application, in terms of generating multiple first candidate text regions on a target image, the processor 902 is specifically configured to perform the following steps:

[0129] Get multiple preset font sizes;

[0130] Based on the typesetting information of the target text and each font size, determining a standard text box corresponding to each font size;

[0131] Based on a preset moving step, the standard text box corresponding to each font size is moved in the target image to obtain multiple first candidate text areas, wherein each first candidate text area belongs to a target area, and the target area includes an area of ​​the target image excluding a target main area.

[0132] In one embodiment of the present application, before obtaining a plurality of first candidate text regions, the processor 902 is specifically configured to perform the following steps:

[0133] Perform saliency calculation on the target image to obtain a saliency map corresponding to the target image;

[0134] Binarizing the saliency map to obtain a first binarized image;

[0135] An area in the first binary image whose grayscale value is a first preset value is determined as a target area.

[0136] In one embodiment of the present application, in determining a region in the first binary image whose grayscale value is a first preset value as the target region, the processor 902 is specifically configured to perform the following steps:

[0137] Detecting whether the grayscale value of the target main body area in the first binary image is a first preset value;

[0138] If not, determining the region with the gray value of the first preset value in the first binary image as the target region;

[0139] If so, adjusting the grayscale value of the target subject area in the first binary image to a second preset value to obtain a second binary image;

[0140] An area in the second binary image whose grayscale value is a first preset value is determined as a target area.

[0141] In one embodiment of the present application, in determining the target text region from a plurality of first candidate text regions based on the target text box size and the target body region, the processor 902 is specifically configured to perform the following steps:

[0142] Based on the target text box size, the plurality of first candidate text regions are screened to obtain a plurality of second candidate text regions, wherein the size of each second candidate text region is greater than or equal to the target text box size;

[0143] Determining the distance between each second candidate text region and the target body region;

[0144] The second candidate text region with the smallest distance is determined as the target text region.

[0145] Specifically, the transceiver 901 may be Figure 8 In the acquisition unit 801 of the apparatus 800 for determining a text area of ​​the embodiment, the processor 902 may be Figure 8 The processing unit 802 of the apparatus 800 for determining a text area of ​​the embodiment.

[0146] In a specific implementation, the transceiver 901 and the processor 902 described in the embodiment of the present invention may also execute other implementations described in the embodiment of the method for determining a text area provided in the embodiment of the present invention, which will not be described in detail here.

[0147] It should be understood that the electronic device in this application can be a device for determining a text area, and the device for determining a text area can be a server, such as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and basic cloud computing services such as big data and artificial intelligence platforms, which are not specifically limited in this application. The above electronic devices are only examples, not exhaustive, and include but are not limited to the above electronic devices.

[0148] It should be understood that the embodiments of the present application also provide a computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement part or all of the steps of any text area determination method recorded in the above method embodiments.

[0149] An embodiment of the present application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute part or all of the steps of any text area determination method recorded in the above method embodiments.

[0150] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.

[0151] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0152] In the several embodiments provided in the present application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. 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 through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0153] 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 solution of this embodiment.

[0154] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of a software program module.

[0155] If the integrated unit is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of each embodiment method of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0156] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, and the memory can include: a flash drive, a read-only memory (English: Read-Only Memory, abbreviated as: ROM), a random access memory (English: Random Access Memory, abbreviated as: RAM), a magnetic disk or an optical disk, etc.

[0157] The embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for determining a text area, It is characterized in that The method comprises: Get the target image and target text; Based on the target text, determining a target body area matching the target text from the target image; Based on the target text and the target body area, a target text area is determined in the target image, wherein the target text area is used to display the target text.

2. The method according to claim 1, It is characterized in that The step of determining a target main body area matching the target text from the target image based on the target text includes: Performing subject detection on the target image to obtain multiple subject regions; Obtain image features of each subject area; Acquire text features of the target text; Determining the similarity between each main body region and the target text based on the image features of each main body region and the text features; Based on the similarity corresponding to each subject region, the target subject region is determined.

3. The method according to claim 1 or 2, It is characterized in that The step of determining a target text area in the target image based on the target text and the target main body area includes: generating a plurality of first candidate text regions on the target image; Determining a target text box size matching the target text based on the typesetting information of the target text; The target text region is determined from the plurality of first candidate text regions based on the target text box size and the target body region.

4. The method according to claim 3, It is characterized in that The step of generating a plurality of first candidate text regions on the target image comprises: Get multiple preset font sizes; Determining a standard text box corresponding to each font size based on the typesetting information of the target text and each font size; Based on a preset moving step, the standard text box corresponding to each font size is moved in the target image to obtain the multiple first candidate text areas, wherein each first candidate text area belongs to a target area, and the target area includes an area of ​​the target image excluding the target main area.

5. The method according to claim 4, It is characterized in that Before obtaining the plurality of first candidate text regions, the method further includes: Performing saliency calculation on the target image to obtain a saliency map corresponding to the target image; Binarizing the saliency map to obtain a first binarized image; An area in the first binarized image whose grayscale value is a first preset value is determined as the target area.

6. The method according to claim 5, It is characterized in that The step of determining a region in the first binary image whose grayscale value is a first preset value as the target region comprises: Detecting whether the grayscale value of the target subject area in the first binary image is the first preset value; If not, determining a region in the first binary image whose grayscale value is the first preset value as the target region; If yes, adjusting the grayscale value of the target subject area in the first binary image to a second preset value to obtain a second binary image; An area in the second binarized image whose grayscale value is the first preset value is determined as the target area.

7. The method according to any one of claims 3 to 6, It is characterized in that The step of determining the target text area from the plurality of first candidate text areas based on the target text box size and the target main body area includes: Based on the target text box size, the plurality of first candidate text regions are screened to obtain a plurality of second candidate text regions, wherein the size of each second candidate text region is greater than or equal to the target text box size; Determining the distance between each second candidate text region and the target body region; The target text region is determined based on the distance between each second candidate text region and the target body region.

8. A device for determining a text area, It is characterized in that The device comprises: an acquisition unit and a processing unit; The acquisition unit is used to acquire the target image and the target text; The processing unit is used to determine, based on the target text, a target body area matching the target text from the target image; The processing unit is further used to determine a target text area in the target image based on the target text and the target body area, wherein the target text area is used to display the target text.

9. An electronic device, It is characterized in that include: A processor and a memory, wherein the processor is connected to the memory, the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 7.