Nothing Special   »   [go: up one dir, main page]

CN112801923A - Word processing method, system, readable storage medium and computer equipment - Google Patents

Word processing method, system, readable storage medium and computer equipment Download PDF

Info

Publication number
CN112801923A
CN112801923A CN202110397741.8A CN202110397741A CN112801923A CN 112801923 A CN112801923 A CN 112801923A CN 202110397741 A CN202110397741 A CN 202110397741A CN 112801923 A CN112801923 A CN 112801923A
Authority
CN
China
Prior art keywords
repaired
image
character
pixels
character image
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
CN202110397741.8A
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.)
Jiangxi Booway New Technology Co ltd
Original Assignee
Jiangxi Booway New 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 Jiangxi Booway New Technology Co ltd filed Critical Jiangxi Booway New Technology Co ltd
Priority to CN202110397741.8A priority Critical patent/CN112801923A/en
Publication of CN112801923A publication Critical patent/CN112801923A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/77Retouching; Inpainting; Scratch removal
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration using local operators
    • G06T5/30Erosion or dilatation, e.g. thinning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/22Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20036Morphological image processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30176Document

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Multimedia (AREA)
  • Character Input (AREA)

Abstract

The invention discloses a word processing method, a system, a readable storage medium and computer equipment, wherein the method comprises the steps of obtaining an original word image, searching a target position of a word to be repaired in the original word image, and intercepting an area with pixels of a preset size by taking the target position as a center to obtain a first word image to be repaired; recognizing the height of an original character in a first character image to be repaired, creating a blank image with the same size as the first character image to be repaired, and inputting a character to be repaired with the same height as the original character in the blank image to obtain a second character image to be repaired; inputting the first character image to be repaired and the second character image to be repaired into the trained generative confrontation network model to obtain a target image, wherein the generative confrontation network model is used for transferring the character style in the first character image to be repaired to the second character image to be repaired; and extracting characters to be repaired in the target image, and copying the characters to be repaired to a target position.

Description

