[go: up one dir, main page]

CN101393643B - Computer stroke deforming system and method - Google Patents

Computer stroke deforming system and method Download PDF

Info

Publication number
CN101393643B
CN101393643B CN2007100462301A CN200710046230A CN101393643B CN 101393643 B CN101393643 B CN 101393643B CN 2007100462301 A CN2007100462301 A CN 2007100462301A CN 200710046230 A CN200710046230 A CN 200710046230A CN 101393643 B CN101393643 B CN 101393643B
Authority
CN
China
Prior art keywords
sample
vectors
vector
stroke
sample vectors
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.)
Expired - Fee Related
Application number
CN2007100462301A
Other languages
Chinese (zh)
Other versions
CN101393643A (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.)
East China Normal University
Original Assignee
East China Normal 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 East China Normal University filed Critical East China Normal University
Priority to CN2007100462301A priority Critical patent/CN101393643B/en
Publication of CN101393643A publication Critical patent/CN101393643A/en
Application granted granted Critical
Publication of CN101393643B publication Critical patent/CN101393643B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Character Discrimination (AREA)

Abstract

本发明提供了一种计算机笔划变形方法和设备。该方法提供包括多个笔划样本向量的样本空间;对多个样本向量排序,使经排序的样本向量与其平均向量的差的平方和最小;对于经排序的样本向量,求出协方差矩阵的所有特征向量,并从中选出最能反映样本特征的特征向量;用选出的特征向量构成特征矩阵,并建立统计模型:<math><![CDATA[<mrow> <mi>X</mi> <mo>&ap;</mo> <mover> <mi>X</mi> <mo>&OverBar;</mo> </mover> <mo>+</mo> <mi>&Phi;b</mi> </mrow>]]></math>

Figure B2007100462301A00011
,其中
Figure B2007100462301A00012
是经排序的样本向量的平均向量,Φ是特征矩阵,b是参数向量,X是变形后获得的笔划向量。本发明通过改变参数向量的分量,可以获得经变形的笔划向量。由于本发明在建模过程中以笔划的一些主要特征作为变形的依据,所以可以改进字体变形的整体效果和效率。同时,通过对参数向量适当取值,可以体现出个人的审美观点。

Figure 200710046230

The invention provides a computer stroke deformation method and equipment. This method provides a sample space including multiple stroke sample vectors; sorts multiple sample vectors to minimize the sum of squares of the differences between the sorted sample vectors and their mean vectors; for the sorted sample vectors, finds all of the covariance matrix eigenvectors, and select the eigenvectors that best reflect the characteristics of the sample; use the selected eigenvectors to form a feature matrix, and establish a statistical model: <math><![CDATA[<mrow><mi>X</mi><mo>&ap;</mo><mover><mi>X</mi><mo>&OverBar;</mo></mover><mo>+</mo><mi>&Phi;b</mi></mrow>]]></math>

Figure B2007100462301A00011
,in
Figure B2007100462301A00012
is the average vector of the sorted sample vectors, Φ is the feature matrix, b is the parameter vector, and X is the stroke vector obtained after deformation. The present invention can obtain the deformed stroke vector by changing the components of the parameter vector. Since the present invention uses some main features of strokes as the basis for deformation during the modeling process, the overall effect and efficiency of font deformation can be improved. At the same time, by properly selecting the value of the parameter vector, it can reflect the personal aesthetic point of view.

Figure 200710046230

Description

计算机笔划变形系统和方法Computer stroke deformation system and method

技术领域technical field

本发明涉及一种通过计算机模拟来实现书法创作的图像变换系统和方法,尤其涉及一种计算机笔划变形系统和方法。The invention relates to an image transformation system and method for realizing calligraphy creation through computer simulation, in particular to a computer stroke deformation system and method.

背景技术Background technique

回顾人工智能诞生至今的半个世纪历程,人们在理解认知、模拟思维实践中,取得了一次又一次令人鼓舞的成绩,如证明四色定理、战胜国际象棋冠军,说明计算机系统在某些方面可以超过专门训练的人。然而,对一些最通常的、经过长期进化形成的认知功能,比如艺术创作、视觉识别、以至下围棋时的辨图与直觉,当今的思维模拟还不具备婴儿的能力。其根本原因,如同钱学森先生指出的,在于形象思维这一“瓶颈”。右脑的形象思维对于这类困难的任务,对于把直觉的洞察转换成逻辑的、言语的序列来说,始终具有极其重要的地位。Looking back on the half a century since the birth of artificial intelligence, people have made encouraging achievements time and time again in the practice of understanding cognition and simulating thinking, such as proving the four-color theorem and defeating the chess champion, which shows that computer systems can be used in some Aspects can surpass those of specially trained people. However, for some of the most common cognitive functions that have evolved over a long period of time, such as artistic creation, visual recognition, and even picture recognition and intuition when playing Go, today's thinking simulations do not yet have the ability of infants. The fundamental reason, as Mr. Qian Xuesen pointed out, lies in the "bottleneck" of imagery thinking. Right-brain imagery has always been of paramount importance for such difficult tasks, for translating intuitive insights into logical, verbal sequences.

形象思维的计算机模拟可以有两个切入点:一是从认知神经科学的基本结论着手,这是基础的和根本的,只是目前的依据还十分有限;另一是直接从形象思维过程着手。书法创作是一种典型的形象思维过程。Computer simulation of imagery thinking can have two entry points: one is to start from the basic conclusions of cognitive neuroscience, which is fundamental and fundamental, but the current basis is still very limited; the other is to start directly from the process of imagery thinking. Calligraphy creation is a typical image thinking process.

印第安那大学的Letter Spirit项目对英文字母字体的感知与创作进行建模并模拟,企图对人类高级感知与创作的中心内容进行建模,设计一个字母的不同风格和不同字母的同一风格。Hofstadter Douglas等人在CRCC Technical Report,No.68,Bloomington:Indiana University上发表的“An Emergent Model of the Perception andCreation of Alphabetic Style”对此有所描述。该文章通过引用包括在此。该建模方法是以一个或几个字母作为“种子”,构成某种风格的起始,然后通过四个代理(Agent)的交互,形成不同的、但风格一致、设计完整的字符集。所述四个代理分别为想象(Imaginer)、草稿(Drafter)、检查(Examiner)和调整(Adjudicator),它们是一个迭代过程。由于“创作”被限制在栅格字体(gridfont)中,其结果仅仅是不同的选择组合,所以适用于“美术字”的创作,其中基本的点线无需变化。事实上,上述方法是一种“有导师”的创作,而且未见最后结果。The Letter Spirit project of Indiana University models and simulates the perception and creation of English alphabet fonts, attempts to model the central content of human advanced perception and creation, and designs different styles of a letter and the same style of different letters. This is described in "An Emergent Model of the Perception and Creation of Alphabetic Style" published by Hofstadter Douglas et al. in CRCC Technical Report, No.68, Bloomington: Indiana University. This article is hereby incorporated by reference. This modeling method uses one or several letters as a "seed" to form the beginning of a certain style, and then through the interaction of four agents (Agent), a different character set with a consistent style and complete design is formed. The four agents are imagine (Imaginer), draft (Drafter), check (Examiner) and adjust (Adjudicator), which are an iterative process. Since "creation" is limited to grid fonts (gridfont), the result is only a combination of different choices, so it is suitable for the creation of "art fonts", wherein the basic dotted line does not need to be changed. In fact, the above method is a kind of creation "with a mentor", and the final result has not been seen.

Grebert I.等在Neural Networks于1992年5月出版的《ConnectionistGeneralization for Production》上发表了“An Example form Gridfont”一文,提出用三层神经网络学习五个由人设计的栅格字体,然后再学习另外一个人设计的栅格字体中的十四个字母。接着,要求网络构造出剩余的十二个字母。尽管该方法有时会输出无法辨认的字母,但具有一定的意义。但是,这种方法没有概念基础,没有内部的概念结构和边界,没有时间关系以及交互和反馈。另外,字母产生是并行的,字母的生成对其余的没有影响。所述文章的内容通过引用包括在此。Grebert I. et al. published the article "An Example form Gridfont" in "Connectionist Generalization for Production" published by Neural Networks in May 1992, proposing to use a three-layer neural network to learn five grid fonts designed by humans, and then learn Fourteen letters in a raster font designed by someone else. Next, the network was asked to construct the remaining twelve letters. Although the method sometimes outputs unintelligible letters, it makes sense. However, this approach has no conceptual basis, no internal conceptual structure and boundaries, no temporal relationships and no interaction and feedback. Also, letter generation is parallel, and letter generation has no effect on the rest. The content of said article is hereby incorporated by reference.

