CN110889267A - Method and device for editing characters in picture, electronic equipment and storage medium - Google Patents

Method and device for editing characters in picture, electronic equipment and storage medium Download PDF

Info

Publication number
CN110889267A
CN110889267A CN201911206186.5A CN201911206186A CN110889267A CN 110889267 A CN110889267 A CN 110889267A CN 201911206186 A CN201911206186 A CN 201911206186A CN 110889267 A CN110889267 A CN 110889267A
Authority
CN
China
Prior art keywords
characters
character
picture
input
editing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911206186.5A
Other languages
Chinese (zh)
Inventor
葉念庭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Lemi Technology Co ltd
Original Assignee
Beijing Kingsoft Internet Security Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Internet Security Software Co Ltd filed Critical Beijing Kingsoft Internet Security Software Co Ltd
Priority to CN201911206186.5A priority Critical patent/CN110889267A/en
Publication of CN110889267A publication Critical patent/CN110889267A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/148Segmentation of character regions
    • G06V30/153Segmentation of character regions using recognition of characters or words

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The embodiment of the invention provides a method and a device for editing characters in a picture, electronic equipment and a storage medium, which relate to the technical field of picture processing and comprise the following steps: acquiring characters input by a user in a character input process; semantic detection is carried out on the input characters; when the semantic detection result represents that an error character exists in the input characters, correcting and editing the error character; performing segmented editing on the input characters according to the semantic detection result; and adding the edited characters to the picture. Therefore, the scheme provided by the embodiment of the invention is applied to edit the characters in the picture, so that the character editing effect can be improved.

Description

