CN108388920B - HOG and LBPH characteristic fused identity card copy detection method - Google Patents
HOG and LBPH characteristic fused identity card copy detection method Download PDFInfo
- Publication number
- CN108388920B CN108388920B CN201810172048.9A CN201810172048A CN108388920B CN 108388920 B CN108388920 B CN 108388920B CN 201810172048 A CN201810172048 A CN 201810172048A CN 108388920 B CN108388920 B CN 108388920B
- Authority
- CN
- China
- Prior art keywords
- representing
- lambda
- pixel
- abscissa
- image
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
- G06F18/2411—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on the proximity to a decision surface, e.g. support vector machines
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/25—Fusion techniques
- G06F18/253—Fusion techniques of extracted features
-
- 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/40—Extraction of image or video features
-
- 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/40—Extraction of image or video features
- G06V10/50—Extraction of image or video features by performing operations within image blocks; by using histograms, e.g. histogram of oriented gradients [HoG]; by summing image-intensity values; Projection analysis
- G06V10/507—Summing image-intensity values; Histogram projection analysis
-
- 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/40—Extraction of image or video features
- G06V10/46—Descriptors for shape, contour or point-related descriptors, e.g. scale invariant feature transform [SIFT] or bags of words [BoW]; Salient regional features
- G06V10/467—Encoded features or binary features, e.g. local binary patterns [LBP]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V2201/00—Indexing scheme relating to image or video recognition or understanding
- G06V2201/07—Target detection
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- Bioinformatics & Computational Biology (AREA)
- General Engineering & Computer Science (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Multimedia (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses an identity card copy detection method fusing HOG and LBPH characteristics, which comprises the following steps: firstly, selecting a large number of identity card and non-identity card pictures as positive and negative samples of a training sample set, respectively extracting HOG characteristics and LBPH characteristics from the training sample set, training an SVM to obtain a first classifier and a second classifier, and performing target detection on a test image by using the first classifier to obtain the LBPH characteristics of a target detection result; and judging by using a second classifier according to the LBPH characteristics of the target detection result, and reserving the target with the judgment result of true. According to the invention, the HOG classifier is used for detection, and then the LBPH classifier is used for detecting the HOG detection result again, so that the method is simple, rapid and efficient, and the detection accuracy is high.
Description
Technical Field
The invention relates to the technical field of pattern recognition, in particular to an identity card copy detection method fusing HOG and LBPH characteristics.
Background
With the development of science and technology and economy, government enterprises and public institutions have more and more workload, larger range of office activities, higher requirements and higher accuracy of marketization on office speed, and less identification card copy detection software available in the market. Most procedures for detecting identity card copies are still completely based on manual work, which causes a great deal of waste of time, manpower and material resources, and the result is greatly influenced by human factors. Most of traditional identity card copy detection software only uses a single characteristic for detection, and the detection accuracy is low. Both of these detection methods have significant disadvantages. Government enterprises and public institutions urgently need office automation software capable of automatically, quickly and accurately detecting whether procedures related to identity card copies are correct or not, so that the government enterprises and public institutions can spend less manpower, material resources and time and can quickly and accurately detect the identity card copies. When business related to the financial industry is handled, identity card copies need to be provided. Such as debit card transactions, security accounting transactions, financial insurance transactions, and the like. With the development of science and economy and the more and more people pay more attention to economic management, the workload of business personnel in many financial industries is increased sharply, and identity card copies must be detected regularly.
The traditional processing method selects a single characteristic for detection, and the detection method of the identity card copy on the market is few, and basically still completely depends on the condition of manual detection.
Disclosure of Invention
Aiming at the problems that the traditional method for manually detecting the identity card copy or detecting the identity card copy only according to a single characteristic has low detection efficiency and detection accuracy, the invention provides the identity card copy detection method fusing HOG and LBPH characteristics.
In order to achieve the purpose, the technical scheme of the invention is as follows: an identity card copy detection method fusing HOG and LBPH characteristics comprises the following steps:
step S1: selecting a large number of identity card and non-identity card pictures as positive and negative samples of a training sample set, and carrying out scale normalization on each picture in the training sample set;
step S2: extracting HOG characteristics of the training samples after the scale normalization, training the SVM based on the HOG characteristics, and obtaining a first classifier;
step S3: extracting the LBPH characteristic of the training sample after the scale normalization, training the SVM based on the LBPH characteristic, and obtaining a second classifier;
step S4: preprocessing the test image of the identity card copy;
step S5: carrying out target detection on the preprocessed test image by using a first classifier;
step S6: calculating the LBP characteristics of the target detection result of the step S5, and generating the LBPH characteristics according to the obtained LBP characteristics;
step S7: and judging by using a second classifier according to the LBPH characteristics generated in the step S6, and reserving the target with the judgment result of true to obtain the ID card copy in the test image.
Further, the method for extracting the HOG features of the training samples after the scale normalization in step S2 specifically includes:
normalizing gamma space and color space and calculating the gradient of each pixel of the training sample, and using the following equation:
H(s,t)=H(s,t)gamma
Gs(s,t)=H(s+1,t)-H(s-1,t) Gt(s,t)=H(s,t+1)-H(s,t-1)
where s denotes the abscissa on the training sample image, t denotes the ordinate on the training sample image, Gs(s, t) represents the horizontal gradient at the pixel point (s, t), Gt(s, t) represents a vertical gradient at the pixel point (s, t), G (s, t) represents a gradient magnitude value at the pixel point (s, t), α (s, t) represents a gradient direction at the pixel point (s, t), a parameter gamma is 0.5, and H (s, t) represents a pixel value at the pixel point (s, t);
the training sample is divided into cell cells, a histogram of gradient direction is constructed for each cell, then the cells are combined into blocks, the gradient histograms need to be normalized in the blocks, and finally the HOG feature vector of the training sample is generated.
Further, the method for training the SVM based on the HOG feature in step S2 to obtain the first classifier specifically includes:
using a linear kernel function, and using the following equation:
wherein x isεTo representHOG feature vector, x, of sample εlThe HOG feature vector representing the sample l, k represents the kernel function,denotes xεThe transposition of (2) and storing the training result into an XML file;
reading an array alpha, an array support vector and a floating point rho from the obtained XML file, multiplying the alpha and the support vector to obtain a row vector, multiplying the front of the row vector by-1, and adding the floating point rho at the last of the row vector to obtain a first classifier.
Further, the method for extracting the LBPH feature of the training sample after the scale normalization in the step S3 specifically includes:
calculating LBP characteristics of a training sample, dividing an image LBP into a plurality of coded images, and calculating the pixel value of each coded image by using the following formula:
dxn=-radius*sin(2.0*π*n/neighbors)dyn=radius*cos(2.0*π*n/neighbors),
where x represents the abscissa on the image, y represents the ordinate on the image, radius represents the sampling radius, neighbor represents the neighborhood size, parameter n is an integer, dxnThe nth neighborhood representing pixel point (x, y) corresponds to pixel offset abscissa, dynRepresenting the pixel shift ordinate corresponding to the nth neighborhood of the pixel (x, y), gray (x, y) representing the gray value at the pixel (x, y), gray (x, y)nRepresenting the gray value of the nth neighborhood of the pixel (x, y), lbp (x, y) representing the encoded value at the pixel (x, y), lbp (x, y)nRepresenting the coded value of the nth neighborhood of the pixel point (x, y), w representing the width of each area of the LBP coded image, and h representing the height of each area of the LBP coded image; generatingAnd training the LBPH characteristics of the sample, and acquiring the width and the height of each grid by using the following formula:
wherein, gridxIndicates the number of cells, grid, in the width directionyIndicating the number of bins in the height direction, LBPiDenotes the i-th coded picture area in the LBP coded picture, cols denotes the number of columns, rows denotes the number of rows, LBPiCols denotes the number of columns of the i-th coded picture area in the LBP code map, LBPiRows represents the number of rows, grad, of the ith encoded image region in the LBP encoded mapwRepresenting the width of the grid, gradhRepresenting the height of the grid, counting the height of each value of the histogram in each grid according to the row sequence, and storing the result to each row of the corresponding histogram matrix according to the sequence; then normalizing the height of the histogram; then using the row as main sequence to convert the corresponding histogram matrix into 1 row M2neighborsA vector matrix of columns, M representing the total number of regions; and finally, connecting the local histograms to obtain a histogram of the whole training sample.
Further, the step S4 specifically includes:
step S41: inputting an identity card copy test image;
step S42: the test image is normalized in scale using a bilinear interpolation algorithm using the following equation:
f (lambda + u, j + v) ═ 1-u) (1-v) f (lambda, j) + (1-u) vf (lambda, j +1) + u (1-v) f (lambda +1, j) + uvf (lambda +1, j +1), wherein lambda represents the horizontal coordinate of the tested image, j represents the vertical coordinate of the tested image, lambda and j are integers, u and v are small numbers which are greater than or equal to 0 and smaller than 1, and f (lambda, j) represents the pixel value of a pixel point (lambda, j) on the tested image;
step S43: the test image is converted to a gray scale map using the following formula:
Gray(λ,j)=[Red(λ,j)+Green(λ,j)+Blue(λ,j)]/3
red (lambda, j) represents a Red channel value at the pixel point (lambda, j), Green (lambda, j) represents a Green channel value at the pixel point (lambda, j), Blue (lambda, j) represents a Blue channel value at the pixel point (lambda, j), and Gray (lambda, j) represents a Gray value at the pixel point (lambda, j) in a Gray scale image;
step S44: gaussian smoothing is performed using the following equation:
wherein, σ represents the variance of the gaussian function, and Gauss (λ, j) represents the pixel value at the pixel point (λ, j) on the measured image after gaussian filtering processing.
Further, the step S5 specifically includes:
step S51: reading the first classifier, and performing target detection on the test image;
step S52: removing the area with the internal and external inclusion relation in the detection result, and utilizing the following formula:
(Recte&Rectψ)==Recte
wherein Rect iseRepresents a rectangular box e, RectψThe rectangular frame phi is shown, if the above formula is judged to be true, the rectangular frame e and the rectangular frame phi are in the relation of containing inside and outside, and a large area is reserved;
step S53: judging whether the detection results are intersected or not, and utilizing the following formula:
xc1=max(xa1,xb1)yc1=max(ya1,yb1)xc2=min(xa2,xb2)yc2=min(ya2,yb2)xc1<=xc2yc1<=yc2
wherein x isa1Abscissa, y, representing the upper left corner of the rectangular box aa1Ordinate, x, representing the upper left corner of the rectangular box aa2Abscissa, y, representing the lower right corner of the rectangular frame aa2Ordinate, x, representing the lower right corner of the rectangular frame ab1Abscissa, y, representing the upper left corner of the rectangular box bb1Ordinate, x, representing the upper left corner of the rectangular box bb2Representing momentsAbscissa, y, of the lower right corner of the frame bb2Ordinate, x, representing the lower right corner of the rectangular frame bc1Maximum value, y, representing the abscissa of the upper left corner of the rectangular box a and the rectangular box bc1Maximum value, x, representing the ordinate of the upper left corner of rectangular box a and rectangular box bc2Represents the minimum value, y, of the abscissa of the lower right corner of the rectangular frame a and the rectangular frame bc2The minimum value of the vertical coordinates of the lower right corners of the rectangular frame a and the rectangular frame b is represented, and if the above formula is judged to be true, the intersection relationship between the rectangular frame a and the rectangular frame b is represented;
step S54: fusing the crossed areas in the detection result, if the rectangular frames are crossed, solving the crossed area, and if the crossed area is larger than a threshold value, fusing the two rectangular frames by using the following formula:
xd1=min(xg1,xr1) yd1=min(yg1,yr1) xd2=max(xg2,xr2) yd2=max(yg2,yr2) Wherein x isd1Denotes the abscissa, y, of the top left corner of the fused rectangled1Denotes the ordinate, x, of the top left corner of the fused rectangled2Abscissa, y, representing the lower right corner of the fused rectangled2Ordinate, x, representing the lower right corner of the fused rectangleg1Abscissa, y, representing the upper left corner of the rectangular box gg1Denotes the ordinate, x, of the upper left corner of the rectangular box gg2Abscissa, y, representing the lower right corner of the rectangular frame gg2Ordinate, x, representing the lower right corner of the rectangular frame gr1Abscissa, y, representing the upper left corner of the rectangular box rr1Denotes the ordinate, x, of the upper left corner of the rectangular box rr2Abscissa, y, representing the lower right corner of the rectangular frame rr2The ordinate of the lower right corner of the rectangular frame r is shown.
Compared with the prior art, the invention has the beneficial effects that: firstly, training an SVM based on HOG characteristics, and saving a first classifier; secondly, training the SVM based on LBPH characteristics to obtain a second classifier, and then primarily determining the identity card through the first classifier; and finally, the preliminarily determined target is handed to a second classifier for secondary detection and classification, and the final target is determined. The invention can automatically and rapidly detect, and the combination of the HOG characteristic and the LBPH can accurately detect the identity card, thereby improving the detection accuracy, avoiding the manual detection, saving the time and the energy and avoiding the errors in the manual operation.
Drawings
FIG. 1 is a flow chart of the method for detecting the copy of the identity card with the HOG and LBPH characteristics fused.
Detailed Description
The invention is further explained below with reference to the drawings and the embodiments.
As shown in fig. 1, a method for detecting an identity card copy with the fused HOG and LBPH features comprises the following steps:
step S1: selecting a large number of identity card and non-identity card pictures as positive and negative samples of a training sample set, and carrying out scale normalization on each picture in the training sample set;
step S2: extracting HOG characteristics of the training samples after the scale normalization, training the SVM based on the HOG characteristics, and obtaining a first classifier;
the method for extracting the HOG characteristics of the training sample after the scale normalization specifically comprises the following steps:
normalizing gamma space and color space and calculating the gradient of each pixel of the training sample, and using the following equation:
H(s,t)=H(s,t)gamma
Gs(s,t)=H(s+1,t)-H(s-1,t) Gt(s,t)=H(s,t+1)-H(s,t-1)
where s denotes the abscissa on the training sample image, t denotes the ordinate on the training sample image, Gs(s, t) represents the horizontal gradient at the pixel point (s, t), Gt(s, t) represents a vertical gradient at the pixel point (s, t), G (s, t) represents a gradient magnitude value at the pixel point (s, t), α (s, t) represents a gradient direction at the pixel point (s, t), a parameter gamma is 0.5, and H (s, t) represents a pixel value at the pixel point (s, t);
the training sample is divided into cell cells, a histogram of gradient direction is constructed for each cell, then the cells are combined into blocks, the gradient histograms need to be normalized in the blocks, and finally the HOG feature vector of the training sample is generated.
The method for training the SVM based on the HOG features to obtain the first classifier specifically comprises the following steps:
using a linear kernel function, and using the following equation:
wherein x isεHOG feature vector, x, representing sample εlThe HOG feature vector representing the sample l, k represents the kernel function,denotes xεThe transposition of (2) and storing the training result into an XML file;
reading an array alpha, an array support vector and a floating point rho from the obtained XML file, multiplying the alpha and the support vector to obtain a row vector, multiplying the front of the row vector by-1, and adding the floating point rho at the last of the row vector to obtain a first classifier.
Step S3: extracting the LBPH characteristic of the training sample after the scale normalization, training the SVM based on the LBPH characteristic, and obtaining a second classifier;
the method for extracting the LBPH characteristic of the training sample after the scale normalization specifically comprises the following steps:
calculating LBP characteristics of a training sample, dividing an image LBP into a plurality of coded images, and calculating the pixel value of each coded image by using the following formula:
dxn=-radius*sin(2.0*π*n/neighbors)dyn=radius*cos(2.0*π*n/neighbors),
where x represents the abscissa on the image, y represents the ordinate on the image, radius represents the sampling radius, neighbor represents the neighborhood size, parameter n is an integer, dxnThe nth neighborhood representing pixel point (x, y) corresponds to pixel offset abscissa, dynRepresenting the pixel shift ordinate corresponding to the nth neighborhood of the pixel (x, y), gray (x, y) representing the gray value at the pixel (x, y), gray (x, y)nRepresenting the gray value of the nth neighborhood of the pixel (x, y), lbp (x, y) representing the encoded value at the pixel (x, y), lbp (x, y)nRepresenting the coded value of the nth neighborhood of the pixel point (x, y), w representing the width of each area of the LBP coded image, and h representing the height of each area of the LBP coded image;
generating LBPH characteristics of training samples, and acquiring the width and the height of each grid by using the following formula:
wherein, gridxIndicates the number of cells, grid, in the width directionyIndicating the number of bins in the height direction, LBPiDenotes the i-th coded picture area in the LBP coded picture, cols denotes the number of columns, rows denotes the number of rows, LBPiCols denotes the number of columns of the i-th coded picture area in the LBP code map, LBPiRows represents the number of rows, grad, of the ith encoded image region in the LBP encoded mapwRepresenting the width of the grid, gradhRepresenting the height of the grid, counting the height of each value of the histogram in each grid according to the row sequence, and storing the result to each row of the corresponding histogram matrix according to the sequence; the histogram is then normalized in height, i.e., the total histogram height divided by the gradw*gradh;
Then using the row as main sequence to convert the corresponding histogram matrix into 1 row M2neighborsA vector matrix of columns, M representing the total number of regions; finally, the local histogram is connected to obtain the whole training sampleA histogram of (a).
The SVM is trained based on LBPH features. Using a linear kernel function, the following equation is utilized:
wherein x isεLBPH feature vector, x, representing sample εlDenotes the LBPH feature vector of sample l, κ denotes the kernel function,denotes xεAnd (4) transposing, and training to obtain a second classifier.
Step S4: preprocessing the test image of the identity card copy;
the method specifically comprises the following steps:
step S41: inputting an identity card copy test image;
step S42: the test image is normalized in scale using a bilinear interpolation algorithm using the following equation:
f (lambda + u, j + v) ═ 1-u) (1-v) f (lambda, j) + (1-u) vf (lambda, j +1) + u (1-v) f (lambda +1, j) + uvf (lambda +1, j +1), wherein lambda represents the horizontal coordinate of the tested image, j represents the vertical coordinate of the tested image, lambda and j are integers, u and v are small numbers which are greater than or equal to 0 and smaller than 1, and f (lambda, j) represents the pixel value of a pixel point (lambda, j) on the tested image;
step S43: the test image is converted to a gray scale map using the following formula:
Gray(λ,j)=[Red(λ,j)+Green(λ,j)+Blue(λ,j)]/3
red (lambda, j) represents a Red channel value at the pixel point (lambda, j), Green (lambda, j) represents a Green channel value at the pixel point (lambda, j), Blue (lambda, j) represents a Blue channel value at the pixel point (lambda, j), and Gray (lambda, j) represents a Gray value at the pixel point (lambda, j) in a Gray scale image;
step S44: gaussian smoothing is performed using the following equation:
wherein, σ represents the variance of the gaussian function, and Gauss (λ, j) represents the pixel value at the pixel point (λ, j) on the measured image after gaussian filtering processing.
Step S5: carrying out target detection on the preprocessed test image by using a first classifier;
the method specifically comprises the following steps:
step S51: reading the first classifier, and performing target detection on the test image;
step S52: removing the area with the internal and external inclusion relation in the detection result, and utilizing the following formula:
(Recte&Rectψ)==Recte
wherein Rect iseRepresents a rectangular box e, RectψThe rectangular frame phi is shown, if the above formula is judged to be true, the rectangular frame e and the rectangular frame phi are in the relation of containing inside and outside, and a large area is reserved;
step S53: judging whether the detection results are intersected or not, and utilizing the following formula:
xc1=max(xa1,xb1)yc1=max(ya1,yb1)xc2=min(xa2,xb2)yc2=min(ya2,yb2)xc1<=xc2yc1<=yc2
wherein x isa1Abscissa, y, representing the upper left corner of the rectangular box aa1Ordinate, x, representing the upper left corner of the rectangular box aa2Abscissa, y, representing the lower right corner of the rectangular frame aa2Ordinate, x, representing the lower right corner of the rectangular frame ab1Abscissa, y, representing the upper left corner of the rectangular box bb1Ordinate, x, representing the upper left corner of the rectangular box bb2Abscissa, y, representing the lower right corner of rectangular box bb2Ordinate, x, representing the lower right corner of the rectangular frame bc1Maximum value, y, representing the abscissa of the upper left corner of the rectangular box a and the rectangular box bc1Maximum value, x, representing the ordinate of the upper left corner of rectangular box a and rectangular box bc2Representing rectangular boxes a and bMinimum of the abscissa of the lower right corner, yc2The minimum value of the vertical coordinates of the lower right corners of the rectangular frame a and the rectangular frame b is represented, and if the above formula is judged to be true, the intersection relationship between the rectangular frame a and the rectangular frame b is represented;
step S54: fusing the crossed areas in the detection result, if the rectangular frames are crossed, solving the crossed area, and if the crossed area is larger than a threshold value, fusing the two rectangular frames by using the following formula:
xd1=min(xg1,xr1)yd1=min(yg1,yr1)xd2=max(xg2,xr2)yd2=max(yg2,yr2) Wherein x isd1Denotes the abscissa, y, of the top left corner of the fused rectangled1Denotes the ordinate, x, of the top left corner of the fused rectangled2Abscissa, y, representing the lower right corner of the fused rectangled2Ordinate, x, representing the lower right corner of the fused rectangleg1Abscissa, y, representing the upper left corner of the rectangular box gg1Denotes the ordinate, x, of the upper left corner of the rectangular box gg2Abscissa, y, representing the lower right corner of the rectangular frame gg2Ordinate, x, representing the lower right corner of the rectangular frame gr1Abscissa, y, representing the upper left corner of the rectangular box rr1 denotes the ordinate, x, of the upper left corner of the rectangular box rr2Abscissa, y, representing the lower right corner of the rectangular frame rr2The ordinate of the lower right corner of the rectangular frame r is shown.
Step S6: calculating the LBP characteristics of the target detection result of the step S5, and generating the LBPH characteristics according to the obtained LBP characteristics;
step S7: and judging by using a second classifier according to the LBPH characteristics generated in the step S6, and reserving the target with the judgment result of true to obtain the ID card copy in the test image.
The above are preferred embodiments of the present invention, and all changes made according to the technical scheme of the present invention that produce functional effects do not exceed the scope of the technical scheme of the present invention belong to the protection scope of the present invention.
Claims (1)
1. A method for detecting an identity card copy fused with HOG and LBPH characteristics is characterized by comprising the following steps:
step S1: selecting a large number of identity card and non-identity card pictures as positive and negative samples of a training sample set, and carrying out scale normalization on each picture in the training sample set;
step S2: extracting HOG characteristics of the training samples after the scale normalization, training the SVM based on the HOG characteristics, and obtaining a first classifier;
step S3: extracting the LBPH characteristic of the training sample after the scale normalization, training the SVM based on the LBPH characteristic, and obtaining a second classifier;
step S4: preprocessing the test image of the identity card copy;
step S5: carrying out target detection on the preprocessed test image by using a first classifier;
step S6: calculating the LBP characteristics of the target detection result of the step S5, and generating the LBPH characteristics according to the obtained LBP characteristics;
step S7: judging by using a second classifier according to the LBPH characteristics generated in the step S6, and reserving a target with a true judgment result to obtain an identity card copy in the test image;
in step S2, the method for training the SVM based on the HOG feature to obtain the first classifier specifically includes:
using a linear kernel function, and using the following equation:
wherein x isεHOG feature vector, x, representing sample εlThe HOG feature vector representing the sample l, k represents the kernel function,denotes xεThe transposition of (2) and storing the training result into an XML file;
reading an array alpha, an array support vector and a floating point rho from the obtained XML file, multiplying the alpha and the support vector to obtain a row vector, multiplying the front of the row vector by-1, and adding the floating point rho at the last of the row vector to obtain a first classifier;
the step S4 specifically includes:
step S41: inputting an identity card copy test image;
step S42: the test image is normalized in scale using a bilinear interpolation algorithm using the following equation: f (lambda + u, j + v) ═ 1-u) (1-v) f (lambda, j) + (1-u) vf (lambda, j +1) + u (1-v) f (lambda +1, j) + uvf (lambda +1, j +1), wherein lambda represents the horizontal coordinate of the tested image, j represents the vertical coordinate of the tested image, lambda and j are integers, u and v are small numbers which are greater than or equal to 0 and smaller than 1, and f (lambda, j) represents the pixel value of a pixel point (lambda, j) on the tested image;
step S43: the test image is converted to a gray scale map using the following formula:
Gray(λ,j)=[Red(λ,j)+Green(λ,j)+Blue(λ,j)]/3
red (lambda, j) represents a Red channel value at the pixel point (lambda, j), Green (lambda, j) represents a Green channel value at the pixel point (lambda, j), Blue (lambda, j) represents a Blue channel value at the pixel point (lambda, j), and Gray (lambda, j) represents a Gray value at the pixel point (lambda, j) in a Gray scale image;
step S44: gaussian smoothing is performed using the following equation:
wherein, σ represents the variance of the Gaussian function, and Gauss (λ, j) represents the pixel value at the pixel point (λ, j) on the measured image after Gaussian filtering processing;
the step S5 specifically includes:
step S51: reading the first classifier, and performing target detection on the test image;
step S52: removing the area with the internal and external inclusion relation in the detection result, and utilizing the following formula:
(Recte&Rectψ)==Recte
wherein Rect iseRepresenting momentsFrame e, RectψThe rectangular frame phi is shown, if the above formula is judged to be true, the rectangular frame e and the rectangular frame phi are in the relation of containing inside and outside, and a large area is reserved;
step S53: judging whether the detection results are intersected or not, and utilizing the following formula:
xc1=max(xa1,xb1)
yc1=max(ya1,yb1)
xc2=min(xa2,xb2)
yc2=min(ya2,yb2)
xc1<=xc2 yc1<=yc2
wherein x isa1Abscissa, y, representing the upper left corner of the rectangular box aa1Ordinate, x, representing the upper left corner of the rectangular box aa2Abscissa, y, representing the lower right corner of the rectangular frame aa2Ordinate, x, representing the lower right corner of the rectangular frame ab1Abscissa, y, representing the upper left corner of the rectangular box bb1Ordinate, x, representing the upper left corner of the rectangular box bb2Abscissa, y, representing the lower right corner of rectangular box bb2Ordinate, x, representing the lower right corner of the rectangular frame bc1Maximum value, y, representing the abscissa of the upper left corner of the rectangular box a and the rectangular box bc1Maximum value, x, representing the ordinate of the upper left corner of rectangular box a and rectangular box bc2Represents the minimum value, y, of the abscissa of the lower right corner of the rectangular frame a and the rectangular frame bc2The minimum value of the vertical coordinates of the lower right corners of the rectangular frame a and the rectangular frame b is represented, and if the above formula is judged to be true, the intersection relationship between the rectangular frame a and the rectangular frame b is represented;
step S54: fusing the crossed areas in the detection result, if the rectangular frames are crossed, solving the crossed area, and if the crossed area is larger than a threshold value, fusing the two rectangular frames by using the following formula:
xd1=min(xg1,xr1)
yd1=min(yg1,yr1)
xd2=max(xg2,xr2)
yd2=max(yg2,yr2)
wherein x isd1Denotes the abscissa, y, of the top left corner of the fused rectangled1Denotes the ordinate, x, of the top left corner of the fused rectangled2Abscissa, y, representing the lower right corner of the fused rectangled2Ordinate, x, representing the lower right corner of the fused rectangleg1Abscissa, y, representing the upper left corner of the rectangular box gg1Denotes the ordinate, x, of the upper left corner of the rectangular box gg2Abscissa, y, representing the lower right corner of the rectangular frame gg2Ordinate, x, representing the lower right corner of the rectangular frame gr1Abscissa, y, representing the upper left corner of the rectangular box rr1Denotes the ordinate, x, of the upper left corner of the rectangular box rr2Abscissa, y, representing the lower right corner of the rectangular frame rr2The ordinate of the lower right corner of the rectangular frame r is represented;
the method for extracting the HOG features of the training samples after the scale normalization in the step S2 specifically includes:
normalizing gamma space and color space and calculating the gradient of each pixel of the training sample, and using the following equation:
H(s,t)=H(s,t)gamma
Gs(s,t)=H(s+1,t)-H(s-1,t)
Gt(s,t)=H(s,t+1)-H(s,t-1)
where s denotes the abscissa on the training sample image, t denotes the ordinate on the training sample image, Gs(s, t) represents the horizontal gradient at the pixel point (s, t), Gt(s, t) represents the vertical gradient at the pixel (s, t), G (s, t) represents the gradient magnitude at the pixel (s, t), and α (s, t) represents the gradient magnitude at the pixel (s, t)H (s, t) represents a pixel value at the pixel point (s, t);
dividing a training sample into cell cells, constructing a histogram of gradient direction for each cell, combining the cells into blocks, normalizing the gradient histograms in the blocks, and finally generating an HOG feature vector of the training sample;
the method for extracting the LBPH feature of the training sample after the scale normalization in the step S3 specifically includes:
calculating LBP characteristics of a training sample, dividing an image LBP into a plurality of coded images, and calculating the pixel value of each coded image by using the following formula:
dxn=-radius*sin(2.0*π*n/neighbors)
dyn=radius*cos(2.0*π*n/neighbors)
where x represents the abscissa on the image, y represents the ordinate on the image, radius represents the sampling radius, neighbor represents the neighborhood size, parameter n is an integer, dxnThe nth neighborhood representing pixel point (x, y) corresponds to pixel offset abscissa, dynRepresenting the pixel shift ordinate corresponding to the nth neighborhood of the pixel (x, y), gray (x, y) representing the gray value at the pixel (x, y), gray (x, y)nRepresenting the gray value of the nth neighborhood of the pixel (x, y), lbp (x, y) representing the encoded value at the pixel (x, y), lbp (x, y)nRepresenting the coded value of the nth neighborhood of the pixel point (x, y), w representing the width of each area of the LBP coded image, and h representing the height of each area of the LBP coded image;
generating LBPH characteristics of training samples, and acquiring the width and the height of each grid by using the following formula:
wherein, gridxIndicates the number of cells, grid, in the width directionyIndicating the number of bins in the height direction, LBPiDenotes the i-th coded picture area in the LBP coded picture, cols denotes the number of columns, rows denotes the number of rows, LBPiCols denotes the number of columns of the i-th coded picture area in the LBP code map, LBPiRows represents the number of rows, grad, of the ith encoded image region in the LBP encoded mapwRepresenting the width of the grid, gradhRepresenting the height of the grid, counting the height of each value of the histogram in each grid according to the row sequence, and storing the result to each row of the corresponding histogram matrix according to the sequence; then normalizing the height of the histogram; then using the row as main sequence to convert the corresponding histogram matrix into 1 row M2neighborsA vector matrix of columns, M representing the total number of regions; and finally, connecting the local histograms to obtain a histogram of the whole training sample.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810172048.9A CN108388920B (en) | 2018-03-01 | 2018-03-01 | HOG and LBPH characteristic fused identity card copy detection method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810172048.9A CN108388920B (en) | 2018-03-01 | 2018-03-01 | HOG and LBPH characteristic fused identity card copy detection method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108388920A CN108388920A (en) | 2018-08-10 |
CN108388920B true CN108388920B (en) | 2022-04-08 |
Family
ID=63070166
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810172048.9A Active CN108388920B (en) | 2018-03-01 | 2018-03-01 | HOG and LBPH characteristic fused identity card copy detection method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108388920B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109377624B (en) * | 2018-11-23 | 2020-09-08 | 深圳市宝诚通科技发展有限公司 | Intelligent door opening system based on face image recognition |
CN112800968B (en) * | 2021-01-29 | 2024-05-14 | 江苏大学 | HOG blocking-based feature histogram fusion method for identifying identity of pigs in drinking area |
Family Cites Families (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102169544A (en) * | 2011-04-18 | 2011-08-31 | 苏州市慧视通讯科技有限公司 | Face-shielding detecting method based on multi-feature fusion |
US9330336B2 (en) * | 2011-09-16 | 2016-05-03 | Arizona Board of Regents, a body corporate of the State of Arizona, acting for and on behalf of, Arizona State University | Systems, methods, and media for on-line boosting of a classifier |
CN103634519A (en) * | 2012-08-28 | 2014-03-12 | 北京博威康技术有限公司 | Image display method and device based on dual-camera head |
CN104063722B (en) * | 2014-07-15 | 2018-03-23 | 国家电网公司 | A kind of detection of fusion HOG human body targets and the safety cap recognition methods of SVM classifier |
CN104268514A (en) * | 2014-09-17 | 2015-01-07 | 西安交通大学 | Gesture detection method based on multi-feature fusion |
CN105825243A (en) * | 2015-01-07 | 2016-08-03 | 阿里巴巴集团控股有限公司 | Method and device for certificate image detection |
CN104978567B (en) * | 2015-06-11 | 2018-11-20 | 武汉大千信息技术有限公司 | Vehicle checking method based on scene classification |
CN105447503B (en) * | 2015-11-05 | 2018-07-03 | 长春工业大学 | Pedestrian detection method based on rarefaction representation LBP and HOG fusion |
US10740912B2 (en) * | 2016-05-19 | 2020-08-11 | Intel Corporation | Detection of humans in images using depth information |
CN106250936A (en) * | 2016-08-16 | 2016-12-21 | 广州麦仑信息科技有限公司 | Multiple features multithreading safety check contraband automatic identifying method based on machine learning |
CN106570523B (en) * | 2016-10-25 | 2019-07-26 | 浙江工业大学 | Multi-feature combined robot football recognition method |
CN106682641A (en) * | 2017-01-05 | 2017-05-17 | 北京细推科技有限公司 | Pedestrian identification method based on image with FHOG- LBPH feature |
CN106940791B (en) * | 2017-03-09 | 2019-11-26 | 中南大学 | A kind of pedestrian detection method based on low-dimensional histograms of oriented gradients |
CN107563377A (en) * | 2017-08-30 | 2018-01-09 | 江苏实达迪美数据处理有限公司 | It is a kind of to detect localization method using the certificate key area of edge and character area |
-
2018
- 2018-03-01 CN CN201810172048.9A patent/CN108388920B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN108388920A (en) | 2018-08-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108647681B (en) | A kind of English text detection method with text orientation correction | |
CN111401372B (en) | Method for extracting and identifying image-text information of scanned document | |
CN108596166A (en) | A kind of container number identification method based on convolutional neural networks classification | |
CN110648322B (en) | Cervical abnormal cell detection method and system | |
CN111539330B (en) | Transformer substation digital display instrument identification method based on double-SVM multi-classifier | |
CN106096610A (en) | A kind of file and picture binary coding method based on support vector machine | |
CN107256547A (en) | A kind of face crack recognition methods detected based on conspicuousness | |
CN112307919B (en) | Improved YOLOv 3-based digital information area identification method in document image | |
CN102547079B (en) | Night scene light source detection device and method | |
CN109740572A (en) | A kind of human face in-vivo detection method based on partial color textural characteristics | |
CN108334955A (en) | Copy of ID Card detection method based on Faster-RCNN | |
CN113688821B (en) | OCR text recognition method based on deep learning | |
CN108388920B (en) | HOG and LBPH characteristic fused identity card copy detection method | |
CN110689003A (en) | Low-illumination imaging license plate recognition method and system, computer equipment and storage medium | |
CN110443184A (en) | ID card information extracting method, device and computer storage medium | |
CN111626145A (en) | Simple and effective incomplete form identification and page-crossing splicing method | |
WO2022111247A1 (en) | Report analysis method and apparatus | |
CN117315670B (en) | Water meter reading area detection method based on computer vision | |
CN113313678A (en) | Automatic sperm morphology analysis method based on multi-scale feature fusion | |
CN112215266A (en) | X-ray image contraband detection method based on small sample learning | |
CN113159027B (en) | Seven-segment digital display instrument identification method based on minimum external rectangular variant | |
CN116259008A (en) | Water level real-time monitoring method based on computer vision | |
Gyamfi et al. | Pixel-based unsupervised classification approach for information detection on optical markup recognition sheet | |
CN112308141B (en) | Scanning bill classification method, system and readable storage medium | |
Sathisha | Bank automation system for Indian currency-a novel approach |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |