CN110633457B - Content replacement method and device, electronic equipment and readable storage medium - Google Patents

Content replacement method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN110633457B
CN110633457B CN201810651671.2A CN201810651671A CN110633457B CN 110633457 B CN110633457 B CN 110633457B CN 201810651671 A CN201810651671 A CN 201810651671A CN 110633457 B CN110633457 B CN 110633457B
Authority
CN
China
Prior art keywords
picture
character
target
characters
recorded
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.)
Active
Application number
CN201810651671.2A
Other languages
Chinese (zh)
Other versions
CN110633457A (en
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 Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Kingsoft Mobile Technology Co Ltd
Original Assignee
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Kingsoft Mobile Technology 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 Office Software Inc, Zhuhai Kingsoft Office Software Co Ltd, Guangzhou Kingsoft Mobile Technology Co Ltd filed Critical Beijing Kingsoft Office Software Inc
Priority to CN201810651671.2A priority Critical patent/CN110633457B/en
Publication of CN110633457A publication Critical patent/CN110633457A/en
Application granted granted Critical
Publication of CN110633457B publication Critical patent/CN110633457B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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)
  • Character Discrimination (AREA)

Abstract

The embodiment of the invention provides a content replacement method, a content replacement device, electronic equipment and a readable storage medium. The method comprises the following steps: receiving a content replacement instruction for a target picture in a document; the content replacement instruction at least carries: a first character to be replaced and a second character for replacing the first character; inputting a target picture into a pre-constructed picture character recognition model to obtain target characters recorded by the target picture and position area information of each target character; the picture character recognition model is used for: identifying the characters recorded by the picture and the position area information of each recorded character; judging whether characters matched with the first character exist in the target characters or not; if the second character exists, generating a sub-picture recorded with the second character; and covering the target area of the target picture by utilizing the sub-picture. By applying the embodiment of the invention, the text content recorded by the pictures in the document can be replaced, so that the office experience of a user is improved.

Description