书法创作是人脑通过手指挥笔运动的过程,笔是创作和表现工具,形象思维活动的结果需要毛笔来体现。因而,有人提出用参数化模型来模拟书法笔划生成的物理过程。例如Wang Helena T.F.等在《Computers & Graphics》2000年第24期第99~113页上发表了“A Model-based Synthesis of Chinese Calligraphy”,该文章利用虚拟笔捕捉笔的三维几何参数、笔毛特性和墨沿笔划轨迹的变化;徐颂华等在《中国科学(E)》2004年第34(12)期第1359~1374页上发表的“面向电子书画创作的虚拟毛笔模型”一文也提出了一种面向书画创作的、基于实体造型技术的、虚拟毛笔的模型,以及利用它进行交互式电子书画创作的模拟框架。尽管上述两种方法不属于形象思维,但书法创作的计算机模拟最终是需要这类技术支持的。上述两篇文章的内容通过引用包括在此。Calligraphy creation is a process in which the human brain moves the pen through the hand. The pen is a tool for creation and expression. The result of image thinking activities needs a brush to reflect. Therefore, it was proposed to use parametric models to simulate the physical process of calligraphy stroke generation. For example, Wang Helena T.F. published "A Model-based Synthesis of Chinese Calligraphy" on pages 99-113 of "Computers & Graphics" No. 24, 2000. This article uses a virtual pen to capture the three-dimensional geometric parameters and brush characteristics of the pen. and the change of ink along the stroke track; Xu Songhua et al. also proposed a "virtual brush model for electronic calligraphy and painting creation" published on pages 1359-1374 of "Chinese Science (E)" in 2004 No. 34 (12) period 1359-1374. A virtual brush model based on physical modeling technology and a simulation framework for interactive electronic calligraphy and painting creation oriented to calligraphy and painting creation. Although the above two methods do not belong to image thinking, the computer simulation of calligraphy creation ultimately needs this kind of technical support. The contents of the above two articles are incorporated herein by reference.

徐颂华等在《IEEE Intelligent Systems》2005年5月/6月第20(3)期第32~39页上发表的“Automatic Generation of Artistic Chinese Calligraphy”一文介绍了一种基于综合推理的书法创作方法。虽然该方法使用了各个形象源(书法字)的信息,但由于随机选择权值,所以导致审美约束难以体现,字体变形效率也较低,线条及微妙之处无法涉及。因此,从形象思维或审美角度来看,这种方法还需要进一步的完善。上述文章的内容通过引用包括在此。Xu Songhua et al. published the article "Automatic Generation of Artistic Chinese Calligraphy" on pages 32-39 of the 20th (3) issue of "IEEE Intelligent Systems" in May/June 2005, introducing a calligraphy creation method based on comprehensive reasoning. Although this method uses the information of various image sources (calligraphy characters), due to the random selection of weights, it is difficult to reflect the aesthetic constraints, the efficiency of font deformation is also low, and the lines and subtleties cannot be involved. Therefore, from the perspective of image thinking or aesthetics, this method needs further improvement. The content of the aforementioned article is incorporated herein by reference.

真正的书法创作,与个人的审美观密切相关,是一种目前难以言状的心理过程。对于一件作品,细微的改变有时会造成很大的或美或丑的差异。因此,需要一种既能体现个人审美观点,又能提供字体变形效率的方法和系统。True calligraphy creation is closely related to personal aesthetics, and is an indescribable psychological process. For a piece of work, small changes can sometimes make a big difference in beauty or ugliness. Therefore, there is a need for a method and system that can not only reflect personal aesthetic views, but also provide font deformation efficiency.

发明内容Contents of the invention

本发明的目的是,提供一种既能体现个人审美观点,又能提供字体变形效率的方法和系统。The purpose of the present invention is to provide a method and system that can not only reflect personal aesthetic point of view, but also improve font deformation efficiency.

依照本发明的一个方面,提供了一种计算机笔划变形方法。所述方法包括下述步骤:According to one aspect of the present invention, a computer stroke deformation method is provided. The method comprises the steps of:

提供多个笔划的轮廓样本,以构成样本空间,其中所述多个轮廓样本分别由相应的样本向量来表示;providing a plurality of stroke contour samples to form a sample space, wherein the plurality of contour samples are respectively represented by corresponding sample vectors;

对所述多个样本向量排序,使所述多个经排序的样本向量与其平均向量的差的平方和最小;sorting the plurality of sample vectors such that the sum of squares of differences between the plurality of sorted sample vectors and their mean vector is minimized;

对于所述经排序的样本向量,求出其协方差矩阵的所有特征向量;For the sorted sample vectors, find all eigenvectors of its covariance matrix;

从所述求得的特征向量中,选出多个最能反映样本特征的特征向量;From the obtained eigenvectors, select a plurality of eigenvectors that can best reflect the characteristics of the samples;

用所述多个被选出的特征向量,构成一特征矩阵,并按下式建立统计模型:Form a feature matrix with the multiple selected feature vectors, and set up a statistical model as follows:

Xx &ap;&ap; Xx &OverBar;&OverBar; ++ &Phi;b&Phi;b

其中,

Figure S2007100462301D00032
是所述经排序的样本向量的平均向量,Φ是所述特征矩阵,b是参数向量,X是变形后获得的笔划向量;以及in,
Figure S2007100462301D00032
is the average vector of the sorted sample vectors, Φ is the feature matrix, b is a parameter vector, and X is a stroke vector obtained after deformation; and

改变所述参数向量的分量,以获得经变形的笔划向量。The components of the parameter vector are varied to obtain a deformed stroke vector.

在本发明的方法中,对所述多个样本向量排序的所述步骤可以包括下述步骤:In the method of the present invention, the step of sorting the plurality of sample vectors may include the following steps:

(a)将所述多个样本向量中每个样本向量的重心平移到原点,获得多个经平移的样本向量;(a) translating the center of gravity of each sample vector in the plurality of sample vectors to the origin to obtain a plurality of translated sample vectors;

(b)以所述多个经平移的样本向量中的一个向量为基准,对所述多个经平移的样本向量进行归一化,以获得多个经归一化的样本向量;(b) normalizing the plurality of translated sample vectors with reference to one of the plurality of translated sample vectors to obtain a plurality of normalized sample vectors;

(c)相对于所述基准,对所述多个经归一化的样本向量进行对齐操作,以获得多个经对齐的样本向量;(c) performing an alignment operation on the plurality of normalized sample vectors with respect to the reference to obtain a plurality of aligned sample vectors;

(d)对所述多个经对齐的样本向量,求出平均向量,并且相对于所述基准,对所述平均向量进行对齐操作,以获得经对齐的平均向量;(d) calculating an average vector for the plurality of aligned sample vectors, and performing an alignment operation on the average vector with respect to the reference to obtain an aligned average vector;

(e)判断所述经对齐的平均向量与所述基准的偏差是否大于一设定值;(e) judging whether the deviation between the aligned mean vector and the reference is greater than a set value;

(f)如果判断结果是大于所述设定值,则将经对齐的平均向量用作新的基准,对所述多个经对齐的样本向量进行归一化,并且重复步骤(c)-(d);(f) if the judgment result is greater than the set value, then use the aligned average vector as a new benchmark, normalize the plurality of aligned sample vectors, and repeat steps (c)-( d);

(g)如果判断结果不大于所述设定值,则获得所述多个经排序的样本向量。(g) If the judgment result is not greater than the set value, then obtain the plurality of sorted sample vectors.

在本发明的方法中,所述经对齐的平均向量与所述基准的偏差可以是所述经对齐的平均向量与所述基准之间的距离。In the method of the present invention, the deviation of the aligned mean vector from the reference may be the distance between the aligned mean vector and the reference.

在本发明的方法中,从所述求得的特征向量中选出多个最能反映样本特征的特征向量的所述步骤可以包括下述步骤:In the method of the present invention, the step of selecting a plurality of eigenvectors that can best reflect the characteristics of the samples from the obtained eigenvectors may include the following steps:

求出与所述所有特征向量相对应的特征值;find the eigenvalues corresponding to all the eigenvectors;

由大到小对所述特征值排序;sorting the eigenvalues from large to small;

由大到小选出多个特征值,使得Multiple eigenvalues are selected from large to small, so that

&Sigma;&Sigma; ii == 11 tt &lambda;&lambda; ii &GreaterEqual;&Greater Equal; ff vv VV TT

其中,λi表示特征值,t表示被选出的所述特征值的个数,VT表示所有特征值λi的总和,而fv是一个设定值,用于反映将要建立的统计模型所涵盖的样本变化的比例值,Among them, λi represents the eigenvalue, t represents the number of selected eigenvalues, V T represents the sum of all eigenvalues λi , and f v is a set value, which is used to reflect the statistical model to be established The proportion value of the sample variation covered,

其中,所述选出的多个特征值分别与所述选出的特征向量相对应。Wherein, the selected eigenvalues correspond to the selected eigenvectors respectively.

在本发明的方法中,所述被选出的特征向量的个数可以为3,并且所述参数向量可以具有三个分量,其中第一分量基本上表征经变形获得的笔划的“肥”或“瘦”,第二分量基本上表征经变形获得的笔划的“长”或“短”,第三分量基本上表征经变形获得的笔划的“方”或“圆”。In the method of the present invention, the number of the selected feature vectors can be 3, and the parameter vector can have three components, wherein the first component basically characterizes the "fat" or "fat" of the stroke obtained through deformation. "Thin", the second component basically characterizes the "long" or "short" of the deformed stroke, and the third component basically characterizes the "square" or "circle" of the deformed stroke.

本发明的方法还可以包括下述步骤:Method of the present invention can also comprise the following steps:

对多个笔划的轮廓进行特征点采样,以形成所述多个笔划的轮廓样本;Sampling feature points on contours of multiple strokes to form contour samples of the multiple strokes;

根据所述经变形的笔划向量,显示经变形的笔划。Based on the deformed stroke vector, the deformed stroke is displayed.

在本发明的方法中,所述特征点可以包括所述轮廓上的转折点,以及位于所述转折点之间的Bezier曲线控制点。In the method of the present invention, the feature points may include turning points on the contour, and Bezier curve control points located between the turning points.

依照本发明的另一方面,提供了一种计算机笔划变形设备。所述设备包括:According to another aspect of the present invention, a computerized stroke deformation device is provided. The equipment includes:

用于提供多个笔划的轮廓样本以构成样本空间的装置,其中所述多个轮廓样本分别由相应的样本向量来表示;means for providing a plurality of stroke contour samples to form a sample space, wherein the plurality of contour samples are respectively represented by corresponding sample vectors;

用于对所述多个样本向量排序,使所述多个经排序的样本向量与其平均向量的差的平方和最小的装置;means for sorting the plurality of sample vectors to minimize the sum of squares of the differences between the plurality of sorted sample vectors and their mean vector;

用于对于所述经排序的样本向量,求出其协方差矩阵的所有特征向量的装置;For said sorted sample vector, find all eigenvectors of its covariance matrix;

用于从所述求得的特征向量中,选出多个最能反映样本特征的特征向量的装置;A device for selecting a plurality of eigenvectors that best reflect the characteristics of the sample from the obtained eigenvectors;

用于将所述多个被选出的特征向量构成一特征矩阵并按下式建立统计模型的装置:A device for forming a feature matrix from the plurality of selected feature vectors and establishing a statistical model as follows:

Xx &ap;&ap; Xx &OverBar;&OverBar; ++ &Phi;b&Phi;b

其中,

Figure S2007100462301D00043
是所述经排序的样本向量的平均向量,Φ是所述特征矩阵,b是参数向量,X是变形后获得的笔划向量;以及in,
Figure S2007100462301D00043
is the average vector of the sorted sample vectors, Φ is the feature matrix, b is a parameter vector, and X is a stroke vector obtained after deformation; and

用于改变所述参数向量的分量以获得经变形的笔划向量的装置。means for altering components of said parameter vectors to obtain deformed stroke vectors.

在本发明的装置中,用于对所述多个样本向量排序的所述装置可以包括:In the apparatus of the present invention, the means for sorting the plurality of sample vectors may include:

用于将所述多个样本向量中每个样本向量的重心平移到原点,获得多个经平移的样本向量的装置;means for translating the center of gravity of each sample vector in the plurality of sample vectors to the origin to obtain a plurality of translated sample vectors;

用于以所述多个经平移的样本向量中的一个向量为基准,对所述多个经平移的样本向量进行归一化,以获得多个经归一化的样本向量的装置;means for normalizing the plurality of translated sample vectors with reference to one of the plurality of translated sample vectors to obtain a plurality of normalized sample vectors;

用于相对于所述基准,对所述多个经归一化的样本向量进行对齐操作,以获得多个经对齐的样本向量的装置;means for performing an alignment operation on said plurality of normalized sample vectors relative to said reference to obtain a plurality of aligned sample vectors;

用于对所述多个经对齐的样本向量求出平均向量,并且相对于所述基准对所述平均向量进行对齐操作以获得经对齐的平均向量的装置;means for finding an average vector of the plurality of aligned sample vectors, and performing an alignment operation on the average vector relative to the reference to obtain an aligned average vector;

用于判断所述经对齐的平均向量与所述基准的偏差是否大于一设定值的装置;means for judging whether the deviation of the aligned mean vector from the reference is greater than a set value;

用于如果判断结果是大于所述设定值,则将经对齐的平均向量用作新的基准,对所述多个经对齐的样本向量进行归一化的装置;A means for normalizing the plurality of aligned sample vectors using the aligned mean vector as a new reference if the judgment result is greater than the set value;

用于如果判断结果不大于所述设定值,则获得所述多个经排序的样本向量的装置。means for obtaining the plurality of sorted sample vectors if the judgment result is not greater than the set value.

在本发明的装置中,所述经对齐的平均向量与所述基准的偏差可以是所述经对齐的平均向量与所述基准之间的距离。In the apparatus of the present invention, the deviation of the aligned mean vector from the reference may be the distance between the aligned mean vector and the reference.

在本发明的装置中,用于从所述求得的特征向量中选出多个最能反映样本特征的特征向量的所述装置可以包括:In the device of the present invention, the means for selecting a plurality of eigenvectors that can best reflect the characteristics of the sample from the obtained eigenvectors may include:

用于求出与所述所有特征向量相对应的特征值的装置;means for finding eigenvalues corresponding to said all eigenvectors;

用于由大到小对所述特征值排序的装置;A device for sorting the feature values from large to small;

用于由大到小选出多个特征值,使得满足下式的装置:It is used to select multiple eigenvalues from large to small, so that the device that satisfies the following formula:

&Sigma;&Sigma; ii == 11 tt &lambda;&lambda; ii &GreaterEqual;&Greater Equal; ff vv VV TT

其中,λi表示特征值,t表示被选出的所述特征值的个数,VT表示所有特征值λi的总和,而fv是一个设定值,用于反映将要建立的统计模型所涵盖的样本变化的比例值,Among them, λi represents the eigenvalue, t represents the number of selected eigenvalues, V T represents the sum of all eigenvalues λi , and f v is a set value, which is used to reflect the statistical model to be established The proportion value of the sample variation covered,

其中,所述选出的多个特征值分别与所述选出的特征向量相对应。Wherein, the selected eigenvalues correspond to the selected eigenvectors respectively.

在本发明的装置中,所述被选出的特征向量的个数可以为3,并且所述参数向量可以具有三个分量,其中第一分量基本上表征经变形获得的笔划的“肥”或“瘦”,第二分量基本上表征经变形获得的笔划的“长”或“短”,第三分量基本上表征经变形获得的笔划的“方”或“圆”。In the device of the present invention, the number of the selected feature vectors can be 3, and the parameter vector can have three components, wherein the first component basically represents the "fat" or "fat" of the stroke obtained through deformation. "Thin", the second component basically characterizes the "long" or "short" of the deformed stroke, and the third component basically characterizes the "square" or "circle" of the deformed stroke.

本发明的装置还可以包括:The device of the present invention may also include:

用于对多个笔划的轮廓进行特征点采样以形成所述多个笔划的轮廓样本的装置;means for sampling feature points of contours of a plurality of strokes to form contour samples of said plurality of strokes;

用于根据所述经变形的笔划向量,显示经变形的笔划的装置。means for displaying a deformed stroke based on said deformed stroke vector.

在本发明的装置中,所述特征点可以包括所述轮廓上的转折点,以及位于所述转折点之间的Bezier曲线控制点。In the device of the present invention, the feature points may include turning points on the contour, and Bezier curve control points located between the turning points.

由于本发明在建模过程中以笔划的一些主要特征作为变形的依据,所以在一定程度上可以改进字体变形的整体效果和效率。同时,通过对表示主要特征的参数进行合适的取值,体现出个人的审美观点。Since the present invention uses some main features of strokes as the basis for deformation during the modeling process, the overall effect and efficiency of font deformation can be improved to a certain extent. At the same time, the personal aesthetic point of view is reflected by taking appropriate values of the parameters representing the main features.

附图说明Description of drawings

图1示意了一种基于计算机模拟的书法临摹和创作过程;Fig. 1 illustrates a kind of calligraphy copying and creation process based on computer simulation;

图2例示了对“横划”进行自动采样而得到的特征点;Fig. 2 illustrates the feature points obtained by automatic sampling of "horizontal stroke";

图3是依照本发明一实施例的样本排序流程图;Fig. 3 is a sample sorting flowchart according to an embodiment of the present invention;

图4是依照本发明一实施例的采用主成分分析法来建立模型的流程图。FIG. 4 is a flow chart of establishing a model by principal component analysis according to an embodiment of the present invention.

图5(a)示出了依照本发明一实施例的第一样本空间中三个“横划”字的轮廓;Figure 5(a) shows the contours of three "horizontal strokes" characters in the first sample space according to an embodiment of the present invention;

图5(b)示出了依照本发明一实施例的第二样本空间中三个“横划”字的轮廓;Figure 5(b) shows the contours of three "horizontal strokes" characters in the second sample space according to an embodiment of the present invention;

图6(a)例示了第一样本空间中“横划”的一种变化过程;Figure 6(a) illustrates a change process of "horizontal stroke" in the first sample space;

图6(b)例示了第二样本空间中“横划”的一种变化过程;Fig. 6(b) illustrates a change process of "horizontal stroke" in the second sample space;

图6(c)例示了第二样本空间中“横划”的另一种变化过程;Fig. 6 (c) illustrates another variation process of "horizontal stroke" in the second sample space;

图7(a)例示了第三样本空间中“横划”的一种变化过程;Figure 7(a) illustrates a change process of "horizontal stroke" in the third sample space;

