CN106599818B - Method and device for generating handwriting format file based on picture - Google Patents

Method and device for generating handwriting format file based on picture Download PDF

Info

Publication number
CN106599818B
CN106599818B CN201611114430.1A CN201611114430A CN106599818B CN 106599818 B CN106599818 B CN 106599818B CN 201611114430 A CN201611114430 A CN 201611114430A CN 106599818 B CN106599818 B CN 106599818B
Authority
CN
China
Prior art keywords
handwriting
color value
picture
pixel points
generating
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
CN201611114430.1A
Other languages
Chinese (zh)
Other versions
CN106599818A (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.)
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Guangzhou Shirui Electronics Co Ltd
Original Assignee
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Guangzhou Shirui Electronics 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 Guangzhou Shiyuan Electronics Thecnology Co Ltd, Guangzhou Shirui Electronics Co Ltd filed Critical Guangzhou Shiyuan Electronics Thecnology Co Ltd
Priority to CN201611114430.1A priority Critical patent/CN106599818B/en
Priority to PCT/CN2017/077154 priority patent/WO2018103226A1/en
Publication of CN106599818A publication Critical patent/CN106599818A/en
Application granted granted Critical
Publication of CN106599818B publication Critical patent/CN106599818B/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/32Digital ink
    • G06V30/333Preprocessing; Feature extraction
    • G06V30/347Sampling; Contour coding; Stroke extraction

Landscapes

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

Abstract

The invention discloses a method for generating a file in a handwriting format based on a picture, which comprises the following steps: identifying the picture to be processed to obtain identified handwriting; obtaining at least one handwriting color value according to color values of pixel points forming the recognized handwriting; acquiring pixel points in the picture, which have the same color value as the handwriting color value, and generating a handwriting point set; generating a background image based on the stroke point set and the picture; and generating a handwriting format file according to the background picture and the handwriting point set. The invention also discloses a device for generating the file in the handwriting format based on the picture, which can convert the picture into the file in the editable handwriting format and is convenient for a user to edit the handwriting.

Description

Method and device for generating handwriting format file based on picture
Technical Field
The invention relates to the field of picture processing, in particular to a method and a device for generating a file in a handwriting format based on a picture.
Background
When the electronic whiteboard is used for writing, the written handwriting is generally drawn on the background, and after the writing is finished, the handwriting and the background can be selected to be stored as a file with a specific handwriting format (such as a file with an ENB format) or directly stored as a file format such as a general picture, PDF and the like.
For the file stored in the handwriting format, the method has the advantages that when the file is opened again, the file or the written handwriting can be edited for the second time, and the defect that the file in the handwriting format has poor compatibility, only specific writing software can be opened generally, and the written content is inconvenient to check in the environment without the writing software. If the document is directly stored in a general document format such as a picture and PDF (portable document format), although the document format is convenient to view and transmit in various environments, the writing software cannot perform secondary operation on the original handwriting and only can edit the picture, so that the front content and the back content of the file are inconsistent, the definition of the file is reduced due to repeated storage of the picture, and the user experience is poor.
Disclosure of Invention
In view of the above problems, an object of the present invention is to provide a method and an apparatus for generating a document in a handwriting format based on a picture, which can generate a document in a handwriting format according to a picture, and facilitate a user to perform a secondary operation on handwriting.
The invention provides a method for generating a file in a handwriting format based on a picture, which comprises the following steps:
identifying the picture to be processed to obtain identified handwriting;
obtaining at least one handwriting color value according to color values of pixel points forming the recognized handwriting;
acquiring pixel points in the picture, which have the same color value as the handwriting color value, and generating a handwriting point set;
generating a background image based on the stroke point set and the picture;
and generating a handwriting format file according to the background picture and the handwriting point set.
Preferably, the obtaining at least one handwriting color value according to the color values of the pixel points forming the recognized handwriting specifically comprises:
acquiring color values of all pixel points forming the recognized handwriting, and counting the number of the pixel points corresponding to each color value;
and setting the color value corresponding to the pixel point with the largest number as the handwriting color value.
Preferably, the obtaining at least one handwriting color value according to the color values of the pixel points forming the recognized handwriting specifically comprises:
acquiring color values of all pixel points forming the recognized handwriting, and counting the number of the pixel points corresponding to each color value;
and marking the color value of which the ratio of the number of the corresponding pixel points to the total number of the identified pixel points exceeds a preset threshold value as a handwriting color value.
Preferably, the generating a background map according to the stroke point set and the picture specifically includes:
acquiring a background color value of the picture;
inquiring pixel points in the picture, which are located in the stroke point set;
and replacing the color value of the inquired pixel point with the background color value to generate a background image.
Preferably, the generating a background map according to the stroke point set and the picture specifically includes:
inquiring pixel points in the picture, which are located in the stroke point set;
generating a replacement color value according to the color value of an adjacent pixel point adjacent to the inquired pixel point;
and replacing the color value of the inquired pixel point with the replacement color value to generate a background graph.
Preferably, the generating of the replacement color value according to the color value of the adjacent pixel point adjacent to the queried pixel point specifically includes:
acquiring the color value of an adjacent pixel point adjacent to the inquired pixel point;
removing adjacent pixel points in the stroke point set;
and mixing the color values of the remaining adjacent pixel points to generate a replacement color value.
Preferably, the generating of the replacement color value according to the color value of the pixel point adjacent to the queried pixel point specifically includes:
acquiring the color value of an adjacent pixel point adjacent to the inquired pixel point;
removing adjacent pixel points in the stroke point set;
and determining the replacement color value according to the occurrence times of the color values of the rest adjacent pixel points.
The invention also provides a device for generating a file in a handwriting format based on the picture, which comprises the following steps:
the handwriting recognition unit is used for recognizing the picture to be processed to obtain recognized handwriting;
the handwriting color value generating unit is used for obtaining at least one handwriting color value according to the color value of the pixel point forming the recognized handwriting;
the handwriting point set generating unit is used for acquiring pixel points which have the same color value as the handwriting color value in the picture and generating a handwriting point set;
the background image generating unit is used for generating a background image based on the stroke point set and the picture;
and the handwriting file generating unit is used for generating a handwriting format file according to the background picture and the handwriting point set.
Preferably, the handwriting color value generating unit specifically includes:
the first statistical module is used for acquiring color values of all pixel points forming the recognized handwriting and counting the number of the pixel points corresponding to each color value;
and the first marking module is used for marking the color value corresponding to the pixel point with the largest number as a handwriting color value.
Preferably, the background map generating unit specifically includes:
the background color value acquisition module is used for acquiring a background color value of the picture;
the first query module is used for querying pixel points in the picture, which are located in the stroke point set;
and the first color value replacing module is used for replacing the color value of the inquired pixel point with the background color value to generate a background image.
The method and the device for generating the file in the handwriting format based on the picture convert the picture into the file in the handwriting format by identifying the handwriting in the picture, obtaining the handwriting color value according to the identified handwriting, obtaining the pixel points of all the handwriting in the picture by using the handwriting color value, generating the handwriting point set, restoring the background image according to the handwriting point set, and finally generating the file in the handwriting format according to the handwriting point set and the background image. On one hand, for the environment or the terminal which is not provided with the file capable of opening the handwriting format, the content can be checked by directly opening the original picture, and for the environment or the terminal (such as an electronic whiteboard) which is provided with the file capable of opening the handwriting format, the handwriting in the file in the handwriting format converted from the picture can be secondarily edited, so that the compatibility of the file is improved, and the operation and experience of a user are facilitated.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for generating a document in a handwriting format based on a picture according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of a picture to be processed according to an embodiment of the present invention.
FIG. 3 is a diagram illustrating the picture shown in FIG. 2 after handwriting recognition.
FIG. 4 is a schematic diagram of obtaining neighboring pixels adjacent to the queried pixel.
FIG. 5 is another illustration of obtaining neighboring pixels adjacent to the queried pixel.
FIG. 6 is a schematic structural diagram of an apparatus for generating a document in a handwriting format based on a picture according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, the present invention provides a method for generating a document in a handwriting format based on a picture, which at least includes the following steps:
s101, identifying the picture to be processed to obtain the identified handwriting.
As shown in fig. 2, in the embodiment of the present invention, the to-be-processed picture may be obtained by storing, by writing software on an electronic whiteboard, a background picture drawn with handwriting as a picture format, or may be a picture arbitrarily containing handwriting information or handwriting information, which is not limited in the present invention.
In the embodiment of the invention, considering that the handwriting or the handwriting generally comprises more elements such as horizontal, vertical and circle, most of the handwriting in the picture can be recognized by using a straight line and circle detection algorithm based on Hough transform. The hough transform is one of the classic means in image transform, and is mainly used for separating geometric shapes with certain identical features, such as straight lines, circles and the like, from an image. Of course, it should be understood that in the embodiment of the present invention, other well-known text-text separation techniques may be used to recognize the handwriting from the picture, and the present invention is not limited in particular.
It should be noted that, since the handwriting often includes some irregular geometric shapes, such as non-dots, hooks, etc., which are generally difficult to be completely separated by the text-text separation technique, it should be understood that the recognized handwriting is only a part of the handwriting in the picture and not the whole handwriting (for example, the geometric shape with black color in fig. 3 is the unrecognized handwriting).
In addition, it should be noted that, in the embodiment of the present invention, after the recognition is completed, a modification of the recognition result by the user may also be received, for example, to supplement the missing handwriting, or to remove the part that is recognized incorrectly. If the area needing to be supplemented or removed is smaller, the handwriting can be modified in a copying mode, and if the area is larger, the handwriting can be modified in a circling mode, so that the handwriting obtained by recognition is more accurate.
S102, obtaining at least one handwriting color value according to color values of pixel points forming the recognized handwriting.
Specifically, in one implementation, step S102 includes:
s1021, obtaining color values of pixel points forming the recognized handwriting, and counting the number of the pixel points corresponding to each color value.
S1022, sets the color value corresponding to the pixel having the largest number as the handwriting color value.
In the embodiment of the invention, in the process of picture recognition or image-text separation, non-handwriting pixel points (such as pixel points of a background adjacent to handwriting or other interference pixel points) are inevitably introduced, the color value of the part of the pixel points is different from the color value of the handwriting, so that the real color value of the handwriting needs to be obtained from the recognized handwriting, and the introduced non-handwriting pixel points necessarily occupy a small number, so that the number of the pixel points corresponding to each color value can be counted, and the color value corresponding to the pixel point with the largest number is set as the handwriting color value of the picture.
For example, assuming that the number of all the pixel points forming the handwriting is 1000, the number of the pixel points with the color value of black is 900, and the number of the pixel points with other colors is 100, the black is set as the handwriting color value of the picture.
It should be noted that the present invention is applicable to the case where the color values of the scripts in the picture are relatively single, and particularly, all the scripts in the picture are drawn or written by using the same color value.
In one implementation, step S102 includes:
and S1023, obtaining color values of all pixel points forming the recognized handwriting, and counting the number of the pixel points corresponding to each color value.
And S1024, marking the color value of which the ratio of the number of the corresponding pixel points to the total number of the identified pixel points exceeds a preset threshold value as a handwriting color value.
In some cases, the pictures may include handwriting of different colors at the same time, and then at this time, the number of pixel points corresponding to each color value is obtained, and color values of which the ratio of the number to the total number of the identified pixel points exceeds a predetermined threshold value are all marked as handwriting color values.
For example, assuming that the threshold is 20% and the number of all pixel points of the recognized handwriting is 1000, wherein the number of pixel points having a black color value is 600, the number of pixel points having a red color value is 300, and the number of pixel points having other color values is 100, then both black and red are labeled as handwriting color values.
It should be noted that, because the color values of the non-handwriting pixels (such as background pixels) are inevitably included in the recognized handwriting, a threshold needs to be reasonably set to filter out these interferences, on one hand, if the threshold is set too small, the color values of the non-handwriting pixels may be marked as the handwriting color values, and if the threshold is set to be larger, some handwriting with a smaller proportion may be filtered out, which affects the effect of the finally generated file. The specific threshold value can be obtained by statistics according to the recognition accuracy of the adopted image-text separation algorithm.
S103, obtaining pixel points in the picture, wherein the pixel points have the same color value as the handwriting color value, and generating a handwriting point set.
In the embodiment of the invention, after the handwriting color values of the picture are obtained, more parts or nearly all handwriting can be extracted from the picture according to the handwriting color values. When extracting, the upper left corner of the picture can be used as an origin O (0, 0), the width of the picture is used as an x-axis boundary, the height of the picture is used as a y-axis boundary, and the color value of each pixel point of the picture is read row by row and column by column, if the pixel point P1(x 1)1,y1) Is the same as the handwriting color value (which may be one or any one of a plurality of handwriting color values), then point P1 (x) is added1,y1) And (4) collecting handwriting points until a complete picture is read.
It should be noted that, in the stroke point set, in addition to recording the position coordinates of each pixel point, the corresponding color value is also recorded at the same time.
And S104, generating a background image based on the stroke point set and the picture.
In the embodiment of the invention, the handwriting formatted file comprises the background image and the handwriting points, so that the background image needs to be reconstructed or restored in order to obtain the handwriting formatted file. Specifically, the method comprises the following steps:
in one embodiment, step S104 specifically includes:
and S1041, obtaining a background color value of the picture.
And S1042, inquiring pixel points in the picture, which are located in the stroke point set.
And S1043, replacing the color value of the inquired pixel point with the background color value, and generating a background image.
For some cases, the color of the background image is a single color, such as a white background image or a light green background image. At this moment, only the background color value of the background image needs to be acquired, then the image is traversed, the pixel points located in the stroke point set are inquired, and then the color value of the inquired pixel points is replaced by the background color value, so that the background image is reconstructed.
In one embodiment, step S104 specifically includes:
and S1044, inquiring pixel points in the picture in the stroke point set.
S1045, generating a replacement color value according to the color values of at least 4 adjacent pixel points adjacent to the inquired pixel point.
And S1046, replacing the color value of the inquired pixel point with the replacement color value, and generating a background map.
In some cases, the background map may include a background pattern or be composed of multiple colors, and at this time, when the background map is restored, a pixel point located in the stroke point set in the picture needs to be queried, then a replacement color value is generated according to a color value of a pixel point adjacent to the queried pixel point, and the queried color value of the pixel point is set as the replacement color value, so that the background map is obtained. Because the replacement color value of the inquired pixel point is determined by the color value of the pixel point adjacent to the inquired pixel point, the reconstruction effect of the background image can be ensured as much as possible.
And S105, generating a handwriting format file according to the background picture and the handwriting point set.
In the embodiment of the invention, after the trace point set and the background map are obtained, the document in the trace format (such as the document in the ENB format) can be saved as long as the background map is drawn first, and then the pixel points in the trace point set are drawn on the background map according to the corresponding trace color values. The user can open the file in the handwriting format through specific writing software and directly edit the handwriting.
In summary, in the method for generating a document in a handwriting format based on a picture provided by the embodiment of the present invention, the picture is converted into the document in the handwriting format by identifying the handwriting in the picture, obtaining the handwriting color value according to the identified handwriting, obtaining the pixel points of all the handwriting in the picture by using the handwriting color value, generating the handwriting point set, restoring the background image according to the handwriting point set, and finally generating the document in the handwriting format according to the handwriting point set and the background image. On one hand, for the environment or the terminal which is not provided with the file capable of opening the handwriting format, the content can be checked by directly opening the original picture, and for the environment or the terminal (such as an electronic whiteboard) which is provided with the file capable of opening the handwriting format, the handwriting in the file in the handwriting format converted from the picture can be secondarily edited, so that the compatibility of the file is improved, and the operation and experience of a user are facilitated.
Some preferred embodiments of the invention are described further below to facilitate an understanding of embodiments of the invention.
First preferred embodiment:
preferably, step S1045 specifically includes:
s10451, obtaining a color value of an adjacent pixel point adjacent to the inquired pixel point.
In the preferred embodiment, the color values of 4 adjacent pixels adjacent to the pixel point may be obtained (as shown in fig. 4), and the color values of 8 adjacent pixels in a square region centered on the pixel point may also be obtained (as shown in fig. 5).
And S10452, removing adjacent pixel points in the stroke point set.
In the preferred embodiment, because the pixels in the trace point set do not necessarily belong to the background, the pixels in the trace point set in adjacent pixels are removed, so that the pixels are prevented from interfering with the effect of restoring the background image.
And S10453, mixing the color values of the rest adjacent pixel points to generate a replacement color value.
In the preferred embodiment, the color values of the remaining adjacent pixel points are mixed to generate a replacement color value. Because the color of the pattern is generally in continuous transition, the original color value of the position occupied by the pixel point can be obtained by mixing the color values of the adjacent pixel points, wherein the mixing can be directly mixing the RGB values of the pixel points, or mixing the RGB values after converting the RGB values into hues, generally speaking, the mixing after converting the RGB values into the hues has better effect.
Second preferred embodiment:
preferably, step S1045 specifically includes:
s10454, obtaining a color value of an adjacent pixel point adjacent to the inquired pixel point.
In the preferred embodiment, the color values of 4 adjacent pixels adjacent to the pixel point may be obtained, and the color values of 8 adjacent pixels in a square region centered on the pixel point may also be obtained.
And S10455, removing adjacent pixel points in the stroke point set.
In the preferred embodiment, because the pixel points in the trace point set do not necessarily belong to the background, the pixel points in the trace point set among the adjacent pixel points are removed, so that the adjacent pixel points are prevented from interfering with the effect of restoring the background image.
And S10456, determining a replacement color value according to the occurrence times of the color values of the rest adjacent pixel points.
For example, if a pixel point P1(x1,y1) For a pixel point in the stroke point set, reading the point P1Upper P ofup(x1,y1-1) lower Pdown(x1,y1+1), left Pleft(x1-1,y1) Right Pright(x1+1,y1) Four-direction adjacent pixel point Cu,Cd,Cl,CrAnd if the four adjacent pixel points are not located in the trace point set, judging:
if C is presentu,Cd,Cl,CrIf the color values are the same, replacing the color values and taking the color values;
if C is presentu,Cd,Cl,CrIf 3 color values are the same, the replacement color value takes the color value which is the same as the 3 values;
if C is presentu,Cd,Cl,CrIf 2 color values are the same, and the other 2 color values are different, the replacement color value is the same as the 2 color values;
if C is presentu,Cd,Cl,CrIf 2 color values are the same, and the other 2 color values are also the same, the replacement color value is the mixed color value of the 2 color values;
if C is presentu,Cd,Cl,CrIf the color values are different, the description is that the stroke points are isolated, the stroke points can be removed as noise points, the noise points are removed from the stroke point set, and the replacement color values are mixed color values of four values.
Referring to fig. 6, an embodiment of the present invention further provides an apparatus 100 for generating a document in a handwriting format based on a picture, including:
and the handwriting recognition unit 10 is used for recognizing the picture to be processed to obtain recognized handwriting.
And the handwriting color value generating unit 20 is configured to obtain at least one handwriting color value according to color values of pixel points forming the recognized handwriting.
And the stroke point set generating unit 30 is configured to obtain pixel points in the picture, which have the same color value as the handwriting color value, and generate a stroke point set.
And the background image generating unit 40 is used for generating a background image based on the stroke point set and the picture.
And the handwriting file generating unit 50 is used for generating a file in a handwriting format according to the background image and the handwriting point set.
Preferably, in an implementation manner, the handwriting color value generating unit 20 specifically includes:
the first statistical module 21 is configured to obtain color values of all pixel points forming the recognized handwriting, and count the number of pixel points corresponding to each color value;
and the first marking module 22 is configured to mark the color value corresponding to the pixel with the largest number as a handwriting color value.
Preferably, in an implementation manner, the handwriting color value generating unit 20 specifically includes:
and the second statistical module 23 is configured to obtain color values of the pixels forming the recognized handwriting, and count the number of pixels corresponding to each color value.
And the second marking module 24 is configured to mark color values, of which the ratio of the number of the corresponding pixel points to the total number of the identified pixel points exceeds a predetermined threshold, as handwriting color values.
Preferably, in an implementation manner, the background map generating unit 40 specifically includes:
a background color value obtaining module 41, configured to obtain a background color value of the picture;
the first query module 42 is configured to query a pixel point in the picture, which is located in the stroke point set;
and a first color value replacing module 43, configured to replace the color value of the queried pixel with the background color value, so as to generate a background map.
Preferably, in an implementation manner, the background map generating unit 40 specifically includes:
and the second query module 44 is configured to query the pixel points in the picture, which are located in the stroke point set.
And a replacement color value generation module 45, configured to generate a replacement color value according to color values of at least 4 neighboring pixel points neighboring the queried pixel point.
And a second color value replacing module 46, configured to replace the color value of the queried pixel with the replacement color value, so as to generate a background map.
Preferably, the replacement color value generating module 45 specifically includes:
the first adjacent color value obtaining sub-module 451 is configured to obtain color values of at least 4 adjacent pixel points adjacent to the queried pixel point.
And the first removing submodule 452 is configured to remove adjacent pixel points located in the stroke point set.
And a color value mixing submodule 453, configured to mix color values of the remaining neighboring pixel points, and generate a replacement color value.
Preferably, the replacement color value generating module 45 specifically includes:
and a second adjacent color value obtaining submodule 454, configured to obtain color values of at least 4 adjacent pixel points adjacent to the queried pixel point.
The second removing submodule 455 is configured to remove adjacent pixel points located in the stroke point set;
and the color value setting submodule 456 is configured to determine a replacement color value according to the number of occurrences of the color value of the remaining adjacent pixel point.
According to the device 100 for generating a file in a handwriting format based on a picture, provided by the embodiment of the invention, the handwriting in the picture is recognized through the handwriting recognition unit 10, the handwriting color value generation unit 20 obtains the handwriting color value according to the recognized handwriting, the handwriting point set generation unit 30 obtains pixel points of all the handwriting in the picture by using the handwriting color value to generate the handwriting point set, then the background image generation unit 40 recovers the background image according to the handwriting point set, and finally the handwriting file generation unit 50 generates the file in the handwriting format according to the handwriting point set and the background image, so that the picture is converted into the file in the handwriting format. On one hand, for the environment or the terminal which is not provided with the file capable of opening the handwriting format, the content can be checked by directly opening the original picture, and for the environment or the terminal (such as an electronic whiteboard) which is provided with the file capable of opening the handwriting format, the handwriting in the file in the handwriting format converted from the picture can be secondarily edited, so that the compatibility of the file is improved, and the operation and experience of a user are facilitated.
While the invention has been described with reference to a preferred embodiment, it will be understood by those skilled in the art that various changes in form and detail may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.

Claims (10)

1. A method for generating a file in a handwriting format based on a picture is characterized by comprising the following steps:
identifying the picture to be processed to obtain identified handwriting;
obtaining at least one handwriting color value according to color values of pixel points forming the recognized handwriting;
acquiring pixel points in the picture, which have the same color value as the handwriting color value, and generating a handwriting point set;
generating a background image based on the stroke point set and the picture;
generating a file in a handwriting format according to the background picture and the handwriting point set;
generating a background image according to the stroke point set and the picture, specifically comprising:
acquiring a background color value of the picture;
inquiring pixel points in the picture, which are located in the stroke point set;
and replacing the color value of the inquired pixel point with the background color value to generate a background image.
2. The method for generating a document in handwriting format based on a picture as claimed in claim 1, wherein said obtaining at least one handwriting color value from color values of pixel points constituting said recognized handwriting is specifically:
acquiring color values of all pixel points forming the recognized handwriting, and counting the number of the pixel points corresponding to each color value;
and setting the color value corresponding to the pixel point with the largest number as the handwriting color value.
3. The method for generating a document in handwriting format based on a picture as claimed in claim 1, wherein said obtaining at least one handwriting color value from color values of pixel points constituting said recognized handwriting is specifically:
acquiring color values of all pixel points forming the recognized handwriting, and counting the number of the pixel points corresponding to each color value;
and marking the color value of which the ratio of the number of the corresponding pixel points to the total number of the identified pixel points exceeds a preset threshold value as a handwriting color value.
4. A method for generating a file in a handwriting format based on a picture is characterized by comprising the following steps:
identifying the picture to be processed to obtain identified handwriting;
obtaining at least one handwriting color value according to color values of pixel points forming the recognized handwriting;
acquiring pixel points in the picture, which have the same color value as the handwriting color value, and generating a handwriting point set;
generating a background image based on the stroke point set and the picture;
generating a file in a handwriting format according to the background picture and the handwriting point set;
generating a background image according to the stroke point set and the picture, specifically comprising:
inquiring pixel points in the picture, which are located in the stroke point set;
generating a replacement color value according to the color value of an adjacent pixel point adjacent to the inquired pixel point;
and replacing the color value of the inquired pixel point with the replacement color value to generate a background graph.
5. The method for generating handwriting-formatted files based on pictures according to claim 4, wherein said generating replacement color values according to color values of adjacent pixel points adjacent to said queried pixel points comprises:
acquiring the color value of an adjacent pixel point adjacent to the inquired pixel point;
removing adjacent pixel points in the stroke point set;
and mixing the color values of the remaining adjacent pixel points to generate a replacement color value.
6. The method for generating a document in handwriting format based on picture as claimed in claim 4, wherein said generating a replacement color value according to a color value of a pixel adjacent to said queried pixel is specifically:
acquiring the color value of an adjacent pixel point adjacent to the inquired pixel point;
removing adjacent pixel points in the stroke point set;
and determining the replacement color value according to the occurrence times of the color values of the rest adjacent pixel points.
7. The method for generating a document in handwriting format based on picture as claimed in claim 4, wherein said obtaining at least one handwriting color value according to color values of pixel points constituting said recognized handwriting specifically is:
acquiring color values of all pixel points forming the recognized handwriting, and counting the number of the pixel points corresponding to each color value;
and setting the color value corresponding to the pixel point with the largest number as the handwriting color value.
8. The method for generating a document in handwriting format based on picture as claimed in claim 4, wherein said obtaining at least one handwriting color value according to color values of pixel points constituting said recognized handwriting specifically is:
acquiring color values of all pixel points forming the recognized handwriting, and counting the number of the pixel points corresponding to each color value;
and marking the color value of which the ratio of the number of the corresponding pixel points to the total number of the identified pixel points exceeds a preset threshold value as a handwriting color value.
9. An apparatus for generating a document in handwriting format based on a picture, comprising:
the handwriting recognition unit is used for recognizing the picture to be processed to obtain recognized handwriting;
the handwriting color value generating unit is used for obtaining at least one handwriting color value according to the color value of the pixel point forming the recognized handwriting;
the handwriting point set generating unit is used for acquiring pixel points which have the same color value as the handwriting color value in the picture and generating a handwriting point set;
the background image generating unit is used for generating a background image based on the stroke point set and the picture;
a handwriting file generating unit, configured to generate a file in a handwriting format according to the background image and the handwriting point set;
wherein, the background map generation unit specifically comprises:
the background color value acquisition module is used for acquiring a background color value of the picture;
the first query module is used for querying pixel points in the picture, which are located in the stroke point set;
and the first color value replacing module is used for replacing the color value of the inquired pixel point with the background color value to generate a background image.
10. An apparatus for generating a document in handwriting format based on a picture according to claim 9, wherein said handwriting color value generating unit specifically comprises:
the first statistical module is used for acquiring color values of all pixel points forming the recognized handwriting and counting the number of the pixel points corresponding to each color value;
and the first marking module is used for marking the color value corresponding to the pixel point with the largest number as a handwriting color value.
CN201611114430.1A 2016-12-07 2016-12-07 Method and device for generating handwriting format file based on picture Active CN106599818B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201611114430.1A CN106599818B (en) 2016-12-07 2016-12-07 Method and device for generating handwriting format file based on picture
PCT/CN2017/077154 WO2018103226A1 (en) 2016-12-07 2017-03-17 Method and device for generating handwriting format document on the basis of picture

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611114430.1A CN106599818B (en) 2016-12-07 2016-12-07 Method and device for generating handwriting format file based on picture

