CN113420647B - Method for creating new style font by expanding and deforming Chinese character center of gravity outwards - Google Patents

Method for creating new style font by expanding and deforming Chinese character center of gravity outwards Download PDF

Info

Publication number
CN113420647B
CN113420647B CN202110689792.8A CN202110689792A CN113420647B CN 113420647 B CN113420647 B CN 113420647B CN 202110689792 A CN202110689792 A CN 202110689792A CN 113420647 B CN113420647 B CN 113420647B
Authority
CN
China
Prior art keywords
character picture
picture
new
original
chinese
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
CN202110689792.8A
Other languages
Chinese (zh)
Other versions
CN113420647A (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.)
Nankai University
Original Assignee
Nankai University
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 Nankai University filed Critical Nankai University
Priority to CN202110689792.8A priority Critical patent/CN113420647B/en
Publication of CN113420647A publication Critical patent/CN113420647A/en
Application granted granted Critical
Publication of CN113420647B publication Critical patent/CN113420647B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/11Complex mathematical operations for solving equations, e.g. nonlinear equations, general mathematical optimization problems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/40Filling a planar surface by adding surface attributes, e.g. colour or texture

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Theoretical Computer Science (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Mathematics (AREA)
  • Operations Research (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

The invention discloses a method for creating a new style font by expanding and deforming a gravity center point of a Chinese character outwards, belonging to the field of computers. The method for creating the new style font by expanding and deforming the gravity center points of the Chinese characters outwards comprises the following steps: inputting Chinese characters with given style and font and converting the Chinese characters into Chinese character pictures, or directly inputting Chinese character pictures, which are called 'original character pictures' for short; acquiring the size, foreground color and center of gravity of an original character picture; acquiring the outline of the strokes of the Chinese characters of the 'original character picture'; creating a blank 'new character picture' with the same size as the 'original character picture'; setting an expansion deformation coefficient; aiming at each point P on the outline of the Chinese character stroke of the' original character pictureiCalculating the corresponding point R on the 'new character picture' according to the expansion deformation functioniAnd further with the previous point Ri‑1Connecting; and (4) filling the outline of the strokes of the Chinese characters of the new character picture to finish the generation of the new character picture. The invention is helpful for the efficient and automatic creation of more new style Chinese character fonts.

Description

Method for creating new style font by expanding and deforming Chinese character center of gravity outwards
Technical Field
The invention belongs to the field of computers, and mainly focuses on how to quickly and automatically create a new style Chinese character font based on a Chinese character with a given style font.
Background
With the development of cloud computing and artificial intelligence, computer automated learning and processing is becoming more and more trend. Among them, font recognition, creation of new fonts, evaluation of new fonts, and the like are also attracting increasing attention in academic and industrial fields.
The method for manually creating the new font has slow efficiency and long period, and is not suitable for the requirement of rapid development. The method for generating the font based on the artificial intelligence algorithm is not used for creating a new font but imitating the existing font.
Disclosure of Invention
The invention aims to improve the efficiency of creating more new-style Chinese character fonts automatically by a computer and provides a method for creating new-style fonts by expanding and deforming the gravity center points of Chinese characters outwards.
The method for creating the new style font by expanding and deforming the gravity center points of the Chinese characters outwards comprises the following steps: inputting Chinese characters with given style and font and converting the Chinese characters into Chinese character pictures, or directly inputting Chinese character pictures, which are called 'original character pictures' for short; acquiring the size, foreground color and center of gravity of an original character picture; acquiring the outline of the strokes of the Chinese characters of the 'original character picture'; creating a blank 'new character picture' with the same size as the 'original character picture'; setting an expansion deformation coefficient; aiming at each point Pi on the stroke contour line of the Chinese character of the 'original character picture', calculating a corresponding point Ri on the 'new character picture' according to the expansion deformation function, and further connecting the corresponding point Ri-1 with the previous point Ri-1; and filling the stroke contour lines of the Chinese characters of the new character picture to finish the generation of the new character picture.
Technical scheme of the invention
A method for manufacturing new style Chinese characters based on outward expansion of Chinese character gravity center points comprises the following specific steps:
step 1, inputting Chinese characters with given style or inputting Chinese character pictures, and if the input is the Chinese character pictures, executing step 3;
2, converting the input Chinese characters with given style and font into Chinese character pictures with given size;
step 3, converting the Chinese character picture in the step 1 or the step 2 into a gray picture, and calling the gray picture as an original character picture;
4, further acquiring the sizes of the 'original character picture', namely the width w, the height h and the foreground color gray value c;
5, calculating the coordinate (O) of the gravity center point O of the original character picturex,oy),oxIs calculated by the formula
Figure GDA0003586303530000021
oyIs calculated by the formula
Figure GDA0003586303530000022
Wherein V (i, j) is the foreground gray of the pixel point with the coordinate (i, j) on the' original character pictureThe gravity center point of the original character picture is further used as a reference point of the original character picture, and the reference point is an undeformed point;
6, obtaining the outline of the strokes of the Chinese characters of the original character picture;
7, establishing a new blank character picture, which is called as a new character picture for short, wherein the size of the new character picture is the same as that of the original character picture, and setting the coordinate of a reference point O of the new character picture to be the same as that of the original character picture;
the size of the new character picture can also be set to be N times of the size of the original character picture, wherein N is a positive integer greater than or equal to 1; the X coordinate value of the corresponding reference point of the new character picture is N times of the X coordinate value of the reference point of the original character picture, and the Y coordinate value of the corresponding reference point of the new character picture is N times of the Y coordinate value of the reference point of the original character picture;
8, setting the value of the expansion deformation coefficient k, wherein the k value is a number larger than 0;
9, sequentially traversing each pixel point Pi on the stroke contour line of the Chinese character of the 'original character picture', wherein the coordinate of the pixel point Pi is
Figure GDA0003586303530000023
The following substeps are performed:
9.1, calculating the value of the included angle alpha between the X axis and the OPi line segment formed by the pixel point Pi on the 'original character picture' and the reference point O on the 'original character picture', namely
Figure GDA0003586303530000024
9.2, calculating the distance | OP between the pixel point Pi on the ' original character picture ' and the reference point O on the ' original character pictureiI, the formula is
Figure GDA0003586303530000025
9.3, calculating the corresponding expansion deformation of the pixel point Pi on the 'original character picture' according to the expansion deformation function f (d)Distance | OP between pixel point Ri corresponding to the new character picture and reference point O on the new character pictureiThe formula of |, f (d) is
Figure GDA0003586303530000026
Thus can be composed of | ORi|=f(|OPi| OR) is calculatedi|;
9.4 according to the distance | OR expanded in step 9.3iAnd further calculating coordinates of pixel points Ri on the' new character picture
Figure GDA0003586303530000027
Namely, it is
Figure GDA0003586303530000028
9.5, if the coordinates of the pixel points Ri calculated in the step 9.4
Figure GDA0003586303530000031
If not, executing step 9.6, otherwise, executing step 9.7;
9.6 th, if
Figure GDA0003586303530000032
Then order
Figure GDA0003586303530000033
Has a value of w; if it is
Figure GDA0003586303530000034
Then order
Figure GDA0003586303530000035
The value of (b) is h;
9.7, taking the color gray value of the pixel point Pi in the original character picture as the color gray value of the pixel point Ri in the new character picture;
9.8, further traversing the pixel Ri in the step 9.7 and the pixel R obtained in the previous traversal in the new character picturei-1To proceed directlyConnecting a line, wherein the color gray value of the line is set to the gray value c in the 4 th step;
9.9, finishing the setting of the current pixel point Ri on the 'new character picture';
10, filling the interior of the stroke contour line of the Chinese character on the new character picture, wherein the filled color gray value is the gray value c in the step 4;
and 11, completing the generation of a new character picture, wherein the Chinese characters in the new character picture are the Chinese characters with the new style created by outward expansion and deformation of the gravity center points of the Chinese characters, and ending the program execution.
The expansion deformation coefficient in step 8 of the present invention may adopt four sub expansion deformation coefficients k1, k2, k3, and k4, which respectively correspond to different expansion deformation coefficients of four quadrants divided by an X coordinate axis and a Y coordinate axis with a reference point as an origin, k1 corresponds to an included angle of 0 degree or more and α < 90 degrees, k2 corresponds to an included angle of 90 degree or more and α < 180 degrees, k3 corresponds to an included angle of 180 degree or more and α < 270 degrees, k4 corresponds to an included angle of 270 degree or more and α < 360 degrees, and the values of k1, k2, k3, and k4 are all greater than 0; the corresponding expansion deformation function f (d) is formulated as
Figure GDA0003586303530000036
The formula of the "expansion deformation function f (d)" in step 9.3 can be adopted
Figure GDA0003586303530000037
And (6) replacing.
The invention has the advantages and positive effects that:
the invention can enable the computer to efficiently and automatically create more new style Chinese character fonts on the basis of the limited style Chinese character fonts, thereby providing richer cases for further screening the new style Chinese character fonts and carrying out Chinese character recognition and Chinese character font recognition algorithms based on machine learning.
In fact the present invention is not limited to chinese character font generation.
Drawings
FIG. 1 is a flow chart of the algorithm program operation in the present invention.
FIG. 2 is the "age" of a Chinese character.
FIG. 3 is an "original text picture" of the "age" of a Chinese character.
FIG. 4 is the center of gravity of the "original text picture" of the "age" of a Chinese character.
FIG. 5 is the outline of the strokes of a Chinese character "original text picture" of the age of the Chinese character.
Fig. 6 shows a reference point O of the "original character picture" of the "age" of the chinese character and a certain pixel point P on the outline of the stroke of the chinese character.
Fig. 7 shows a reference point O and a certain pixel point R of a "new character picture" of "age" of a chinese character.
FIG. 8 is the inside filling of the outline of the strokes of a Chinese character on the "new character picture" of the age of the Chinese character.
Fig. 9 is a comparison of "new character pictures" of "old" characters with different expansion deformation coefficients k, where (a) is an "original character picture" of "old" characters, (b) is a "new character picture" of "old" characters generated by the present invention when k is 5, (c) is a "new character picture" of "old" characters generated by the present invention when k is 6, (d) is a "new character picture" of "old" characters generated by the present invention when k is 7, and (e) is a "new character picture" of "old" characters generated by the present invention when k is 8.
Detailed Description
The invention provides a method for creating a new style font by expanding and deforming the center of gravity of a Chinese character outwards.
The invention provides a method for creating a new style font by expanding and deforming a Chinese character center of gravity outwards, which comprises the following specific steps of referring to fig. 1:
step 1, inputting Chinese characters with given style or inputting Chinese character pictures, and if the input is the Chinese character pictures, executing step 3;
2, converting the input Chinese characters with given style and font into Chinese character pictures with given size;
step 3, converting the Chinese character picture in the step 1 or the step 2 into a gray picture, and calling the gray picture as an original character picture;
4, further acquiring the sizes of the 'original character picture', namely the width w, the height h and the foreground color gray value c;
5, calculating the coordinate (O) of the gravity center point O of the original character picturex,oy),oxIs calculated by the formula
Figure GDA0003586303530000041
oyIs calculated by the formula
Figure GDA0003586303530000042
V (i, j) is a foreground color gray value of a pixel point with coordinates (i, j) on the 'original character picture', and further a center of gravity point of the 'original character picture' is used as a reference point of the 'original character picture', and the reference point is an undeformed point;
6, obtaining the outline of the strokes of the Chinese characters of the original character picture;
7, establishing a new blank character picture, which is called as a new character picture for short, wherein the size of the new character picture is the same as that of the original character picture, and setting the coordinate of a reference point O of the new character picture to be the same as that of the original character picture;
8, setting the value of the expansion deformation coefficient k, wherein the k value is a number larger than 0;
9, sequentially traversing each pixel point Pi on the stroke contour line of the Chinese character of the 'original character picture', wherein the coordinate of the pixel point Pi is
Figure GDA0003586303530000051
The following substeps are performed:
9.1, calculating the value of the included angle alpha between the X axis and the OPi line segment formed by the pixel point Pi on the 'original character picture' and the reference point O on the 'original character picture', namely
Figure GDA0003586303530000052
9.2, calculating the distance | OP between the pixel point Pi on the ' original character picture ' and the reference point O on the ' original character pictureiI, the formula is
Figure GDA0003586303530000053
9.3, calculating the distance | OR between the pixel point Ri corresponding to the pixel point Pi on the 'original character picture' after the expansion deformation and the reference point O on the 'new character picture' according to the expansion deformation function f (d)iThe formula of |, f (d) is
Figure GDA0003586303530000054
Thus can be composed of | ORi|=f(|OPi| OR) is calculatedi|;
9.4 according to the distance | OR expanded in step 9.3iAnd further calculating coordinates of pixel points Ri on the' new character picture
Figure GDA0003586303530000055
Namely, it is
Figure GDA0003586303530000056
9.5, if the coordinates of the pixel points Ri calculated in the step 9.4
Figure GDA0003586303530000057
If not, executing step 9.6, otherwise, executing step 9.7;
9.6, if
Figure GDA0003586303530000058
Then order
Figure GDA0003586303530000059
Has a value of w; if it is
Figure GDA00035863035300000510
Then order
Figure GDA00035863035300000511
The value of (b) is h;
9.7, taking the color gray value of the pixel point Pi in the original character picture as the color gray value of the pixel point Ri in the new character picture;
9.8, further directly connecting the pixel Ri in the step 9.7 with the pixel Ri-1 obtained in the previous traversal to form a line in the new character picture, wherein the color gray value of the line is set as the gray value c in the step 4;
9.9, finishing the setting of the current pixel point Ri on the 'new character picture';
10, filling the interior of the stroke contour line of the Chinese character on the new character picture, wherein the filled color gray value is the gray value c in the step 4;
and 11, completing the generation of a new character picture, wherein the Chinese characters in the new character picture are the Chinese characters with the new style created by expanding and deforming the gravity center points of the Chinese characters outwards, and ending the program execution.
For further understanding of the technical contents, characteristics and effects of the present invention, the following application examples are listed and will be described in detail with reference to the accompanying drawings:
application example 1
Taking the Chinese characters shown in fig. 2 and fig. 3 as examples, fig. 2 is an age character of a Chinese character with a given font style, and fig. 3 is a character picture of the age character of the Chinese character.
The method provided by the invention is applied to the application example 1, and the specific steps are as follows by referring to the flow shown in fig. 1:
step 1, inputting Chinese characters with given style or inputting Chinese character pictures, and if the input is the Chinese character pictures, executing step 3;
as shown in fig. 3, a picture of chinese characters is input.
2, converting the input Chinese characters with given style and font into Chinese character pictures with given size;
as shown in FIG. 2, the "age" of a Chinese character of a given font style is converted into a picture of the Chinese character.
For example, using the PIL library, a chinese character of a given font style can be generated into a chinese character picture, and the key codes are as follows:
from PIL import Image,ImageDraw,ImageFont
name="BoYangXingShu7000-1"
font=ImageFont.truetype(f'./{fontset_dir}/{name}.ttf',96)
text_width,text_height=font.getsize(name)
image=Image.new(mode='RGBA',size=(text_width,text_height))
draw_table=ImageDraw.Draw(im=image)
text (xy ═ 0,0), text ═ age ═ file ═ 000000', font ═ font)
image, save (f "{ fontimg _ dir }/age. PNG", 'PNG')
Step 3, converting the Chinese character picture in the step 1 or the step 2 into a gray picture, and calling the gray picture as an original character picture;
namely: the input Chinese character picture can be colorful, the invention focuses on the character font rather than the color, and therefore, the Chinese character picture is uniformly converted into the gray picture.
4, further acquiring the sizes of the 'original character picture', namely the width w, the height h and the foreground color gray value c;
namely: as shown in fig. 3, the dimensions of the "original text picture" in fig. 3 are that the width w is 96, the height h is 96, and the foreground color gradation value c is 0.
5, calculating the coordinate (O) of the gravity center point O of the original character picturex,oy),oxIs calculated by the formula
Figure GDA0003586303530000071
oyIs calculated by the formula
Figure GDA0003586303530000072
V (i, j) is a foreground color gray value of a pixel point with coordinates (i, j) on the 'original character picture', and further a center of gravity point of the 'original character picture' is used as a reference point of the 'original character picture', and the reference point is an undeformed point;
namely: as shown in fig. 4, the barycentric coordinates of the chinese character picture are: (47,46), the center of gravity point of the Chinese character picture is not the center point of the picture.
6, obtaining the outline of the strokes of the Chinese characters of the original character picture;
namely: as shown in FIG. 5, the outline of the Chinese character stroke can be obtained by using the outline extraction function findContours () of opencv, etc.
7, establishing a new blank character picture, namely a new character picture, wherein the size of the new character picture is the same as that of the original character picture, and setting the coordinate of a reference point O of the new character picture to be the same as that of the original character picture;
namely: as shown in fig. 6, the reference point of the "original text picture"; as shown in fig. 7, the "new text picture" is a blank picture at this time.
8, setting the value of the expansion deformation coefficient k, wherein the k value is a number larger than 0;
namely: as shown in fig. 6 and 7, the expansion deformation coefficient k is set to 6.
9, sequentially traversing each pixel point Pi on the stroke contour line of the Chinese character of the 'original character picture', wherein the coordinate of the pixel point Pi is
Figure GDA0003586303530000073
The following substeps are performed:
namely: and selecting each pixel point Pi on the stroke contour line of the Chinese character of the 'original character picture', wherein the coordinate of the pixel point Pi is (32, 62).
9.1, calculating the value of the included angle alpha between the X axis and the OPi line segment formed by the pixel point Pi on the 'original character picture' and the reference point O on the 'original character picture', namely
Figure GDA0003586303530000074
Namely: the angle between the pixel point Pi and the x-axis is 133.1 degrees.
9.2, calculating the distance | OP between the pixel point Pi on the ' original character picture ' and the reference point O on the ' original character pictureiI, the formula is
Figure GDA0003586303530000081
Namely: distance | OPiThe value of | is 21.93171219946131.
9.3, calculating the distance | OR between the pixel point Ri corresponding to the pixel point Pi on the 'original character picture' after the expansion deformation and the reference point O on the 'new character picture' according to the expansion deformation function f (d)iThe formula of |, f (d) is
Figure GDA0003586303530000082
Thus can be composed of | ORi|=f(|OPi| OR) is calculatedi|;
Namely: distance | ORiThe value of | is 28.098783588984897.
9.4 according to the distance | OR expanded in step 9.3iAnd further calculating coordinates of pixel points Ri on the' new character picture
Figure GDA0003586303530000083
Namely, it is
Figure GDA0003586303530000084
Namely: as shown in fig. 7, the coordinates of the Ri point are obtained as: (27,66).
9.5, if the coordinates of the pixel points Ri calculated in the step 9.4
Figure GDA0003586303530000085
If not, executing step 9.6, otherwise, executing step 9.7;
9.6 th, if
Figure GDA0003586303530000086
Then order
Figure GDA0003586303530000087
Has a value of w; if it is
Figure GDA0003586303530000088
Then order
Figure GDA0003586303530000089
The value of (d) is h;
9.7, taking the color gray value of the pixel point Pi in the original character picture as the color gray value of the pixel point Ri in the new character picture;
9.8, further traversing the pixel Ri in the step 9.7 and the pixel R obtained in the previous traversal in the new character picturei-1Making a direct connection into a line, wherein the color gray value of the line is set to the gray value c in the 4 th step;
9.9, finishing the setting of the current pixel point Ri on the 'new character picture';
10, filling the interior of the stroke contour line of the Chinese character on the new character picture, wherein the filled color gray value is the gray value c in the step 4;
that is, as shown in fig. 8, the stroke contour lines of the Chinese characters on the new character picture are internally filled to generate a figure 8, and fig. 8 is the age of the Chinese characters with the created new style font.
And 11, completing the generation of a new character picture, wherein the Chinese characters in the new character picture are the Chinese characters with the new style created by outward expansion and deformation of the gravity center points of the Chinese characters, and ending the program execution.
Application example 2
According to the establishing method provided by the invention, the size of the new character picture in the step 7 is set to be N times of the size of the original character picture, wherein N is a positive integer greater than or equal to 1; the X-coordinate value of the reference point of the corresponding "new character picture" is N times the X-coordinate value of the reference point of the "original character picture", and the Y-coordinate value of the reference point of the corresponding "new character picture" is N times the Y-coordinate value of the reference point of the "original character picture". The rest of the procedure was the same as in application example 1.
For example: the size of the 'new character picture' is set to be 2 times of the size of the 'original character picture', namely the size of the 'new character picture' is 192 × 192, the coordinates of the center of gravity point of the 'original character picture' Chinese character picture are (47,46), namely the coordinates of the reference point of the 'original character picture' Chinese character picture are (47,46), and then the coordinates of the reference point of the 'original character picture' Chinese character picture are (94, 92).
Application example 3
According to the establishing method provided by the invention, the expansion deformation coefficient in the step 8 adopts four sub expansion deformation coefficients k1, k2, k3 and k4 which respectively correspond to different expansion deformation coefficients of four quadrants divided by an X coordinate axis and a Y coordinate axis by taking a reference point as an origin, k1 corresponds to an included angle of 0-90 degrees, k2 corresponds to an included angle of 90-180 degrees, k3 corresponds to an included angle of 180-270 degrees, k4 corresponds to an included angle of 270-360 degrees, and the values of k1, k2, k3 and k4 are all larger than 0; the corresponding expansion deformation function f (d) is formulated as
Figure GDA0003586303530000091
The rest of the procedure was the same as in application example 1.
For example: if the first quadrant, which is the upper right corner in fig. 6, is expanded and the other quadrants are not expanded, the four sub-expansion deformation coefficients k1, k2, k3, and k4 may be set to k 1-5, k 2-1, k 3-1, and k 4-1, respectively.
Application example 4
According to the establishing method provided by the invention, the formula of the expanding deformation function f (d) in the step 9.3 is adopted
Figure GDA0003586303530000092
And (6) replacing.
The rest of the procedure was the same as in application example 1.
Namely: distance | OP between pixel point Pi on ' original text picture ' and reference point O on ' original text pictureiThe non-linear expansion transformation of | generates fonts of different styles.
Application example 5
As shown in fig. 9, the font style of the "new character picture" of the "old" character with different expansion deformation coefficients k is different, where (a) is the "original character picture" of the "old" character, (b) is the font style of the "old" character "new character picture" generated by the present invention when k is 5, (c) is the font style of the "old" character "new character picture" generated by the present invention when k is 6, (d) is the font style of the "old" character "new character picture" generated by the present invention when k is 7, and (e) is the font style of the "old" character "new character picture" generated by the present invention when k is 8.
Other embodiments of the present invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. It should be understood that the description and examples are intended for purposes of illustration only and are intended to cover any variations, equivalents, improvements, etc. that fall within the spirit and scope of the invention.