Method and device for editing characters in picture, electronic equipment and storage medium
Technical Field
The present invention relates to the field of picture processing technologies, and in particular, to a method and an apparatus for editing characters in a picture, an electronic device, and a storage medium.
Background
When processing a picture, in order to enrich the picture content, characters are generally required to be added to the picture. In the related art, when adding characters, the characters manually input by a user are obtained, and the obtained characters are directly added to the center position of the picture after the user completes the input.
In the process of inputting characters, users usually do not conveniently edit the input characters, which results in poor character editing effect.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for editing characters in a picture, an electronic device and a storage medium, so as to improve the character editing effect. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a method for editing characters in a picture, where the method includes:
acquiring characters input by a user in a character input process;
semantic detection is carried out on the input characters;
when the semantic detection result represents that an error character exists in the input characters, correcting and editing the error character;
performing segmented editing on the input characters according to the semantic detection result;
and adding the edited characters to the picture.
In one embodiment of the invention, the method further comprises:
and judging whether the characters of the current line where the currently input characters are located exceed the boundary of the picture or not, and if so, performing line feed editing on the current line.
In an embodiment of the present invention, the adding the edited character to the picture includes:
identifying a background area and a foreground area in the picture by using a picture identification technology;
and adding the edited characters to the background area.
In an embodiment of the present invention, the adding the edited character to the picture includes:
identifying elements in the picture according to a picture identification algorithm;
judging whether the edited characters are associated with the elements or not;
and if the association exists, adding the edited character to the picture in a mode of spacing the edited character with the element by a preset interval.
In a second aspect, an embodiment of the present invention provides an apparatus for editing characters in a picture, where the apparatus includes:
the character acquisition module is used for acquiring characters input by a user in the character input process;
the semantic detection module is used for carrying out semantic detection on the input characters;
the character correction module is used for correcting and editing the wrong characters when the semantic detection result represents that the wrong characters exist in the input characters;
the character segmentation module is used for carrying out segmentation editing on the input characters according to the semantic detection result;
and the character adding module is used for adding the edited characters to the picture.
In one embodiment of the present invention, the apparatus further comprises:
and the character line-changing module is used for judging whether the characters of the current line where the currently input characters are located exceed the boundary of the picture or not, and if so, performing line-changing editing on the current line.
In an embodiment of the present invention, the character adding module is specifically configured to:
identifying a background area and a foreground area in the picture by using a picture identification technology;
and adding the edited characters to the background area.
In an embodiment of the present invention, the character adding module is specifically configured to:
identifying elements in the picture according to a picture identification algorithm;
judging whether the edited characters are associated with the elements or not;
and if the association exists, adding the edited character to the picture in a mode of spacing the edited character with the element by a preset interval.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor and the communication interface complete communication between the memory and the processor through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of the first aspect when executing a program stored in the memory.
In a fourth aspect, the present invention provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the method steps of any one of the first aspect.
In a fifth aspect, an embodiment of the present invention further provides a computer program product including instructions, which when run on a computer, cause the computer to execute any one of the above-mentioned character editing methods in a picture.
The embodiment of the invention has the following beneficial effects:
when the scheme provided by the embodiment of the invention is applied to edit characters in the picture, the characters which are input by a user in the character input process are obtained, the semantic detection is carried out on the input characters, and when the semantic detection result represents that error characters exist in the input characters, the correction and editing are carried out on the error characters. Thus, error correction of the characters can be realized, and the probability of error characters in the characters added on the picture is reduced finally. In addition, segmented editing is carried out on the input characters according to the semantic detection result, and the edited characters are added to the picture. Therefore, after the character input is finished, all characters input by the user are the characters subjected to segmented editing, and the edited characters are added to the picture, so that the character paragraphs finally added to the picture can be clear, the characters input by the user are prevented from being arranged together, the user can read the characters conveniently, and the character editing effect on the picture is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for editing characters in a picture according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a character input process according to an embodiment of the present invention;
fig. 3a and fig. 3b are schematic diagrams illustrating the effect of the segmentation editing according to the embodiment of the present invention;
fig. 4 is a flowchart illustrating another method for editing characters in a picture according to an embodiment of the present invention;
fig. 5 is a schematic diagram illustrating an effect of adding characters to a picture according to an embodiment of the present invention;
fig. 6 is a schematic diagram of a picture boundary according to an embodiment of the present invention;
fig. 7a and 7b are schematic diagrams illustrating an effect of line feed of a character according to an embodiment of the present invention;
fig. 8 is a flowchart illustrating a method for editing characters in a picture according to another embodiment of the present invention;
fig. 9 is a schematic diagram illustrating a labeling effect according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of an apparatus for editing characters in a picture according to an embodiment of the present invention;
fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a schematic flowchart of a method for editing characters in a picture according to an embodiment of the present invention, where the method may be applied to an electronic device, such as a computer, a tablet computer, a mobile phone, and the like. As shown in fig. 1, the method includes the following steps 101 to 105.
Step 101, obtaining characters input by a user in a character input process.
The characters can be Chinese characters, English characters, numeric characters, symbolic characters, and the like.
From the character input perspective, the above character input process can be understood as follows: the process by which the user enters all of the characters he desires to enter. All the characters that the user desires to input may be characters included in one sentence or characters included in multiple sentences.
For example, suppose the user desires to add a sentence to a picture, the process from the user entering the first character of the sentence to the user entering the last character of the sentence is the character entry process.
In addition, as for a character input mode, the character input process may be a process of inputting characters in a text box, a process of inputting characters in a layer, and the like, and the embodiment of the present invention is not limited thereto.
In an embodiment of the present invention, the character that has been input may be a current character, and the current character is a character currently being input and may include one or more characters.
For example, for a scene where characters are added to a picture, a text box may be inserted into the picture first, and the characters may be entered into the inserted text box. For example, as shown in fig. 2, the white rectangular area is an inserted text box, and when characters are added to the picture, the characters input in the text box of the white rectangular area are obtained first, where a "puppy" is a character currently being input by the user, and thus the "puppy" is a current character, and a "happy" is a character input before the current character.
In one embodiment of the present invention, the current character entered by the user is typically arranged at a cursor, which may be located behind the last character entered before the current character, or in front of or behind any other of the characters entered before the current character.
In one embodiment of the present invention, the inputted characters may be a current character and a character inputted before the current character. Specifically, the entered character may be the current character and all characters entered before the current character, and the entered character may also be the current character and a preset length of characters entered before the current character. The preset length may be 20 characters long, 50 characters long, 80 characters long, and the like, which is not limited in the embodiments of the present invention. When the preset length is shorter, the semantic relation between the characters with the preset length is stronger, so that the subsequent semantic detection effect on the characters with the preset length is better. In addition, semantic detection is not required to be carried out on all the input characters, so that computing resources can be saved, and the semantic detection efficiency is improved. Conversely, when the preset length is too short, less semantic information is provided between the characters, which is not favorable for semantic detection of the characters. Therefore, the preset length can be determined according to the actual application scene.
For example, assuming that the input character is "moonlight as running water and statically falls on the leaf and also on the flower", wherein the current character is "flower", and the preset length is 20 characters, the character "moonlight as running water and statically falls on the leaf and also on the flower" in the input character is obtained.
Step 102, semantic detection is carried out on the input characters.
Specifically, the content of the characters that have been input, the association between the characters, and the like can be detected. Wherein, the above character content can be understood as: the contents expressed by a plurality of characters in succession. For example, the consecutive plurality of characters are: "ancient times, there was a talent, the character content corresponding to these characters can be: a character. The consecutive plurality of characters are: the "willow around river flies with the wind", the character content corresponding to the characters may be: landscape.
In an embodiment of the present invention, semantic detection may be performed on an input character by using a semantic detection algorithm, where the semantic detection algorithm may be a Grammer check (syntax detection) algorithm, and the like.
And 103, when the semantic detection result represents that the input characters have error characters, correcting and editing the error characters.
Specifically, semantic detection is performed on the input characters, and it is possible to detect that characters with wrong character order, characters with wrong character use, and the like exist in the input characters. And when the characters are detected, considering that the error characters are detected, and performing correction editing on the error characters.
Wherein, the character sequence error is: the arrangement order of the characters is wrong, for example, when the characters are english characters, in "goodmoring (good morning)", the arrangement order of i and n of "moving" is wrong, and thus the above "moving" is considered as a wrong character.
The character use errors are: the character used is wrong, for example, when the character is a chinese character, the "main" in "idea safe" is wrong, and thus the "main" is considered to be the wrong character. Character usage errors also include punctuation character usage errors. For example, when the character is a Chinese character, "at. "middle". "punctuation characters are in error and are therefore considered above". "is an error character.
In an embodiment of the present invention, when an error character is detected, a corrected character for performing correction editing on the error character may be generated, and the corrected character may be displayed near the error character, for example, the corrected character may be displayed above the error character, so that a user may freely select to perform correction editing on the error character using the corrected character, or may perform correction editing on the error character manually by himself without using the corrected character.
In one embodiment of the present invention, after the error character is corrected and edited, the corrected character may be marked, for example, the corrected character may be marked with a "√" symbol, "△" symbol, or the like, or the corrected character may be marked with red, wavy line, yellow, or the like.
And 104, performing segmented editing on the input characters according to the semantic detection result.
Wherein, the segment editing comprises: paragraphs are distinguished for the characters that have been entered.
Specifically, the content expressed by the input character can be obtained according to the result of semantic detection, and the continuous character corresponding to each character content can be determined as a paragraph. It can be understood that the character contents of the continuous characters in the input characters are obtained, the continuous characters with the same character contents are divided into the same type of characters, and then the characters of the same type are determined as a paragraph. For example, for the continuous characters "ancient times have a talent" and "like laughter with oil poetry" the contents of the two pieces of characters are "people", and thus the two pieces of characters are determined as a paragraph.
In an embodiment of the present invention, punctuation characters in the input characters can be further identified, and whether text characters on both sides of the punctuation characters are the same paragraph is determined according to the identified punctuation characters. Specifically, when the punctuation characters among the text characters are preset punctuation characters, the text characters are determined as the same paragraph. Wherein, the preset punctuation characters can be 'v', 'v' or 'v'; "and the like.
For example, assuming that the inputted character is "moonlight as running water and statically falls on the leaf and flower", wherein the punctuation character is "and the text characters on both sides of the punctuation character are" moonlight as running water "and" statically falls on the leaf and flower ", respectively, the two text characters are determined as the same paragraph.
In an embodiment of the present invention, whether there is a correlation between adjacent character contents may be further analyzed, and if there is a correlation, a character corresponding to a continuous and correlated character content may be determined as a paragraph.
For example, if the content of consecutive characters is: and the characters corresponding to the contents of the two characters are determined as the same paragraph if the cat and the dog are associated with each other.
As shown in fig. 3a, the characters in the text box in fig. 3a are already input characters, and the character content of the already input characters is recognized, and it can be known that the characters include 3 character contents, which are: from "ancient time there are few things" to "[ imperial victims of a side of a Chinese imperial sidewall). "the character content of the continuous character is: the actions of "the character", "just, the big erodium" to "are inconvenient. "the character content of the continuous character is: "the first poem", "the person who is overtime" to "the person who is peaceful crying". "the character content of the continuous character is: "second poem". And determining the continuous characters with the same character content as the same paragraph, namely dividing the characters into 3 paragraphs to obtain the segmented editing result as shown in fig. 3 b.
In one embodiment of the present invention, the character classification algorithm may be used to perform segmented editing on the inputted character. The character classification algorithm may be a Word segmentation algorithm, which is used to segment the input characters and then determine the continuous characters with the same character content after segmentation as the same paragraph. The character classification algorithm may also be a Text classification algorithm, and the like, which is not limited in the embodiments of the present invention.
Step 105, adding the edited characters to the picture.
In one embodiment of the invention, the background area and the foreground area in the picture can be identified through a picture identification technology, and the edited characters are added to the background area. Specifically, a foreground region in the picture is usually a region where the picture subject content is located, and a region outside the foreground is a background region, so that in order to avoid the characters from shielding the picture subject content, the characters are added to the background region. The picture identification technology may be to identify a background region and a foreground region of the picture by using a region detection algorithm, for example, the region detection algorithm may be a Self-organization background detection (SOBS) algorithm, a Temporal Media Filter (TMF) algorithm, or the like.
In an embodiment of the present invention, the character after paragraph editing may also be added to a preset region of the picture, where the preset region may be a center region, an upper region, a lower right corner region, and the like of the picture, and the embodiment of the present invention does not limit this.
In one embodiment of the invention, a texture smoothing region in a picture can be identified, and a character after paragraph editing is added to the identified texture smoothing region.
The texture smoothing area represents that the area has less content, and may be, for example, a blank area of a picture. The character after paragraph editing is added to the texture smooth area, so that the phenomenon that the added character shields the picture content can be avoided, and the character adding effect is poor.
Specifically, a texture smoothing region in the picture may be detected by using a picture detection algorithm, for example, the picture detection algorithm may be an edge detection algorithm, a spectrum analysis algorithm, or the like, which is not limited in the embodiment of the present invention.
Referring to fig. 4, in an embodiment of the present invention, for the above step 105, adding edited characters to the picture may be implemented by the following steps 1051 to 1053:
step 1051, identifying elements in the picture according to a picture identification algorithm.
The image recognition algorithm may be a template matching-based image recognition algorithm, or a feature point-based image recognition algorithm.
The element in the picture may be content contained in the picture, e.g. for fig. 2 the element contained in the picture is a "puppy".
Step 1052, determine whether there is a relationship between the edited character and the element.
Wherein, the character content of the edited character may be: puppies, girls, computers, and the like.
Specifically, whether there is a relationship between the character and the element may be determined by calculating a similarity between the character content of the character and the element content of the element. Considering that the characters and the elements are associated under the condition that the calculated similarity is greater than or equal to a preset threshold; and under the condition that the calculated similarity is smaller than the preset threshold, the characters and the elements are considered to be not associated.
The similarity between the character content and the element content can be calculated by utilizing algorithms such as Euclidean distance, cosine similarity, Jacard similarity and the like.
Step 1053, if there is a correlation, adding the edited character to the picture in a way of preset interval between the edited character and the element.
The preset interval may be 2 pounds, 3 pounds, 5 pounds, and the like, and a specific value of the preset interval may be determined according to a size of the picture, a size of the element, a size of an area occupied by the character, and the like, which is not limited in the implementation of the present invention.
Specifically, if there is a relationship, the character after the segment editing may be added to a region of the element where the element is located, such as directly below, directly above, and right side of the region, and the interval between the character and the region where the element is located is the preset interval. If no association exists, the character may be added to the picture in other ways, for example, the character may be added directly to the exact center of the picture.
For example, as shown in fig. 5, the added character is a "cheerful puppy", the content of the character includes the puppy, and an element region where an element related to the puppy is located, that is, a black dashed box region, can be recognized in the picture. Therefore, when a character after paragraph editing is added directly below the recognized element region, the character is added directly below the recognized black dashed frame.
When the scheme provided by the embodiment is applied to edit characters in the picture, the characters input by the user in the character input process are obtained, the semantic detection is carried out on the input characters, and when the semantic detection result represents that the input characters have error characters, the error characters are corrected and edited. Thus, error correction of the characters can be realized, and the probability of error characters in the characters added on the picture is reduced finally. In addition, segmented editing is carried out on the input characters according to the semantic detection result, and the edited characters are added to the picture. Therefore, after the character input is finished, all characters input by the user are the characters subjected to segmented editing, and the edited characters are added to the picture, so that the character paragraphs finally added to the picture can be clear, the characters input by the user are prevented from being arranged together, the user can read the characters conveniently, and the character editing effect on the picture is improved.
In an embodiment of the present invention, when editing characters in a picture, all characters input by a user can be obtained after completing character input, and semantic detection, correction, segmented editing, and the like are performed on all characters. Therefore, all the input characters can be edited only by performing semantic detection, correction, segmented editing and other operations once, and computing resources can be saved. And because the semantic detection is carried out on all the characters, the obtained semantic detection result is more accurate, and further, the correction, segmentation and the like of the characters are more accurate.
From the character input perspective, the completion of the character input can be understood as follows: the user ends all the characters he desires to enter. For example, assuming that the user desires to add a sentence to the picture, when the user has finished entering the last character of the sentence, the character entry is considered to be complete.
In addition, in the case of the character input method, the completion of the character input may be to end the character input in the current input method. For example, in the case that the user inputs characters through a text box inserted in a picture, an option representing that the user completes character input may be set at the text box, and when the user clicks the option, the user is considered to finish inputting characters through the text box, that is, completing character input, where the option may be a "complete" option, an "end" option, or the like. When the user clicks an area other than the text box, the user may be considered to end inputting characters through the text box, that is, the character input is completed. After the user clicks a button representing that the character input is completed, the user is considered to finish inputting the character through the text box, that is, the character input is completed, wherein the button may be an "Enter" button, an "Esc" button, or the like.
In an embodiment of the present invention, when editing a character in a picture, line feed editing may be performed on the character in the picture, and whether a character of a current line where a currently input character is located exceeds a boundary of the picture may be determined, and if so, line feed editing may be performed on the current line. Similarly, the characters can be subjected to permutation editing.
Wherein, the line feed editing is as follows: changing part of the input characters to the next row for arrangement; the column change is compiled as: and replacing part of the input characters to the next column for arrangement.
Therefore, the input characters can be prevented from overflowing the boundary of the picture, incomplete display of the characters is avoided, and the experience effect of reading the characters in the picture by a user is improved.
In an embodiment of the present invention, when performing line-feed editing or column-feed editing on characters, characters whose positions relative to a picture do not exceed a picture boundary and whose distances relative to the picture boundary are smaller than a preset distance threshold may be determined character by character, starting from a first character in current characters, and characters following the determined character in the input characters are switched to a next column unit until a last character in the input characters is determined.
The preset distance threshold may be 3 pounds, 5 pounds, 10 pounds, etc., which is not limited by the embodiment of the present invention.
The picture boundaries are: the arrangement direction of the input characters may be horizontal left-to-right arrangement, horizontal right-to-left arrangement, vertical top-to-bottom arrangement, vertical bottom-to-top arrangement, or along a certain inclination angle.
For example, as shown in fig. 6, it is known that the arrangement direction of the inputted characters is arranged from left to right in the horizontal direction, and the boundary of the picture pointed by the arrangement direction of the inputted characters is the right boundary of the picture as indicated by the arrow.
The arrangement unit is: a character row or a character column indicated by the arrangement direction.
For the current character, the last character in the characters input before the current character may be arranged according to the cursor position, and the front or the back of any character in the characters input before the current character may be arranged according to the cursor position. Determining the distance between the character and the boundary of the picture from the first character of the current character, and not executing editing operation when the distance is larger than or equal to a preset distance threshold; and when the distance is smaller than a preset distance threshold value, switching the characters after the character in the input characters to the next arrangement unit. The above operation is performed for each character following the first character of the current character until the operation is performed for the last character of the entered character.
For example, as shown in fig. 7a, the current character is "on the way", it can be seen that the position of the character "small" relative to the picture does not exceed the picture boundary, it is assumed that the distance between the character "small" and the picture boundary is 30 pounds, the preset distance threshold is 35 pounds, it can be seen that the distance between the character "small" is smaller than the preset distance threshold, and therefore the characters "on the way" and "on" after the character "small" are changed to the next row arrangement, which achieves the effect of fig. 7 b.
In an embodiment of the present invention, for a case where a current character is arranged behind a last character in characters input before the current character according to a cursor position, a distance between each character in the current character and a picture boundary may be obtained, a character with a first distance smaller than a preset distance threshold is determined according to a character input sequence, and the character and characters following the character in the current character are changed to a next arrangement unit.
In an embodiment of the present invention, in a case where a current character is arranged in front of or behind any one of characters input before the current character according to a cursor position, a distance between each character after a first character in the current character and a picture boundary may be obtained, a character with the first distance smaller than a preset distance threshold is determined, and the character and characters after the character are changed to a next arrangement unit.
Therefore, by applying the scheme provided by the embodiment, the characters close to the picture boundary can be edited in a line-feed or column-feed manner, and the situation that the input characters overflow the picture boundary so that a user cannot edit and read the characters is avoided.
Referring to fig. 8, another method for editing characters in a picture is provided in an embodiment of the present invention, and as shown in the figure, the method includes the following steps 801 to 803.
Step 801, identifying picture content of a picture as picture content to be matched.
Specifically, one or more picture contents included in the picture may be identified for the whole picture, and the one or more picture contents may be used as the picture contents to be matched. The picture content in a preset area in the picture can be identified, the picture content in the preset area is used as the picture content to be matched, and the preset area can be a center area, a bottom area and the like of the picture.
In the embodiment of the present invention, the manner of identifying the picture content is the same as that in the above embodiment, and is not described herein again.
And 802, matching the to-be-added labels corresponding to the contents of the to-be-matched pictures in a preset label library.
Wherein, the label library comprises: and the preset corresponding relation between the label and the picture content. The tags and the picture contents may be in a one-to-one correspondence relationship, that is, one tag corresponds to one picture content. The tags and the picture contents may be in a one-to-many relationship, that is, one tag corresponds to a plurality of picture contents. The label comprises a label frame and a label file. The shape of the label frame can be a preset rectangle, a circle, a triangle, an arrow and the like, and the label file can be a preset 'xiaolingu', 'happy holiday', 'HappyBirthday' and the like.
For example, the preset tag library may be as shown in table 1 below:
TABLE 1
Label frame Label file Picture content
Label 1 Rectangle Small fairy Girl
Label 2 Circular shape Happy festival Firework
Label 3 Arrow head shape Happy Birthday Cake
Taking the label 1 as an example, the label frame of the label 1 is rectangular, the label file is "xiaolingyu", and the corresponding picture content is "girl". That is, when the content of the picture to be matched identified in the above step 801 is "girl", the matching tag 1 is used as the tag to be added.
Step 803, adding the label to be added to the area where the picture content to be matched is located.
Specifically, the to-be-added tag may be added to an area where the to-be-matched picture content is located, for example, the to-be-added tag may be added to a central area, a lower left corner area, a lower area, and the like in the area. The tag to be added can also be added to a region right below, a region right above, a region right side and the like outside the region where the picture content to be matched is located. For example, as shown in fig. 9, the label "puppy" to be added is added to the upper left corner area of the area where the picture content "puppy" to be matched is located.
The size of the label to be added can be preset or in a direct proportional relationship with the size of the picture, and the larger the picture area is, the larger the area of the label to be added is.
By applying the scheme provided by the embodiment, the content in the picture can be identified, and the matched tag is added aiming at the picture content, so that the content of the picture can be enriched, the watching effect is improved, and the tag adding efficiency can be improved without manual operation of a user.
It should be noted that, the solutions provided by the above embodiments may be implemented in a manner of being matched with each other, or in a manner of being matched with a plurality of solutions, and the embodiments of the present invention do not limit this.
Referring to fig. 10, an embodiment of the present invention provides an apparatus for editing characters in a picture, where the apparatus includes:
a character obtaining module 1001 configured to obtain a character that has been input by a user in a character input process;
a semantic detection module 1002, configured to perform semantic detection on an input character;
the character correction module 1003 is configured to, when a result of semantic detection indicates that an error character exists in an input character, perform correction editing on the error character;
a character segmentation module 1004, configured to perform segmented editing on the input character according to a result of the semantic detection;
a character adding module 1005, configured to add the edited character to the picture.
In one embodiment of the present invention, the apparatus further comprises:
and the character line-changing module is used for judging whether the characters of the current line where the currently input characters are located exceed the boundary of the picture or not, and if so, performing line-changing editing on the current line.
In an embodiment of the present invention, the character adding module 1005 is specifically configured to:
identifying a background area and a foreground area in the picture by using a picture identification technology;
and adding the edited characters to the background area.
In an embodiment of the present invention, the character adding module 1005 is specifically configured to:
identifying elements in the picture according to a picture identification algorithm;
judging whether the edited characters are associated with the elements or not;
and if the association exists, adding the edited character to the picture in a mode of spacing the edited character with the element by a preset interval.
When the scheme provided by the embodiment is applied to edit characters in the picture, the characters input by the user in the character input process are obtained, the semantic detection is carried out on the input characters, and when the semantic detection result represents that the input characters have error characters, the error characters are corrected and edited. Thus, error correction of the characters can be realized, and the probability of error characters in the characters added on the picture is reduced finally. In addition, segmented editing is carried out on the input characters according to the semantic detection result, and the edited characters are added to the picture. Therefore, after the character input is finished, all characters input by the user are the characters subjected to segmented editing, and the edited characters are added to the picture, so that the character paragraphs finally added to the picture can be clear, the characters input by the user are prevented from being arranged together, the user can read the characters conveniently, and the character editing effect on the picture is improved.
An embodiment of the present invention further provides an electronic device, as shown in fig. 11, including a processor 1101, a communication interface 1102, a memory 1103, and a communication bus 1104, where the processor 1001, the communication interface 1102, and the memory 1103 complete mutual communication through the communication bus 1104,
a memory 1103 for storing a computer program;
the processor 1101 is configured to implement the following steps when executing the program stored in the memory 1103:
acquiring characters input by a user in a character input process;
semantic detection is carried out on the input characters;
when the semantic detection result represents that an error character exists in the input characters, correcting and editing the error character;
performing segmented editing on the input characters according to the semantic detection result;
and adding the edited characters to the picture.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
In another embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of any of the above character editing methods in a picture.
In another embodiment of the present invention, there is also provided a computer program product containing instructions, which when run on a computer, causes the computer to execute the character editing method in any one of the pictures in the above embodiments.
When the scheme provided by the embodiment is applied to edit characters in the picture, the characters input by the user in the character input process are obtained, the semantic detection is carried out on the input characters, and when the semantic detection result represents that the input characters have error characters, the error characters are corrected and edited. Thus, error correction of the characters can be realized, and the probability of error characters in the characters added on the picture is reduced finally. In addition, segmented editing is carried out on the input characters according to the semantic detection result, and the edited characters are added to the picture. Therefore, after the character input is finished, all characters input by the user are the characters subjected to segmented editing, and the edited characters are added to the picture, so that the character paragraphs finally added to the picture can be clear, the characters input by the user are prevented from being arranged together, the user can read the characters conveniently, and the character editing effect on the picture is improved.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, apparatus embodiments, electronic device embodiments, computer-readable storage medium embodiments, and computer program product embodiments are substantially similar to method embodiments and therefore are described with relative ease, as appropriate, with reference to the partial description of the method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A method for editing characters in a picture, the method comprising:
acquiring characters input by a user in a character input process;
semantic detection is carried out on the input characters;
when the semantic detection result represents that an error character exists in the input characters, correcting and editing the error character;
performing segmented editing on the input characters according to the semantic detection result;
and adding the edited characters to the picture.
2. The method of claim 1, further comprising:
and judging whether the characters of the current line where the currently input characters are located exceed the boundary of the picture or not, and if so, performing line feed editing on the current line.
3. The method of claim 1, wherein adding the edited character to the picture comprises:
identifying a background area in the picture by using a picture identification technology;
and adding the edited characters to the background area.
4. The method of claim 1, wherein adding the edited character to the picture comprises:
identifying elements in the picture according to a picture identification algorithm;
judging whether the edited characters are associated with the elements or not;
and if the association exists, adding the edited character to the picture in a mode of spacing the edited character with the element by a preset interval.
5. An apparatus for editing characters in a picture, the apparatus comprising:
the character acquisition module is used for acquiring characters input by a user in the character input process;
the semantic detection module is used for carrying out semantic detection on the input characters;
the character correction module is used for correcting and editing the wrong characters when the semantic detection result represents that the wrong characters exist in the input characters;
the character segmentation module is used for carrying out segmentation editing on the input characters according to the semantic detection result;
and the character adding module is used for adding the edited characters to the picture.
6. The apparatus of claim 5, further comprising:
and the character line-changing module is used for judging whether the characters of the current line where the currently input characters are located exceed the boundary of the picture or not, and if so, performing line-changing editing on the current line.
7. The apparatus of claim 5, wherein the character adding module is specifically configured to:
identifying a background area and a foreground area in the picture by using a picture identification technology;
and adding the edited characters to the background area.
8. The apparatus of claim 5, wherein the character adding module is specifically configured to:
identifying elements in the picture according to a picture identification algorithm;
judging whether the edited characters are associated with the elements or not;
and if the association exists, adding the edited character to the picture in a mode of spacing the edited character with the element by a preset interval.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 4 when executing a program stored in the memory.
10. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1 to 4.
CN201911206186.5A 2019-11-29 2019-11-29 Method and device for editing characters in picture, electronic equipment and storage medium Pending CN110889267A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911206186.5A CN110889267A (en) 2019-11-29 2019-11-29 Method and device for editing characters in picture, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911206186.5A CN110889267A (en) 2019-11-29 2019-11-29 Method and device for editing characters in picture, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110889267A true CN110889267A (en) 2020-03-17