图7(b)例示了第三样本空间中“横划”的另一种变化过程;Fig. 7(b) illustrates another variation process of "horizontal stroke" in the third sample space;

图8示出了依照本发明一实施例的第四样本空间中四个“横划”的轮廓;Fig. 8 shows the contours of four "horizontal strokes" in the fourth sample space according to an embodiment of the present invention;

图9(a)-(e)例示了第四样本空间中“横划”字的一种变化过程;以及Fig. 9 (a)-(e) has illustrated a kind of change process of " cross stroke " character in the 4th sample space; And

图10(a)-(f)例示了第四样本空间中“横划”字的两种变化过程。Fig. 10(a)-(f) illustrate two kinds of change processes of the character "horizontal dash" in the fourth sample space.

具体实施方式Detailed ways

汉字的演变既符合文字发展的一般规律,又始终兼具艺术内涵和审美特征。The evolution of Chinese characters not only conforms to the general law of character development, but also always has artistic connotation and aesthetic characteristics.

书法史告诉我们,书体演变的一般过程为:在已有字体的基础上,根据简便、规范的要求和美观原则,增、删、并笔划,改变线型,调整结构,加强呼应,体现个性,即所谓的“省改、约易”。这是以变型和增删为核心的形象思维过程。The history of calligraphy tells us that the general process of calligraphy evolution is: on the basis of existing fonts, according to the requirements of simplicity, standardization and aesthetic principles, add, delete, and merge strokes, change line types, adjust structures, strengthen echoes, and reflect individuality , which is the so-called "provincial reform and contract change". This is an image thinking process centered on transformation, addition and deletion.

现实生活中,要成为有一定书法修养的人,仅临摹一种碑帖是远远不够的。在临摹了若干种碑帖后,脱离所临摹的碑帖而写的字与临摹对象相比总会有些不同之处,但依然留有所临摹碑帖的特征。例如在临了几种汉隶后,独立写隶书,独立写出的隶书与任何一种所临碑帖都会不完全一样,但又都有不同程度的相似之处。如果临摹的碑帖很多,并且涉及不同的书体,那么就会逐步形成个人的风格。In real life, to become a person with a certain level of calligraphy, it is not enough to just copy a kind of inscription. After copying several types of inscriptions, the characters written without copying the inscriptions will always be somewhat different from those copied, but still retain the characteristics of the inscriptions copied. For example, after learning several kinds of official scripts of the Han Dynasty, if one writes official scripts independently, the official scripts written independently will not be exactly the same as any of the inscriptions that one faced, but they all have different degrees of similarities. If there are many inscriptions copied and different styles of calligraphy are involved, then a personal style will gradually be formed.

形成个人风格实为一种创作过程,可概括为“临摹/记忆-融合-变形/创作”。图1示意了一种基于计算机模拟的书法临摹和创作过程,这个过程依赖于临摹时、记忆时和创作时的形象思维。对书法作品的临习、摹写和默读是书法学习的首要环节。在这个环节的基础上,学习者会自然地将碑刻笔划轮廓上凹凸不平“噪音”滤除,实现笔划轮廓的平滑和进一步的拟合,这是思维的基本功能,也是创作前必需的预处理。接下来是书法作品的记忆,它实际上并不是完全的复制过程,与其对应的是再现。笔划融合、字形改变和整体创作是逐步深入的过程,其结果中的某些部分又可以作为临摹对象。当然,临摹书法作品时,原来记忆的内容也会起作用。Forming a personal style is actually a creative process, which can be summarized as "copy/memory-fusion-deformation/creation". Figure 1 shows a calligraphy copying and creation process based on computer simulation, which relies on image thinking when copying, memorizing and creating. The practice, imitation and silent reading of calligraphy works are the most important part of calligraphy learning. On the basis of this link, learners will naturally filter out the uneven "noise" on the outline of the inscription strokes to achieve smoothness and further fitting of the outline of the strokes. This is the basic function of thinking and a necessary preprocessing before creation . Next is the memory of calligraphy works, which is actually not a complete reproduction process, but the corresponding reproduction. Stroke fusion, glyph change and overall creation are gradual and in-depth processes, and some parts of the result can be used as objects for copying. Of course, when copying calligraphy works, the content of the original memory will also play a role.

当用计算机模拟这样的书法创作过程时,可以将模拟过程概括为“基本文字想象”+“思维发挥”,其中前者通过存储来实现,这是计算机的特长,而后者则是计算机模拟的关键内容。理想地,最好以某种结构层次为模板,但是目前认知神经科学还没有这方面的结论。When using a computer to simulate such a calligraphy creation process, the simulation process can be summarized as "basic text imagination" + "thinking development", in which the former is realized through storage, which is the specialty of computers, while the latter is the key content of computer simulation . Ideally, it would be better to use some kind of structural hierarchy as a template, but cognitive neuroscience has not yet concluded in this regard.

为便于描述,下面将以线条为元素进行讨论。For the convenience of description, the following discussion will take lines as elements.

中国书法讲究笔法,核心是“横划”,在模拟“横划”创作的基础上,模拟其它笔划的创作就会相对比较容易,从而就可以创作单个字,以至篇章。Chinese calligraphy pays attention to strokes, and the core is "horizontal strokes". On the basis of simulating the creation of "horizontal strokes", it is relatively easy to simulate the creation of other strokes, so that single characters and even chapters can be created.

首先,本发明将字型的“肥”、“瘦”,笔划的“长”、“短”,线端的“方”、“圆”等作为特征参数,试图用其来初步刻画字的基本外型特征。当然,还可以将其他的外型特征作为参数。First of all, the present invention uses the "fat" and "thin" of the font, the "long" and "short" of the stroke, the "square" and "circle" of the line end as characteristic parameters, and tries to use it to initially describe the basic appearance of the character. type features. Of course, other appearance features can also be used as parameters.

然后,建立一个带参数的模型,用参数b来控制笔划的形状:Then, build a model with parameters, and use the parameter b to control the shape of the stroke:

X=M(b)    (1)X=M(b) (1)

其中,b是一个参数向量,它可用以调整一个样本空间中的样本的主要形状。在一实施例中,样本是横划,一个样本空间中的样本可以是取自一特定碑帖中的所有或一部分横划,也可以是取自一种字体之多个碑帖的所有或一部分横划,还可以是取自多种字体的所有或一部分横划。在另一些实施例中,样本可以取竖划、点、折勾等笔划,甚至可以是一个汉字。向量b的维数反映了主要特征的个数。M表示一统计模型,用于反映b的变化与X的变化趋势之间的关系。如果能够确定这种关系,那么当调整b的不同分量时,就会得到不同的X,从而“创作”输出期望的字形。where b is a parameter vector that can be used to adjust the dominant shape of samples in a sample space. In one embodiment, the samples are strokes, and the samples in a sample space can be all or part of the strokes taken from a specific inscription, or all or a part of the strokes taken from multiple inscriptions of a font , and can also be all or some strokes from multiple fonts. In some other embodiments, the sample can be strokes such as vertical strokes, dots, folded hooks, etc., or even a Chinese character. The dimension of vector b reflects the number of main features. M represents a statistical model, which is used to reflect the relationship between the change of b and the change trend of X. If this relationship can be determined, then when different components of b are adjusted, different X will be obtained, thus "creating" the output desired glyph.

所建立的模型M最好能够通过参数向量b使样本主要特征与字型的特征参数相关联。在一实施例中,期望在所建立的统计模型M中,参数向量b第一分量的影响能够反映出字形“肥”、“瘦”的变化,参数向量b第二分量的影响能够反映出笔划“长”“短”的变化,参数向量b第三分量的影响能够反映出线端“方”和“圆”的变化。这时,向量b的维数就为3,“肥”或“瘦”,长”或“短”以及“方”与“圆”则可以构成向量b的三个分量。以下描述用于建立本发明统计模型的过程。Preferably, the established model M can associate the main characteristics of the sample with the characteristic parameters of the font through the parameter vector b. In one embodiment, it is expected that in the established statistical model M, the influence of the first component of the parameter vector b can reflect the change of the font "fat" and "thin", and the influence of the second component of the parameter vector b can reflect the stroke The change of "long" and "short", the influence of the third component of the parameter vector b can reflect the change of "square" and "circle" at the end of the line. At this time, the dimension of vector b is 3, "fat" or "thin", long" or "short", "square" and "circle" can constitute the three components of vector b. The following description is used to establish this The process of inventing statistical models.

1.点集定位1. Point set positioning

为了建立一个整体轮廓的模型,首先要从文字的轮廓中通过人机交互找出一些特征点来勾勒出它的形状,这些点反映了文字的结构及其变化。这样的点一般是边界上曲率变化很大的转折点,它们通常处于两个笔划相交的地方,或者是笔锋突变的地方。然而,仅仅使用这些点还不足以描述文字的外形信息。为了准确描述文字轮廓,还需要沿着轮廓在定位好的标记点之间自动利用Béziér曲线法平均地取一些点,以便更好地勾勒出文字的形状。In order to build a model of the overall outline, it is first necessary to find some feature points from the outline of the text to outline its shape through human-computer interaction. These points reflect the structure and changes of the text. Such points are generally turning points on the boundary where the curvature changes greatly, and they are usually at the place where two strokes intersect, or where the stroke suddenly changes. However, only using these points is not enough to describe the shape information of text. In order to accurately describe the outline of the text, it is also necessary to automatically use the Béziér curve method to automatically take some points along the outline between the positioned marking points, so as to better outline the shape of the text.