Claims (4)

1. A method for creating a new style font by outwardly expanding and deforming the gravity center points of Chinese characters is characterized by comprising the following specific steps:
step 1, inputting Chinese characters with given style or inputting Chinese character pictures, and if the input is the Chinese character pictures, executing step 3;
2, converting the input Chinese characters with given style and font into Chinese character pictures with given size;
step 3, converting the Chinese character picture in the step 1 or the step 2 into a gray picture, and calling the gray picture as an original character picture;
4, further acquiring the sizes of the 'original character picture', namely the width w, the height h and the foreground color gray value c;
5, calculating the coordinate (O) of the gravity center point O of the original character picturex,oy),oxIs calculated by the formula
Figure FDA0003125750600000011
oyIs calculated by the formula
Figure FDA0003125750600000012
Wherein V (i, j) is the gray value of the foreground color of the pixel point with the coordinate (i, j) on the ' original character picture ', and further the center of gravity of the ' original character picture ' is used as the reference of the ' original character picturePoints, wherein the datum points are non-deformation points;
6, obtaining the outline of the strokes of the Chinese characters of the original character picture;
7, establishing a new blank character picture, which is called as a new character picture for short, wherein the size of the new character picture is the same as that of the original character picture, and setting the coordinate of a reference point O of the new character picture to be the same as that of the original character picture;
8, setting the value of the expansion deformation coefficient k, wherein the k value is a number larger than 0;
9, sequentially traversing each pixel point Pi on the stroke contour line of the Chinese character of the 'original character picture', wherein the coordinate of the pixel point Pi is
Figure FDA0003125750600000013
The following substeps are performed:
9.1, calculating the value of the included angle alpha between the X axis and the OPi line segment formed by the pixel point Pi on the 'original character picture' and the reference point O on the 'original character picture', namely
Figure FDA0003125750600000014
9.2, calculating the distance | OP between the pixel point Pi on the ' original character picture ' and the reference point O on the ' original character pictureiI, the formula is
Figure FDA0003125750600000015
9.3, calculating the distance | OR between the pixel point Ri corresponding to the pixel point Pi on the 'original character picture' after the expansion deformation and the reference point O on the 'new character picture' according to the expansion deformation function f (d)iThe formula of |, f (d) is
Figure FDA0003125750600000016
Thus can be composed of | ORi|=f(|OPi| OR) is calculatedi|;
9.4 according to the distance | OR expanded in step 9.3i|,Further calculating the coordinates of pixel points Ri on the' new character picture
Figure FDA0003125750600000021
Namely, it is
Figure FDA0003125750600000022
9.5, if the coordinates of the pixel points Ri calculated in the step 9.4
Figure FDA0003125750600000023
If not, executing step 9.6, otherwise, executing step 9.7;
9.6, if
Figure FDA0003125750600000024
Then order
Figure FDA0003125750600000025
Has a value of w; if it is
Figure FDA0003125750600000026
Then make it give
Figure FDA0003125750600000027
The value of (d) is h;
9.7, taking the color gray value of the pixel point Pi in the original character picture as the color gray value of the pixel point Ri in the new character picture;
9.8, further traversing the pixel Ri in the step 9.7 and the pixel R obtained in the previous traversal in the new character picturei-1Making a direct connection into a line, wherein the color gray value of the line is set to the gray value c in the 4 th step;
9.9, finishing the setting of the current pixel point Ri on the 'new character picture';
10, filling the interior of the stroke contour line of the Chinese character on the new character picture, wherein the filled color gray value is the gray value c in the step 4;
and 11, completing the generation of a new character picture, wherein the Chinese characters in the new character picture are the Chinese characters with the new style created by expanding and deforming the gravity center points of the Chinese characters outwards, and ending the program execution.
2. The method according to claim 1, wherein the setting of the size of the "new text picture" in step 7 is performed by setting the size of the "new text picture" to be N times of the size of the "original text picture", where N is a positive integer greater than or equal to 1; the X-coordinate value of the reference point of the corresponding "new character picture" is N times the X-coordinate value of the reference point of the "original character picture", and the Y-coordinate value of the reference point of the corresponding "new character picture" is N times the Y-coordinate value of the reference point of the "original character picture".
3. The method as claimed in claim 1, wherein the expansion deformation coefficients in step 8 are four sub expansion deformation coefficients k1, k2, k3, k4 corresponding to different expansion deformation coefficients of four quadrants divided by the X coordinate axis and the Y coordinate axis with the reference point as an origin, k1 corresponding to an included angle of 0 ° α ≦ 90 °, k2 corresponding to an included angle of 90 ° α ≦ 180 °, k3 corresponding to an included angle of 180 ° α ≦ 270 °, k4 corresponding to an included angle of 270 ° α ≦ 360 °, k1, k2, k3, k4 all having values greater than 0; the corresponding expansion deformation function f (d) is formulated as
Figure FDA0003125750600000028
4. The method according to claim 1, wherein the formula of the "dilation deformation function f (d)" in step 9.3 is the one obtained by
Figure FDA0003125750600000031
And (6) replacing.
CN202110689792.8A 2021-06-22 2021-06-22 Method for creating new style font by expanding and deforming Chinese character center of gravity outwards Active CN113420647B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110689792.8A CN113420647B (en) 2021-06-22 2021-06-22 Method for creating new style font by expanding and deforming Chinese character center of gravity outwards

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110689792.8A CN113420647B (en) 2021-06-22 2021-06-22 Method for creating new style font by expanding and deforming Chinese character center of gravity outwards