Family

ID=69749718

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911206186.5A Pending CN110889267A (en) 2019-11-29 2019-11-29 Method and device for editing characters in picture, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110889267A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106649246A (en) * 2015-10-30 2017-05-10 方正国际软件(北京)有限公司 Line breaking method and apparatus
CN106777073A (en) * 2016-12-13 2017-05-31 深圳爱拼信息科技有限公司 The automatic method for correcting of wrong word and server in a kind of search engine
CN109285203A (en) * 2017-07-21 2019-01-29 中兴通讯股份有限公司 A kind of edit methods, computer equipment and the storage medium of 3D picture
CN109614604A (en) * 2018-12-17 2019-04-12 北京百度网讯科技有限公司 Subtitle processing method, device and storage medium
CN109978972A (en) * 2019-03-20 2019-07-05 珠海天燕科技有限公司 A kind of method and device of copy editor in picture
CN109992120A (en) * 2017-12-29 2019-07-09 北京搜狗科技发展有限公司 A kind of input error correction method and device
CN110264545A (en) * 2019-06-19 2019-09-20 北京字节跳动网络技术有限公司 Picture Generation Method, device, electronic equipment and storage medium
CN110457678A (en) * 2019-06-28 2019-11-15 创业慧康科技股份有限公司 A kind of electronic health record modification method and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106649246A (en) * 2015-10-30 2017-05-10 方正国际软件(北京)有限公司 Line breaking method and apparatus
CN106777073A (en) * 2016-12-13 2017-05-31 深圳爱拼信息科技有限公司 The automatic method for correcting of wrong word and server in a kind of search engine
CN109285203A (en) * 2017-07-21 2019-01-29 中兴通讯股份有限公司 A kind of edit methods, computer equipment and the storage medium of 3D picture
CN109992120A (en) * 2017-12-29 2019-07-09 北京搜狗科技发展有限公司 A kind of input error correction method and device
CN109614604A (en) * 2018-12-17 2019-04-12 北京百度网讯科技有限公司 Subtitle processing method, device and storage medium
CN109978972A (en) * 2019-03-20 2019-07-05 珠海天燕科技有限公司 A kind of method and device of copy editor in picture
CN110264545A (en) * 2019-06-19 2019-09-20 北京字节跳动网络技术有限公司 Picture Generation Method, device, electronic equipment and storage medium
CN110457678A (en) * 2019-06-28 2019-11-15 创业慧康科技股份有限公司 A kind of electronic health record modification method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
廖卫献: "数控线切割加工自动编程", vol. 1, 北京:国防工业出版社, pages: 96 *