Word processing method, system, readable storage medium and computer equipment
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to a word processing method, a word processing system, a readable storage medium and computer equipment.
Background
The method aims at repairing damaged or polluted characters in the scanned image, corresponding characters are input at the positions of the damaged characters by a user, and the style of the characters can be automatically converted by software to be consistent with the style of the original characters, so that the characters are subjected to ageing.
In the prior art, the main scheme for realizing the character antique finishing is to artificially deduct characters with the same font style from other images of the characters to be repaired, and achieve the purpose of character antique finishing through operations such as zooming, filter and the like; or recognizing all characters in the image in advance, establishing a corresponding relation between the characters and the image blocks (namely one character corresponds to one image block), directly searching the image blocks corresponding to the characters when the characters needing to be repaired are input, scaling according to the sizes of the characters, and pasting to the specified positions.
However, in the above solutions, the first method requires that the user has professional image processing capability, the effect of character restoration varies due to different user levels, and the whole process requires manual operation, so that the degree of automation is low and the processing efficiency is low; the second method is high in automation degree, but cannot be used for identifying wrong characters depending on character identification accuracy, in addition, most of one document cannot cover all characters, and if one character does not have a corresponding image block or has a difference in font style, a satisfactory old-making effect cannot be achieved.
Disclosure of Invention
In view of the above, the present invention provides a method, a system, a readable storage medium and a computer device for word processing, which are used to solve the problem of poor effect of word old-making processing in the prior art.
A method of word processing, comprising:
acquiring an original character image, searching a target position of a character to be repaired in the original character image, and taking the target position as a center, and intercepting an area with a preset size of pixels to obtain a first character image to be repaired;
identifying the height of an original character in the first character image to be repaired, creating a blank image with the same size as the first character image to be repaired, and inputting a character to be repaired with the same height as the original character in the blank image to obtain a second character image to be repaired;
inputting the first character image to be repaired and the second character image to be repaired into a trained generative confrontation network model to obtain a target image, wherein the generative confrontation network model is used for transferring the character style in the first character image to be repaired to the second character image to be repaired;
and extracting the characters to be repaired in the target image, and copying the characters to be repaired to the target position.
Further, in the above method for processing words, the step of obtaining an original word image, finding a target position of a word to be repaired in the original word image, and taking the target position as a center, and capturing an area with pixels of a preset size to obtain a first word image to be repaired includes:
judging whether the target position contains the characters to be repaired or not;
if not, the original character image is intercepted into a plurality of areas with pixels of the preset size, the areas with the pixels of the preset size are traversed, and when the area with the pixels of the preset size is judged to contain the character to be repaired, the area with the pixels of the preset size is judged to be the first character image to be repaired.
Further, in the above method for processing words, the step of determining that the region of the pixels with the preset size contains the word to be repaired includes:
performing black-white binarization processing on the area of the pixels with the preset size, and calculating the proportion of the number of black pixels in the area of the pixels with the preset size to the total number of pixels in the pixels with the preset size after the black-white binarization processing;
and when the proportion exceeds a preset value, judging that the preset-size pixels contain the characters to be repaired.
Further, in the above text processing method, the step of identifying the original text height in the first text image to be repaired includes:
carrying out black-white binarization processing on the first character image to be repaired, and carrying out morphological expansion processing on the first character image to be repaired, which is subjected to black-white binarization, by using structural elements with preset pixel sizes;
performing connected region analysis on the expanded first character image to be repaired to obtain a plurality of connected first character sub-image blocks to be repaired;
and calculating the average height of the plurality of sub image blocks communicated with the first character to be repaired to obtain the height of the original character in the first character image to be repaired.
Further, in the above method for processing words, the step of copying the word to be repaired to the target position includes:
carrying out black-and-white binarization processing on the target image, and carrying out connected region analysis on the target image subjected to black-and-white binarization to obtain position information of a single character connected sub-image block;
and intercepting the characters to be repaired from the target image according to the position information, and copying the characters to be repaired to the target position in the original character image.
Further, in the above method for processing words, the step of inputting the first to-be-repaired word image and the second to-be-repaired word image into the trained generative confrontation network model to obtain the target image includes:
and constructing a generating type confrontation network model by using the generating model and the distinguishing model, and training the generating type confrontation network model by using a training group image, wherein the training group image comprises a plurality of groups of document scanning images with the same content, character images and repaired digital images.
Further, in the above method for processing words, the step of intercepting the area of pixels of a preset size with the target position as a center includes:
and taking the target position as a center, and cutting out a region of 256 pixels by 256 pixels.
The embodiment of the invention also provides a word processing system, which comprises;
the system comprises an acquisition module, a restoration module and a restoration module, wherein the acquisition module is used for acquiring an original character image, searching a target position of a character to be restored in the original character image, and intercepting an area with a preset size pixel by taking the target position as a center to obtain a first character image to be restored;
the recognition module is used for recognizing the height of an original character in the first character image to be repaired, creating a blank image with the same size as the first character image to be repaired, and inputting a character to be repaired with the same height as the original character in the blank image to obtain a second character image to be repaired;
the generating module is used for inputting the first character image to be repaired and the second character image to be repaired into a trained generating type confrontation network model to obtain a target image, and the generating type confrontation network model is used for transferring the character style in the first character image to be repaired to the second character image to be repaired;
and the extraction module is used for extracting the characters to be repaired in the target image and copying the characters to be repaired to the target position.
Further, in the word processing system, the obtaining module includes:
the judging unit is used for judging whether the target position contains the characters to be repaired or not;
if not, the original character image is intercepted into a plurality of areas with pixels of the preset size, the areas with the pixels of the preset size are traversed, and when the area with the pixels of the preset size is judged to contain the character to be repaired, the area with the pixels of the preset size is judged to be the first character image to be repaired.
Further, in the above word processing system, the determination unit is specifically configured to:
performing black-white binarization processing on the area of the pixels with the preset size, and calculating the proportion of the number of black pixels in the area of the pixels with the preset size to the total number of pixels in the pixels with the preset size after the black-white binarization processing;
and when the proportion exceeds a preset value, judging that the preset-size pixels contain the characters to be repaired.
Further, in the above word processing system, the identification module is specifically configured to:
carrying out black-white binarization processing on the first character image to be repaired, and carrying out morphological expansion processing on the first character image to be repaired, which is subjected to black-white binarization, by using structural elements with preset pixel sizes;
performing connected region analysis on the expanded first character image to be repaired to obtain a plurality of connected first character sub-image blocks to be repaired;
and calculating the average height of the plurality of sub image blocks communicated with the first character to be repaired to obtain the height of the original character in the first character image to be repaired.
Further, in the above word processing system, the extraction module is specifically configured to:
carrying out black-and-white binarization processing on the target image, and carrying out connected region analysis on the target image subjected to black-and-white binarization to obtain position information of a single character connected sub-image block;
and intercepting the characters to be repaired from the target image according to the position information, and copying the characters to be repaired to the target position in the original character image.
Further, in the above word processing system, the generating module is specifically configured to:
and constructing a generating type confrontation network model by using the generating model and the distinguishing model, and training the generating type confrontation network model by using a training group image, wherein the training group image comprises a plurality of groups of document scanning images, character images and repaired post-image images.
Further, in the word processing system, the obtaining module further includes:
and the intercepting unit is used for intercepting 256-by-256 pixel areas by taking the target position as the center.
An embodiment of the present invention further provides a readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements any of the word processing methods described above.
The embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program that is stored in the memory and can be run on the processor, and when the processor executes the computer program, the processor implements any of the above-mentioned word processing methods.
The invention adopts the advanced and popular deep learning network at present, and the generative confrontation network (GAN) is adopted to automatically generate the old-making characters with the required font style, so that the character old-making can be automated and intelligentized, a user does not need to have professional image processing knowledge, the universality of character old-making can be met, the font styles appointed by different characters can be automatically generated without depending on whether the required font styles exist in the same characters, the font style of the character image containing the character to be repaired is consistent with the font style of the character image containing the character to be repaired by intercepting the character image containing the character to be repaired and reconstructing a blank image, the character to be repaired is input in the blank image, and the font style in the character image containing the character to be repaired is transferred to the character to be repaired in the blank image by utilizing the generative confrontation network model, so that the font style of the character to be repaired is consistent with the font style of the character image containing the character to be repaired, and the character can And the old character is made, so that the old character making effect is improved.
Drawings
FIG. 1 is a flow chart of a word processing method according to a first embodiment of the present invention;
FIG. 2a is a scanned document image;
FIG. 2b is a text image;
FIG. 2c is a repaired post-amble digital image;
FIG. 3 is a flowchart of a word processing method according to a second embodiment of the present invention;
FIG. 4 is a block diagram of a word processing system in a third embodiment of the present invention;
FIG. 5 is a schematic structural diagram of the acquisition module shown in FIG. 4;
fig. 6 is a schematic diagram of a hardware structure of a computer device according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
These and other aspects of embodiments of the invention will be apparent with reference to the following description and attached drawings. In the description and drawings, particular embodiments of the invention have been disclosed in detail as being indicative of some of the ways in which the principles of the embodiments of the invention may be practiced, but it is understood that the scope of the embodiments of the invention is not limited correspondingly. On the contrary, the embodiments of the invention include all changes, modifications and equivalents coming within the spirit and terms of the claims appended hereto.
Example one
Referring to FIG. 1, a method for processing a word in accordance with a first embodiment of the present invention is shown, the method including steps S10-S13.
Step S10, acquiring an original text image, finding a target position of a text to be repaired in the original text image, and intercepting an area with pixels of a preset size with the target position as a center to obtain a first text image to be repaired.
The original text image is a scanned image obtained by scanning a paper document (such as a test paper, a job, etc.) by a scanning device or a photographed image obtained by photographing the paper document by an image pickup apparatus (such as a camera), and may also be an image directly downloaded from a website.
When performing character restoration, a target position of a character to be restored may be searched in an original character image, and a region with a preset size of pixels, for example, 256 × 256 pixels, is intercepted with the target position as a center to obtain a first character image to be restored, where the first character image to be restored is a region in the original character image that needs to be subjected to character restoration.
Step S11, recognizing the height of the original text in the first text image to be repaired, creating a blank image with the same size as the first text image to be repaired, and inputting the text to be repaired with the same height as the original text in the blank image to obtain a second text image to be repaired.
In order to restore the characters to be restored in the original character image to the maximum extent completely, the size of the characters to be restored can be determined by identifying the height of the original characters in the first restored character image, a blank image with the same size as the first character image to be restored is created, the characters to be restored with the same height as the original characters are input into the blank image, and a second character image to be restored is obtained, wherein the second character image to be restored at the moment is an image which contains the characters to be restored and is different from the character style in the original character image.
Step S12, inputting the first to-be-repaired character image and the second to-be-repaired character image into the trained generative confrontation network model to obtain a target image, where the generative confrontation network model is used to transfer the character style in the first to-be-repaired character image to the second to-be-repaired character image.
A Generative Adaptive Networks (GAN) is a deep learning model, and is one of the most promising methods for unsupervised learning in complex distribution in recent years. The model passes through (at least) two modules in the framework: the mutual game learning of the Generative Model (Generative Model) and the Discriminative Model (Discriminative Model) yields a reasonably good output.
Before the generated confrontation network model is used for processing the first character image to be repaired and the second character image to be repaired, the generated confrontation network model needs to be trained.
As shown in fig. 2a, fig. 2b and fig. 2c, the document scanning image is a region with a fixed pixel size, which is cut out from the actual scanned document image, and may be 256 × 256 pixels, for example; the character image is a character (standard font) image to be input, and is placed on a blank image with the size of 256 × 256 pixels, and it should be noted that characters in the character image do not need to be in a document scanning image; the repaired digital image is an image obtained by transferring the style of the character font in the character image according to the style of the scanned image of the document, namely the repaired character.
After the GAN model is trained, the generated model is used as an image processing model, that is, the first character image to be repaired and the second character image to be repaired are input into the trained generated model to output a target image, wherein the target image is an image after character repair in the characters to be repaired.
Step S13, extracting the text to be repaired in the target image, and copying the text to be repaired to the target position.
And extracting the characters to be repaired in the target image, wherein the characters to be repaired are repaired characters, and the repairing of the stained characters in the original character image is completed by copying the repaired characters to be repaired to the target position.
In the embodiment, the advanced and popular deep learning network is adopted, the generation type confrontation network (GAN) is adopted, the old-making characters with the required font style are automatically generated, the character old-making can be automatically and intelligently made, a user does not need to have professional image processing knowledge, the universality of character old-making can be met, the font styles designated by different characters can be automatically generated without depending on whether the required font styles exist in the same characters, the character style of the character image containing the character to be repaired is consistent with the font style in the character image containing the character to be repaired by intercepting the character image containing the character to be repaired and reconstructing a blank image, the character to be repaired is input in the blank image, the font style in the character image containing the character to be repaired is transferred to the character to be repaired in the blank image by using the generation type confrontation network model, and the font style of the character to be repaired is consistent with the font style in the character image containing the character to be repaired, and the character can be well confronted And the antique finishing is carried out, so that the antique finishing effect of characters is improved.
Example two
Referring to FIG. 3, a word processing method according to a second embodiment of the present invention includes steps S20-S25.
Step S20, acquiring an original text image, finding a target position of a text to be repaired in the original text image, and intercepting an area with pixels of a preset size with the target position as a center to obtain a first text image to be repaired.
Step S21, judging whether the target position contains the character to be repaired, if not, executing step S22, if so, executing step S23
Step S22, intercepting the original text image into a plurality of regions of pixels with the preset size, traversing the plurality of regions of pixels with the preset size, and when it is determined that the region of pixels with the preset size contains the text to be repaired, determining that the region of pixels with the preset size is the first text image to be repaired.
Specifically, performing black-white binarization processing on the area of the pixels with the preset size, and calculating the proportion of the number of black pixels in the area of the pixels with the preset size to the total number of pixels in the pixels with the preset size after the black-white binarization processing; and when the proportion exceeds a preset value, judging that the preset-size pixels contain the characters to be repaired, wherein the preset value can be set to be 25%.
Step S23, recognizing the height of the original text in the first text image to be repaired, creating a blank image with the same size as the first text image to be repaired, and inputting the text to be repaired with the same height as the original text in the blank image to obtain a second text image to be repaired.
Specifically, in order to identify the original text height in a first text image to be repaired, black-and-white binarization processing is performed on the first text image to be repaired, and morphological expansion processing is performed on the first text image to be repaired through black-and-white binarization by using structural elements with preset pixel sizes; for example, structural elements with the size of 7 × 3 pixels, performing connected region analysis on the expanded first character image to be repaired to obtain a plurality of connected first character sub-image blocks to be repaired; and calculating the average height of the plurality of sub image blocks communicated with the first character to be repaired to obtain the height of the original character in the first character image to be repaired.
Step S24, inputting the first to-be-repaired character image and the second to-be-repaired character image into a trained generative confrontation network model to obtain a target image, where the generative confrontation network model is used to transfer the character style in the first to-be-repaired character image to the second to-be-repaired character image
Step S25, extracting the text to be repaired in the target image, and copying the text to be repaired to the target position.
Specifically, performing black-and-white binarization processing on the target image, and performing connected region analysis on the target image subjected to black-and-white binarization to obtain position information of a single character connected sub-image block; and intercepting the characters to be repaired from the target image according to the position information, and copying the characters to be repaired to the target position in the original character image.
In the embodiment, a first character image to be repaired is subjected to binarization processing, a structural element with a preset pixel size is utilized to perform morphological expansion processing on the first character image to be repaired, then connected region analysis is performed, the average height of a plurality of sub image blocks of the connected first character image to be repaired is obtained through calculation, the original character height in the first character image to be repaired is obtained, the target image is subjected to black-and-white binarization processing, the connected region analysis is performed on the target image subjected to black-and-white binarization, and the position information of the obtained single character connected sub image block is obtained; and copying the character to be repaired to the target position in the original character image.
EXAMPLE III
Referring to fig. 4, a word processing system according to a third embodiment of the present invention includes:
an obtaining module 100, configured to obtain an original text image, search a target position of a text to be repaired in the original text image, and intercept an area with a preset size of pixels with the target position as a center to obtain a first text image to be repaired;
the recognition module 200 is configured to recognize an original text height in the first text image to be repaired, create a blank image with the same size as the first text image to be repaired, and input a text to be repaired with the same height as the original text in the blank image to obtain a second text image to be repaired;
a generating module 300, configured to input the first to-be-repaired character image and the second to-be-repaired character image into a trained generative confrontation network model to obtain a target image, where the generative confrontation network model is used to transfer a character style in the first to-be-repaired character image to the second to-be-repaired character image;
an extracting module 400, configured to extract the text to be repaired in the target image, and copy the text to be repaired to the target position.
Further, in the word processing system, the obtaining module 100 includes:
a determining unit 110, configured to determine whether the target position contains the text to be repaired;
if not, the original character image is intercepted into a plurality of areas with pixels of the preset size, the areas with the pixels of the preset size are traversed, and when the area with the pixels of the preset size is judged to contain the character to be repaired, the area with the pixels of the preset size is judged to be the first character image to be repaired.
Further, in the above word processing system, the determining unit 110 is specifically configured to:
performing black-white binarization processing on the area of the pixels with the preset size, and calculating the proportion of the number of black pixels in the area of the pixels with the preset size to the total number of pixels in the pixels with the preset size after the black-white binarization processing;
and when the proportion exceeds a preset value, judging that the preset-size pixels contain the characters to be repaired.
Further, in the above word processing system, the identification module is specifically configured to:
carrying out black-white binarization processing on the first character image to be repaired, and carrying out morphological expansion processing on the first character image to be repaired, which is subjected to black-white binarization, by using structural elements with preset pixel sizes;
performing connected region analysis on the expanded first character image to be repaired to obtain a plurality of connected first character sub-image blocks to be repaired;
and calculating the average height of the plurality of sub image blocks communicated with the first character to be repaired to obtain the height of the original character in the first character image to be repaired.
Further, in the word processing system, the extracting module 400 is specifically configured to:
carrying out black-and-white binarization processing on the target image, and carrying out connected region analysis on the target image subjected to black-and-white binarization to obtain position information of a single character connected sub-image block;
and intercepting the characters to be repaired from the target image according to the position information, and copying the characters to be repaired to the target position in the original character image.
Further, in the word processing system, the generating module 300 is specifically configured to:
and constructing a generating type confrontation network model by using the generating model and the distinguishing model, and training the generating type confrontation network model by using a training group image, wherein the training group image comprises a plurality of groups of document scanning images, character images and repaired post-image images.
Further, in the word processing system, the obtaining module 100 further includes:
and a clipping unit 120 for clipping a 256 × 256 pixel region with the target position as a center.
The above modules may be functional modules or program modules, and may be implemented by software or hardware. For a module implemented by hardware, the modules may be located in the same processor; or the modules can be respectively positioned in different processors in any combination.
In addition, the word processing method in the embodiment of the present application described in conjunction with fig. 1 may be implemented by a computer device, which may be a server. Fig. 6 is a hardware structure diagram of a computer device according to an embodiment of the present application.
The computer device may comprise a processor 71 and a memory 72 in which computer program instructions are stored.
Specifically, the processor 71 may include a Central Processing Unit (CPU), or A Specific Integrated Circuit (ASIC), or may be configured to implement one or more Integrated circuits of the embodiments of the present Application.
Memory 72 may include, among other things, mass storage for data or instructions. By way of example, and not limitation, memory 72 may include a Hard Disk Drive (Hard Disk Drive, abbreviated to HDD), a floppy Disk Drive, a Solid State Drive (SSD), flash memory, an optical Disk, a magneto-optical Disk, tape, or a Universal Serial Bus (USB) Drive or a combination of two or more of these. Memory 72 may include removable or non-removable (or fixed) media, where appropriate. The memory 72 may be internal or external to the data processing apparatus, where appropriate. In a particular embodiment, the memory 72 is a Non-Volatile (Non-Volatile) memory. In particular embodiments, Memory 72 includes Read-Only Memory (ROM) and Random Access Memory (RAM). The ROM may be mask-programmed ROM, Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable PROM (EEPROM), Electrically rewritable ROM (EAROM), or FLASH Memory (FLASH), or a combination of two or more of these, where appropriate. The RAM may be a Static Random-Access Memory (SRAM) or a Dynamic Random-Access Memory (DRAM), where the DRAM may be a Fast Page Mode Dynamic Random-Access Memory (FPMDRAM), an Extended data output Dynamic Random-Access Memory (EDODRAM), a Synchronous Dynamic Random-Access Memory (SDRAM), and the like.
The memory 72 may be used to store or cache various data files that need to be processed and/or used for communication, as well as possible computer program instructions executed by the processor 71.
The processor 71 reads and executes the computer program instructions stored in the memory 72 to implement any of the word processing methods in the above embodiments.
In some of these embodiments, the computer device may also include a communication interface 73 and a bus 70. As shown in fig. 6, the processor 71, the memory 72, and the communication interface 73 are connected via the bus 70 to complete communication therebetween.
The communication interface 73 is used for realizing communication among modules, devices, units and/or equipment in the embodiment of the present application. The communication interface 73 may also be implemented with other components such as: the data communication is carried out among external equipment, image/data acquisition equipment, a database, external storage, an image/data processing workstation and the like.
The bus 70 comprises hardware, software, or both that couple the components of the computer device to one another. Bus 70 includes, but is not limited to, at least one of the following: data Bus (Data Bus), Address Bus (Address Bus), Control Bus (Control Bus), Expansion Bus (Expansion Bus), and Local Bus (Local Bus). By way of example, and not limitation, Bus 70 may include an Accelerated Graphics Port (AGP) or other Graphics Bus, an Enhanced Industry Standard Architecture (EISA) Bus, a Front-Side Bus (FSB), a Hyper Transport (HT) Interconnect, an ISA (ISA) Bus, an InfiniBand (InfiniBand) Interconnect, a Low Pin Count (LPC) Bus, a memory Bus, a microchannel Architecture (MCA) Bus, a PCI (Peripheral Component Interconnect) Bus, a PCI-Express (PCI-X) Bus, a Serial Advanced Technology Attachment (SATA) Bus, a Video Electronics Bus (audio Electronics Association), abbreviated VLB) bus or other suitable bus or a combination of two or more of these. Bus 70 may include one or more buses, where appropriate. Although specific buses are described and shown in the embodiments of the application, any suitable buses or interconnects are contemplated by the application.
In addition, in combination with the word processing method in the foregoing embodiments, the embodiments of the present application may provide a readable storage medium to implement. The readable storage medium having stored thereon computer program instructions; the computer program instructions, when executed by a processor, implement any of the word processing methods in the above embodiments.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (10)