Content replacement method and device, electronic equipment and readable storage medium
Technical Field
The present invention relates to the field of document processing technologies, and in particular, to a content replacement method, a device, an electronic apparatus, and a readable storage medium.
Background
Currently, in an office process, users often need to process a variety of documents through office software. For example, editing of documents such as word documents, PDF (Portable Document Format ) documents, and PPT (PowerPoint) documents is often required.
Often, some pictures are stored in these documents, and some text content is sometimes recorded in these pictures. For example, a picture in a document records text: others. The inventor finds that when a user wants to replace "others" appearing in the document with "others" by using the replacement function of the office software, so that the words of the document are unified, the office software cannot replace "others" recorded by the picture, and the office experience of the user is affected.
Disclosure of Invention
The embodiment of the invention aims to provide a content replacement method, a content replacement device, electronic equipment and a readable storage medium, so that the text content recorded by pictures can be replaced, and the office experience of a user is improved. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a content replacement method, which may include:
receiving a content replacement instruction for a target picture in a document; wherein, the content replacement instruction at least carries: a first character to be replaced and a second character for replacing the first character;
inputting a target picture into a pre-constructed picture character recognition model to obtain target characters recorded by the target picture and position area information of each target character; the picture character recognition model is used for: identifying the characters recorded by the picture and the position area information of each recorded character;
judging whether characters matched with the first character exist in the target characters or not;
if the second character exists, generating a sub-picture recorded with the second character;
covering a target area of the target picture by utilizing the sub picture; the target area is: and the area corresponding to the position area information of the target character matched with the first character.
Optionally, before inputting the target picture into the pre-built picture character recognition model, the method may further include:
constructing a picture character recognition model;
the step of constructing a picture character recognition model comprises the following steps:
obtaining a plurality of preset pictures recorded with characters;
training the training sample by using a preset deep learning algorithm to obtain a picture character recognition model; wherein, a training sample comprises: a preset picture, characters in the preset picture and corresponding position area information of the characters in the preset picture.
Optionally, a training sample may further include: the training sample contains the background content of the characters in the preset picture.
Optionally, the step of inputting the target picture into a pre-constructed picture character recognition model to obtain the target characters recorded by the target picture and the position area information of each target character may include:
inputting a target picture into a pre-constructed picture character recognition model to obtain target characters recorded by the target picture, position area information of each target character and background content of each target character;
a step of generating a sub-picture recorded with a second character, comprising:
generating a sub-picture recorded with the second character and the target background content; the target background content is as follows: background content of the target character that matches the first character.
Optionally, the preset deep learning algorithm may include: any one of a convolutional cyclic neural network algorithm CRNN and a combination algorithm; the combination algorithm comprises a convolutional cyclic neural network algorithm CRNN and a scene text detection network algorithm CTNN.
In a second aspect, an embodiment of the present invention further provides a content replacement apparatus, which may include:
a receiving unit configured to receive a content replacement instruction for a target picture in a document; wherein, the content replacement instruction at least carries: a first character to be replaced and a second character for replacing the first character;
the input unit is used for inputting the target picture into a pre-constructed picture character recognition model to obtain target characters recorded by the target picture and position area information of each target character; the picture character recognition model is used for: identifying the characters recorded by the picture and the position area information of each recorded character;
a judging unit for judging whether a character matched with the first character exists in the target characters;
a generation unit for generating a sub-picture recorded with a second character when a character matched with the first character exists in the target character;
the covering unit is used for covering the target area of the target picture by utilizing the sub picture; the target area is: and the area corresponding to the position area information of the target character matched with the first character.
Optionally, in an embodiment of the present invention, the apparatus may further include:
a construction unit for constructing a picture character recognition model before inputting a target picture into a previously constructed picture character recognition model;
the construction unit is specifically used for:
obtaining a plurality of preset pictures recorded with characters;
training the training sample by using a preset deep learning algorithm to obtain a picture character recognition model; wherein, a training sample comprises: a preset picture, characters in the preset picture and corresponding position area information of the characters in the preset picture.
Optionally, a training sample may further include: the training sample contains the background content of the characters in the preset picture.
Optionally, in an embodiment of the present invention, the input unit may specifically be configured to:
inputting a target picture into a pre-constructed picture character recognition model to obtain target characters recorded by the target picture, position area information of each target character and background content of each target character;
accordingly, the generating unit may specifically be configured to:
generating a sub-picture recorded with the second character and the target background content; the target background content is as follows: background content of the target character that matches the first character.
Optionally, the preset deep learning algorithm may include: any one of a convolutional cyclic neural network algorithm CRNN and a combination algorithm; the combination algorithm comprises a convolutional cyclic neural network algorithm CRNN and a scene text detection network algorithm CTNN.
In a third aspect, an embodiment of the present invention further provides an electronic device, which may include a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing the method steps of any content replacement method when executing the program stored in the memory.
In a fourth aspect, embodiments of the present invention further provide a readable storage medium having a computer program stored therein, which when executed by a processor, implements method steps of any of the content replacement methods described above.
In a fifth aspect, embodiments of the present invention also provide a computer program product comprising instructions that, when run on an electronic device, cause the electronic device to perform: the method steps of any of the above content substitution methods.
In the embodiment of the invention, a content replacement instruction for a target picture in a document can be received, wherein the content replacement instruction at least carries: a first character to be replaced and a second character for replacing the first character. After receiving the content replacement instruction, the target picture may be input to a pre-built picture character recognition model. The character recognition model can recognize the characters recorded by the picture and the position area information of each recorded character. Thus, after inputting the target picture into the picture character recognition model, the picture character recognition model can recognize and output: target characters recorded by the target picture and position area information of each target character. Then, it may be determined whether there is a character matching the first character among the target characters. If so, generating a sub-picture recorded with the second character. And then, covering a target area corresponding to the position area information of the target character matched with the first character in the target picture by utilizing the sub-picture.
In this way, after the target area is covered by the sub-picture, the first character in the target picture is replaced by the second character. According to the content replacement mode, a user is not required to send the target picture to the picture editing software, and the picture content is adjusted through the picture editing software, so that the operation complexity and the operation time for adjusting the picture content are reduced, the content replacement cost is reduced, and the office efficiency and the office experience of the user are improved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a content replacement method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a content replacing device according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In order to solve the problems in the prior art, the embodiment of the invention provides a content replacement method, a content replacement device, electronic equipment and a readable storage medium.
The following first describes a content replacement method provided by an embodiment of the present invention.
The content replacement method provided by the embodiment of the invention can be applied to the electronic equipment provided with the office software. Such electronic devices include, but are not limited to, computers and cell phones.
Among them, office software includes, but is not limited to: WPS (WPS software) office software, PPT (PowerPoint) office software, and PDF (Portable Document Format ) office software, although not limited thereto.
Accordingly, the target documents in the embodiments of the present invention include, but are not limited to: WPS documents, PPT documents, and PDF documents, of course, are not limited thereto.
Referring to fig. 1, the method may include the steps of:
s101: receiving a content replacement instruction for a target picture in a document; wherein, the content replacement instruction at least carries: a first character to be replaced and a second character for replacing the first character;
s102: inputting a target picture into a pre-constructed picture character recognition model to obtain target characters recorded by the target picture and position area information of each target character; the picture character recognition model is used for: identifying the characters recorded by the picture and the position area information of each recorded character;
s103: judging whether characters matched with the first character exist in the target characters or not; if so, executing step S104;
s104: generating a sub-picture recorded with a second character;
s105: covering a target area of the target picture by utilizing the sub picture; the target area is: and the area corresponding to the position area information of the target character matched with the first character.
In the embodiment of the invention, a content replacement instruction for a target picture in a document can be received, wherein the content replacement instruction at least carries: a first character to be replaced and a second character for replacing the first character. After receiving the content replacement instruction, the target picture may be input to a pre-built picture character recognition model. The character recognition model can recognize the characters recorded by the picture and the position area information of each recorded character. Thus, after inputting the target picture into the picture character recognition model, the picture character recognition model can recognize and output: target characters recorded by the target picture and position area information of each target character. Then, it may be determined whether there is a character matching the first character among the target characters. If so, generating a sub-picture recorded with the second character. And then, covering a target area corresponding to the position area information of the target character matched with the first character in the target picture by utilizing the sub-picture.
In this way, after the target area is covered by the sub-picture, the first character in the target picture is replaced by the second character. According to the content replacement mode, a user is not required to send the target picture to the picture editing software, and the picture content is adjusted through the picture editing software, so that the operation complexity and the operation time for adjusting the picture content are reduced, the content replacement cost is reduced, and the office efficiency and the office experience of the user are improved.
The following describes a content replacement method provided by an embodiment of the present invention, taking a PDF document as an example.
Assume that PDF office software is installed in an electronic device, and a PDF document in which a target picture is stored is opened by the PDF office software. Then, when the electronic device detects a content replacement instruction for the full text of the PDF document, it indicates that the electronic device receives the content replacement instruction for the target picture.
In addition, when the electronic device detects a content replacement instruction for a target picture in the PDF document, the electronic device also indicates that the electronic device receives the content replacement instruction for the target picture. Wherein, the content replacement instruction at least carries: a first character to be replaced and a second character for replacing the first character.
The first character/second character may be a letter, a number, a word or a symbol, and any combination of a letter, a number, a word and a symbol, or may be an english word composed of a plurality of letters, or a word composed of a plurality of words, which is not limited thereto. Wherein the symbols include, but are not limited to: the following is carried out , # and%.
For example, when the user wants to replace "other" recorded in the target picture in the PDF document with "other", the first character carried by the content replacement instruction for the target picture received by the electronic device is: the other carried second characters are as follows: others.
After receiving the content replacement instruction for the target picture, the electronic device can input the target picture into a pre-constructed picture character recognition model. It is reasonable that the picture character recognition model may be a model stored in the electronic device or a model stored in the server.
When the picture character recognition model is stored in the server, the electronic equipment can input the target picture into the picture character recognition model in the server through a picture character recognition model interface in the server, and obtain a recognition result of the picture character recognition model for the target picture from the picture character recognition model interface.
Because the picture character recognition model can recognize the characters recorded by the picture and the position area information of each recorded character, after the target picture is input into the picture character recognition model constructed in advance, the picture character recognition model can recognize and output the target picture: target characters recorded by the target picture and position area information of each target character.
For example, the picture character recognition model may recognize that the first line of characters in the target picture is "plum blossom is different from other flowers", and recognize that the second line of characters in the target picture is "it is also not struggling for spring, and only report spring. And, the position area information of each character in the first line of characters and the second line of characters can be identified. For example, the positional area information that can recognize the character "it" is: the character "it" in the target picture is located at the top left and bottom right coordinates of the rectangular area.
The mode of constructing the picture character recognition model is as follows:
the training samples are formed by using a plurality of preset pictures recorded with characters. Wherein, one training sample obtained may include: a preset picture, characters in the preset picture and position area information of the characters in the preset picture.
For example, one training sample may include: preset picture k, the characters recorded by preset picture k and the position area information of the characters in preset picture k. The characters recorded by the preset picture k are as follows: other areas. The location area information of the character "it" is: presetting the left upper corner coordinate and the right lower corner coordinate of a rectangular area where a character 'in the picture k' is located; … …; the location area information of the character "area" is: the upper left corner coordinates and the lower right corner coordinates of a rectangular area where the character zone is located in the picture k are preset. Of course, the positional area information is not limited thereto.
And then training the training sample by using a preset deep learning algorithm, so that a picture character recognition model can be obtained.
In order to make the target picture after the replacement operation appear to be similar to the target picture before the replacement operation, the reading experience of the user is enhanced. The training samples for training the picture character recognition model include: the preset picture, the characters in the preset picture and the position area information of the characters in the preset picture can also comprise: the training sample contains the background content of the characters in the preset picture.
Thus, after inputting the target picture into the pre-constructed picture character recognition model, the picture character recognition model can recognize and output the target picture: the target characters recorded by the target pictures, the position area information of each target character and the background content of each target character.
The preset deep learning algorithm includes, but is not limited to, any one of a convolutional neural network algorithm (Convolutional Recurrent Neural Network, CRNN) and a combination algorithm. The combination algorithm includes a convolutional recurrent neural network algorithm CRNN and a scene text detection network algorithm (Connectionist Text Proposal Network, CTPN).
The convolutional neural network algorithm (CRNN) integrates the advantages of the convolutional neural network algorithm (Convolutional Neural Networks, CNN) and the convolutional neural network algorithm (Recurrent Neural Network, RNN), so that the image character recognition model obtained through training in the embodiment of the invention can more accurately recognize characters in the image, position area information of the characters and background content of the characters, further a more accurate search result can be obtained, and further accurate replacement can be realized.
In addition, the more training samples are used for training the picture character recognition model, the more accurate the recognition result of the picture character recognition model is obtained, so that the picture character recognition model can be trained by adopting as many training samples as possible.
In addition, in order to improve accuracy of the recognition result output by the picture character recognition model, after the picture character recognition model is obtained through training, a plurality of optimization samples can be used for optimizing the picture character recognition model. Wherein, one optimization sample can comprise: a picture for optimizing the model and the characters recorded by the picture and the positional area information of each character. But of course may also include the background content of each character. In this way, parameters in the picture character recognition model can be optimized, so that the recognition result of the output of the model is more accurate.
The training picture character recognition model can recognize characters recorded in pictures input into the model, position area information of each character and background content of each target character.
Assuming that the target characters recorded by the picture in the PDF document, the position area information of each target character and the background content of each target character can be identified through a pre-constructed picture character identification model, after the identification result of the picture character identification model is obtained, the first character 'other' can be used for matching with the target characters recorded by the target picture.
Then, it may be determined whether or not there is a character matching the first character among the recognized target characters. If the character exists, the character successfully matched can be determined, and the position area information of the character successfully matched can be determined. Then, a sub-picture in which the second character is recorded may be generated. And when judging that the character matched with the first character does not exist in the identified target character, discarding generating the sub-picture recorded with the second character.
In one implementation, the background of the generated sub-picture may be a background of a preset color, such as a white background. In another implementation, the background of the generated sub-picture may also be based on the background content of the successfully matched character. This is reasonable.
It will be appreciated that the operation of generating the sub-picture may be performed on the electronic device or on a server. When executed on the electronic device, the data transmission amount between the electronic device and the server can be reduced, and the transmission bandwidth of the electronic device and the server is saved. When executed on a server, the computing power of the electronic device can be reduced, and the speed of generating the sub-picture can be increased.
After the sub-picture is generated, the target region of the target picture may be covered with the sub-picture. The target area is: and the region corresponding to the position region information of the target character matched with the first character in the target picture.
When the size of the generated sub-picture is equal to the size of the target area, the sub-picture can be directly used for covering the target area of the target picture. When the size of the generated sub-picture is not equal to the target area size, the sub-picture may be scaled so that the size of the sub-picture is equal to the target area size, and then an overlay operation is performed using the scaled sub-picture.
If the content replacement instruction detected by the electronic device is for the whole document, the first character is also used for matching with the text content in the document, and the second character is used for replacing the content matched with the first character in the text content. Thus, the "first character" in the whole text may be replaced with the "second character".
For example, assume that a PDF document has two pages, one being a target picture and the other being text content. Then, after recognition by the picture character recognition model: after the target characters recorded by the pictures in the PDF document, the position area information of each target character and the background content of each target character, the first characters can be used for matching with the target characters obtained by recognition. When the target character has the character matched with the first character, generating a sub-picture recorded with the second character. And covering a target area corresponding to the position area information of the target character matched with the first character in the target picture by utilizing the sub-picture. And the first character is directly used for matching with the text content in the other page, and the second character is used for replacing the successfully matched character in the text content.
Note that, the manner of replacing the content in the word document, WPS document, PPT document, and other documents may refer to the manner of replacing the content corresponding to the PDF document, which is not described in detail herein.
After the electronic device receives the content replacement instruction for the target picture, the electronic device can cover the corresponding area of the target picture, in which the first character is recorded, through the sub-picture, in which the second character is recorded, so that the first character in the target picture is replaced by the second character. According to the content replacement mode, a user is not required to send the target picture to the picture editing software, and the picture content is adjusted through the picture editing software, so that the operation complexity and the operation time for adjusting the picture content are reduced, the content replacement cost is reduced, and the office efficiency and the office experience of the user are improved.
Corresponding to the above method embodiment, the embodiment of the present invention further provides a content replacing device, referring to fig. 2, the device may include:
a receiving unit 201 for receiving a content replacement instruction for a target picture in a document; wherein, the content replacement instruction at least carries: a first character to be replaced and a second character for replacing the first character;
an input unit 202, configured to input a target picture into a pre-constructed picture character recognition model, to obtain target characters recorded by the target picture and position area information of each target character; the picture character recognition model is used for: identifying the characters recorded by the picture and the position area information of each recorded character;
a judging unit 203 for judging whether or not there is a character matching the first character among the target characters;
a generating unit 204, configured to generate a sub-picture in which a second character is recorded when there is a character matching the first character in the target characters;
a covering unit 205, configured to cover a target area of the target picture with the sub-picture; the target area is: and the area corresponding to the position area information of the target character matched with the first character.
By applying the device provided by the embodiment of the invention, the content replacement instruction aiming at the target picture in the document can be received, and the content replacement instruction at least carries: a first character to be replaced and a second character for replacing the first character. After receiving the content replacement instruction, the target picture may be input to a pre-built picture character recognition model. The character recognition model can recognize the characters recorded by the picture and the position area information of each recorded character. Thus, after inputting the target picture into the picture character recognition model, the picture character recognition model can recognize and output: target characters recorded by the target picture and position area information of each target character. Then, it may be determined whether there is a character matching the first character among the target characters. If so, generating a sub-picture recorded with the second character. And then, covering a target area corresponding to the position area information of the target character matched with the first character in the target picture by utilizing the sub-picture.
In this way, after the target area is covered by the sub-picture, the first character in the target picture is replaced by the second character. According to the content replacement mode, a user is not required to send the target picture to the picture editing software, and the picture content is adjusted through the picture editing software, so that the operation complexity and the operation time for adjusting the picture content are reduced, the content replacement cost is reduced, and the office efficiency and the office experience of the user are improved.
Optionally, in an embodiment of the present invention, the apparatus may further include:
a construction unit for constructing a picture character recognition model before inputting a target picture into a previously constructed picture character recognition model;
the construction unit is specifically used for:
obtaining a plurality of preset pictures recorded with characters;
training the training sample by using a preset deep learning algorithm to obtain a picture character recognition model; wherein, a training sample comprises: a preset picture, characters in the preset picture and corresponding position area information of the characters in the preset picture.
Optionally, one training sample further includes: the training sample contains the background content of the characters in the preset picture.
Optionally, in the embodiment of the present invention, the input unit 202 is specifically configured to:
inputting a target picture into a pre-constructed picture character recognition model to obtain target characters recorded by the target picture, position area information of each target character and background content of each target character;
accordingly, the generating unit 204 is specifically configured to:
generating a sub-picture recorded with the second character and the target background content; the target background content is as follows: background content of the target character that matches the first character.
Optionally, the preset deep learning algorithm includes: any one of a convolutional cyclic neural network algorithm CRNN and a combination algorithm; the combination algorithm comprises a convolutional cyclic neural network algorithm CRNN and a scene text detection network algorithm CTNN.
Corresponding to the above-described method embodiments, the present invention also provides an electronic device, see fig. 3, which includes a processor 301, a communication interface 302, a memory 303, and a communication bus 304, where the processor 301, the communication interface 302, and the memory 303 perform communication with each other through the communication bus 304,
a memory 303 for storing a computer program;
the processor 301 is configured to implement the method steps of any of the content substitution methods described above when executing the program stored in the memory 303.
In the embodiment of the invention, the electronic device can receive the content replacement instruction aiming at the target picture in the document, and the content replacement instruction at least carries: a first character to be replaced and a second character for replacing the first character. After receiving the content replacement instruction, the target picture may be input to a pre-built picture character recognition model. The character recognition model can recognize the characters recorded by the picture and the position area information of each recorded character. Thus, after inputting the target picture into the picture character recognition model, the picture character recognition model can recognize and output: target characters recorded by the target picture and position area information of each target character. Then, it may be determined whether there is a character matching the first character among the target characters. If so, generating a sub-picture recorded with the second character. And then, covering a target area corresponding to the position area information of the target character matched with the first character in the target picture by utilizing the sub-picture.
In this way, after the target area is covered by the sub-picture, the first character in the target picture is replaced by the second character. According to the content replacement mode, a user is not required to send the target picture to the picture editing software, and the picture content is adjusted through the picture editing software, so that the operation complexity and the operation time for adjusting the picture content are reduced, the content replacement cost is reduced, and the office efficiency and the office experience of the user are improved.
Corresponding to the above-described method embodiments, the present invention further provides a readable storage medium having stored therein a computer program which, when executed by a processor, implements the method steps of any of the above-described content replacement methods.
After the computer program stored in the readable storage medium provided by the embodiment of the invention is executed by the processor of the electronic device, the electronic device can receive a content replacement instruction for a target picture in a document, wherein the content replacement instruction at least carries: a first character to be replaced and a second character for replacing the first character. After receiving the content replacement instruction, the target picture may be input to a pre-built picture character recognition model. The character recognition model can recognize the characters recorded by the picture and the position area information of each recorded character. Thus, after inputting the target picture into the picture character recognition model, the picture character recognition model can recognize and output: target characters recorded by the target picture and position area information of each target character. Then, it may be determined whether there is a character matching the first character among the target characters. If so, generating a sub-picture recorded with the second character. And then, covering a target area corresponding to the position area information of the target character matched with the first character in the target picture by utilizing the sub-picture.
In this way, after the target area is covered by the sub-picture, the first character in the target picture is replaced by the second character. According to the content replacement mode, a user is not required to send the target picture to the picture editing software, and the picture content is adjusted through the picture editing software, so that the operation complexity and the operation time for adjusting the picture content are reduced, the content replacement cost is reduced, and the office efficiency and the office experience of the user are improved.
Corresponding to the above method embodiments, the present invention also provides a computer program product comprising instructions which, when run on an electronic device, cause the electronic device to perform: the method steps of any of the above content substitution methods.
The embodiment of the invention provides a computer program product containing instructions, which enables electronic equipment to receive a content replacement instruction aiming at a target picture in a document when the computer program product runs on the electronic equipment, wherein the content replacement instruction at least carries: a first character to be replaced and a second character for replacing the first character. After receiving the content replacement instruction, the target picture may be input to a pre-built picture character recognition model. The character recognition model can recognize the characters recorded by the picture and the position area information of each recorded character. Thus, after inputting the target picture into the picture character recognition model, the picture character recognition model can recognize and output: target characters recorded by the target picture and position area information of each target character. Then, it may be determined whether there is a character matching the first character among the target characters. If so, generating a sub-picture recorded with the second character. And then, covering a target area corresponding to the position area information of the target character matched with the first character in the target picture by utilizing the sub-picture.
In this way, after the target area is covered by the sub-picture, the first character in the target picture is replaced by the second character. According to the content replacement mode, a user is not required to send the target picture to the picture editing software, and the picture content is adjusted through the picture editing software, so that the operation complexity and the operation time for adjusting the picture content are reduced, the content replacement cost is reduced, and the office efficiency and the office experience of the user are improved.
The communication bus mentioned above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include 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 aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processing, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
It is noted that relational terms such as first and second, and the like are 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. Moreover, 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for apparatus, electronic devices, readable storage media and computer program product embodiments, the description is relatively simple as it is substantially similar to method embodiments, as relevant points are found in the partial description of method embodiments.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims (10)