图2示出了对“横划”自动采样得到的特征点,其中方点代表轮廓线上曲率较大的点以及沿着轮廓添加的点,圆点代表Béziér曲线控制点。如果特征点太少,笔划特征无法显现;相反,如果特征点太多,则不仅会增大计算量,而且会引入明显的噪声。Figure 2 shows the feature points obtained by automatic sampling of "horizontal stroke", where the square points represent the points with larger curvature on the contour line and the points added along the contour, and the circle points represent the control points of the Béziér curve. If there are too few feature points, the stroke features cannot be displayed; on the contrary, if there are too many feature points, it will not only increase the amount of calculation, but also introduce obvious noise.

对于一个笔划的轮廓样本,如果设该样本上第i个特征点的坐标为{(xi,yi)},那么这个笔划就可以用下述列向量来表示:For an outline sample of a stroke, if the coordinates of the i-th feature point on the sample are {( xi , y i )}, then this stroke can be represented by the following column vector:

X=(x1,...,xn,y1,...,yn)T    (2)X=(x 1 , . . . , x n , y 1 , . . . , y n ) T (2)

其中,T表示转置。X是一列向量。若样本空间中存在s个样本,那么就意味着有s个列向量。这s个列向量组成所述样本空间中的一个矩阵。Among them, T means transpose. X is a column of vectors. If there are s samples in the sample space, it means that there are s column vectors. These s column vectors form a matrix in the sample space.

2.样本排序2. Sample sorting

建立模型时,希望消除与形状无关或关系不大的分量。一般需要采用大量样本叠合的方法来排列数据。在一实施例中,采用广义普鲁克分析(GeneralizedProcrustes Analysis,GPA)方法。GPA方法的主要思想是:首先将每个样本向量的重心平移到原点,然后将经平移的各样本向量的幅度归一化,最后通过反复旋转观测对象,直到求出平均形状,获得排列后的向量。When building a model, it is desirable to eliminate components that have no or little relationship to shape. Generally, a large number of sample superimposition methods are required to arrange the data. In one embodiment, a generalized Procrustes Analysis (GPA) method is used. The main idea of the GPA method is: firstly translate the center of gravity of each sample vector to the origin, then normalize the amplitude of the translated sample vectors, and finally rotate the observation object repeatedly until the average shape is obtained to obtain the arranged vector.

图3是依照本发明一实施例的样本排序流程图。在本实施例中,假设样本空间具有s个样本,对每个样本采样n个特征点,而每个特征点又都位于2维空间上。于是,样本空间中每个样本向量可以表示为:Fig. 3 is a flowchart of sample sorting according to an embodiment of the present invention. In this embodiment, it is assumed that the sample space has s samples, and n feature points are sampled for each sample, and each feature point is located in a 2-dimensional space. Then, each sample vector in the sample space can be expressed as:

X=(x1,…,xn,y1,…,yn)T    (3)X=(x 1 , ..., x n , y 1 , ..., y n ) T (3)

如图3所示,在步骤S2,将每个样本向量X的重心G平移到原点。例如,可以先计算每个样本向量的重心G:As shown in Fig. 3, in step S2, the center of gravity G of each sample vector X is translated to the origin. For example, the center of gravity G of each sample vector can be calculated first:

GG (( Xx )) == (( 11 nno &Sigma;&Sigma; ii == 11 nno xx ii ,, 11 nno &Sigma;&Sigma; ii == 11 nno ythe y ii )) -- -- -- (( 44 ))

然后,将每个样本向量的重心平移到原点。经平移后的样本向量可以表示为:Then, translate the center of gravity of each sample vector to the origin. The translated sample vector can be expressed as:

X=(x1,…,xn,y1,…,yn)TX=(x 1 , . . . , x n , y 1 , . . . , y n ) T ,

xx ii == xx ii -- 11 nno &Sigma;&Sigma; ii == 11 nno xx ii ,, ythe y ii == ythe y ii -- 11 nno &Sigma;&Sigma; ii == 11 nno ythe y ii -- -- -- (( 55 ))

在步骤S4,将每个经平移的样本向量的幅度归一化,也称为伸缩。例如,可以先计算向量长度|X|。经归一化的样本向量可以表示为:In step S4, the magnitude of each translated sample vector is normalized, also called scaling. For example, the vector length |X| can be calculated first. The normalized sample vector can be expressed as:

X=(x1,…,xn,y1,…,y2)T X=(x 1 ,...,x n ,y 1 ,...,y 2 ) T

xx ii == xx ii || Xx || ,, ythe y ii == ythe y ii || Xx || -- -- -- (( 66 ))

在步骤S5,将多个经归一化的样本向量中的一个向量设为基准向量X0。在一实施例中,令X0=X1。在步骤S6,以X0为基准,对经归一化的样本向量进行对齐操作。例如,对齐后的样本向量可以通过下述计算获得:In step S5, one of the normalized sample vectors is set as the reference vector X 0 . In one embodiment, let X 0 =X 1 . In step S6, an alignment operation is performed on the normalized sample vectors based on X 0 . For example, the aligned sample vectors can be obtained by the following calculation:

aa == (( Xx mm TT &CenterDot;&CenterDot; Xx 00 )) || Xx mm || 22

bb == &Sigma;&Sigma; ii == 11 nno (( xx mimi -- ythe y 00 ii -- ythe y mimi xx 00 ii )) || Xx mm || 22

s = a 2 + b 2 , θ=tan-1(b/a) the s = a 2 + b 2 , θ=tan -1 (b/a)

AA == coscos &theta;&theta; -- sinsin &theta;&theta; sinsin &theta;&theta; coscos &theta;&theta;

xx mimi ythe y mimi == sAsA xx ii ythe y ii

Xm=(xm1,…,xmn,ym1,…,ymn)T,m=1,…,s    (7)X m = (x m1 , . . . , x mn , y m1 , . . . , y mn ) T , m=1, . . . , s (7)

在步骤S8,对经对齐的样本向量求平均向量

Figure S2007100462301D00099
In step S8, the average vector is calculated for the aligned sample vectors
Figure S2007100462301D00099

Xx &OverBar;&OverBar; == EE. (( Xx 11 ,, .. .. .. ,, Xx sthe s )) -- -- -- (( 88 ))

在步骤S10,仍以X0为基准,根据等式(7),对平均向量

Figure S2007100462301D000911
进行对齐操作,获得经对齐的平均向量。In step S10, still taking X0 as the benchmark, according to equation (7), the mean vector
Figure S2007100462301D000911
Perform the alignment operation to obtain the aligned mean vector.

在步骤S12,将经对齐的平均向量与基准向量X0。作比较。如果两向量之间的偏差大于一设定值,则过程进至步骤S14。在步骤S14,用经对齐的平均向量替代当前的基准向量X0,并将当前经对齐的样本向量的幅度归一化。随后,过程返回步骤S6,进行循环。In step S12, the aligned average vector is compared with the reference vector X 0 . compared to. If the deviation between the two vectors is greater than a set value, the process proceeds to step S14. In step S14, the current reference vector X 0 is replaced by the aligned average vector, and the magnitude of the current aligned sample vector is normalized. Subsequently, the procedure returns to step S6, and a loop is performed.

如果在步骤S12中两向量之间的偏差不大于所述设定值,则过程进至步骤S16,输出在本次循环中步骤S6所获得的经对齐的样本向量,从而获得排列后的样本集。If the deviation between the two vectors is not greater than the set value in step S12, then the process proceeds to step S16 to output the aligned sample vectors obtained in step S6 in this cycle, thereby obtaining the arranged sample set .

在一较佳实施例中,步骤S12将两向量之间的距离L与一设定值L0比较,其中所述距离L可以按等式(9)来计算。In a preferred embodiment, step S12 compares the distance L between the two vectors with a set value L 0 , wherein the distance L can be calculated according to equation (9).

LL == &Sigma;&Sigma; ii == 11 nno [[ (( xx &OverBar;&OverBar; ii -- xx 00 ii )) 22 ++ (( ythe y &OverBar;&OverBar; ii -- ythe y 00 ii )) 22 ]] -- -- -- (( 99 ))

步骤S12还可以计算其他参数来表示经对齐的平均向量与基准向量X0之间的偏差。Step S12 may also calculate other parameters to represent the deviation between the aligned mean vector and the reference vector X 0 .

GPA方法将所有的样本经过排列之后,使得它们与平均向量的差的平方和最小,即The GPA method arranges all the samples so that the sum of the squares of the differences between them and the average vector is the smallest, that is

DD. == &Sigma;&Sigma; ii == 11 sthe s || Xx ii -- Xx &OverBar;&OverBar; || 22 ,, ii == 11 ,, .. .. .. ,, sthe s -- -- -- (( 1010 ))

3.模型建立3. Model building