1. A method for word processing, the method comprising:
acquiring an original character image, searching a target position of a character to be repaired in the original character image, and taking the target position as a center, and intercepting an area with a preset size of pixels to obtain a first character image to be repaired;
identifying the height of an original character in the first character image to be repaired, creating a blank image with the same size as the first character image to be repaired, and inputting a character to be repaired with the same height as the original character in the blank image to obtain a second character image to be repaired;
inputting the first character image to be repaired and the second character image to be repaired into a trained generative confrontation network model to obtain a target image, wherein the generative confrontation network model is used for transferring the character style in the first character image to be repaired to the second character image to be repaired;
and extracting the characters to be repaired in the target image, and copying the characters to be repaired to the target position.
2. The word processing method according to claim 1, wherein the step of obtaining an original word image, searching a target position of a word to be repaired in the original word image, and taking the target position as a center, and intercepting an area with a preset size of pixels to obtain a first word image to be repaired comprises:
judging whether the target position contains the characters to be repaired or not;
if not, the original character image is intercepted into a plurality of areas with pixels of the preset size, the areas with the pixels of the preset size are traversed, and when the area with the pixels of the preset size is judged to contain the character to be repaired, the area with the pixels of the preset size is judged to be the first character image to be repaired.
3. The method of claim 2, wherein the step of determining that the region of pixels with the preset size contains the text to be repaired comprises:
performing black-white binarization processing on the area of the pixels with the preset size, and calculating the proportion of the number of black pixels in the area of the pixels with the preset size to the total number of pixels in the pixels with the preset size after the black-white binarization processing;
and when the proportion exceeds a preset value, judging that the preset-size pixels contain the characters to be repaired.
4. The word processing method of claim 1, wherein the step of identifying the original text height in the first text image to be repaired comprises:
carrying out black-white binarization processing on the first character image to be repaired, and carrying out morphological expansion processing on the first character image to be repaired, which is subjected to black-white binarization, by using structural elements with preset pixel sizes;
performing connected region analysis on the expanded first character image to be repaired to obtain a plurality of connected first character sub-image blocks to be repaired;
and calculating the average height of the plurality of sub image blocks communicated with the first character to be repaired to obtain the height of the original character in the first character image to be repaired.
5. The word processing method of claim 1, wherein the step of copying the word to be repaired to the target location comprises:
carrying out black-and-white binarization processing on the target image, and carrying out connected region analysis on the target image subjected to black-and-white binarization to obtain position information of a single character connected sub-image block;
and intercepting the characters to be repaired from the target image according to the position information, and copying the characters to be repaired to the target position in the original character image.
6. The word processing method according to claim 1, wherein the step of inputting the first to-be-repaired word image and the second to-be-repaired word image into the trained generative confrontation network model to obtain the target image comprises:
and constructing a generating type confrontation network model by using the generating model and the distinguishing model, and training the generating type confrontation network model by using a training group image, wherein the training group image comprises a plurality of groups of document scanning images with the same content, character images and repaired digital images.
7. The word processing method of claim 1, wherein the step of intercepting an area of pixels of a predetermined size centered on the target position comprises:
and taking the target position as a center, and cutting out a region of 256 pixels by 256 pixels.
8. A word processing system, comprising:
the system comprises an acquisition module, a restoration module and a restoration module, wherein the acquisition module is used for acquiring an original character image, searching a target position of a character to be restored in the original character image, and intercepting an area with a preset size pixel by taking the target position as a center to obtain a first character image to be restored;
the recognition module is used for recognizing the height of an original character in the first character image to be repaired, creating a blank image with the same size as the first character image to be repaired, and inputting a character to be repaired with the same height as the original character in the blank image to obtain a second character image to be repaired;
the generating module is used for inputting the first character image to be repaired and the second character image to be repaired into a trained generating type confrontation network model to obtain a target image, and the generating type confrontation network model is used for transferring the character style in the first character image to be repaired to the second character image to be repaired;
and the extraction module is used for extracting the characters to be repaired in the target image and copying the characters to be repaired to the target position.
9. A readable storage medium on which a computer program is stored, which program, when being executed by a processor, carries out the word processing method of any one of claims 1 to 7.
10. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the word processing method of any one of claims 1 to 7 when executing the computer program.
CN202110397741.8A 2021-04-14 2021-04-14 Word processing method, system, readable storage medium and computer equipment Pending CN112801923A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110397741.8A CN112801923A (en) 2021-04-14 2021-04-14 Word processing method, system, readable storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110397741.8A CN112801923A (en) 2021-04-14 2021-04-14 Word processing method, system, readable storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN112801923A true CN112801923A (en) 2021-05-14