Similar Documents

Publication Publication Date Title
US10013643B2 (en) Performing optical character recognition using spatial information of regions within a structured document
TWI685795B (en) Information recognition method and device
US7970213B1 (en) Method and system for improving the recognition of text in an image
US20210209297A1 (en) Table detection in spreadsheet
CN111353501A (en) Book point-reading method and system based on deep learning
CN111291572A (en) Character typesetting method and device and computer readable storage medium
US9519404B2 (en) Image segmentation for data verification
WO2020024939A1 (en) Text region identification method and device
CN112580637A (en) Text information identification method, text information extraction method, text information identification device, text information extraction device and text information identification system
CN113762309A (en) Object matching method, device and equipment
CN114359533B (en) Page number identification method based on page text and computer equipment
CN107909054B (en) Similarity evaluation method and device for picture texts
US20220292587A1 (en) Method and apparatus for displaying product review information, electronic device and storage medium
CN111783561A (en) Picture examination result correction method, electronic equipment and related products
CN110889267A (en) Method and device for editing characters in picture, electronic equipment and storage medium
KR20230083971A (en) A method for translating and editing text contained within an image and a device for performing the same
CN114049686A (en) Signature recognition model training method and device and electronic equipment
CN114092684A (en) Text calibration method, device, equipment and storage medium
CN111798542A (en) Model training method, data processing device, model training apparatus, and storage medium
Futagami et al. Automatic product region extraction based on analysis of images uploaded to C2C online market
CN116758565B (en) OCR text restoration method, equipment and storage medium based on decision tree
WO2021143629A1 (en) Table extraction method and apparatus, and touch-control display apparatus
CN105843949B (en) A kind of image display method and device
CN115527230A (en) Information extraction method and device, electronic equipment and storage medium
Futagami et al. Automatic product region extraction based on colour similarity and saliency detection models

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20201123

Address after: Room 115, area C, 1 / F, building 8, yard 1, yaojiayuan South Road, Chaoyang District, Beijing 100123

Applicant after: Beijing LEMI Technology Co.,Ltd.

Address before: 100123 Building 8, Huitong Times Square, 1 South Road, Chaoyang District, Beijing.

Applicant before: BEIJING KINGSOFT INTERNET SECURITY SOFTWARE Co.,Ltd.