CN107491780A - A kind of anti-down hanging method of calligraphy based on SIFT - Google Patents
A kind of anti-down hanging method of calligraphy based on SIFT Download PDFInfo
- Publication number
- CN107491780A CN107491780A CN201710584019.9A CN201710584019A CN107491780A CN 107491780 A CN107491780 A CN 107491780A CN 201710584019 A CN201710584019 A CN 201710584019A CN 107491780 A CN107491780 A CN 107491780A
- Authority
- CN
- China
- Prior art keywords
- mrow
- msub
- image
- calligraphy
- sift
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/74—Image or video pattern matching; Proximity measures in feature spaces
- G06V10/75—Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
- G06V10/751—Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/23—Clustering techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/26—Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
- G06V10/267—Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion by performing operations on regions, e.g. growing, shrinking or watersheds
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/28—Quantising the image, e.g. histogram thresholding for discrimination between background and foreground patterns
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Multimedia (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Computation (AREA)
- General Engineering & Computer Science (AREA)
- Evolutionary Biology (AREA)
- Bioinformatics & Computational Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- Databases & Information Systems (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Software Systems (AREA)
- Character Input (AREA)
Abstract
The invention discloses a kind of anti-down hanging method of the calligraphy based on SIFT, calligraphy font image is pre-processed first, obtain the bianry image of calligraphy font, carry out convolution algorithm, introduce Gaussian difference scale space DOG operators, generate DOG metric spaces, the extreme point of calligraphy font image is detected again, final computing turns into Sift Feature Descriptors, matched with the radical in existing radical storehouse, immediate result is matched, the present invention solves the problems, such as that Chinese character is inverted by external friend present in prior art due to being ignorant of Chinese character.
Description
Technical field
The invention belongs to image matching method technical field, and in particular to a kind of anti-down hanging method of calligraphy based on SIFT.
Background technology
Chinese calligraphy's works are an important parts in traditional Chinese culture, have unique art form,
Establish one's own system, take the course of its own in world field, so also deep liked by foreign friend.In the family of many foreigners all
The calligraphy work of China can be seen, but due to the particularity of Chinese character, most of external friends not understanding Chinese characters
Composition, seen when calligraphy work is hung the situation energy.Trace it to its cause, it is more likely that when mounting just as being ignorant of in
State's word and be placed instead.Such as:One width calligraphy work is hung or is rotated by 90 °, 180 °, hung above and below 270 ° or spool etc.
Deng, make us annoyed and sneered at the behaviours or things made, be highly desirable provide a method come identify calligraphy hang situation, so as to prevent China calligraphy
Works are abroad by projecting phenomenon.
The content of the invention
It is an object of the invention to provide a kind of anti-down hanging method of the calligraphy based on SIFT, solve present in prior art
External friend is due to being ignorant of the problem of Chinese character is inverted by Chinese character.
The technical solution adopted in the present invention is the anti-down hanging method of a kind of calligraphy based on SIFT, specifically according to following step
It is rapid to implement:
Step 1, calligraphy font image pre-processed, obtain the bianry image of calligraphy font;
Step 2, after obtaining bianry image I (x, y) through step 1, capture vegetarian refreshments and Gaussian filter carry out convolution algorithm:
Metric spaces of the bianry image I (x, y) under different scale is expressed as L (x, y, σ), L (x, y, σ) is by image I
(x, y) and Gaussian kernel G (x, y, σ) convolution obtain;
Step 3, after step 2, introduce Gaussian difference scale space DOG operators, generate DOG metric spaces;
Step 4, after step 3, detect the extreme point of calligraphy font image;
Step 5, after step 4, eliminate boundary effect for the extreme point of calligraphy font image detected, it is reasonable to carry out
Screening as characteristic point be subsequent detection identification used in;
Step 6, after step 5, for obtained characteristic point assigned direction parameter, utilize the neighborhood territory pixel gradient point of characteristic point
Cloth characteristic, the final computing of calligraphy font characteristic point turn into the radical in Sift Feature Descriptors, with existing radical storehouse
Matched, match immediate result;
Step 7, first use iteration Self-organization clustering algorithm to arrange obtained pivoting angle data, then choose the equal of sample
It is worth the final anglec of rotation as font sample, finally according to Feature Points Matching and closest method, by normal radical
Situation judges whether original calligraphy font is rotated or hung upside down.
The features of the present invention also resides in,
Step 1 is specifically implemented according to following steps:
Step (1.1), calligraphy work is subjected to artificial capture, obtains calligraphy font image;
Step (1.2), using writing brush word cutting technique the calligraphy font image obtained through step (1.1) is handled,
Obtain the image of a single Chinese character;
Step (1.3), after step (1.2), the image procossing of acquisition is obtained into the bianry image I (x, y) of calligraphy font.
Step 3 is specially:
The operation result that step 2 is obtained establishes the DOG pyramids of image, in 26 fields in DOG metric spaces
Extreme value is detected, while local extremum, and the local extremum that will be detected are detected in two-dimensional image plane space DOG metric spaces
Point is used as characteristic point, and characteristic point possesses good uniqueness and stability, by the pixel cross mark of Local Extremum.
Step 4 is specially:The DOG metric spaces part that step 3 is detected and the Local Extremum pixel labeled as cross,
It is compared with 8 pixels of surrounding neighbors of same yardstick and 9 × 2 pixels of surrounding neighbors of adjacent yardstick correspondence position,
Ensure all to detect local extremum in metric space and two dimensional image space, comparison procedure is as follows:
D (x, y, σ) is the difference of two adjacent scalogram pictures, i.e.,:
D (x, y, σ)=(G (x, y, k σ)-G (x, y, σ)) * I (x, y)=L (x, y, k σ)-L (x, y, σ) (1)
In above formula:For two-dimensional Gaussian function, x, y represent the coordinate of point, and σ is represented
The variance of Gauss normal distribution, L (x, y, σ)=G (x, y, σ) * I (x, y) represent metric space,
An if pixel and 8 pixels around and 18 neighborhood territory pixel points of levels totally 26 neighborhood territory pixel points
Compared to being maximum or minimum value, it is an extreme point of the image under the yardstick to determine the point.
Step 5 is specially:
Step (5.1), after the position of extreme point is accurately positioned out, first exclude not meeting containing 18 neighborhood territory pixels
Extreme point, using remaining extreme point as characteristic point, the gradient distribution of these characteristic point neighborhood territory pixels is calculated, and it is special to establish these
Levy the histogram of gradients of point;
Step (5.2), the gradient distribution character using characteristic point neighborhood territory pixel, it is each characteristic point assigned direction parameter,
Characteristic point is set to possess rotational invariance, it is specific as follows:
θ (x, y)=arctan { [L (x, y+1)-L (x, y-1)]/[L (x+1, y)-L (x-1, y)] } (3)
In above formula:M (x, y) is the modulus value of (x, y) place gradient, and θ (x, y) is the direction of (x, y) place gradient, the chi used in L
Spend for each characteristic point each where yardstick;
The parameter equation of histogram of gradients is specific as follows:
In actually calculating, the sliding window selected pixels point of generally use 16 × 16, according to every in formula (3) calculation window
The Grad of individual pixel and direction, and histogram of gradients is established according to the calculating process of formula (4), histogram of gradients is 0 °~
360 °, in order to reduce the complexity of calculating, direction is divided into 36 equal portions, every 10 ° are an equal portions;
In formula (4):S is the smooth yardstick of image, and floor is floor function, (xc, yc) it is characterized coordinate a little, (xi,
yi) neighborhood of a point pixel coordinate is characterized, the value of neighborhood territory pixel coordinate is xi∈[xc-8,xc+ 8], yi∈[yc-8,yc+ 8], wi
For the weight of pixel, θi(xi,yi) be the point direction, using angle system and by its regular to 0 °~360 °, to be counterclockwise
Positive direction, m (xi,yi) be the point gradient modulus value, θ and m computational methods are identical with formula (3), biIt is the direction in histogram
Position in transverse axis, hnFor the numerical value of n-th of angle equal portions in histogram, all h when initialn=0 (n=0 ... 35), is uniting
During counting histogram, the gradient modulus value for all angles scope that added up using the method for weight.
Step 6 generates the sift Feature Descriptors of matching, and the radical sift Feature Descriptors with first having are carried out
Matching, it is specially:
Step (6.1), all characteristic point assigned direction parameters to obtain, generate sift Feature Descriptors, specifically will
Reference axis rotates to characteristic point angle direction, records the angle value of rotation, the sift features containing angle information now generated
Description, possesses rotational invariance;
Step (6.2), each pixel in the neighborhood of keyword 16 × 16 is calculated, obtained relative to principal direction
Gradient direction Δ θ, specific formula is as follows:
Δ θ=θ (xi,yi)-θmain (5)
Wherein, be the zonule of 16 4 × 4 by 16 × 16 region division, each zonule according to formula (4) algorithm
Accumulation calculating is carried out to Δ θ, θ is calculated, now the θ values of gradient direction gradient are equal to the angle of image rotation;
Step (6.3), the sift Feature Descriptors extracted in above-mentioned image and the sift features in radical storehouse retouched
State son to be matched, obtain multiple matching results.
Multiple matching results that step 7 is obtained using iteration self-organizing clustering method arrangement step 6, after iteration, it is determined that
One radical best suited, it is specially:Iteration Self-organization clustering algorithm parameter is set first:
The class number that K classifies for expectation, K=1, θkFor the minimum matched sample number in a classification, θsFor on single class
The parameter of not middle degree of scatter, θcFor the parameter minimum between class distance, L is the maximum classification that each iteration allows to merge
Number, I are the maximum times for allowing iteration, and iteration self-organizing clustering calculation process is specific as follows:
(1) setup parameter;
(2) all kinds of center { Z are chosen1,Z2,…ZNC, NC=60, for the total number of radical species;
(3) sample is distributed, if there are ‖ Z-Zj‖≤‖Z-Zi‖, then Z ∈ Sj, wherein i=1,2 ..., NC, j=1,2 ..., NC;
(4) if SjClass number of samples NJ<θk, then S is cancelledjClass, NC=NC-1;
(5) all kinds of centers are recalculatedJ=1,2 ..., NC;
(6) average distance in class Sj is calculatedJ=1,2 ..., NC;
(7) inter- object distance average value is asked to all samples
(8) if iterative times >=I, (12) is jumped to, target class is merged;
If NC≤K/2, jump to (9);
If even-times iterate or NC >=2K if jump to (12);
(9) standard deviation of each component during calculating is all kinds ofWherein,
I=1,2 ... ... n;J=1,2 ..., Nj;K=1,2 ..., Nj, xik;X is Z ∈ SjI-th of component, zijFor Zi's
I-th of component, σijIt is poor for i-th of component standard of jth class;
(10) the maximum component σ of all kinds of standard deviations is foundjmax=max { σ1j,σ2j,…σnj, j=1,2 ..., NC;
(11) if σjmax>θSAnd Dj>D and Nj>2(θk+ 1) or σjmax>θsAnd NC≤K/2, then make NC=NC+1, Zj +=
Zj+kσjmax, Zj -=Zj-kσjmax, wherein, k is empirical coefficient, k=0.5;
(12) the mutual distance D at adjacent two classes center is calculatedij=(Zi-Zj), wherein:I=1,2 ..., NC-1;J=i+1,
2 ..., NC;
(13) by DijSort from small to large, carry out, by merging, until by being incorporated into 6 final results, selecting in order
Take 6 result Plays difference σijMinimum result as matching result,
Now, image contains the sift Feature Descriptors of angle information, with the radical in existing radical storehouse
Sift Feature Descriptors are matched, and with reference to the regular obtained angle value of step 6, the angle of image rotation are provided, if angle is
Positive number, image is represented as the situation that turns clockwise, if angle is negative, expression image is rotate counterclockwise direction.
The invention has the advantages that a kind of anti-down hanging method of calligraphy based on SIFT, for the calligraphy work hung,
It is that user is taken pictures using oneself mobile phone or picture pick-up device by man-machine interaction, then touch screen clicks on selection oneself to be judged
Multiple calligraphy Chinese characters, some Chinese characters are cut out as sample, with 60 radicals in radical storehouse and these Hanzi specimens
The images match based on SIFT is carried out, filters out and have matched the writing brush word of radical, then calculates the anglec of rotation of matching,
Judge the method hung at present, it is indicated that correctly hang direction.
Brief description of the drawings
Fig. 1 is DoG local extremum detection figures in a kind of anti-down hanging method of calligraphy based on SIFT of the invention;
Fig. 2 is histogram of gradients in a kind of anti-down hanging method of calligraphy based on SIFT of the invention;
Fig. 3 is the size distribution figure that image is just being put in a kind of anti-down hanging method of calligraphy based on SIFT of the invention;
Fig. 4 is the size distribution figure that image is rotated in a kind of anti-down hanging method of calligraphy based on SIFT of the invention;
Fig. 5 is the writing brush word Song typeface " postal " printed words figure in a kind of anti-down hanging method of calligraphy based on SIFT of the invention;
Fig. 6 is will using the anti-down hanging method of calligraphy of the present invention in a kind of anti-down hanging method of calligraphy based on SIFT of the invention
Font " postal ", which is rotated by 90 °, matches correct figure with " Fu " in radical storehouse;
Fig. 7 is will using the anti-down hanging method of calligraphy of the present invention in a kind of anti-down hanging method of calligraphy based on SIFT of the invention
Font " postal " rotates 180 ° and correct figure is matched with " Fu " in radical storehouse;
Fig. 8 is will using the anti-down hanging method of calligraphy of the present invention in a kind of anti-down hanging method of calligraphy based on SIFT of the invention
Font " postal " rotates 270 ° and correct figure is matched with " Fu " in radical storehouse;
Fig. 9 is will using the anti-down hanging method of calligraphy of the present invention in a kind of anti-down hanging method of calligraphy based on SIFT of the invention
Font " postal ", which is rotated by 360 °, matches correct figure with " Fu " in radical storehouse;
Figure 10 is to match incorrect case diagram using radical after a kind of anti-down hanging method of calligraphy based on SIFT of the invention.
Embodiment
The present invention is described in detail with reference to the accompanying drawings and detailed description.
A kind of anti-down hanging method of calligraphy based on SIFT of the invention, specifically implements according to following steps:
Step 1, calligraphy font image pre-processed, the bianry image of calligraphy font is obtained, specifically according to following step
It is rapid to implement:
Step (1.1), calligraphy work is subjected to artificial capture, obtains calligraphy font image;
Step (1.2), using writing brush word cutting technique the calligraphy font image obtained through step (1.1) is handled,
Obtain the image of a single Chinese character;
Step (1.3), after step (1.2), as shown in figure 1, the image procossing of acquisition is obtained into the two-value of calligraphy font
Image I (x, y);
Step 2, after obtaining bianry image I (x, y) through step 1, capture vegetarian refreshments and Gaussian filter carry out convolution algorithm:
Metric spaces of the bianry image I (x, y) under different scale is expressed as L (x, y, σ), L (x, y, σ) is by image I
(x, y) and Gaussian kernel G (x, y, σ) convolution obtain;
Step 3, after step 2, introduce Gaussian difference scale space DOG operators, generate DOG metric spaces, be specially:
The operation result that step 2 is obtained establishes the DOG pyramids of image, in 26 fields in DOG metric spaces
Extreme value is detected, while local extremum, and the local extremum that will be detected are detected in two-dimensional image plane space DOG metric spaces
Point is used as characteristic point, and characteristic point possesses good uniqueness and stability, by the pixel cross mark of Local Extremum;
Step 4, after step 3, detect the extreme point of calligraphy font image, be specially:The DOG chis that step 3 is detected
The Local Extremum pixel for being is marked in degree space part and Fig. 1, with 8 pixels of surrounding neighbors and phase of same yardstick
9 × 2 pixels of surrounding neighbors of adjacent yardstick correspondence position are compared, it is ensured that are all detected in metric space and two dimensional image space
It is as follows to local extremum, comparison procedure:
D (x, y, σ) is the difference of two adjacent scalogram pictures, i.e.,:
D (x, y, σ)=(G (x, y, k σ)-G (x, y, σ)) * I (x, y)=L (x, y, k σ)-L (x, y, σ) (1)
In above formula:For two-dimensional Gaussian function, x, y represent the coordinate of point, and σ is represented
The variance of Gauss normal distribution, L (x, y, σ)=G (x, y, σ) * I (x, y) represent metric space,
An if pixel and 8 pixels around and 18 neighborhood territory pixel points of levels totally 26 neighborhood territory pixel points
Compared to being maximum or minimum value, it is an extreme point of the image under the yardstick to determine the point;
Step 5, after step 4, eliminate boundary effect for the extreme point of calligraphy font image detected, it is reasonable to carry out
Screening as characteristic point be subsequent detection identification used in, be specially:
Step (5.1), after the position of extreme point is accurately positioned out, first exclude not meeting containing 18 neighborhood territory pixels
Extreme point, using remaining extreme point as characteristic point, the gradient distribution of these characteristic point neighborhood territory pixels is calculated, and it is special to establish these
The histogram of gradients of point is levied, as shown in Figure 2;
Step (5.2), the gradient distribution character using characteristic point neighborhood territory pixel, it is each characteristic point assigned direction parameter,
Characteristic point is set to possess rotational invariance, it is specific as follows:
θ (x, y)=arctan { [L (x, y+1)-L (x, y-1)]/[L (x+1, y)-L (x-1, y)] } (3)
In above formula:M (x, y) is the modulus value of (x, y) place gradient, and θ (x, y) is the direction of (x, y) place gradient, the chi used in L
Spend for each characteristic point each where yardstick;
The parameter equation of histogram of gradients is specific as follows:
In actually calculating, the sliding window selected pixels point of generally use 16 × 16, according to every in formula (3) calculation window
The Grad of individual pixel and direction, and histogram of gradients is established according to the calculating process of formula (4), histogram of gradients is 0 °~
360 °, in order to reduce the complexity of calculating, direction is divided into 36 equal portions, every 10 ° are an equal portions;
In formula (4):S is the smooth yardstick of image, and floor is floor function, (xc, yc) it is characterized coordinate a little, (xi,
yi) neighborhood of a point pixel coordinate is characterized, the value of neighborhood territory pixel coordinate is xi∈[xc-8,xc+ 8], yi∈[yc-8,yc+ 8], wi
For the weight of pixel, θi(xi,yi) be the point direction, using angle system and by its regular to 0 °~360 °, to be counterclockwise
Positive direction, m (xi,yi) be the point gradient modulus value, θ and m computational methods are identical with formula (3), biIt is the direction in histogram
Position in transverse axis, hnFor the numerical value of n-th of angle equal portions in histogram, all h when initialn=0 (n=0 ... 35), is uniting
During counting histogram, the gradient modulus value for all angles scope that added up using the method for weight;
During statistic histogram, using the method for weight come the gradient modulus value for all angles scope that adds up, such as Fig. 2 institutes
Show, be histogram of gradients when using 8 angle equal portions, wherein arrow direction is principal direction;
Step 6, after step 5, for obtained characteristic point assigned direction parameter, utilize the neighborhood territory pixel gradient point of characteristic point
Cloth characteristic, the final computing of calligraphy font characteristic point turn into the radical in Sift Feature Descriptors, with existing radical storehouse
Matched, match immediate result, be specially:
Step (6.1), all characteristic point assigned direction parameters to obtain, generate sift Feature Descriptors, specifically will
Reference axis rotates to characteristic point angle direction, records the angle value of rotation, the sift features containing angle information now generated
Description, possesses rotational invariance;
Step (6.2), each pixel in the neighborhood of keyword 16 × 16 is calculated, obtained relative to principal direction
Gradient direction Δ θ, specific formula is as follows:
Δ θ=θ (xi,yi)-θmain (5)
Wherein, be the zonule of 16 4 × 4 by 16 × 16 region division, each zonule according to formula (4) algorithm
Accumulation calculating is carried out to Δ θ, θ is calculated, now the θ values of gradient direction gradient are equal to the angle of image rotation;
Step (6.3), the sift Feature Descriptors extracted in above-mentioned image and the sift features in radical storehouse retouched
State son to be matched, obtain multiple matching results;
SIFT algorithms can keep the reason for rotational invariance to be:The feature point description period of the day from 11 p.m. to 1 a.m is generated to each characteristic point
Angle coordinate axle is rotated, angle during calculating rather than referring to these characteristic points in image coordinate, but will be sat first
Parameter rotates to be the direction of characteristic point, so that it is guaranteed that rotational invariance,
Fig. 3 is characterized vertex neighborhood gradient distributed intelligence, and thicker black line is principal direction, and Fig. 4 is that Fig. 3 turns clockwise
The gradient modulus value and directional spreding obtained after 15 °, 4 zonules are only used in Fig. 3 and Fig. 4, and Fig. 3 and Fig. 4 are one
The schematic diagram of rotational invariance, as shown in figure 3, after pixel therein rotates, image do not occur rescaling and
In the case of distortion, the topology distribution between pixel does not change, therefore the principal direction of this feature point will also rotate accordingly
Angle, the angle of principal direction has been reduced due to each pixel first in the generation feature point description period of the day from 11 p.m. to 1 a.m, so revolving
After turning, the Feature Descriptor of each zonule does not change, realizes rotational invariance, and the anglec of rotation of principal direction
It is exactly the anglec of rotation of characteristic point.
Step 7, first use iteration Self-organization clustering algorithm to arrange obtained pivoting angle data, then choose the equal of sample
It is worth the final anglec of rotation as font sample, finally according to Feature Points Matching and closest method, by normal radical
Situation judges whether original calligraphy font is rotated or hung upside down, the anglec of rotation number of degrees for arranging to obtain using ISODATA methods
According to iteration self-organizing clustering is a kind of fuzzy clustering method, and the number of cluster can be adaptively adjusted according to parameter preset, can be increased
The robustness of strong whole angle calculation algorithm, iteration Self-organization clustering algorithm are operated according to following principle:
Specially:Iteration Self-organization clustering algorithm parameter is set first:
The class number that K classifies for expectation, K=1, θkFor the minimum matched sample number in a classification, θsFor on single class
The parameter of not middle degree of scatter, θcFor the parameter minimum between class distance, L is the maximum classification that each iteration allows to merge
Number, I are the maximum times for allowing iteration, and iteration self-organizing clustering calculation process is specific as follows:
(1) setup parameter;
(2) all kinds of center { Z are chosen1,Z2,…ZNC, NC=60, for the total number of radical species;
(3) sample is distributed, if there are ‖ Z-Zj‖≤‖Z-Zi‖, then Z ∈ Sj, wherein i=1,2 ..., NC, j=1,2 ..., NC;
(4) if SjClass number of samples NJ<θk, then S is cancelledjClass, NC=NC-1;
(5) all kinds of centers are recalculatedJ=1,2 ..., NC;
(6) average distance in class Sj is calculatedJ=1,2 ..., NC;
(7) inter- object distance average value is asked to all samples
(8) if iterative times >=I, (12) is jumped to, target class is merged;
If NC≤K/2, jump to (9);
If even-times iterate or NC >=2K if jump to (12);
(9) standard deviation of each component during calculating is all kinds ofWherein,
I=1,2 ... ... n;J=1,2 ..., Nj;K=1,2 ..., Nj, xik;X is Z ∈ SjI-th of component, zijFor Zi's
I-th of component, σijIt is poor for i-th of component standard of jth class;
(10) the maximum component σ of all kinds of standard deviations is foundjmax=max { σ1j,σ2j,…σnj, j=1,2 ..., NC;
(11) if σjmax>θSAnd Dj>D and Nj>2(θk+ 1) or σjmax>θsAnd NC≤K/2, then make NC=NC+1, Zj +=
Zj+kσjmax, Zj -=Zj-kσjmax, wherein, k is empirical coefficient, k=0.5;
(12) the mutual distance D at adjacent two classes center is calculatedij=(Zi-Zj), wherein:I=1,2 ..., NC-1;J=i+1,
2 ..., NC;
(13) by DijSort from small to large, carry out, by merging, until by being incorporated into 6 final results, selecting in order
Take 6 result Plays difference σijMinimum result is as matching result, and now, image contains the sift features description of angle information
Son, matched with the radical sift Feature Descriptors in existing radical storehouse, with reference to the regular obtained angle of step 6
Value, the angle of image rotation is provided, if angle is positive number, represent that image for the situation that turns clockwise, if angle is negative, represents
Image is rotate counterclockwise direction.
It is 3 classes that the anglec of rotation, which calculates the reference clusters number set in the inventive method, and maximum clusters number is 4 classes, most
Small clusters number is 1 class (1≤K≤4), θk=1, θs=15, θc=20, clustered according to upper section clustering algorithm, to split original
Highest priority then.3 classes with reference to cluster correspond to respectively in meaning directly perceived correct rotation angle classification, the mistake anglec of rotation classify and
Reversely rotate angle classification.Reverse rotation angle therein classification is the anglec of rotation for finding to have only a few characteristic point in an experiment, and
The rotate counterclockwise direction not constrained according to the inventive method, but according to the direction that turns clockwise, so by such number
Classification is reversely rotated according to being classified as.
By the analysis of a large amount of cluster results, the method that correct sample class is chosen in automation is set in the inventive method:
The most class of number of samples is found first in cluster result, is specifically implemented according to following algorithm:
imax=arg max { n1,n2,…,nNC}
Wherein:niFor the number of samples of the i-th class;
If σimax≤ 15, then the anglec of rotation of object can finally be determined according to following algorithm:
θrotation=μimax
μimaxFor the average of the i-th max classes;If σimax>15, then the class of number of samples more than second in class is chosen as correct sample
This class, and the final object anglec of rotation is used as using its average.
Feature Points Matching refers to after the characteristic point of image is found out, and finds the corresponding relation of characteristic point between image.Generally adopt
With arest neighbors method, that is, search arest neighbors of each characteristic point in other piece image.Ideally two images it
Between the characteristic point of same section should have identical feature description vectors, so the distance between they should be nearest.sift
The main matching of characteristic vector is exactly to carry out similarity measurement to the sift characteristic vectors of two images to be matched, calculates the first width
Closest matching of each local feature region of image in the feature point set of image to be matched, used here as chamfer distance conduct
The similarity measurement of characteristic point.Calculate two characteristic vector (a1,a2,a3,...),(b1,b2,b3...) and between chamfer distance
U(a,b)Specifically obtained according to following algorithm:
In formula:(1,2 ..., n), n are characterized the dimension of vector to i ∈.
Embodiment
First will likely existing four kinds of anglecs of rotation (90 °, 180 °, 270 °, 360 °) be used as sample image, then in radical
Automatic-searching relevant matches radical, is contrasted in radical storehouse, as a result as shown in Fig. 5, Fig. 6, Fig. 7, Fig. 8, Fig. 9, it can be seen that
The match is successful for radical, and as check experiment, Figure 10 is the incorrect matching case of radical.Result of the test is handled, it is normal outstanding
It is straight to hang angle character Point matching line, and other abnormal suspension angles, matched line has intersection, is judged by these matched lines,
It can obtain being expected successful effect.
Claims (7)
1. the anti-down hanging method of a kind of calligraphy based on SIFT, it is characterised in that specifically implement according to following steps:
Step 1, calligraphy font image pre-processed, obtain the bianry image of calligraphy font;
Step 2, after obtaining bianry image I (x, y) through step 1, capture vegetarian refreshments and Gaussian filter carry out convolution algorithm:
Metric spaces of the bianry image I (x, y) under different scale is expressed as L (x, y, σ), L (x, y, σ) is by image I (x, y)
Obtained with Gaussian kernel G (x, y, σ) convolution;
Step 3, after step 2, introduce Gaussian difference scale space DOG operators, generate DOG metric spaces;
Step 4, after step 3, detect the extreme point of calligraphy font image;
Step 5, after step 4, eliminate boundary effect for the extreme point of calligraphy font image detected, reasonably sieved
It is elected to be and is characterized a little as used in subsequent detection identification;
Step 6, after step 5, for obtained characteristic point assigned direction parameter, utilize the neighborhood territory pixel gradient distribution of characteristic point special
Property, the final computing of calligraphy font characteristic point turns into Sift Feature Descriptors, carried out with the radical in existing radical storehouse
Matching, matches immediate result;
Step 7, first iteration Self-organization clustering algorithm is used to arrange obtained pivoting angle data, the average for then choosing sample is made
For the final anglec of rotation of font sample, finally according to Feature Points Matching and closest method, by normal radical situation
Judge whether original calligraphy font is rotated or hung upside down.
2. the anti-down hanging method of a kind of calligraphy based on SIFT according to claim 1, it is characterised in that the step 1 has
Body is implemented according to following steps:
Step (1.1), calligraphy work is subjected to artificial capture, obtains calligraphy font image;
Step (1.2), using writing brush word cutting technique the calligraphy font image obtained through step (1.1) is handled, obtained
The image of a single Chinese character;
Step (1.3), after step (1.2), the image procossing of acquisition is obtained into the bianry image I (x, y) of calligraphy font.
3. the anti-down hanging method of a kind of calligraphy based on SIFT according to claim 1, it is characterised in that the step 3 has
Body is:
The operation result that step 2 is obtained establishes the DOG pyramids of image, is detected in 26 fields in DOG metric spaces
Extreme value, while local extremum is detected in two-dimensional image plane space DOG metric spaces, and the Local Extremum detected is made
It is characterized a little, characteristic point possesses good uniqueness and stability, by the pixel cross mark of Local Extremum.
4. the anti-down hanging method of a kind of calligraphy based on SIFT according to claim 1, it is characterised in that the step 4 has
Body is:The DOG metric spaces part that step 3 is detected and the Local Extremum pixel labeled as cross, with the week of same yardstick
9 × 2 pixels of surrounding neighbors for enclosing 8 pixels of neighborhood and adjacent yardstick correspondence position are compared, it is ensured that in metric space
Local extremum is all detected with two dimensional image space, and comparison procedure is as follows:
D (x, y, σ) is the difference of two adjacent scalogram pictures, i.e.,:
D (x, y, σ)=(G (x, y, k σ)-G (x, y, σ)) * I (x, y)=L (x, y, k σ)-L (x, y, σ) (1)
In above formula:For two-dimensional Gaussian function, x, y represent the coordinate of point, and σ represents Gauss
The variance of normal distribution, L (x, y, σ)=G (x, y, σ) * I (x, y) represent metric space,
If a pixel is compared with 8 pixels around and 18 neighborhood territory pixel points of levels totally 26 neighborhood territory pixel points
It is maximum or minimum value, it is an extreme point of the image under the yardstick to determine the point.
5. the anti-down hanging method of a kind of calligraphy based on SIFT according to claim 1, it is characterised in that the step 5 has
Body is:
Step (5.1), after the position of extreme point is accurately positioned out, first exclude can not meet the extreme value containing 18 neighborhood territory pixels
Point, using remaining extreme point as characteristic point, the gradient distribution of these characteristic point neighborhood territory pixels is calculated, and establish these characteristic points
Histogram of gradients;
Step (5.2), the gradient distribution character using characteristic point neighborhood territory pixel, it is each characteristic point assigned direction parameter, makes spy
Sign point possesses rotational invariance, specific as follows:
<mrow>
<mi>m</mi>
<mrow>
<mo>(</mo>
<mi>x</mi>
<mo>,</mo>
<mi>y</mi>
<mo>)</mo>
</mrow>
<mo>=</mo>
<msqrt>
<mrow>
<msup>
<mrow>
<mo>(</mo>
<mi>L</mi>
<mo>(</mo>
<mrow>
<mi>x</mi>
<mo>+</mo>
<mn>1</mn>
<mo>,</mo>
<mi>y</mi>
</mrow>
<mo>)</mo>
<mo>-</mo>
<mi>L</mi>
<mo>(</mo>
<mrow>
<mi>x</mi>
<mo>-</mo>
<mn>1</mn>
<mo>,</mo>
<mi>y</mi>
</mrow>
<mo>)</mo>
<mo>)</mo>
</mrow>
<mn>2</mn>
</msup>
<mo>+</mo>
<mrow>
<mo>(</mo>
<mi>L</mi>
<mo>(</mo>
<mrow>
<mi>x</mi>
<mo>,</mo>
<mi>y</mi>
</mrow>
<mo>)</mo>
<mo>+</mo>
<mn>1</mn>
<mo>)</mo>
</mrow>
<mo>-</mo>
<mi>L</mi>
<mo>(</mo>
<mrow>
<mi>x</mi>
<mo>,</mo>
<mi>y</mi>
<mo>-</mo>
<mn>1</mn>
</mrow>
<mo>)</mo>
<msup>
<mo>)</mo>
<mn>2</mn>
</msup>
</mrow>
</msqrt>
<mo>-</mo>
<mo>-</mo>
<mo>-</mo>
<mrow>
<mo>(</mo>
<mn>2</mn>
<mo>)</mo>
</mrow>
</mrow>
θ (x, y)=arctan { [L (x, y+1)-L (x, y-1)]/[L (x+1, y)-L (x-1, y)] } (3)
In above formula:M (x, y) is the modulus value of (x, y) place gradient, and θ (x, y) is the direction of (x, y) place gradient, and the yardstick used in L is
The yardstick at the respective place of each characteristic point;
The parameter equation of histogram of gradients is specific as follows:
<mrow>
<mfenced open = "{" close = "}">
<mtable>
<mtr>
<mtd>
<mrow>
<msub>
<mi>w</mi>
<mi>i</mi>
</msub>
<mo>=</mo>
<msup>
<mi>e</mi>
<mrow>
<mo>-</mo>
<mfrac>
<msqrt>
<mrow>
<msup>
<mrow>
<mo>(</mo>
<msub>
<mi>x</mi>
<mi>i</mi>
</msub>
<mo>-</mo>
<msub>
<mi>x</mi>
<mi>c</mi>
</msub>
<mo>)</mo>
</mrow>
<mn>2</mn>
</msup>
<mo>+</mo>
<msup>
<mrow>
<mo>(</mo>
<msub>
<mi>y</mi>
<mi>i</mi>
</msub>
<mo>-</mo>
<msub>
<mi>y</mi>
<mi>c</mi>
</msub>
<mo>)</mo>
</mrow>
<mn>2</mn>
</msup>
</mrow>
</msqrt>
<mrow>
<mn>1.5</mn>
<mo>&times;</mo>
<mi>s</mi>
</mrow>
</mfrac>
</mrow>
</msup>
</mrow>
</mtd>
</mtr>
<mtr>
<mtd>
<mrow>
<msub>
<mi>b</mi>
<mi>i</mi>
</msub>
<mo>=</mo>
<mi>f</mi>
<mi>l</mi>
<mi>o</mi>
<mi>o</mi>
<mi>r</mi>
<mo>&lsqb;</mo>
<mfrac>
<mrow>
<mi>&theta;</mi>
<mrow>
<mo>(</mo>
<msub>
<mi>x</mi>
<mi>i</mi>
</msub>
<mo>,</mo>
<msub>
<mi>y</mi>
<mi>i</mi>
</msub>
<mo>)</mo>
</mrow>
</mrow>
<mn>360</mn>
</mfrac>
<mo>&rsqb;</mo>
</mrow>
</mtd>
</mtr>
<mtr>
<mtd>
<mrow>
<msub>
<mi>h</mi>
<mi>n</mi>
</msub>
<mo>=</mo>
<munder>
<mi>&Sigma;</mi>
<mrow>
<mi>i</mi>
<mi>f</mi>
<mrow>
<mo>(</mo>
<msub>
<mi>b</mi>
<mi>i</mi>
</msub>
<mo>=</mo>
<mi>n</mi>
<mo>)</mo>
</mrow>
</mrow>
</munder>
<msub>
<mi>w</mi>
<mi>i</mi>
</msub>
<mo>&times;</mo>
<mi>m</mi>
<mrow>
<mo>(</mo>
<msub>
<mi>x</mi>
<mi>i</mi>
</msub>
<mo>,</mo>
<msub>
<mi>y</mi>
<mi>i</mi>
</msub>
<mo>)</mo>
</mrow>
</mrow>
</mtd>
</mtr>
</mtable>
</mfenced>
<mo>-</mo>
<mo>-</mo>
<mo>-</mo>
<mrow>
<mo>(</mo>
<mn>4</mn>
<mo>)</mo>
</mrow>
</mrow>
In actually calculating, the sliding window selected pixels point of generally use 16 × 16, according to each picture in formula (3) calculation window
The Grad of element and direction, and histogram of gradients is established according to the calculating process of formula (4), histogram of gradients is 0 °~360 °,
In order to reduce the complexity of calculating, direction is divided into 36 equal portions, every 10 ° are an equal portions;
In formula (4):S is the smooth yardstick of image, and floor is floor function, (xc, yc) it is characterized coordinate a little, (xi, yi) it is spy
Neighborhood of a point pixel coordinate is levied, the value of neighborhood territory pixel coordinate is xi∈[xc-8,xc+ 8], yi∈[yc-8,yc+ 8], wiFor pixel
The weight of point, θi(xi,yi) be the point direction, using angle system and by its regular to 0 °~360 °, with counterclockwise for pros
To m (xi,yi) be the point gradient modulus value, θ and m computational methods are identical with formula (3), biIt is the direction in histogram transverse axis
In position, hnFor the numerical value of n-th of angle equal portions in histogram, all h when initialn=0 (n=0 ... 35) is straight in statistics
During square figure, the gradient modulus value for all angles scope that added up using the method for weight.
A kind of 6. anti-down hanging method of calligraphy based on SIFT proposed according to claim 1, it is characterised in that step 6 generation
The sift Feature Descriptors of adapted, and matched with the radical sift Feature Descriptors first having, it is specially:
Step (6.1), all characteristic point assigned direction parameters to obtain, generate sift Feature Descriptors, specifically by coordinate
Axle rotates to characteristic point angle direction, records the angle value of rotation, the description of the sift features containing angle information now generated
Son, possesses rotational invariance;
Step (6.2), each pixel in the neighborhood of keyword 16 × 16 is calculated, obtain the ladder relative to principal direction
Direction Δ θ is spent, specific formula is as follows:
Δ θ=θ (xi,yi)-θmain (5)
Wherein, by the zonule that 16 × 16 region division is 16 4 × 4, each zonule is according to the algorithm of formula (4) to Δ
θ carries out accumulation calculating, and θ is calculated, and now the θ values of gradient direction gradient are equal to the angle of image rotation;
Step (6.3), by the sift Feature Descriptors in the sift Feature Descriptors extracted in above-mentioned image and radical storehouse
Matched, obtain multiple matching results.
7. the anti-down hanging method of a kind of calligraphy based on SIFT according to claim 1, it is characterised in that step 7 is utilized and changed
The multiple matching results obtained for self-organizing clustering method arrangement step 6, after iteration, determine the radical best suited a portion
Head, it is specially:Iteration Self-organization clustering algorithm parameter is set first:
The class number that K classifies for expectation, K=1, θkFor the minimum matched sample number in a classification, θsFor in single classification
The parameter of degree of scatter, θcFor the parameter minimum between class distance, L is the maximum classification number that each iteration allows to merge, and I is
The maximum times of permission iteration, iteration self-organizing clustering calculation process are specific as follows:
(1) setup parameter;
(2) all kinds of center { Z are chosen1,Z2,…ZNC, NC=60, for the total number of radical species;
(3) sample is distributed, if there are ‖ Z-Zj‖≤‖Z-Zi‖, then Z ∈ Sj, wherein i=1,2 ..., NC, j=1,2 ..., NC;
(4) if SjClass number of samples NJ<θk, then S is cancelledjClass, NC=NC-1;
(5) all kinds of centers are recalculated
(6) average distance in class Sj is calculated
(7) inter- object distance average value is asked to all samples
(8) if iterative times >=I, (12) is jumped to, target class is merged;
If NC≤K/2, jump to (9);
If even-times iterate or NC >=2K if jump to (12);
(9) standard deviation of each component during calculating is all kinds ofWherein, i=1,2 ... ... n;j
=1,2 ..., Nj;K=1,2 ..., Nj, xik;X is Z ∈ SjI-th of component, zijFor ZiI-th of component, σijFor jth class
I component standard is poor;
(10) the maximum component σ of all kinds of standard deviations is foundjmax=max { σ1j,σ2j,…σnj, j=1,2 ..., NC;
(11) if σjmax>θSAnd Dj>D and Nj>2(θk+ 1) or σjmax>θsAnd NC≤K/2, then make NC=NC+1, Zj +=Zj+k
σjmax, Zj -=Zj-kσjmax, wherein, k is empirical coefficient, k=0.5;
(12) the mutual distance D at adjacent two classes center is calculatedij=(Zi-Zj), wherein:I=1,2 ..., NC-1;J=i+1,2 ...,
NC;
(13) by DijSort from small to large, carry out, by merging, until by being incorporated into 6 final results, choosing 6 in order
As a result Plays difference σijMinimum result as matching result,
Now, image contains the sift Feature Descriptors of angle information, special with the radical sift in existing radical storehouse
Sign description is matched, and with reference to the regular obtained angle value of step 6, provides the angle of image rotation, if angle is positive number, table
Diagram picture is the situation that turns clockwise, if angle is negative, expression image is rotate counterclockwise direction.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710584019.9A CN107491780A (en) | 2017-07-18 | 2017-07-18 | A kind of anti-down hanging method of calligraphy based on SIFT |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710584019.9A CN107491780A (en) | 2017-07-18 | 2017-07-18 | A kind of anti-down hanging method of calligraphy based on SIFT |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107491780A true CN107491780A (en) | 2017-12-19 |
Family
ID=60644523
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710584019.9A Pending CN107491780A (en) | 2017-07-18 | 2017-07-18 | A kind of anti-down hanging method of calligraphy based on SIFT |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107491780A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109426815A (en) * | 2017-08-22 | 2019-03-05 | 顺丰科技有限公司 | A kind of rotation of document field and cutting method, system, equipment |
CN110956184A (en) * | 2019-11-18 | 2020-04-03 | 山西大学 | Abstract diagram direction determination method based on HSI-LBP characteristics |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104050680A (en) * | 2014-07-04 | 2014-09-17 | 西安电子科技大学 | Image segmentation method based on iteration self-organization and multi-agent inheritance clustering algorithm |
-
2017
- 2017-07-18 CN CN201710584019.9A patent/CN107491780A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104050680A (en) * | 2014-07-04 | 2014-09-17 | 西安电子科技大学 | Image segmentation method based on iteration self-organization and multi-agent inheritance clustering algorithm |
Non-Patent Citations (1)
Title |
---|
朱齐丹 等: "采用改进的尺度不变特征变换算法计算物体旋转角度", 《光学精密工程》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109426815A (en) * | 2017-08-22 | 2019-03-05 | 顺丰科技有限公司 | A kind of rotation of document field and cutting method, system, equipment |
CN109426815B (en) * | 2017-08-22 | 2022-05-10 | 顺丰科技有限公司 | Bill region rotating and splitting method, system and equipment |
CN110956184A (en) * | 2019-11-18 | 2020-04-03 | 山西大学 | Abstract diagram direction determination method based on HSI-LBP characteristics |
CN110956184B (en) * | 2019-11-18 | 2023-09-22 | 山西大学 | Abstract graph direction determining method based on HSI-LBP characteristics |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Zhou et al. | Principal visual word discovery for automatic license plate detection | |
CN111695522B (en) | In-plane rotation invariant face detection method and device and storage medium | |
Zhao et al. | Learning mid-level filters for person re-identification | |
CN104573744B (en) | Fine granulation classification identifies and the part of object positions and feature extracting method | |
Vazquez-Reina et al. | Segmentation fusion for connectomics | |
CN107368807B (en) | Monitoring video vehicle type classification method based on visual word bag model | |
CN106503727B (en) | A kind of method and device of classification hyperspectral imagery | |
CN102147858B (en) | License plate character identification method | |
CN106408030B (en) | SAR image classification method based on middle layer semantic attribute and convolutional neural networks | |
CN105488536A (en) | Agricultural pest image recognition method based on multi-feature deep learning technology | |
Shahab et al. | How salient is scene text? | |
CN111965197B (en) | Defect classification method based on multi-feature fusion | |
Klein et al. | Salient pattern detection using W 2 on multivariate normal distributions | |
CN111832659B (en) | Laser marking system and method based on feature point extraction algorithm detection | |
Cao et al. | A unified framework for detecting groups and application to shape recognition | |
CN107305691A (en) | Foreground segmentation method and device based on images match | |
CN107239792A (en) | A kind of workpiece identification method and device based on binary descriptor | |
CN102799888A (en) | Eye detection method and eye detection equipment | |
CN109343920A (en) | A kind of image processing method and its device, equipment and storage medium | |
CN107292302A (en) | Detect the method and system of point of interest in picture | |
CN110021028A (en) | A kind of automatic clothing method based on garment fashion drawing | |
CN107886066A (en) | A kind of pedestrian detection method based on improvement HOG SSLBP | |
CN109993213A (en) | A kind of automatic identifying method for garment elements figure | |
CN105868776A (en) | Transformer equipment recognition method and device based on image processing technology | |
CN107491780A (en) | A kind of anti-down hanging method of calligraphy based on SIFT |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20171219 |