Family

ID=75811327

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110397741.8A Pending CN112801923A (en) 2021-04-14 2021-04-14 Word processing method, system, readable storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN112801923A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113674176A (en) * 2021-08-23 2021-11-19 北京市商汤科技开发有限公司 Image restoration method and device, electronic equipment and storage medium
WO2023001112A1 (en) * 2021-07-19 2023-01-26 维沃移动通信有限公司 Text beautification method and apparatus, and readable storage medium and electronic device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103839062A (en) * 2014-03-11 2014-06-04 东方网力科技股份有限公司 Image character positioning method and device
CN109189965A (en) * 2018-07-19 2019-01-11 中国科学院信息工程研究所 Pictograph search method and system
CN109800750A (en) * 2019-01-25 2019-05-24 济南浪潮高新科技投资发展有限公司 A kind of character area mask method of the text based on morphological image for rule composing
CN110458918A (en) * 2019-08-16 2019-11-15 北京百度网讯科技有限公司 Method and apparatus for output information
US20190392624A1 (en) * 2018-06-20 2019-12-26 Ahmed Elgammal Creative gan generating art deviating from style norms
CN110765339A (en) * 2019-11-14 2020-02-07 南宁师范大学 Incomplete Chinese calligraphy repairing and completing method based on generation of confrontation network
CN110852326A (en) * 2019-11-06 2020-02-28 贵州工程应用技术学院 Handwriting layout analysis and multi-style ancient book background fusion method
CN111046915A (en) * 2019-11-20 2020-04-21 武汉理工大学 Method for generating style characters

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103839062A (en) * 2014-03-11 2014-06-04 东方网力科技股份有限公司 Image character positioning method and device
US20190392624A1 (en) * 2018-06-20 2019-12-26 Ahmed Elgammal Creative gan generating art deviating from style norms
CN109189965A (en) * 2018-07-19 2019-01-11 中国科学院信息工程研究所 Pictograph search method and system
CN109800750A (en) * 2019-01-25 2019-05-24 济南浪潮高新科技投资发展有限公司 A kind of character area mask method of the text based on morphological image for rule composing
CN110458918A (en) * 2019-08-16 2019-11-15 北京百度网讯科技有限公司 Method and apparatus for output information
CN110852326A (en) * 2019-11-06 2020-02-28 贵州工程应用技术学院 Handwriting layout analysis and multi-style ancient book background fusion method
CN110765339A (en) * 2019-11-14 2020-02-07 南宁师范大学 Incomplete Chinese calligraphy repairing and completing method based on generation of confrontation network
CN111046915A (en) * 2019-11-20 2020-04-21 武汉理工大学 Method for generating style characters

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
YE YUAN 等: ""Art Font Image Generation with Conditional Generative Adversarial Networks"", 《2020 EIGHTH INTERNATIONAL SYMPOSIUM ON COMPUTING AND NETWORKING WORKSHOPS》 *
李进 等: ""基于条件生成对抗网络的蒙古文字体风格迁移模型"", 《中文信息学报》 *
韦煜: "《贵州少数民族文化研究丛书-贵州少数民族语言文字研究》", 31 January 2018 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023001112A1 (en) * 2021-07-19 2023-01-26 维沃移动通信有限公司 Text beautification method and apparatus, and readable storage medium and electronic device
CN113674176A (en) * 2021-08-23 2021-11-19 北京市商汤科技开发有限公司 Image restoration method and device, electronic equipment and storage medium
CN113674176B (en) * 2021-08-23 2024-04-16 北京市商汤科技开发有限公司 Image restoration method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110705405B (en) Target labeling method and device
WO2020098250A1 (en) Character recognition method, server, and computer readable storage medium
CN112070649B (en) Method and system for removing specific character string watermark
JP7026165B2 (en) Text recognition method and text recognition device, electronic equipment, storage medium
CN112613553B (en) Picture sample set generation method and device, computer equipment and storage medium
CN112801923A (en) Word processing method, system, readable storage medium and computer equipment
CN112396047B (en) Training sample generation method and device, computer equipment and storage medium
CN113033269A (en) Data processing method and device
CN112348028A (en) Scene text detection method, correction method, device, electronic equipment and medium
CN111435445A (en) Training method and device of character recognition model and character recognition method and device
CN114429636B (en) Image scanning identification method and device and electronic equipment
CN111091122A (en) Training and detecting method and device for multi-scale feature convolutional neural network
CN111079624B (en) Sample information acquisition method and device, electronic equipment and medium
CN116503885A (en) Table identification method and device, electronic equipment and storage medium
CN113793264B (en) Archive image processing method and system based on convolution model and electronic equipment
CN115495498A (en) Data association method, system, electronic device and storage medium
CN111950542B (en) Learning scanning pen based on OCR recognition algorithm
CN112215784B (en) Image decontamination method, image decontamination device, readable storage medium and computer equipment
CN112825141B (en) Method and device for recognizing text, recognition equipment and storage medium
CN112565549A (en) Book image scanning method
CN111832498A (en) Cartoon face recognition method based on convolutional neural network
CN111767916A (en) Image detection method, device, equipment and storage medium
CN112396058B (en) Document image detection method, device, equipment and storage medium
CN115546780B (en) License plate recognition method, model and device
CN115730094A (en) Picture data set obtaining method, device, equipment and storage medium

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210514

RJ01 Rejection of invention patent application after publication