如果一个样本空间包含s个样本,每个样本都包含n个特征点,每个特征点又都位于2维空间上,那么当n取值较大时,计算量就会很大。因此,为了方便计算,需要把样本空间的样本数s减少到易于计算的范围。If a sample space contains s samples, each sample contains n feature points, and each feature point is located in a 2-dimensional space, then when the value of n is large, the amount of calculation will be very large. Therefore, in order to facilitate calculation, it is necessary to reduce the number of samples s in the sample space to a range that is easy to calculate.

在本发明的一个实施例中,当计算出全部s个样本之协方差矩阵S的所有特征向量φi及其相应的特征值λi后,采用主成分分析法(Principal Components Analysis,PCA)分析样本协方差矩阵的特征值,从中挑选出t个特征向量组成一个特征矩阵Φ。这里,被挑选出的t个特征向量必须能够反映样本的主要特征。In one embodiment of the present invention, after calculating all eigenvectors φ i and their corresponding eigenvalues λ i of the covariance matrix S of all s samples, principal component analysis (Principal Components Analysis, PCA) is used to analyze The eigenvalues of the sample covariance matrix, from which t eigenvectors are selected to form a eigenmatrix Φ. Here, the selected t feature vectors must be able to reflect the main features of the sample.

图4是依照本发明的一实施例的采用主成分分析法来建立模型的流程图。如图4所示,在步骤S22中,根据等式(11)计算s个经排列的样本向量的平均向量 FIG. 4 is a flow chart of establishing a model by principal component analysis according to an embodiment of the present invention. As shown in Figure 4, in step S22, the average vector of s sample vectors arranged according to equation (11) is calculated

Xx &OverBar;&OverBar; == 11 sthe s &Sigma;&Sigma; ii == 11 sthe s Xx ii -- -- -- (( 1111 ))

然后,在步骤S24,计算协方差矩阵S:Then, in step S24, the covariance matrix S is calculated:

SS == 11 sthe s -- 11 &Sigma;&Sigma; ii == 11 sthe s (( Xx ii -- Xx &OverBar;&OverBar; )) (( Xx ii -- Xx &OverBar;&OverBar; )) TT -- -- -- (( 1212 ))

在步骤S26,求出协方差矩阵S的所有特征向量φi及其相应的特征值λi。在步骤S28,按λi≥λi+1的顺序对特征向量φi排序。在步骤S30,从大到小选出t个特征值λi使其满足下式(13):In step S26, all eigenvectors φ i of the covariance matrix S and their corresponding eigenvalues λ i are obtained. In step S28, the feature vectors φ i are sorted in the order of λ iλ i+1 . In step S30, t eigenvalues λ i are selected from large to small to satisfy the following formula (13):

&Sigma;&Sigma; ii == 11 tt &lambda;&lambda; ii &times;&times; ff vv VV TT -- -- -- (( 1313 ))

其中,VT表示所有特征值λi的总和,而fv则是一个预定的用于反映将要建立的统计模型所涵盖的样本变化的比例值,譬如96%。Wherein, V T represents the sum of all eigenvalues λ i , and f v is a predetermined proportion value used to reflect the sample variation covered by the statistical model to be established, such as 96%.

在步骤S32,将与所选出的t个特征值λi相对应的特征向量φi组成一个特征矩阵Φ:In step S32, the eigenvectors φ i corresponding to the selected t eigenvalues λ i are combined into a feature matrix Φ:

Φ=(φ12|…φt)    (14)Φ=(φ 12 |...φ t ) (14)

如此被挑选出的t个特征向量能够反映样本的主要特征。The t feature vectors selected in this way can reflect the main features of the sample.

然后,在步骤S34,建立下述统计模型:Then, in step S34, the following statistical model is established:

Xx == Mm (( bb )) &ap;&ap; Xx &OverBar;&OverBar; ++ &Phi;b&Phi;b -- -- -- (( 1515 ))

其中,

Figure S2007100462301D00114
是根据等式(11)计算得到的平均向量,Φ是由t个特征向量组成的矩阵,b是一个t维的列向量,对应的是“主成份”。in,
Figure S2007100462301D00114
is the average vector calculated according to equation (11), Φ is a matrix composed of t eigenvectors, and b is a t-dimensional column vector, corresponding to the "principal component".

在一实施例中,t=3。这时,b是一个3维的列向量,b=[b1,b2,b3]。当给向量b的各个分量赋予合理的值时,利用统计模型(23)就可以得到一个与原始样本相似的新笔划。In one embodiment, t=3. At this time, b is a 3-dimensional column vector, b=[b 1 , b 2 , b 3 ]. When assigning reasonable values to each component of the vector b, a new stroke similar to the original sample can be obtained by using the statistical model (23).

4.笔划的模拟结果4. Simulation results of strokes

图5(a)和图5(b)分别示出了从二个不同碑的原始样本中获得的三个“横划”的轮廓。假设图5(a)所示的三个“一”字的轮廓构成第一样本空间,图5(b)示出了三个“一”字的轮廓构成第二样本空间。Figure 5(a) and Figure 5(b) respectively show the contours of three "horizontal strokes" obtained from two original samples of different monuments. Assuming that the outlines of the three "one" characters shown in Fig. 5(a) constitute the first sample space, and Fig. 5(b) shows that the outlines of the three "one" characters constitute the second sample space.

在一实施例中,通过前述点集定位、样本排序和模型建立等三个步骤,为第一样本空间和第二样本空间建立相应的统计模型。然后,分别在第一和第二样本空间进行“横划”的形状变化。例如,可以取参数b=(b1,b2,b3)T,其中b1表示字型的“肥”、“瘦”特征,b2表示笔划的“长”、“短”特征,b3表示线端的“方”、“圆”特征。图6(a)例示了第一样本空间中“横划”的一种变化过程。从上至下,b1的取值依次为0.10、0.05、0、-0.05和-0.10(人机交互确定);b2和b3始终取0。在图6(a)所示的变化中,“横划”基本上由“肥”变“瘦”,但长度和方圆基本不变。图6(b)例示了第二样本空间中“横划”的一种变化过程。从上至下,b1的取值依次为0.10、0.05、0、-0.05和-0.10;b2和b3始终取0。在图6(b)所示的变化中,“横划”基本上由“肥”变“瘦”,但长度基本不变。图6(c)例示了第二样本空间中“横划”的另一种变化过程。从上至下,b1和b3始终取0;b2的取值依次为0.20、0、-0.20和0.50。在图6(c)所示的变化中,“横划”长度有所变化,但“肥”“瘦”和“方”“圆”基本不变。In one embodiment, corresponding statistical models are established for the first sample space and the second sample space through the aforementioned three steps of point set location, sample sorting, and model building. Then, the shape change of "horizontal stroke" is performed in the first and second sample spaces respectively. For example, the parameter b=(b 1 , b 2 , b 3 ) T can be taken, wherein b 1 represents the "fat" and "thin" features of the font, b 2 represents the "long" and "short" features of the stroke, and b 3 represents the "square" and "circle" features of the line end. Fig. 6(a) illustrates a change process of "horizontal stroke" in the first sample space. From top to bottom, the values of b1 are 0.10, 0.05, 0, -0.05 and -0.10 (determined by human-computer interaction); b2 and b3 always take 0. In the change shown in Figure 6(a), the "horizontal stroke" basically changed from "fat" to "thin", but the length and square circle remained basically unchanged. Fig. 6(b) illustrates a change process of "horizontal stroke" in the second sample space. From top to bottom, the values of b1 are 0.10, 0.05, 0, -0.05 and -0.10; b2 and b3 are always 0. In the change shown in Figure 6(b), the "horizontal stroke" basically changes from "fat" to "thin", but the length basically remains the same. Fig. 6(c) illustrates another variation process of "horizontal stroke" in the second sample space. From top to bottom, b 1 and b 3 always take 0; the values of b 2 are 0.20, 0, -0.20 and 0.50 in turn. In the changes shown in Figure 6(c), the length of the "horizontal stroke" changes, but the "fat", "thin", "square" and "round" basically remain unchanged.

在另一实施例中,将上述第一和第二样本空间中的“横划”合并为第三样本空间,通过前述点集定位、样本排序和模型建立等三个步骤,建立统计模型。图7(a)例示了第三样本空间中“横划”的一种变化过程。从上至下,b1的取值依次为0.15、0.10、0.05、0、-0.05、-0.10和-0.15;b2和b3始终为0。在图7(a)所示的变化中,“横划”基本上由“肥”变“瘦”,但长度和方圆基本不变。图7(b)例示了第三样本空间中“横划”的另一种变化过程。从上至下,b2依次取0.05、0和-0.05;b1和b3始终为0。在图7(b)所示的变化中,“横划”长度有所变化,但“肥”“瘦”和“方”“圆”基本不变。与图6(a)-6(c)的字型变化相比,图7(a)-7(b)的字形发生了更丰富的变化,产生了不同于第一样本空间和第二样本空间的形状。In another embodiment, the above-mentioned "horizontal strokes" in the first and second sample spaces are combined into a third sample space, and a statistical model is established through the aforementioned three steps of point set positioning, sample sorting, and model building. Fig. 7(a) illustrates a change process of "horizontal stroke" in the third sample space. From top to bottom, the values of b1 are 0.15, 0.10, 0.05, 0, -0.05, -0.10 and -0.15; b2 and b3 are always 0. In the change shown in Fig. 7(a), the "horizontal stroke" basically changes from "fat" to "thin", but the length and square circle are basically unchanged. Fig. 7(b) illustrates another variation process of "horizontal stroke" in the third sample space. From top to bottom, b 2 takes 0.05, 0 and -0.05 in turn; b 1 and b3 are always 0. In the changes shown in Figure 7(b), the length of the "horizontal stroke" changes, but the "fat", "thin", "square" and "round" basically remain unchanged. Compared with the font changes in Figures 6(a)-6(c), the fonts in Figures 7(a)-7(b) have undergone richer changes, resulting in a difference from the first sample space and the second sample space. The shape of the space.