Publications (2)

Publication Number Publication Date
CN113420647A CN113420647A (en) 2021-09-21
CN113420647B true CN113420647B (en) 2022-05-20

Family

ID=77789858

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110689792.8A Active CN113420647B (en) 2021-06-22 2021-06-22 Method for creating new style font by expanding and deforming Chinese character center of gravity outwards

Country Status (1)

Country Link
CN (1) CN113420647B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012138782A (en) * 2010-12-27 2012-07-19 Ricoh Co Ltd Image processing device
CN105468574A (en) * 2015-11-19 2016-04-06 厦门大学 Decorative font synthesizing method
CN109064522A (en) * 2018-08-03 2018-12-21 厦门大学 The Chinese character style generation method of confrontation network is generated based on condition
CN110188750A (en) * 2019-05-16 2019-08-30 杭州电子科技大学 A kind of natural scene picture character recognition method based on deep learning
CN111553837A (en) * 2020-04-28 2020-08-18 武汉理工大学 Artistic text image generation method based on neural style migration
CN112070658A (en) * 2020-08-25 2020-12-11 西安理工大学 Chinese character font style migration method based on deep learning

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012138782A (en) * 2010-12-27 2012-07-19 Ricoh Co Ltd Image processing device
CN105468574A (en) * 2015-11-19 2016-04-06 厦门大学 Decorative font synthesizing method
CN109064522A (en) * 2018-08-03 2018-12-21 厦门大学 The Chinese character style generation method of confrontation network is generated based on condition
CN110188750A (en) * 2019-05-16 2019-08-30 杭州电子科技大学 A kind of natural scene picture character recognition method based on deep learning
CN111553837A (en) * 2020-04-28 2020-08-18 武汉理工大学 Artistic text image generation method based on neural style migration
CN112070658A (en) * 2020-08-25 2020-12-11 西安理工大学 Chinese character font style migration method based on deep learning