1. A content replacement method, the method comprising:
receiving a content replacement instruction for a target picture in a document; wherein, the content replacement instruction at least carries: a first character to be replaced and a second character for replacing the first character;
inputting the target picture into a pre-constructed picture character recognition model to obtain target characters recorded by the target picture and position area information of each target character; the picture character recognition model is used for: identifying the characters recorded by the picture and the position area information of each recorded character;
judging whether characters matched with the first character exist in the target characters or not;
if the second character exists, generating a sub-picture recorded with the second character;
covering a target area of the target picture by using the sub-picture; the target area is: a region corresponding to the position region information of the target character matched with the first character;
the step of inputting the target picture into a pre-constructed picture character recognition model to obtain target characters recorded by the target picture and position area information of each target character comprises the following steps:
inputting the target picture into a pre-constructed picture character recognition model to obtain target characters recorded by the target picture, position area information of each target character and background content of each target character;
the step of generating the sub-picture recorded with the second character includes:
generating a sub-picture recorded with the second character and the target background content; the target background content is as follows: background content of the target character matching the first character.
2. The method of claim 1, wherein prior to inputting the target picture into a pre-built picture character recognition model, the method further comprises:
constructing the picture character recognition model;
the step of constructing the picture character recognition model comprises the following steps:
obtaining a plurality of preset pictures recorded with characters;
training a training sample by using a preset deep learning algorithm to obtain the picture character recognition model; wherein, a training sample comprises: a preset picture, characters in the preset picture and corresponding position area information of the characters in the preset picture.
3. The method of claim 2, wherein the training samples further comprise: the training sample contains the background content of the characters in the preset picture.
4. A method according to any one of claims 2-3, wherein the preset deep learning algorithm comprises: any one of a convolutional cyclic neural network algorithm CRNN and a combination algorithm; the combination algorithm comprises the convolutional neural network algorithm CRNN and a scene text detection network algorithm CTPN.
5. A content replacement device, the device comprising:
a receiving unit configured to receive a content replacement instruction for a target picture in a document; wherein, the content replacement instruction at least carries: a first character to be replaced and a second character for replacing the first character;
the input unit is used for inputting the target picture into a pre-constructed picture character recognition model to obtain target characters recorded by the target picture and position area information of each target character; the picture character recognition model is used for: identifying the characters recorded by the picture and the position area information of each recorded character;
a judging unit configured to judge whether or not there is a character matching the first character in the target characters;
a generation unit, configured to generate a sub-picture in which the second character is recorded when a character matching the first character exists in the target character;
a covering unit, configured to cover a target area of the target picture with the sub-picture; the target area is: a region corresponding to the position region information of the target character matched with the first character;
the input unit is specifically configured to:
inputting the target picture into a pre-constructed picture character recognition model to obtain target characters recorded by the target picture, position area information of each target character and background content of each target character;
the generating unit is specifically configured to:
generating a sub-picture recorded with the second character and the target background content; the target background content is as follows: background content of the target character matching the first character.
6. The apparatus of claim 5, wherein the apparatus further comprises:
a construction unit for constructing a picture character recognition model before inputting the target picture into the picture character recognition model constructed in advance;
the construction unit is specifically used for:
obtaining a plurality of preset pictures recorded with characters;
training a training sample by using a preset deep learning algorithm to obtain the picture character recognition model; wherein, a training sample comprises: a preset picture, characters in the preset picture and corresponding position area information of the characters in the preset picture.
7. The apparatus of claim 6, wherein a training sample further comprises: the training sample contains the background content of the characters in the preset picture.
8. The apparatus of any of claims 6-7, wherein the preset deep learning algorithm comprises: any one of a convolutional cyclic neural network algorithm CRNN and a combination algorithm; the combination algorithm comprises the convolutional neural network algorithm CRNN and a scene text detection network algorithm CTPN.
9. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1-4 when executing a program stored on a memory.
10. A readable storage medium, characterized in that it has stored therein a computer program which, when executed by a processor, implements the method steps of any of claims 1-4.
CN201810651671.2A 2018-06-22 2018-06-22 Content replacement method and device, electronic equipment and readable storage medium Active CN110633457B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810651671.2A CN110633457B (en) 2018-06-22 2018-06-22 Content replacement method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810651671.2A CN110633457B (en) 2018-06-22 2018-06-22 Content replacement method and device, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN110633457A CN110633457A (en) 2019-12-31
CN110633457B true CN110633457B (en) 2023-05-26