图8示出了四个“横划”的轮廓,将其构成第四样本空间。在该实施例中,通过前述点集定位、样本排序和模型建立等三个步骤,为第四样本空间建立相应的统计模型。然后,在第四样本空间进行“横划”的字形变化。图9中,向量b含有3个元素b1,b2和b3,(a)中,b=[-0.10,0,0],(b)中,b=[-0.05,0,0],(c)中,b=[0,0,0],(d)中,b=[0.05,0,0],(e)中,b=[0.10,0,0]。在图9a-9e所示的变化中,“横划”基本上由“肥”变“瘦”,但长度和方圆基本不变。图10中,(a)-(c)图像对应于调整分量b2,其余分量不变,其中“横划”的长度有所变化,但“肥”“瘦”和“方”“圆”基本不变。(d)-(f)图像对应于调整分量b3,其余元素不变,其中“横划”的“方”“圆”有所变化,但“肥”“瘦”和长度基本不变。FIG. 8 shows the contours of four "scratches", which constitute the fourth sample space. In this embodiment, a corresponding statistical model is established for the fourth sample space through the aforementioned three steps of point set location, sample sorting, and model building. Then, change the font of "horizontal stroke" in the fourth sample space. In Fig. 9, vector b contains 3 elements b 1 , b 2 and b 3 , in (a), b=[-0.10, 0, 0], in (b), b=[-0.05, 0, 0] , in (c), b=[0,0,0], in (d), b=[0.05,0,0], in (e), b=[0.10,0,0]. In the changes shown in Figures 9a-9e, the "horizontal stroke" basically changes from "fat" to "thin", but the length and square circle are basically unchanged. In Fig. 10, images (a)-(c) correspond to the adjustment component b 2 , and the rest of the components remain unchanged. The length of the "horizontal stroke" changes, but the "fat", "thin" and "square" and "circle" are basically constant. The images (d)-(f) correspond to the adjustment component b 3 , and the other elements remain unchanged, among which the "square" and "circle" of the "horizontal stroke" are changed, but the "fat", "thin" and length are basically unchanged.

虽然向量b的三个分量b1、b2、b3能够主要地影响字型的“肥”、“瘦”特征,笔划的“长”、“短”特征,以及线端的“方”、“圆”特征,但是通过图6、7、9和10可以看出,参数b中一个分量bi的变化并不仅仅引起单一特征的变化,它会在一定程度上引起整个字体的变化。Although the three components b 1 , b 2 , b 3 of the vector b can mainly affect the "fat" and "thin" features of the font, the "long" and "short" features of the strokes, and the "square" and " “circle” feature, but it can be seen from Figures 6, 7, 9 and 10 that the change of a component b i in the parameter b does not only cause the change of a single feature, it will cause the change of the entire font to a certain extent.

5.文字的创作5. Creation of text

在前述笔划模拟的基础上,便可以进行文字的创作。On the basis of the above-mentioned stroke simulation, characters can be created.

本领域的技术人员能够理解,前述实施例所描述的各个步骤可以通过计算机硬件、计算机软件或两者的组合来实现。为了清楚说明硬件和软件间的互换性,各种说明性的组件、框图、模块、电路和步骤一般按照其功能性进行了阐述。这些功能性究竟作为硬件或软件来实现取决于整个系统所采用的特定的应用系统的设计。技术人员可以认识到在这些情况下硬件和软件的交互性,以及怎样最好地实现每个特定应用所述功能。技术人员可能以对于每个特定应用不同的方式来实现所述功能,但这种实现决定不应被解释为造成背离本发明的范围。Those skilled in the art can understand that each step described in the foregoing embodiments can be implemented by computer hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, various illustrative components, blocks, modules, circuits and steps have generally been described in terms of their functionality. Whether these functionalities are implemented as hardware or software depends on the specific application system design adopted by the overall system. Skilled artisans will recognize the interoperability of hardware and software in these cases, and how best to implement the described functions for each particular application. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.

结合这里所描述的实施例来描述的各种步骤的实现或执行可以用:通用处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、场可编程门阵列(FPGA)或其它可编程逻辑器件、离散门或晶体管逻辑、离散硬件组件或者为执行这里所述功能而设计的任意组合。通用处理器可能是微处理器,然而或者,处理器可以是任何常规的处理器、控制器、微控制器或状态机。处理器也可能用计算设备的组合来实现,如,DSP和微处理器的组合、多个微处理器、结合DSP内核的一个或多个微处理器或者任意其它这种配置。Implementation or execution of the various steps described in conjunction with the embodiments described herein may be implemented using a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other Programmable logic devices, discrete gate or transistor logic, discrete hardware components, or any combination designed to perform the functions described herein. A general-purpose processor may be a microprocessor, however, in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented with a combination of computing devices, eg, a combination of a DSP and a microprocessor, multiple microprocessors, one or more microprocessors in combination with a DSP core, or any other such configuration.

尽管以上描述了本发明的较佳实施例,但本发明不仅限于此。本领域的熟练的技术人员可以在以上描述的基础上进行各种变化和改变。不脱离发明精神的各种改变和变化都应落在本发明的保护范围之内。发明的保护范围由所附的权利要求书来限定。Although the preferred embodiments of the present invention have been described above, the present invention is not limited thereto. Those skilled in the art can make various changes and changes on the basis of the above description. Various changes and changes without departing from the spirit of the invention should fall within the protection scope of the present invention. The protection scope of the invention is defined by the appended claims.

Claims (12)

