CN101393643B - Computer stroke deforming system and method - Google Patents
Computer stroke deforming system and method Download PDFInfo
- 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
- mrow
- stroke
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 52
- 239000013598 vector Substances 0.000 claims abstract description 232
- 239000011159 matrix material Substances 0.000 claims abstract description 22
- 238000013179 statistical model Methods 0.000 claims abstract description 18
- 230000008859 change Effects 0.000 claims description 15
- 230000005484 gravity Effects 0.000 claims description 8
- 238000005070 sampling Methods 0.000 claims description 6
- 230000000694 effects Effects 0.000 abstract description 4
- 230000008569 process Effects 0.000 description 17
- 230000000007 visual effect Effects 0.000 description 8
- 238000005094 computer simulation Methods 0.000 description 6
- 238000004088 simulation Methods 0.000 description 5
- 238000004364 calculation method Methods 0.000 description 4
- 230000003993 interaction Effects 0.000 description 4
- 238000000513 principal component analysis Methods 0.000 description 4
- 239000003795 chemical substances by application Substances 0.000 description 3
- 238000013461 design Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 238000010422 painting Methods 0.000 description 3
- 230000008447 perception Effects 0.000 description 3
- 241000282414 Homo sapiens Species 0.000 description 2
- 238000013528 artificial neural network Methods 0.000 description 2
- 230000003796 beauty Effects 0.000 description 2
- 210000004556 brain Anatomy 0.000 description 2
- 230000001149 cognitive effect Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000007792 addition Methods 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000015572 biosynthetic process Effects 0.000 description 1
- 230000019771 cognition Effects 0.000 description 1
- 230000003920 cognitive function Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000004927 fusion Effects 0.000 description 1
- 230000008570 general process Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 238000012804 iterative process Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000003909 pattern recognition Methods 0.000 description 1
- 229920001983 poloxamer Polymers 0.000 description 1
- 230000008433 psychological processes and functions Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 239000004575 stone Substances 0.000 description 1
- 238000003786 synthesis reaction Methods 0.000 description 1
- 230000002123 temporal effect Effects 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 230000017105 transposition Effects 0.000 description 1
- 230000001755 vocal effect Effects 0.000 description 1
Images
Landscapes
- Character Discrimination (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention provides a computer stroke deformation method and a device thereof. The method comprises the following steps: providing a sample space including a plurality of stroke sample vectors; ranking the stroke sample vectors to ensure that the square sum of the difference between the ranked sample vectors and the average vector to be minimum; seeking all characteristic vectors of a covariance matrix for the ranked sample vectors and selecting the characteristic vector which can best reflect sample characteristics; forming a characteristic matrix by using the selected characteristic vector and building a statistical model, that is, X is approximately equal to x plus Phib, wherein x is the average vector of the ranked sample vectors; Phi is the characteristic vector, b is a parameter vector, and X is a stroke vector obtained after deformation. By changing the component of the parameter vector, the deformed stroke vector can be obtained. Since the invention takes the main characteristics of strokes as the basis of deformation, the entire effect and efficiency of character deformation can be improved. At the same time, a proper value can be taken for the parameter vector, so as to reflect individual aesthetic appreciation.
Description
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
Reviewing the half century history of the birth of artificial intelligence till now, people obtain once and again encouraging performances in the practice of understanding cognition and simulating thinking, for example, the fact that the four-color theorem is proved to surpass the chess champion shows that a computer system can exceed specially trained people in some aspects. However, the current thinking simulation does not have the ability of infants 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 pattern recognition and intuition when playing go. The root cause of this is the "bottleneck" of visual thinking, as pointed out by Mr. Qian scholaron. The visual thinking of the right brain is always of paramount importance to this difficult task, converting intuitive insight into logical, verbal sequences.
Computer simulation of visual thinking may have two points of entry: firstly, the basic conclusion of cognitive neuroscience is based and fundamental, and only the current basis is very limited; the other is directly from the image thinking process. Calligraphy creation is a typical visual thinking process.
The Letter Spirit project of Indiana university models and simulates the perception and creation of English Letter fonts, attempts to model the central content of high-level perception and creation of human beings, and designs different styles of one Letter and the same style of different letters. Hofstadter Douglas et al, CRCC Technical Report, No.68, Bloomington: this is described in "An Emergent Model of the Perception and discussion of Alphabet" published in Indiana University. This article is incorporated herein by reference. The modeling method takes one or more letters as 'seeds' to form the beginning of a certain style, and then forms different character sets with consistent style and complete design through the interaction of four agents (agents). The four agents are imagination (Imaginer), draft (draft), examination (exainer) and adjustment (adodicator), respectively, which are an iterative process. Since "creation" is limited to grid fonts (gridfonts), the result is only a different selection combination, and is suitable for creation of "art words", in which the basic dot line does not need to be changed. In fact, the above method is a "instructor" creation and no final result is seen.
Grebert I, et al, published "An Example form grid" in connection construction general teaching for Production, "Neural Networks, published 5.1992, and proposed that a three-layer Neural network be used to learn five, a person-designed grid font, and then learn the fourteen letters of another person-designed grid font. The network is then asked to construct the remaining twelve letters. Although this method sometimes outputs an unrecognizable letter, it has some meaning. However, this approach has no conceptual basis, no internal conceptual structure and boundaries, no temporal relationships and no interaction and feedback. In addition, letter generation is parallel, and letter generation has no effect on the rest. The contents of said article are included herein by reference.
Calligraphy creation is a process of swinging a pen by fingers of a human brain, the pen is an creation and expression tool, and results of image thinking activities need to be reflected by a writing brush. Thus, it has been proposed to simulate the physical process of calligraphy stroke generation with a parameterized model. For example, Wang Helena T.F. published "A Model-based Synthesis of Chinese Calligraph" on pages 99-113 of Computers & Graphics, 2000, 24, which uses a virtual pen to capture the three-dimensional geometric parameters of the pen, the characteristics of the pen hair, and the variation of ink along the trajectory of the pen stroke; the 'virtual brush pen model for electronic painting and calligraphy creation' published in 2004, 34(12) of xu changhua, et al, pages 1359-1374 also provides a model for a virtual brush pen for painting and calligraphy creation based on a solid modeling technology, and a simulation framework for interactive electronic painting and calligraphy creation by using the model. Although the two methods are not visual, the computer simulation of the book creation ultimately requires such technical support. The contents of both of the above articles are incorporated herein by reference.
A Calligraphy creation method based on comprehensive reasoning is introduced in the text of Automatic Generation of academic Chinese calligraph published by Xusonghua et al at pages 32-39 of IEEE Intelligent Systems, 5/6/20 (3) 2005. Although the method uses the information of each image source (calligraphy character), the aesthetic constraint is difficult to embody due to the random selection of the weight value, the character deformation efficiency is low, and lines and subtle parts cannot be involved. Therefore, this method needs further improvement from the viewpoint of image thinking or aesthetic sense. The contents of the above article are incorporated herein by reference.
The real calligraphy creation is closely related to the beauty of individuals, and is a psychological process which is difficult to say at present. For a work, subtle changes sometimes cause large or aesthetic or ugly differences. Therefore, there is a need for a method and system that can both embody an individual's aesthetic perspective and provide font morphing efficiency.
Disclosure of Invention
The invention aims to provide a method and a system which can not only embody the personal aesthetic viewpoint, but also provide the font deformation efficiency.
In accordance with one aspect of the present invention, a computer stroke morphing method is provided. The method comprises the following steps:
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:
wherein,is the average vector of the ordered sample vectors, Φ is the feature matrix, b is the parameter vector, and X is the stroke vector obtained after the deformation; and
changing components of the parameter vector to obtain a deformed stroke vector.
In the method of the present invention, said step of ordering said plurality of sample vectors may comprise 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 determination is greater than the set value, normalizing the plurality of aligned sample vectors using the aligned average vector as a new reference, and repeating steps (c) - (d);
(g) and if the judgment result is not larger than the set value, obtaining the plurality of ordered sample vectors.
In the method of the present invention, the deviation of the aligned average vector from the reference may be a distance between the aligned average vector and the reference.
In the method of the present invention, the step of selecting a plurality of feature vectors that best reflect the features of the sample from the obtained feature vectors may include 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
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.
In the method of the present invention, the number of the selected feature vectors may be 3, and the parameter vector may have three components, wherein a first component substantially represents "fat" or "thin" of the deformed obtained stroke, a second component substantially represents "long" or "short" of the deformed obtained stroke, and a third component substantially represents "square" or "round" of the deformed obtained stroke.
The method of the present invention may further comprise 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.
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.
In accordance with another aspect of the present invention, a computer stroke morphing device is provided. The apparatus comprises:
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:
wherein,is the average vector of the ordered sample vectors, Φ is the feature matrix, b is the parameter vector, and X is the stroke vector obtained after the deformation; and
means for changing components of the parameter vector to obtain a deformed stroke vector.
In the apparatus of the present invention, the means for ordering the plurality of sample vectors may comprise:
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 obtaining the plurality of ordered sample vectors if the determination is not greater than the set value.
In the apparatus of the present invention, the deviation of the aligned average vector from the reference may be a distance between the aligned average vector and the reference.
In the apparatus of the present invention, the means for selecting a plurality of feature vectors that best reflect the features of the sample from the obtained feature vectors may include:
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:
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.
In the apparatus of the present invention, the number of the selected feature vectors may be 3, and the parameter vector may have three components, wherein a first component substantially represents "fat" or "thin" of the deformed obtained stroke, a second component substantially represents "long" or "short" of the deformed obtained stroke, and a third component substantially represents "square" or "round" of the deformed obtained stroke.
The apparatus of the present invention may further comprise:
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.
In the apparatus of the present invention, said characteristic points may comprise turning points on said contour, and Bezier curve control points located between said turning points.
Because some main characteristics of the strokes are used as the basis of deformation in the modeling process, the overall effect and efficiency of font deformation can be improved to a certain extent. Meanwhile, the parameter representing the main characteristic is subjected to proper value taking, so that the aesthetic view of the individual is reflected.
Drawings
FIG. 1 illustrates a computer simulation-based process for handwriting copying and authoring;
FIG. 2 illustrates feature points resulting from automatic sampling of "horizontal strokes";
FIG. 3 is a flow chart of sample ordering according to one embodiment of the present invention;
FIG. 4 is a flow diagram of modeling using principal component analysis in accordance with an embodiment of the present invention.
FIG. 5(a) shows the outline of three cross-hatching words in a first sample space in accordance with an embodiment of the present invention;
FIG. 5(b) shows the outline of three cross-hatching words in a second sample space in accordance with an embodiment of the present invention;
FIG. 6(a) illustrates a variation of "horizontal stroke" in a first sample space;
FIG. 6(b) illustrates a variation of "horizontal stroke" in the second sample space;
FIG. 6(c) illustrates another variation of "horizontal stroke" in the second sample space;
FIG. 7(a) illustrates a variation of the "horizontal stroke" in the third sample space;
FIG. 7(b) illustrates another variation of "horizontal stroke" in the third sample space;
FIG. 8 illustrates the contours of four "dashes" in a fourth sample space in accordance with an embodiment of the present invention;
FIGS. 9(a) - (e) illustrate a variation of the word "horizontal stroke" in the fourth sample space; and
fig. 10(a) - (f) illustrate two variations of the "cross-bar" word in the fourth sample space.
Detailed Description
The evolution of Chinese characters not only conforms to the general law of character development, but also has artistic connotation and aesthetic characteristics all the time.
The calligraphy history tells us that the general process of book body evolution is as follows: based on the existing font, according to the simple and standard requirements and the principle of beauty, the strokes are added, deleted and combined, the line type is changed, the structure is adjusted, the response is strengthened, and the personality is reflected, namely the characters are saved, changed and changed, and are easy to meet. The visual thinking process with modification and addition and deletion as the core is adopted.
In real life, people who have a certain calligraphy to be maintained are far from enough to copy a stone poster. After a plurality of types of the tombstones are copied, characters written without the copied tombstones are different from the copied objects always, but the characteristics of the copied tombstones still remain. For example, after several kinds of liberal, the liberal is independently written, and the liberal written independently is not identical to any one of the adjacent signatures, but has similarities of different degrees. If a plurality of copybooks are copied and different book bodies are involved, the style of the individual can be gradually developed.
Creating a personal style is an authoring process that can be summarized as "copy/memory-fuse-morph/author". FIG. 1 illustrates a computer simulation-based calligraphy copying and creation process that relies on visual thinking at the time of copying, memory and creation. The study, the copying and the reading of calligraphy works are the first links of calligraphy learning. On the basis of the link, learners can naturally filter uneven noise on the carved stroke contour to realize the smoothness and further fitting of the stroke contour, which is the basic function of thinking and is also the necessary pretreatment before creation. The following is the memorization of the calligraphic work, which is not in fact a complete reproduction process, corresponding to which it is reproduced. Stroke fusion, font change and overall creation are gradually and deeply processes, and some parts in the result can be used as copy objects. Of course, when copying the calligraphy works, the originally memorized contents also play a role.
When such a calligraphy authoring process is simulated in a computer, the simulation process can be summarized as "basic word imagination" + "thinking play", in which the former is realized by storage, which is the peculiarity of the computer, and the latter is the key content of the computer simulation. Ideally, it is best to template a certain structural hierarchy, but there is no current conclusion in this regard from cognitive neuroscience.
For ease of description, the following discussion will use lines as elements.
Chinese calligraphy is an excellent calligraphy, the core is 'horizontal stroke', on the basis of simulating 'horizontal stroke', the creation of simulating other strokes is relatively easy, so that a single character can be created, and the chapter can be created.
Firstly, the invention uses the 'fat' and 'thin' of the font, the 'long' and 'short' of the stroke, the 'square' and 'round' of the line end as the characteristic parameters, and tries to preliminarily carve the basic appearance characteristics of the font. Of course, other appearance characteristics can be used as parameters.
Then, a model with parameters is established, and the shape of the stroke is controlled by the parameter b:
X=M(b) (1)
where b is a parameter vector that can be used to adjust the dominant shape of a sample in a sample space. In one embodiment, the samples are horizontal lines, and the samples in a sample space may be all or a portion of the horizontal lines from a particular signature, all or a portion of the horizontal lines from multiple signatures in one font, or all or a portion of the horizontal lines from multiple fonts. In other embodiments, the sample may be a stroke such as vertical stroke, dot, or zigzag, or even a Chinese character. The dimension of the vector b reflects the number of dominant features. M represents a statistical model for reflecting 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 xs result, and the desired glyph is "authored" for output.
The model M is preferably constructed such that the sample principal features can be associated with the feature parameters of the font type by the parameter vector b. In one embodiment, it is expected that in the created statistical model M, the influence of the first component of the parameter vector b can reflect the change of font "fat" and "thin", the influence of the second component of the parameter vector b can reflect the change of stroke "long" and "short", and the influence of the third component of the parameter vector b can reflect the change of line end "square" and "circle". In this case, the dimension of the vector b is 3, and the vector b can be composed of three components, i.e., "fat" or "thin", long "or" short "and" square "and" round ". The following describes a process for building the statistical model of the present invention.
1. Point set positioning
In order to establish a model of the overall outline, firstly, some characteristic points are found out from the outline of the character through human-computer interaction to outline the shape of the character, and the points reflect the structure of the character and the change of the character. Such points are typically turning points on the boundary where the curvature varies greatly, usually where two strokes intersect, or where the tip of the pen changes abruptly. However, the use of these dots alone is not sufficient to describe the shape information of the text. In order to accurately describe the text outline, some points are automatically averaged by using a Bezier curve method among the positioned mark points along the outline so as to better outline the shape of the text.
Fig. 2 shows the feature points obtained by automatic sampling of "horizontal lines", where square points represent points on the contour line with greater curvature and points added along the contour, and circular points represent the control points of the bezier curve. If the feature points are too few, the stroke features cannot be shown; conversely, if there are too many feature points, not only the amount of calculation increases, but also significant noise is introduced.
For a stroke contour sample, if the coordinate of the ith feature point on the sample is set as { (x)i,yi) Then this stroke can be represented by the following vector:
X=(x1,...,xn,y1,...,yn)T (2)
where T denotes transposition. X is a column vector. If there are s samples in the sample space, then it means that there are s column vectors. These s column vectors constitute a matrix in the sample space.
2. Sample ordering
When building a model, it is desirable to eliminate components that are not shape dependent or that are not very relevant. It is generally necessary to arrange the data using a method of stacking a large number of samples. In one embodiment, the Generalized Pluronic Analysis (GPA) method is used. The main idea of the GPA method is: firstly, the gravity center of each sample vector is translated to an original point, then the amplitude of each translated sample vector is normalized, and finally, the average shape is obtained by repeatedly rotating the observation object until the arranged vector is obtained.
FIG. 3 is a flowchart of sample ordering according to one embodiment of the invention. In the present embodiment, assuming that the sample space has s samples, n feature points are sampled for each sample, and each feature point is located on the 2-dimensional space. Thus, each sample vector in the sample space can be represented as:
X=(x1,…,xn,y1,…,yn)T (3)
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 may be calculated first:
the center of gravity of each sample vector is then translated to the origin. The translated sample vector may be represented as:
X=(x1,…,xn,y1,…,yn)T,
in step S4, the magnitude of each translated sample vector is normalized, also referred to as warped. For example, the vector length | X | may be calculated first. The normalized sample vector may be represented as:
X=(x1,…,xn,y1,…,y2)T
in step S5, one of the plurality of normalized sample vectors is set as a reference vector X0. In one embodiment, let X0=X1. In step S6, with X0For reference, an alignment operation is performed on the normalized sample vector. For example, the aligned sample vector may be obtained by the following calculation:
Xm=(xm1,…,xmn,ym1,…,ymn)T,m=1,…,s (7)
In step S10, still X0For reference, the vector is averaged according to equation (7)And carrying out alignment operation to obtain an aligned average vector.
In step S12, the aligned average vector is compared with the reference vector X0. For comparison. 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 is replaced with the aligned average vector0And normalizing the magnitude of the current aligned sample vector. Subsequently, the process returns to step S6 to loop.
If the deviation between the two vectors is not greater than the set value in step S12, the process proceeds to step S16, and the aligned sample vector obtained in step S6 in the present cycle is output, thereby obtaining an aligned sample set.
In a preferred embodiment, step S12 is to combine the distance L between two vectors with a predetermined value L0Comparison, wherein the distance L can be calculated according to equation (9).
Step S12 may also calculate other parameters to represent the aligned average vector and the reference vector X0The deviation therebetween.
The GPA method arranges all samples after they have been aligned so that the sum of the squares of their differences from the average vector is minimal, i.e. it is
3. Model building
If a sample space contains s samples, each sample contains n feature points, and each feature point is located on a 2-dimensional space, the amount of calculation is large when n is large. Therefore, for the convenience of calculation, it is necessary to reduce the number of samples s in the sample space to a range that is easy to calculate.
In one embodiment of the present invention, all eigenvectors φ of the covariance matrix S are calculated when all S samples are calculatediAnd its corresponding characteristic value lambdaiThen, the eigenvalues of the sample covariance matrix are analyzed by Principal Component Analysis (PCA), and t eigenvectors are selected from the eigenvalues to form an eigen matrix Φ. Here, the t feature vectors that are sorted out must be able to reflect the dominant features of the sample.
FIG. 4 is a flow diagram of modeling using principal component analysis in accordance with an embodiment of the present invention. As shown in fig. 4, in step S22, an average vector of the S arranged sample vectors is calculated according to equation (11)
Then, in step S24, a covariance matrix S is calculated:
in step S26, all eigenvectors φ of covariance matrix S are obtainediAnd its corresponding characteristic value lambdai. At step S28, press λi≥λi+1Is directed to the feature vector phiiAnd (6) sorting. In step S30, t eigenvalues λ are selected from large to smalliSo that it satisfies the following formula (13):
wherein, VTRepresenting all eigenvalues λiSum of (a) and fvIs a predetermined one that is covered to reflect the statistical model to be builtThe proportional value of the present variation is, for example, 96%.
In step S32, the selected t eigenvalues λ are compared withiCorresponding feature vector phiiForming a feature matrix Φ:
Φ=(φ1|φ2|…φt) (14)
the t feature vectors thus selected can reflect the dominant features of the sample.
Then, in step S34, the following statistical model is established:
wherein,is the average vector calculated according to equation (11), phi is a matrix composed of t eigenvectors, b is a t-dimensional column vector, and corresponds to the "principal component".
In one embodiment, t is 3. In this case, b is a 3-dimensional column vector, and b ═ b1,b2,b3]. When reasonable values are assigned to the components of the vector b, a new stroke similar to the original sample is obtained using a statistical model (23).
4. Simulation result of strokes
Fig. 5(a) and 5(b) show three "cross-hatched" contours obtained from the original samples of two different monuments, respectively. Assuming that three "one" -shaped contours shown in fig. 5(a) constitute the first sample space, fig. 5(b) shows that three "one" -shaped contours constitute the second sample space.
In one embodiment, the corresponding statistical models are established for the first sample space and the second sample space through the three steps of point set positioning, sample sorting, model establishment and the like. Then, the shape change of the "horizontal stroke" is performed in the first and second sample spaces, respectively. For example, the parameter b ═ (b) may be taken1,b2,b3)TWherein b is1The character 'fat' and 'thin' are expressed, b2Features indicating "long", "short" strokes, b3Indicating the "square", "round" characteristics of the line ends. FIG. 6(a) illustrates a variation of the "horizontal stroke" in the first sample space. From top to bottom, b1The values of (A) are 0.10, 0.05, 0, -0.05 and-0.10 in sequence (determined by man-machine interaction); b2And b3Always take 0. In the variation shown in fig. 6(a), "horizontal stroke" is substantially "thinned" by "fat", but the length and circumference are substantially unchanged. Fig. 6(b) illustrates a variation of the "horizontal stroke" in the second sample space. From top to bottom, b1The values of (A) are 0.10, 0.05, 0, -0.05 and-0.10 in sequence; b2And b3Always take 0. In the variation shown in fig. 6(b), "horizontal stroke" is substantially "thinned" by "fat," but the length is substantially unchanged. Fig. 6(c) illustrates another variation of the "horizontal stroke" in the second sample space. From top to bottom, b1And b3Always taking 0; b2The values of (A) are 0.20, 0, -0.20 and 0.50 in sequence. In the variation shown in fig. 6(c), "horizontal stroke" is varied in length, but "fat", "thin" and "square" and "round" are basically unchanged.
In another embodiment, the "horizontal lines" in the first and second sample spaces are merged into a third sample space, and a statistical model is established through the three steps of point set positioning, sample sorting, model establishment and the like. Fig. 7(a) illustrates a variation of the "horizontal stroke" in the third sample space. From top to bottom, b1Are sequentially 0.15, 0.10, 0.05, 0, -0.05, -0.10 and-0.15;b2and b3Always 0. In the variation shown in fig. 7(a), "horizontal stroke" is substantially "thinned" by "fat", but the length and circumference are substantially unchanged. Fig. 7(b) illustrates another variation of the "horizontal stroke" in the third sample space. From top to bottom, b2Sequentially taking 0.05, 0 and-0.05; b1And b3 is always 0. In the variation shown in fig. 7(b), the length of the horizontal stroke is varied, but the "fat", "thin" and "square" and "round" are basically unchanged. The glyphs of FIGS. 7(a) -7(b) are more varied than the glyph variations of FIGS. 6(a) -6(c), resulting in shapes that are different from the first sample space and the second sample space.
Fig. 8 shows four "cross-hatched" contours, which constitute a fourth sample space. In this embodiment, a corresponding statistical model is established for the fourth sample space through the three steps of point set positioning, sample ordering, model establishment, and the like. Then, a font change of "horizontal stroke" is performed in the fourth sample space. In fig. 9, the vector b contains 3 elements b1,b2And b3Wherein in (a), b [ -0.10, 0 [ ]]Wherein, b is [ -0.05, 0 ]]In (c), b is [0, 0 ]]In (d), b is [0.05, 0 ]]In (e), b is [0.10, 0 ]]. In the variation shown in fig. 9a-9e, the "horizontal stroke" is substantially "thinned" by the "fat", but the length and circumference are substantially unchanged. In fig. 10, (a) - (c) images correspond to the adjustment component b2The other components are unchanged, wherein the length of the horizontal stroke is changed, but the fat, the thin and the square and the circle are basically unchanged. (d) The (f) image corresponds to the adjustment component b3The other elements are unchanged, wherein the 'square' and 'circle' of the 'horizontal stroke' are changed, but the 'fat', the 'thin' and the length are basically unchanged.
Although three components b of the vector b1、b2、b3Can mainly affect the 'fat' and 'thin' characteristics of the font, the 'long' and 'short' characteristics of the stroke, and the 'square' and 'round' characteristics of the line end, but as can be seen from fig. 6, 7, 9 and 10, one component b in the parameter biNot only does the change in (b) cause a change in a single characteristic, itThe entire font may be changed to some extent.
5. Creation of characters
Based on the stroke simulation, the character creation can be carried out.
Those skilled in the art will appreciate that the various steps described in the foregoing embodiments may be implemented by computer hardware, computer software, or a combination of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the overall system. The skilled person will recognize the interactivity of the hardware and software in these cases and how best to implement the functionality described 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.
The implementation or performance of various steps described in connection with the embodiments described herein may be used: 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 device, 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, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP core, or any other such configuration.
While the preferred embodiments of the present invention have been described above, the present invention is not limited thereto. Various changes and modifications can be made by those skilled in the art based on the above description. Various modifications and changes without departing from the spirit of the invention should fall within the scope of the invention. The 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:
wherein,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
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:
wherein,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:
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.
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)
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)
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 hand-written Chinese characters recognition method based on statistic structural features |
CN1936961A (en) * | 2005-09-23 | 2007-03-28 | 威锋数位开发股份有限公司 | Edge-shadow-guide grey-to-grey character font producing method |
-
2007
- 2007-09-21 CN CN2007100462301A patent/CN101393643B/en not_active Expired - Fee Related
Patent Citations (4)
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 hand-written Chinese characters recognition method based on statistic structural features |
CN1936961A (en) * | 2005-09-23 | 2007-03-28 | 威锋数位开发股份有限公司 | Edge-shadow-guide grey-to-grey character font producing method |
Non-Patent Citations (1)
Title |
---|
***等.基于数学形态学的图像汉字笔划细化和提取.《合肥工业大学学报(自然科学版)》.2005,第28卷(第11期),全文. * |
Also Published As
Publication number | Publication date |
---|---|
CN101393643A (en) | 2009-03-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Taricani et al. | A technique for automatically scoring open-ended concept maps | |
Forbus et al. | CogSketch: Sketch understanding for cognitive science research and for education | |
Xu et al. | Automatic generation of artistic Chinese calligraphy | |
Lian et al. | EasyFont: a style learning-based system to easily build your large-scale handwriting fonts | |
US8358320B2 (en) | Interactive transcription system and method | |
Plamondon et al. | Personal digital bodyguards for e-security, e-learning and e-health: A prospective survey | |
Schwartz | Models, simulations, and exploratory environments: A tentative taxonomy | |
Zhang et al. | Application analysis of computer graphics and image aided design in art design teaching | |
Krämer et al. | Thinking with diagrams: The semiotic basis of human cognition | |
CN101393643B (en) | Computer stroke deforming system and method | |
Martins et al. | Evotype: from shapes to glyphs | |
Clayson | Broadening constructionism through visual modelling: My self as subject and object | |
CN109859565A (en) | A kind of method and device generating copybook for calligraphy | |
Zhou et al. | A computational evaluation system of Chinese calligraphy via extended possibility-probability distribution method | |
Sarr et al. | Djehuty: A mixed-initiative handwriting game for preschoolers | |
Xu et al. | Automatic facsimile of chinese calligraphic writings | |
Celine et al. | Multimodal acquisition and analysis of children handwriting for the study of the efficiency of their handwriting movements: the@ MaGma challenge | |
Nowviskie | How to play with maps | |
Xie et al. | The Construction of English Teaching Platform Based on Artificial Intelligence Under Computer-Aided Design | |
Sturdevant et al. | Delivering data differently | |
Savolainen | Expanding human-computer interaction by computer-aided creativity | |
Zhou et al. | Style Conversion of Fine Arts Based on Deep Learning Algorithms and CAD Technology | |
Chen et al. | Effects of generating a large amount of artificial patterns for on-line handwritten Japanese character recognition | |
Chu | The cognitive aspects of Chinese character processing | |
Neris et al. | Self organizing maps and bit signature: a study applied on signal language recognition |
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 |