Family

ID=68967274

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810651671.2A Active CN110633457B (en) 2018-06-22 2018-06-22 Content replacement method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN110633457B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110930302B (en) * 2018-08-30 2024-03-26 珠海金山办公软件有限公司 Picture processing method and device, electronic equipment and readable storage medium
CN117274430A (en) * 2023-08-31 2023-12-22 北京百度网讯科技有限公司 Target picture acquisition and model acquisition method, device, equipment and storage medium

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5167016A (en) * 1989-12-29 1992-11-24 Xerox Corporation Changing characters in an image
JPH05174188A (en) * 1991-12-20 1993-07-13 Ricoh Co Ltd Preprocessing method for character recognition
CN102651138A (en) * 2012-04-10 2012-08-29 西安理工大学 JPEG picture mosaicing-based oversize picture synthesis method
CN102843470A (en) * 2012-08-16 2012-12-26 广东步步高电子工业有限公司 Optimization editing information communication system and method thereof
CN103324924A (en) * 2012-03-19 2013-09-25 宇龙计算机通信科技(深圳)有限公司 Method and device for character positioning and terminal
CN104715497A (en) * 2014-12-30 2015-06-17 上海孩子国科教设备有限公司 Data replacement method and system
CN105184838A (en) * 2015-09-21 2015-12-23 深圳市金立通信设备有限公司 Picture processing method and terminal
CN106407981A (en) * 2016-11-24 2017-02-15 北京文安智能技术股份有限公司 License plate recognition method, device and system
CN106598623A (en) * 2016-12-23 2017-04-26 维沃移动通信有限公司 Picture combination template generation method and mobile terminal
CN106874909A (en) * 2017-01-18 2017-06-20 深圳怡化电脑股份有限公司 A kind of recognition methods of image character and its device
CN107679074A (en) * 2017-08-25 2018-02-09 百度在线网络技术(北京)有限公司 A kind of Picture Generation Method and equipment
CN107688772A (en) * 2017-06-23 2018-02-13 平安科技(深圳)有限公司 Method, apparatus, computer equipment and the storage medium of policy information typing
CN107797737A (en) * 2017-09-26 2018-03-13 努比亚技术有限公司 The method, apparatus and computer-readable recording medium that picture is edited again
CN108153468A (en) * 2017-12-14 2018-06-12 阿里巴巴集团控股有限公司 Image processing method and device

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5167016A (en) * 1989-12-29 1992-11-24 Xerox Corporation Changing characters in an image
JPH05174188A (en) * 1991-12-20 1993-07-13 Ricoh Co Ltd Preprocessing method for character recognition
CN103324924A (en) * 2012-03-19 2013-09-25 宇龙计算机通信科技(深圳)有限公司 Method and device for character positioning and terminal
CN102651138A (en) * 2012-04-10 2012-08-29 西安理工大学 JPEG picture mosaicing-based oversize picture synthesis method
CN102843470A (en) * 2012-08-16 2012-12-26 广东步步高电子工业有限公司 Optimization editing information communication system and method thereof
CN104715497A (en) * 2014-12-30 2015-06-17 上海孩子国科教设备有限公司 Data replacement method and system
CN105184838A (en) * 2015-09-21 2015-12-23 深圳市金立通信设备有限公司 Picture processing method and terminal
CN106407981A (en) * 2016-11-24 2017-02-15 北京文安智能技术股份有限公司 License plate recognition method, device and system
CN106598623A (en) * 2016-12-23 2017-04-26 维沃移动通信有限公司 Picture combination template generation method and mobile terminal
CN106874909A (en) * 2017-01-18 2017-06-20 深圳怡化电脑股份有限公司 A kind of recognition methods of image character and its device
CN107688772A (en) * 2017-06-23 2018-02-13 平安科技(深圳)有限公司 Method, apparatus, computer equipment and the storage medium of policy information typing
CN107679074A (en) * 2017-08-25 2018-02-09 百度在线网络技术(北京)有限公司 A kind of Picture Generation Method and equipment
CN107797737A (en) * 2017-09-26 2018-03-13 努比亚技术有限公司 The method, apparatus and computer-readable recording medium that picture is edited again
CN108153468A (en) * 2017-12-14 2018-06-12 阿里巴巴集团控股有限公司 Image processing method and device

Also Published As

Publication number Publication date
CN110633457A (en) 2019-12-31

Similar Documents

Publication Publication Date Title
US11410407B2 (en) Method and device for generating collection of incorrectly-answered questions
JP6244892B2 (en) Word detection for optical character recognition that is invariant to local scaling, rotation, and display position of characters in a document
US10521654B2 (en) Recognition of handwritten characters in digital images using context-based machine learning
WO2020233332A1 (en) Text structured information extraction method, server and storage medium
CN108108342B (en) Structured text generation method, search method and device
WO2022057707A1 (en) Text recognition method, image recognition classification method, and document recognition processing method
EP3869385A1 (en) Method for extracting structural data from image, apparatus and device
US20210390370A1 (en) Data processing method and apparatus, storage medium and electronic device
WO2015168051A1 (en) Techniques for distributed optical character recognition and distributed machine language translation
CN112396049A (en) Text error correction method and device, computer equipment and storage medium
WO2015168056A1 (en) Techniques for distributed optical character recognition and distributed machine language translation
CN111222368B (en) Method and device for identifying document paragraphs and electronic equipment
CN112396047B (en) Training sample generation method and device, computer equipment and storage medium
CN110633457B (en) Content replacement method and device, electronic equipment and readable storage medium
CN110472701A (en) Text error correction method, device, electronic equipment and storage medium
CN111061887A (en) News character photo extraction method, device, equipment and storage medium
US10643022B2 (en) PDF extraction with text-based key
CN108090044B (en) Contact information identification method and device
US9665786B2 (en) Confirming automatically recognized handwritten answers
CN110363189B (en) Document content restoration method and device, electronic equipment and readable storage medium
CN111027345A (en) Font identification method and apparatus
CN116343221A (en) Certificate information automatic input method and device, electronic equipment and storage medium
CN112396057A (en) Character recognition method and device and electronic equipment
CN111208955A (en) Printing method, printing device and server
CN111695372A (en) Click-to-read method and click-to-read data processing method

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
GR01 Patent grant
GR01 Patent grant