1. A computer stroke morphing method, the method comprising the steps of:
providing a plurality of outline samples of the stroke to form a sample space, wherein the plurality of outline samples are respectively represented by corresponding sample vectors;
sorting the plurality of sample vectors to minimize a sum of squares of differences of the plurality of sorted sample vectors and an average vector thereof;
for the ordered sample vectors, solving all eigenvectors of a covariance matrix of the ordered sample vectors;
selecting a plurality of feature vectors which can reflect the features of the sample most from the obtained feature vectors;
forming a feature matrix by using the plurality of selected feature vectors, and establishing a statistical model according to the following formula:
<math> <mrow> <mi>X</mi> <mo>&ap;</mo> <mover> <mi>X</mi> <mo>&OverBar;</mo> </mover> <mo>+</mo> <mi>&Phi;b</mi> </mrow> </math>
wherein,
Figure FSB00000547172300012
is the average vector of the ordered sample vectors, phi is the feature matrix, b is a parameter vector, and X is a stroke vector obtained after deformation; and
changing components of the parameter vector to obtain a deformed stroke vector,
wherein the step of ordering the plurality of sample vectors comprises the steps of:
(a) translating a center of gravity of each of the plurality of sample vectors to an origin to obtain a plurality of translated sample vectors;
(b) normalizing the plurality of translated sample vectors with respect to one of the plurality of translated sample vectors to obtain a plurality of normalized sample vectors;
(c) performing an alignment operation on the plurality of normalized sample vectors relative to the reference to obtain a plurality of aligned sample vectors;
(d) for the plurality of aligned sample vectors, finding an average vector, and aligning the average vector with respect to the reference to obtain an aligned average vector;
(e) judging whether the deviation of the aligned average vector and the reference is larger than a set value;
(f) if the result of the judgment is larger than the set value, using the aligned average vector as a new reference, normalizing the plurality of aligned sample vectors, and returning to the step (c) for circulation;
(g) and if the judgment result is not larger than the set value, outputting the obtained plurality of aligned sample vectors as the plurality of ordered sample vectors.
2. The method of claim 1, wherein the deviation of the aligned average vector from the reference is a distance between the aligned average vector and the reference.
3. The method of claim 1, wherein said step of selecting a plurality of feature vectors that best reflect sample features from said derived feature vectors comprises the steps of:
finding out the characteristic values corresponding to all the characteristic vectors;
sorting the characteristic values from big to small;
selecting a plurality of characteristic values from large to small so that
<math> <mrow> <munderover> <mi>&Sigma;</mi> <mrow> <mi>i</mi> <mo>=</mo> <mn>1</mn> </mrow> <mi>t</mi> </munderover> <msub> <mi>&lambda;</mi> <mi>i</mi> </msub> <mo>&GreaterEqual;</mo> <msub> <mi>f</mi> <mi>v</mi> </msub> <msub> <mi>V</mi> <mi>T</mi> </msub> </mrow> </math>
Wherein λ isiRepresenting a characteristic value, t representing the number of said characteristic values selected, VTRepresenting all eigenvalues λiSum of (a) and fvIs a set value used for reflecting the proportion value of the sample change covered by the statistical model to be built,
wherein the selected plurality of feature values respectively correspond to the selected feature vectors.
4. A method as recited in claim 3, wherein the number of feature vectors selected is 3 and the parameter vector has three components, wherein a first component substantially characterizes the "fat" or "thin" of the morphed resulting stroke, a second component substantially characterizes the "long" or "short" of the morphed resulting stroke, and a third component substantially characterizes the "square" or "circle" of the morphed resulting stroke.
5. The method of claim 1, further comprising the steps of:
sampling feature points of contours of a plurality of strokes to form contour samples of the plurality of strokes;
displaying the deformed stroke according to the deformed stroke vector.
6. The method of claim 5, wherein said feature points comprise turning points on said contour, and Bezier curve control points located between said turning points.
7. A computer stroke morphing device, the device comprising:
means for providing contour samples of a plurality of strokes to form a sample space, wherein the plurality of contour samples are each represented by a respective sample vector;
means for sorting the plurality of sample vectors to minimize a sum of squares of differences of the plurality of sorted sample vectors and an average vector thereof;
means for solving for all eigenvectors of their covariance matrix for the ordered sample vector;
means for selecting a plurality of feature vectors that best reflect the characteristics of the sample from the obtained feature vectors;
means for constructing a feature matrix from the plurality of selected feature vectors and for building a statistical model according to the following equation:
<math> <mrow> <mi>X</mi> <mo>&ap;</mo> <mover> <mi>X</mi> <mo>&OverBar;</mo> </mover> <mo>+</mo> <mi>&Phi;b</mi> </mrow> </math>
wherein,
Figure FSB00000547172300032
is the average vector of the ordered sample vectors, phi is the feature matrix, b is a parameter vector, and X is a stroke vector obtained after deformation; and
means for altering components of the parameter vector to obtain a deformed stroke vector, wherein the means for ordering the plurality of sample vectors comprises:
means for translating a center of gravity of each sample vector of the plurality of sample vectors to an origin to obtain a plurality of translated sample vectors;
means for normalizing the plurality of translated sample vectors with respect to one of the plurality of translated sample vectors to obtain a plurality of normalized sample vectors;
means for performing an alignment operation on the plurality of normalized sample vectors relative to the reference to obtain a plurality of aligned sample vectors;
means for finding an average vector for the plurality of aligned sample vectors and aligning the average vector relative to the reference to obtain an aligned average vector;
means for determining whether the aligned average vector deviates from the reference by more than a set value;
means for normalizing the plurality of aligned sample vectors using the aligned average vector as a new reference if the determination result is greater than the set value;
means for outputting the obtained plurality of aligned sample vectors as the plurality of ordered sample vectors if the determination result is not greater than the set value.
8. The apparatus of claim 7, wherein the deviation of the aligned average vector from the reference is a distance between the aligned average vector and the reference.
9. The apparatus of claim 7, wherein said means for selecting a plurality of feature vectors from said derived feature vectors that best reflect sample features comprises:
means for finding feature values corresponding to all the feature vectors;
means for sorting the eigenvalues from large to small;
means for selecting a plurality of eigenvalues from large to small such that the following equation is satisfied:
<math> <mrow> <munderover> <mi>&Sigma;</mi> <mrow> <mi>i</mi> <mo>=</mo> <mn>1</mn> </mrow> <mi>t</mi> </munderover> <msub> <mi>&lambda;</mi> <mi>i</mi> </msub> <mo>&GreaterEqual;</mo> <msub> <mi>f</mi> <mi>v</mi> </msub> <msub> <mi>V</mi> <mi>T</mi> </msub> </mrow> </math>
wherein λ isiRepresenting a characteristic value, t representing the number of said characteristic values selected, VTRepresenting all eigenvalues λiSum of (a) and fvIs a set value used for reflecting the proportion value of the sample change covered by the statistical model to be built,
wherein the selected plurality of feature values respectively correspond to the selected feature vectors.
10. The apparatus as recited in claim 9, wherein the number of the selected feature vectors is 3, and the parameter vector has three components, wherein a first component substantially characterizes "fat" or "thin" of the morphed obtained stroke, a second component substantially characterizes "long" or "short" of the morphed obtained stroke, and a third component substantially characterizes "square" or "circle" of the morphed obtained stroke.
11. The apparatus of claim 7, further comprising:
means for sampling feature points of a plurality of strokes' contours to form contour samples of the plurality of strokes;
means for displaying the deformed stroke from the deformed stroke vector.
12. The apparatus of claim 11, wherein said feature points comprise turning points on said contour, and Bezier curve control points located between said turning points.
CN2007100462301A 2007-09-21 2007-09-21 Computer stroke deforming system and method Expired - Fee Related CN101393643B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2007100462301A CN101393643B (en) 2007-09-21 2007-09-21 Computer stroke deforming system and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2007100462301A CN101393643B (en) 2007-09-21 2007-09-21 Computer stroke deforming system and method

Publications (2)

Publication Number Publication Date
CN101393643A CN101393643A (en) 2009-03-25
CN101393643B true CN101393643B (en) 2012-01-18

Family

ID=40493925

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2007100462301A Expired - Fee Related CN101393643B (en) 2007-09-21 2007-09-21 Computer stroke deforming system and method

Country Status (1)

Country Link
CN (1) CN101393643B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102332173B (en) * 2011-09-13 2013-03-27 浙江万朋网络技术有限公司 Vector algebra-based simple and clear soft pen effect generation method
CN108305158B (en) * 2017-12-27 2020-06-09 阿里巴巴集团控股有限公司 Method, device and equipment for training wind control model and wind control

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1336604A (en) * 2000-08-01 2002-02-20 复旦大学 Method and system of digitizing ancient Chinese books and automatizing the content search
CN1459761A (en) * 2002-05-24 2003-12-03 清华大学 Character identification technique based on Gabor filter set
CN1664846A (en) * 2005-04-01 2005-09-07 清华大学 On-line Handwritten Chinese Character Recognition Method Based on Statistical Structural Features
CN1936961A (en) * 2005-09-23 2007-03-28 威锋数位开发股份有限公司 Edge-Shading Guided Grayscale Font Generation Method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1336604A (en) * 2000-08-01 2002-02-20 复旦大学 Method and system of digitizing ancient Chinese books and automatizing the content search
CN1459761A (en) * 2002-05-24 2003-12-03 清华大学 Character identification technique based on Gabor filter set
CN1664846A (en) * 2005-04-01 2005-09-07 清华大学 On-line Handwritten Chinese Character Recognition Method Based on Statistical Structural Features
CN1936961A (en) * 2005-09-23 2007-03-28 威锋数位开发股份有限公司 Edge-Shading Guided Grayscale Font Generation Method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王建平等.基于数学形态学的图像汉字笔划细化和提取.《合肥工业大学学报(自然科学版)》.2005,第28卷(第11期),全文. *

Also Published As

Publication number Publication date
CN101393643A (en) 2009-03-25

Similar Documents

Publication Publication Date Title
Lian et al. Automatic generation of large-scale handwriting fonts via style learning
Henry Drawing for product designers
CN101377854B (en) Method for simulating Chinese characters hand-written handwriting by a computer
CN101465074A (en) Method for evaluating hand-written Hanzi layout
CN102637078B (en) A kind of Chinese character pattern generation method of structure optimization
CN101599180B (en) Automatic generation method of imitative computer calligraphy based on handwriting style
CN106611172B (en) A Chinese Character Synthesis Method Based on Style Learning
CN107622710A (en) Digitize writing practising method and system
Wang et al. Evaluation of Chinese calligraphy by using DBSC vectorization and ICP algorithm
CN106056055A (en) Sanskrit Tibetan online handwritten sample generation method based on component combination
Cheng et al. From concept to space: a new perspective on AIGC-involved attribute translation
CN101393643B (en) Computer stroke deforming system and method
Liu et al. Automatic generation of personalized Chinese handwriting characters
Fuad et al. Okkhor-diffusion: class guided generation of bangla isolated handwritten characters using denoising diffusion probabilistic model (DDPM)
CN104077798B (en) High-reality-sense animation synthesis method for deformable object
Zhou et al. A computational evaluation system of Chinese calligraphy via extended possibility-probability distribution method
Zhou et al. Human motion variation synthesis with multivariate Gaussian processes
He [Retracted] Evaluation and Stratification for Chinese International Education Quality with Deep Learning Model
Sampath Quantifying scribal behavior: a novel approach to digital paleography
Yu Research on the application of artificial intelligence painting in digital media illustration design
Mansure et al. Finding San Carlino: Collected Perspectives on the Geometry of the Baroque
Leymarie et al. Medialness and the perception of visual art
Chen et al. Data‐driven Handwriting Synthesis in a Conjoined Manner
Zhou et al. A Study on the Promoting Effect of Augmented Reality Design on Senior High School Students’ Understanding of Portrait Depiction in “A Dream of Red Mansions”
Lelièvre Pictorial Composition-Modeling, Perception & Creation

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20120118

Termination date: 20130921