Also Published As

Publication number Publication date
CN113420647A (en) 2021-09-21

Similar Documents

Publication Publication Date Title
US7952577B2 (en) Automatic 3D modeling system and method
WO2021139557A1 (en) Portrait stick figure generation method and system, and drawing robot
Chen et al. Gaussianeditor: Swift and controllable 3d editing with gaussian splatting
CN114529925B (en) Method for identifying table structure of whole line table
CN110910433A (en) Point cloud matching method based on deep learning
WO2012155510A1 (en) Method and apparatus for processing character deformation special effect
CN110363804B (en) Flower bas-relief generating method based on deformation model
CN113420647B (en) Method for creating new style font by expanding and deforming Chinese character center of gravity outwards
CN110211032B (en) Chinese character generating method and device and readable storage medium
CN108898679B (en) Automatic labeling method for serial numbers of parts
CN114782645A (en) Virtual digital person making method, related equipment and readable storage medium
CN108197627B (en) Method for extracting binary figure outline along clockwise direction
CN111507946A (en) Element data driven flower type pattern rapid generation method based on similarity sample
CN114723601A (en) Model structured modeling and rapid rendering method under virtual scene
CN114359914A (en) Hand-drawn graph correction method, system and medium based on sampling point sequence
CN113392772A (en) Character recognition-oriented character image shrinkage deformation enhancement method
CN113392780B (en) Character image distortion deformation method for AI recognition of Chinese characters
CN112861709A (en) Hand-drawn sketch recognition method based on simple strokes
CN112508007A (en) Space target 6D posture estimation technology based on image segmentation Mask and neural rendering
Chen et al. A New Design Method of Mechanical and Electrical Products Appearance Modeling Based on Entity Patterns Gene
CN114120011B (en) Method for improving image matching precision and speed by using group intelligent algorithm
CN117238018B (en) Multi-granularity-based incremental deep and wide network living body detection method, medium and equipment
CN112631322B (en) Method and system for generating performance animation of clustered unmanned aerial vehicle, unmanned aerial vehicle and terminal
US20230071291A1 (en) System and method for a precise semantic segmentation
Sumi et al. A production method of reusing existing 2D animation sequences

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