Publications (2)

Publication Number Publication Date
CN106599818A CN106599818A (en) 2017-04-26
CN106599818B true CN106599818B (en) 2020-10-27

Family

ID=58596299

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611114430.1A Active CN106599818B (en) 2016-12-07 2016-12-07 Method and device for generating handwriting format file based on picture

Country Status (2)

Country Link
CN (1) CN106599818B (en)
WO (1) WO2018103226A1 (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108874254B (en) * 2018-06-12 2019-04-09 掌阅科技股份有限公司 The method for drafting and E-book reader of the hand-written pencil person's handwriting of E-book reader
CN109062491A (en) * 2018-07-23 2018-12-21 广州视源电子科技股份有限公司 The handwriting processing method and device of interactive intelligence equipment
CN109215098B (en) * 2018-08-20 2023-04-11 广州视源电子科技股份有限公司 Handwriting erasing method and device
CN110174978A (en) * 2019-05-13 2019-08-27 广州视源电子科技股份有限公司 Data processing method, device, intelligent interaction plate and storage medium
CN111160265B (en) * 2019-12-30 2023-01-10 Oppo(重庆)智能科技有限公司 File conversion method and device, storage medium and electronic equipment
CN112256146B (en) * 2020-09-09 2024-05-03 广州视源电子科技股份有限公司 Method, device and equipment for testing writing of whiteboard and storage medium
CN113688838B (en) * 2021-10-25 2022-03-22 江西软云科技股份有限公司 Red handwriting extraction method and system, readable storage medium and computer equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6909803B2 (en) * 2000-12-22 2005-06-21 Canon Kabushiki Kaisha Text color detection for copier image processing
CN101295359A (en) * 2007-04-25 2008-10-29 日立欧姆龙金融系统有限公司 Image processing program and image processing apparatus
CN102136064A (en) * 2011-03-24 2011-07-27 成都四方信息技术有限公司 System for recognizing characters from image
CN102289322A (en) * 2011-08-25 2011-12-21 盛乐信息技术(上海)有限公司 Method and system for processing handwriting
CN103544722A (en) * 2013-10-25 2014-01-29 深圳市掌网立体时代视讯技术有限公司 Method and device for handwriting decoration of digital painting and chirography
CN102131038B (en) * 2010-01-18 2014-06-25 夏普株式会社 Image compressing apparatus, compressed image outputting apparatus and image compression method
CN105205488A (en) * 2015-07-13 2015-12-30 西北工业大学 Harris angular point and stroke width based text region detection method

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1559086A1 (en) * 2002-10-24 2005-08-03 Immediad ApS System for presenting and controlling information on a display device
CN101593324B (en) * 2009-06-17 2012-05-23 浙江师范大学 Method and system for network multi-level approval based on dependable computing application technique
CN102541347A (en) * 2011-11-15 2012-07-04 上海大学 Automatic identification system and method of handwriting Chinese character
CN102968789B (en) * 2012-10-25 2015-06-24 清华大学 Method used for extracting unearthed bamboo slip and silk character pattern image and based on digital image processing

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6909803B2 (en) * 2000-12-22 2005-06-21 Canon Kabushiki Kaisha Text color detection for copier image processing
CN101295359A (en) * 2007-04-25 2008-10-29 日立欧姆龙金融系统有限公司 Image processing program and image processing apparatus
CN102131038B (en) * 2010-01-18 2014-06-25 夏普株式会社 Image compressing apparatus, compressed image outputting apparatus and image compression method
CN102136064A (en) * 2011-03-24 2011-07-27 成都四方信息技术有限公司 System for recognizing characters from image
CN102289322A (en) * 2011-08-25 2011-12-21 盛乐信息技术(上海)有限公司 Method and system for processing handwriting
CN103544722A (en) * 2013-10-25 2014-01-29 深圳市掌网立体时代视讯技术有限公司 Method and device for handwriting decoration of digital painting and chirography
CN105205488A (en) * 2015-07-13 2015-12-30 西北工业大学 Harris angular point and stroke width based text region detection method

Also Published As

Publication number Publication date
CN106599818A (en) 2017-04-26
WO2018103226A1 (en) 2018-06-14

Similar Documents

Publication Publication Date Title
CN106599818B (en) Method and device for generating handwriting format file based on picture
CN108206917B (en) Image processing method and device, storage medium and electronic device
US8059896B2 (en) Character recognition processing system and computer readable medium storing program for character recognition processing
US8611658B2 (en) Image processing apparatus and image processing method
CN106875408B (en) Screenshot method and device and terminal equipment
JP6779688B2 (en) Image processing equipment, image processing method, computer program
JP5337563B2 (en) Form recognition method and apparatus
JP2021189527A5 (en)
CN110889374A (en) Seal image processing method and device, computer and storage medium
EP2735997A1 (en) Image processing apparatus
CN110807747B (en) Document image noise reduction method based on foreground mask
CN111768456A (en) Feature extraction method based on wood color space
JP4967045B2 (en) Background discriminating apparatus, method and program
CN111414877A (en) Table clipping method of removing color borders, image processing apparatus, and storage medium
CN112465753B (en) Pollen particle detection method and device and electronic equipment
US20100238470A1 (en) Document image processing system and document image processing method
CN113177556A (en) Text image enhancement model, training method, enhancement method and electronic equipment
CN112686253A (en) Screen character extraction system and method for electronic whiteboard
CN110349223A (en) A kind of method and device of image procossing
CN111491069B (en) Automatic setting method for color mode of document image
JP2020091817A (en) Drawing recognition device, drawing recognition method, and program
CN111209922B (en) Image color system style marking method, device, equipment and medium based on svm and opencv
CN113538607B (en) YUV image conversion method and system based on invariance of Y component of artificial image
CN109670500B (en) Text region acquisition method and device, storage medium and terminal equipment
US20220301237A1 (en) Information processing apparatus and non-transitory computer readable 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
GR01 Patent grant
GR01 Patent grant