Specific embodiment
Fig. 1 is the flow chart of character image processing method embodiment of the present invention, the method can by with
Manage device to perform, the processing meanss can be integrated in user equipment, in such as computer.As shown in figure 1,
The method comprises the steps:
In the described pending character picture of step 101, the pending character picture of reception and user input
The feature stroke of character.
In the present embodiment, the character quantity included in above-mentioned pending character picture is one.For a width
For including the picture of multiple characters, can be cut in advance include single character one by one
Character picture, and then processed using the methods described for being carried out example offer.
After processing meanss receive above-mentioned character picture, user can be directed to the word in the character picture
Symbol selects its feature stroke, and then the feature stroke input processing device that will be selected.
Specifically, on display interface is received, feature stroke option, the choosing of this feature stroke can be shown
Various features stroke is contained in, such as:Point, cross break, lifting-hook, slash, right-falling stroke etc., user can be with
Operated selecting the feature stroke of character in the character picture being input into by choosing, this feature stroke can be
One can also be multiple.
What deserves to be explained is, user when feature stroke is selected, as far as possible selects not intersect with other strokes
Or intersect less stroke.
By taking the word forever shown in Fig. 2 as an example, the feature stroke that user selects is point, cross break, lifting-hook.
Step 102, the profile for recognizing character in the pending character picture, generate character outline picture,
And the corresponding data acquisition system of the character outline picture is obtained, the point coordinates included in the data acquisition system is used
In the description character outline curve.
Specifically, pending character picture can be resolved to array of pixels, each array of pixels is illustrated
The position of corresponding pixel points and the color of pixel.And then can be with the pending character of receiving user's input
The color of character in picture, wherein, user can select the color of the character in color options table.
So as to by the color filling of color in each pixel and the unmatched pixel of color of the character with default
Background colour, such as white.So as to, remaining region is the region that character is located, and then by character institute
In region, above-mentioned background colour is also filled in addition to boundary line, character outline picture is obtained, as shown in Figure 3.
In addition, after character outline picture is obtained, obtaining the corresponding data set of character outline picture
Close, will character outline picture change into point coordinates describe data acquisition system, to describe the profile of the character
Curve.Specifically, can be with the bottom left vertex of character outline picture as zero, pixel is coordinate list
Coordinate system is set up in position, then the coordinate figure of each pixel according to character outline picture under the coordinate system,
Generate the data acquisition system described with point coordinates.
Step 103, feature stroke number corresponding with the feature stroke is determined from the data acquisition system
According to subclass, feature pen corresponding with the feature stroke is generated according to the feature stroke data subclass
Picture piece.
After having been received by the feature stroke of user input and getting above-mentioned data acquisition system, Ke Yicong
The corresponding feature stroke data subclass of this feature stroke is identified in the data acquisition system.Because above-mentioned data
The data of each stroke in above-mentioned character are contained in set, that is, constitutes each coordinate points for comparing.So as to,
Stroke feature analysis can be carried out to above-mentioned data acquisition system with reference to the feature stroke of user input, to determine
The data subset for going out this feature stroke for wherein including is closed, it is thus possible to according to this feature stroke data
Set generates feature stroke picture corresponding with feature stroke.Wherein, due to the feature stroke number for identifying
According to subclass constitute be feature stroke contour line, can in the contour line Fill Color such as black,
Such that it is able to the spy that the feature outline strokes for being filled with black are saved as white background, black fore directly
Stroke picture is levied, several feature stroke pictures as shown in Fig. 4, Fig. 5, Fig. 6.
Step 104, the data that corresponding each fixed reference feature stroke data is distinguished from each font classification that is stored with
In storehouse, the fixed reference feature stroke data under all kinds of font classifications corresponding with the feature stroke is selected, and
Generate fixed reference feature stroke picture corresponding with each fixed reference feature stroke data.
In the present embodiment, above-mentioned data base is pre-build, in the data base, has preserved font classification information,
And under each font classification each fixed reference feature stroke fixed reference feature stroke data.Wherein, the reference
Feature stroke data can be obtained from character library.The fixed reference feature stroke data describes correspondence reference
The point coordinates information of feature stroke.
Wherein, the classification fineness to font, can determine according to actual needs, under each font classification
A font can only be included, it is also possible to comprising a few money fonts.In the present embodiment, only with each font class
Illustrate as a example by a font is only included under other.
The data of multiple fixed reference feature strokes that category font packet contains can be included under each font classification, i.e.,
Fixed reference feature stroke data, point coordinates information of the data for fixed reference feature stroke, i.e. point coordinates set.
And, for such as skimming this fixed reference feature stroke for same fixed reference feature stroke, which is in different words
Point coordinates information under body classification is different.
In order to determine the font in pending character picture corresponding to character, in the present embodiment, according to user
Input the character feature stroke, select from data base it is corresponding with this feature stroke all referring to
Feature stroke, that is, select corresponding all referring to feature stroke data.Such as feature stroke " point "
For, " point " the fixed reference feature stroke data under font of all categories is selected from data base.Further,
Generate and the corresponding fixed reference feature stroke picture of each corresponding fixed reference feature stroke data, i.e., it is each right according to this
The fixed reference feature stroke data answered draws corresponding fixed reference feature outline strokes, and fills with color, such as
The solid colour filled in black, with feature stroke picture.
Step 105, calculating feature stroke picture phase respectively with each fixed reference feature stroke picture
Like degree, and determine that the font classification corresponding to the fixed reference feature stroke picture with highest similarity is described
Target font classification in pending character picture belonging to character.
For for each fixed reference feature stroke picture, feature stroke picture and fixed reference feature pen are calculated respectively
The similarity of picture piece, wherein, the similarity can such as be the distance degree of corresponding pixel points in two pictures
Amount result, or, sub-zone dividing, each sub-regions in two pictures of tolerance can also be carried out to each picture
In include the matching of pixel quantity, the matching degree of corresponding pixel points color etc..
In order to ensure the accuracy of Similarity Measure, in the present embodiment, optionally, calculating feature stroke
Picture respectively with the similarity of each fixed reference feature stroke picture before, also include:
According to each fixed reference feature stroke data, and the type of the feature stroke, respectively to described
Feature stroke picture zooms in and out, cut out process, obtain respectively with each fixed reference feature stroke picture one
One corresponding feature stroke picture;
So as to calculate feature stroke picture similarity respectively with each fixed reference feature stroke picture, bag
Include:Calculate each feature stroke picture similarity respectively with corresponding fixed reference feature stroke picture.
That is, for features described above stroke picture, according to corresponding fixed reference feature under every class font
Stroke data, is zoomed in and out respectively to this feature stroke picture, cutting, under ensureing which with every class font
Corresponding fixed reference feature stroke picture has identical tolerance ratio.
Specifically, can be according to the different type of feature stroke, according to correspondence fixed reference feature under all kinds of fonts
Stroke data, scales in different ways, cuts out.
For example, for point, the feature stroke of type such as skim, carry, according to the width of stroke center of gravity
To calculate scaling.Correspondence fixed reference feature stroke is determined according to each fixed reference feature stroke data respectively
The width of center of gravity, further according to the width of the center of gravity of this feature stroke in feature image, calculates pantograph ratio
Example, zooms in and out process to feature stroke picture according to the scaling, so as to obtain from different with reference to special
Levy the corresponding feature stroke picture of stroke picture.
For another example, for the feature stroke comprising horizontal stroke, scaling can be calculated according to horizontal height;
For comprising perpendicular feature stroke, scaling is calculated according to perpendicular width.
Optionally, feature stroke picture can be cut into and fixed reference feature stroke data after scaling is completed
Described wide high identical feature stroke picture.The crop position of cross break is the lower section in horizontal left side and folding,
The crop position of lifting-hook etc. is perpendicular top.
In the present embodiment, what deserves to be explained is, each ginseng that can be included by every class font in data base
Examine feature stroke and one weight is set, the weight can be set with experience.
So as in similarity of the calculating feature stroke picture with each fixed reference feature stroke picture, with only
For one feature stroke picture, its Similarity Measure result is under this feature stroke picture and all kinds of fonts
The Similarity value of corresponding fixed reference feature stroke picture, or can also be special with the reference for the Similarity value
Levy the product of the weight of fixed reference feature stroke corresponding to stroke picture.And, the Similarity Measure result
It is also the Similarity Measure result of pending character picture and each font classification.
Again with comprising for multiple feature stroke pictures, such as selected feature stroke is a1, a2, a3,
Q1, q2, q3 are respectively with the Similarity value of each corresponding fixed reference feature stroke picture under a certain font classification,
And the weights of each corresponding fixed reference feature stroke are respectively w1, w2, w3, then final Similarity Measure is tied
Fruit q=(q1*w1+q2*w2+q3*w3)/(w1+w2+w3), it is as each corresponding with a certain font classification
The weighted mean of fixed reference feature stroke picture Similarity value.So as to the Similarity Measure result is also to treat
The Similarity Measure result of processing character picture and each font classification.
From the corresponding Similarity Measure result of all kinds of fonts, select with highest similarity result of calculation
Font classification be target font classification, the font classification may be considered character institute in pending picture
The font classification of category.So as to only include the situation of a font in the present embodiment in each font classification
Under, can accurately determine the font belonging to character in character picture.
In the present embodiment, for needing to carry out the pending character picture of font matching, character is firstly generated
Profile picture, the character outline curve data set included according to character outline picture and user input
The character feature stroke, generate feature stroke picture;Secondly, include under each font classification
Each fixed reference feature stroke corresponding with the feature stroke of user input is selected in each fixed reference feature stroke data
Data, generate each fixed reference feature stroke picture;Further, by pending character picture corresponding feature stroke
Picture carries out Similarity Measure with each fixed reference feature stroke picture, it is determined that the reference with highest similarity is special
It is the target font class in pending character picture belonging to character to levy the font classification corresponding to stroke picture
Not.By carrying out sophisticated category to font, by way of features described above stroke is matched, can accurately,
Font corresponding to character in character picture is matched conveniently and efficiently.
Fig. 7 is the flow chart of character image processing method embodiment of the present invention two, as shown in fig. 7, in figure
On the basis of 1 illustrated embodiment, in the case of including at least two font in the target font classification,
After above-mentioned steps 105, the method can also comprise the steps:
The character in step 201, the character picture of receiving user's input.
User by the character input included in pending character picture in processing meanss, such as by Fig. 2
The input of word forever in character picture.
Step 202, the font size that the character is determined according to the character outline picture.
Specifically, obtain in pending character picture after the character outline picture of character aforementioned, can
So that the font size of character is determined according to the pixels tall of character in the character outline picture.
What deserves to be explained is, in a particular application, due to the character of the size non-critical of font size in character library
Pixels tall, but be also left white part comprising certain, therefore, in concrete application, can be with the word
In symbol profile picture, the pixels tall of character is left white the font size that threshold value determines character plus certain.
Step 203, constrain by picture size of the font size, it is every at least two font using described in
Money font generates reference font picture corresponding with the character.
In the present embodiment, in the case where above-mentioned target font classification contains many money fonts, generate and be somebody's turn to do
The corresponding reference font picture of every money font of character.That is, each is right with reference to institute in font picture
" forever " word answered is write out using corresponding font, and font size size is according to character outline figure
The above-mentioned font size size that piece determines.
Step 204, pixels tall and the pending word for judging character in each reference font picture
Whether the difference in symbol picture between the pixels tall of character is more than predetermined threshold value, if being more than, performs step
Rapid 205-206, otherwise direct execution step 206.
In the present embodiment, in order to ensure the accuracy of above-mentioned font size determination, it is that follow-up measuring similarity is carried
For reliable premise, after each reference font picture is generated according to above-mentioned font size, can pass through will
Respectively compare to determine the word with reference to the pixels tall that font picture enters line character with pending character picture respectively
It is number whether accurate.
For any one in each reference font picture with reference to for font picture, if this refers to fontmap
Difference in piece in the pixels tall of character and pending character picture between the pixels tall of character is more than pre-
If threshold value, such as 10 pixel sizes, it is determined that the font size is inaccurate, needs to be adjusted, otherwise,
If less than or be equal to predetermined threshold value, then it is assumed that the font size accurately, can directly carry out the phase of step 206
Calculate like degree.
Step 205, the size that the font size is adjusted according to default step-length, and with the font size after adjustment as figure
Piece size constraint, the every money font at least two font using described in generate ginseng corresponding with the character
Examine font picture.
In the present embodiment, in simple terms, such as can be walked with an adjacent font size size as step-length
Long font size adjustment, it is also possible to which the degree of predetermined threshold value is more than according to above-mentioned difference, it is adjacent with such as two
Font size size is step-length, carries out font size size adjustment.
So as to reference font picture and character in pending character picture that the font size after with adjustment is generated
Pixels tall difference less than above-mentioned predetermined threshold value when, adjustment terminates, and meets the reference word of predetermined threshold value with this
Body picture carries out follow-up Similarity Measure.
The similarity of step 206, the calculating pending character picture and each reference font picture,
And determine that the font corresponding to the reference font picture with highest similarity is the pending character picture
Target font belonging to middle character.
The Similarity Measure mode of the pending character picture and each reference font picture and preceding feature stroke
Picture is identical with the calculation of each fixed reference feature stroke picture, repeats no more.Finally, determine target word
Under body classification, the font having with pending character picture corresponding to the reference font picture of highest similarity,
Font belonging to character in the pending character picture.
In the present embodiment, comprising in the case of the specific font of many moneys under each font classification, according to treating
In processing character picture, in the character outline picture of character, the pixels tall of character is foundation, determines character
Font size, so as to the font size as picture size constrain, generate target font classification under each font it is corresponding
With reference to font picture, with the similarity of pending character picture and each reference font picture as foundation, come true
The concrete font under target font classification in fixed pending character picture belonging to character, realizes belonging to which
The accurate match of font.
Fig. 8 is the structural representation of character picture processing device embodiment of the present invention, as shown in figure 8,
The character picture processing device includes:First receiver module 11, profile processing module 12, fisrt feature pen
Draw processing module 13, second feature stroke processing module 14, the first computing module 15.
First receiver module 11, for receiving the described pending of pending character picture and user input
The feature stroke of character in character picture.
Profile processing module 12, for recognizing the profile of character in the pending character picture, generates word
Symbol profile picture, and the corresponding data acquisition system of the character outline picture is obtained, wrap in the data acquisition system
The point coordinates for containing is used to describe the character outline curve.
Fisrt feature stroke processing module 13, for determining from the data acquisition system and the feature pen
Corresponding feature stroke data subclass is drawn, is generated and the spy according to the feature stroke data subclass
Levy the corresponding feature stroke picture of stroke.
Second feature stroke processing module 14, for distinguishing corresponding each reference from each font classification that is stored with
In the data base of feature stroke data, the ginseng under all kinds of font classifications corresponding with the feature stroke is selected
Examine feature stroke data, and generate fixed reference feature stroke pattern corresponding with each fixed reference feature stroke data
Piece.
First computing module 15, for calculate the feature stroke picture respectively with each fixed reference feature pen
The similarity of picture piece, and determine the font corresponding to the fixed reference feature stroke picture with highest similarity
Classification is the target font classification in the pending character picture belonging to character.
Optionally, described device also includes:Scaling cuts out module 16.
Scaling cuts out module 16, for according to each fixed reference feature stroke data, and the feature pen
The type of picture, zooms in and out to the feature stroke picture respectively, cuts out process, obtain respectively with each institute
State the one-to-one feature stroke picture of fixed reference feature stroke picture.
First computing module 15 is additionally operable to:Calculate each feature stroke picture respectively with corresponding ginseng
Examine the similarity of feature stroke picture.
Optionally, the profile processing module 12, including:Recognition unit 121, receiving unit 122,
Fills unit 123.
Recognition unit 121, for recognizing the color of each pixel in the pending character picture.
Receiving unit 122, for receiving character in the described pending character picture of the user input
Color.
Fills unit 123, for will be color in each pixel unmatched with the color of the character
The color filling of pixel is with default background colour.
The character picture processing device of the present embodiment can be used for the technology for performing embodiment of the method shown in Fig. 1
Scheme, which realizes that principle is similar with technique effect, and here is omitted.
Fig. 9 is the structural representation of character picture processing device embodiment of the present invention two, as shown in figure 9,
On the basis of embodiment illustrated in fig. 8, at least two font in the target font classification, is included;It is described
Device also includes:Second receiver module 21, determining module 22, generation module 23, the second computing module
24。
Second receiver module 21, for the character in the character picture of receiving user's input.
Determining module 22, for the font size of the character is determined according to the character outline picture.
Generation module 23, for constraining by picture size of the font size, at least two font using described in
In every money font generate reference font picture corresponding with the character.
Second computing module 24, for calculating the pending character picture with each reference font picture
Similarity, and determine that the font corresponding to the reference font picture with highest similarity is waited to locate for described
Target font in reason character picture belonging to character.
Wherein, the determining module 22 specifically for:
The font size of the character is determined according to the pixels tall of character described in the character outline picture.
Described device also includes:Judge module 25, adjustment generation module 26.
Judge module 25, for judging that the pixels tall of character in each reference font picture is treated with described
Whether the difference in processing character picture between the pixels tall of character is more than predetermined threshold value;
Adjustment generation module 26, for the judge module judge the difference more than predetermined threshold value when,
The size of the font size is adjusted according to default step-length, and is constrained by picture size of the font size after adjustment, adopted
Reference font picture corresponding with the character is generated with the every money font at least two font.
The character picture processing device of the present embodiment can be used for the technology for performing embodiment of the method shown in Fig. 7
Scheme, which realizes that principle is similar with technique effect, and here is omitted.
One of ordinary skill in the art will appreciate that:Realize all or part of step of said method embodiment
Can be completed by the related hardware of programmed instruction, aforesaid program can be stored in a computer-readable
Take in storage medium, the program upon execution, performs the step of including said method embodiment;And it is aforementioned
Storage medium include:ROM, RAM, magnetic disc or CD etc. are various can be with Jie of store program codes
Matter.
Finally it should be noted that:Various embodiments above is only illustrating technical scheme rather than right
Its restriction;Although being described in detail to the present invention with reference to foregoing embodiments, this area it is common
Technical staff should be understood:Which still can be modified to the technical scheme described in foregoing embodiments,
Or equivalent is carried out to which part or all technical characteristic;And these modifications or replacement, and
The scope of the essence disengaging various embodiments of the present invention technical scheme of appropriate technical solution is not made.