CN112686247A - Identification card number detection method and device, readable storage medium and terminal - Google Patents
Identification card number detection method and device, readable storage medium and terminal Download PDFInfo
- Publication number
- CN112686247A CN112686247A CN202011455531.1A CN202011455531A CN112686247A CN 112686247 A CN112686247 A CN 112686247A CN 202011455531 A CN202011455531 A CN 202011455531A CN 112686247 A CN112686247 A CN 112686247A
- Authority
- CN
- China
- Prior art keywords
- image
- area
- detection
- identity card
- character
- 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
- 238000001514 detection method Methods 0.000 title claims abstract description 72
- 238000003860 storage Methods 0.000 title claims abstract description 17
- 238000000034 method Methods 0.000 claims abstract description 57
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 26
- 238000004891 communication Methods 0.000 claims abstract description 22
- 230000000877 morphologic effect Effects 0.000 claims abstract description 5
- 238000012545 processing Methods 0.000 claims description 16
- 238000003708 edge detection Methods 0.000 claims description 14
- 238000005520 cutting process Methods 0.000 claims description 12
- 230000008859 change Effects 0.000 claims description 7
- 238000007781 pre-processing Methods 0.000 claims description 7
- 238000013075 data extraction Methods 0.000 claims description 4
- 230000003044 adaptive effect Effects 0.000 claims description 3
- 150000001875 compounds Chemical class 0.000 claims description 3
- 239000000463 material Substances 0.000 claims description 3
- 238000004519 manufacturing process Methods 0.000 claims description 2
- 238000000605 extraction Methods 0.000 abstract description 5
- 238000012937 correction Methods 0.000 abstract description 2
- 238000010606 normalization Methods 0.000 abstract description 2
- 238000005516 engineering process Methods 0.000 description 11
- 238000012549 training Methods 0.000 description 7
- 238000013528 artificial neural network Methods 0.000 description 6
- 230000008569 process Effects 0.000 description 6
- 230000010339 dilation Effects 0.000 description 5
- 238000003062 neural network model Methods 0.000 description 4
- 238000012015 optical character recognition Methods 0.000 description 4
- 238000010191 image analysis Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000004913 activation Effects 0.000 description 2
- 238000004590 computer program Methods 0.000 description 2
- 238000013527 convolutional neural network Methods 0.000 description 2
- 238000013135 deep learning Methods 0.000 description 2
- 230000007547 defect Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000007689 inspection Methods 0.000 description 2
- 238000002372 labelling Methods 0.000 description 2
- 239000011159 matrix material Substances 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- PXFBZOLANLWPMH-UHFFFAOYSA-N 16-Epiaffinine Natural products C1C(C2=CC=CC=C2N2)=C2C(=O)CC2C(=CC)CN(C)C1C2CO PXFBZOLANLWPMH-UHFFFAOYSA-N 0.000 description 1
- 238000009825 accumulation Methods 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 208000003464 asthenopia Diseases 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 238000003745 diagnosis Methods 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 230000008030 elimination Effects 0.000 description 1
- 238000003379 elimination reaction Methods 0.000 description 1
- 230000002068 genetic effect Effects 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 230000001788 irregular Effects 0.000 description 1
- 230000004807 localization Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000009417 prefabrication Methods 0.000 description 1
- 238000007639 printing Methods 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Images
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/82—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
-
- 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/24—Aligning, centring, orientation detection or correction of the image
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/10—Character recognition
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/40—Document-oriented image-based pattern recognition
- G06V30/41—Analysis of document content
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/40—Document-oriented image-based pattern recognition
- G06V30/42—Document-oriented image-based pattern recognition based on the type of document
Landscapes
- Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Computation (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)
- Image Analysis (AREA)
Abstract
The invention provides an identification card number detection method, a device, a readable storage medium and a terminal, wherein the method comprises the steps of firstly, positioning an identification card position by applying a target detection algorithm, extracting an image in a detection frame, carrying out size normalization on the image, selecting a mask with a proper scale to carry out morphological operation on the image, enabling an identification card number area to realize communication, adaptively selecting a threshold value to realize binarization, obtaining a straight line by applying hough, selecting a main direction of the image and rotating, and extracting a communication area with a length-width ratio meeting requirements and the identification card number area. The detection scheme does not need to perform inclination correction of the identity card, can improve identity card information extraction in a complex shooting scene, greatly improves the recognition rate, and can be widely applied to the fields of security, finance and the like.
Description
Technical Field
The invention relates to the technical field of information detection or intelligent vision, in particular to a method and a device for detecting an identity card number, a readable storage medium and a terminal.
Background
With the rise of artificial intelligence, image recognition technology is gradually applied to the fields of security, military, medical treatment, intelligent transportation and the like, and technologies such as face recognition, fingerprint recognition and the like are increasingly used in the security fields of public security, finance, aerospace and the like. In the military field, image recognition is mainly applied to detection and recognition of targets, and enemy targets are recognized and hit through an automatic image recognition technology; in the medical field, various medical image analysis and diagnosis can be performed through an image recognition technology, so that the medical cost can be greatly reduced, and the medical quality and efficiency can be improved; the vehicle license plate recognition can be carried out in the traffic field, and meanwhile, the vehicle license plate recognition method can also be applied to the automatic driving field at the front edge, so that the clear recognition of roads, vehicles and pedestrians is realized, the convenience of life is improved, and the travel cost of people is reduced.
For identification of certificate images, identity cards are the most commonly used certificates in daily life, and rapid and efficient identification of identity information is needed in the fields of security, finance and enterprise and public information management. Most of information of the early identity card needs to be input manually, the efficiency is very low, and the long-time identification process can also cause eye fatigue, so that the manual input is not suitable for the current situation of rapid development in the fields of current computers and the like. Although the technology of automatically identifying or extracting the information of the identity card has appeared, for complex scenes, such as misalignment of the identity card in vision, uneven illumination, interference of an external light field, sundry coverage and the like, the outline of the identity card and the background boundary of an image are fuzzy, and the accurate extraction of the boundary of the identity card is not facilitated, so that the detection efficiency of the identity card number is reduced or failed. Some solutions have also emerged for this purpose as follows.
The traditional method comprises the following steps: the method comprises the following steps of positioning the edge of a certificate by using an edge detection algorithm and applying an edge detection operator, determining intersection point information of a certificate edge straight line and the edge straight line by using edge point straight line fitting so as to determine a certificate deflection angle, rotating the certificate, and then detecting the position of a certificate number by using an image processing method, wherein the accurate detection of the certificate edge point is the core step of the method, the edge detection operator has high requirements on the complexity of an image background, and if the gradient change of a foreground area of the image background is small or a background area has a large amount of edge information, the detection of the certificate edge point fails, so that the detection of the certificate number cannot be realized.
The deep learning method comprises the following steps: the method comprises the steps of training a deep network by applying a large amount of labeled data in a model training stage, fitting network parameters, realizing modeling of an OCR (Optical Character Recognition) detection algorithm, and realizing detection of a Character area by taking the whole image as input of the network and by network forward reasoning in a model prediction stage. The method is a popular character detection method at present, and for a certificate number detection task, the method has the following defects that (1) non-certificate area images also participate in a network reasoning process, on one hand, computing resources are wasted, and on the other hand, the character misdetection in the non-certificate area needs to be additionally added with processing logic for elimination; (2) the scheme has larger consumption of computing resources and longer training and reasoning time compared with the proposal; (3) because of the unexplainable line of the neural network, the frame of the character area positioned by the method cannot accurately position the minimum external rectangular frame of the character, and even can cut off part of the character area, namely the traditional certificate image optical recognition (OCR) technology is mainly oriented to high-definition scanned images, and the method requires that the identified images have clean backgrounds, use a standard printing form and have higher resolution. However, in a natural scene, problems of large text background noise, irregular text distribution, influence of natural light sources and the like exist, the detection rate of the OCR technology in the actual natural scene is not ideal, and pressure is brought to character recognition in the following steps aiming at identification cards and other certificates.
In summary, in the existing identification card recognition technology, the quality inspection video definition is extremely poor, the environment is extremely complex, the quality inspection requirements are various, and the existing algorithm solves a single problem, for example, recognizing human face and character information from a high-quality image is difficult to directly convert into complex business judgment, so that a detection technology capable of efficiently recognizing the certificate under a complex environment with a complex background of a non-certificate area or a small gradient change of a certificate foreground area is required.
Disclosure of Invention
In order to overcome the defects of the prior art, the invention aims to provide an identification number detection method, an identification number detection device, a readable storage medium and a terminal, which can solve the problems.
The design principle is as follows: firstly, positioning the position of an identity card by using a target detection algorithm, extracting an image in a detection frame, carrying out size normalization on the image, selecting a mask with a proper scale to carry out morphological operation on the image, enabling an identity card number region to be communicated, adaptively selecting a threshold value to realize binarization, obtaining a straight line by using hough, selecting a main direction of the image and rotating, and extracting a communication region with a length-width ratio meeting requirements and the identity card number region; among them, hough transform is a feature detection (feature extraction) widely used in image analysis (image analysis), computer vision (computer vision) and digital image processing (digital image processing). The hough transform is used to identify features in the found object, such as: a line. His algorithm flow is roughly as follows, given an object, the kind of shape to be distinguished, the algorithm performs a vote in the parameter space (parameter space) to determine the shape of the object, which is determined by the local maximum (local maximum) in the accumulation space (accumulator space). For the hough transform, the principle of straight line detection is represented by a straight line: for a straight line in a plane, in hough transform, consider the representation as: a straight line is represented by (r, theta). Where r is the distance from the line to the origin, and theta is the angle between the perpendicular to the line and the x-axis. That is, the parameter representing a straight line in the hough transform becomes (r, theta). Judging whether a plurality of points are on the same straight line: when an object becomes a point, a point can emit innumerable straight lines, and according to the straight line expression form of hough transform, assuming that the point is i, a straight line passing through the point is represented by (ri, thetai). Assuming again that a point is j, then we denote by (rj, thetaj) a series of straight lines that pass through point j. Two points determine a straight line, so the straight line at these two points must have ri ═ rj and thetai ═ thetaj. When three points are used, assuming that the third point is k, a series of straight lines passing through the points k is (rk, theta), and if the three points are on one straight line, then there must be some ri ═ rk ═ r, and some tei ═ thetaj ═ thetak ═ theta. When detecting straight lines through Hough transform, the same straight lines need to be found, and if N points are provided, the straight lines are detected, namely specific r and theta are found. For each point mentioned above, an infinite number of straight lines, here n (usually n is 180), can be found together, and for these Nn (r, theta), statistics can be used, until at theta a certain value theta _ i, the r approximation of the points is equal to r _ i. That is, the points are all on a straight line (r _ i, theta _ i).
The purpose of the invention is realized by adopting the following technical scheme:
a method for detecting an identity card number comprises the following steps: the first step is as follows: detecting the identity card, namely detecting the position of an identity card image in the image by applying a target detection algorithm, wherein S is (a, b, c and d), wherein S is an area where the identity is located, a is the horizontal coordinate of the upper left point of the area, b is the vertical coordinate of the upper left point of the area, c is the horizontal coordinate of the lower right point of the area, and d is the vertical coordinate of the lower right point of the area; the second step is that: drawing the size of an area of the identity card, cutting an image of the identity card according to the position detected in the first step, drawing a long edge into a fixed size under the condition of not changing the original length-width ratio, and drawing a short edge into a fixed size in the same proportion; setting the length of the image after the first stroke as L, the width as H and the image as R; the third step: the identification number area is gelatinized, a mask corresponding to the second step of planning the size is designed, and the mask is used for carrying out morphological operation on the image, so that the purpose of communicating and gelatinizing the character area image is achieved; setting a rectangular mask, and performing expansion operation on the image after the image is planned, wherein the size of the mask is the size of the character to be detected; obtaining a corrected image after the expansion operation; the fourth step: edge detection, namely applying canny detection to obtain an edge detection image C; the fifth step: detecting a straight line to obtain an inclination angle theta; rotating the image, namely rotating the identification image by applying the inclination angle obtained by calculation in the fifth step; the seventh step: expanding and binarizing the rotating image; eighth step: and extracting a communication area with the length-width ratio meeting the requirement, namely an identity card number area, binarizing the image, firstly obtaining character detection and post-selection areas of all rows, and then fusing production character candidate areas of all rows to serve as the identity card number area.
Preferably, the target detection algorithm employed in the first step comprises one of yolo and ssd.
Preferably, in the fifth step, the inclination angle θ is obtained by: performing linear detection on the fourth step binary image by using hough change to obtain a linear detection sequence
Keeping the straight line with the longest length, and calculating the inclination angle of the straight line:
Preferably, the rotation relationship adopted in the sixth step is:
preferably, in the seventh step, the method for expanding and binarizing the rotated image is as follows:
the dilation method is to take a sliding window of size δ +1 to slide on the image R', the smallest pixel within the sliding window being the output of the dilation method in place, and is implemented as follows,
the expanded image is recorded as:
S=[si,j]H×W… … … … … … … … … … … … … the compound of formula 6 is shown in formula 6,
the expansion method comprises the following steps:
si,j=min(R′ij) … … … … … … … … … … … … the method has the advantages that the materials in the formula 7,
wherein R 'is'ijSubimages taken at i, j pixel locations for a sliding window
And applying an adaptive threshold algorithm to the expanded image S to obtain two images TS.
Preferably, the eighth step is to extract a communication area with the length-width ratio meeting the requirement as the identity card number area, the steps are as follows, the image is projected and cut in rows, a communication channel is obtained, then the communication channels are cut in rows and columns, the communication area is obtained, the aspect ratio of the communication area meets the preset condition and is the identity card number area.
For picture TS ═ TSij]Performing line projection to calculate line projection value HORi
Cutting the line projection to obtain the joint traffic, and determining the starting line and the ending line of each joint trafficLine, cut method is as follows, traversing the HOR line by lineiRecording a starting line if the sum of the projection values of the continuous h lines is greater than a fixed threshold TH, not recording a new starting line if no ending line appears, recording an ending starting line if the starting line exists and the sum of the projection values of the continuous h lines is less than the fixed threshold TH, forming a pair of the starting line and the ending line, and recording the m-TH pair of the starting line and the ending line HSm,HEm:
For each linked row projection, for the mth linked row projection,
VERmj=∑itsi,j,i=HSm...HEm。
and (3) carrying out column projection and cutting on the column projection of the cross traffic to obtain a starting column and an ending column of the communication area, wherein the cutting method comprises the following step of traversing the VER column by columnmjThe projection values of the connected rows and columns are recorded, if the sum of the projection values of the continuous w connected rows and columns is greater than a fixed threshold TW, the initial row is recorded, if no termination row appears, no new initial row is recorded, if the initial row exists, and the sum of the projection values of the continuous w connected rows and columns is less than the fixed threshold TW, the termination row is recorded, and the nth connected row of the mth connected row is recordedmFor the initial column, the end column is
The communication area is obtained by starting the row, ending the row, starting the column and ending the column
If it satisfies
Then the region is an identity card number region, where T1,T2Is the aspect ratio threshold of the pre-designed identification number.
The invention also provides a device for detecting the ID number, which comprises: the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring image information to be processed; the preprocessing unit is used for preprocessing the acquired image to obtain a normalized image R; the depth processing unit is used for pasting the number region in the preprocessed image R, wherein a rectangular mask with the same size as the size of the character to be detected is adopted to perform expansion operation on the image subjected to the planning and dividing to obtain a corrected image subjected to the expansion operation; then edge detection, image rotation, expansion and binaryzation are carried out; and the data extraction unit is used for detecting target information of the detected identity card area, extracting a communication area with the length-width ratio meeting the requirement, namely the identity card number area, acquiring character detection post-selection areas of each row in the area, fusing the areas to be used as the identity card number area, and extracting the number in the area to be used as the identity card number.
The invention also provides a computer readable storage medium, which stores computer instructions, and the computer instructions execute the steps of the identity card number detection method when running.
The invention also provides a terminal which comprises a memory and a processor, wherein the memory is stored with a computer instruction capable of running on the processor, and the processor executes the steps of the identification number detection method when running the computer instruction.
Compared with the prior art, the invention has the beneficial effects that: (1) compared with the traditional method, the method solves the problem of certificate number detection failure caused by certificate edge detection failure, can effectively realize good detection of deep certificates no matter the background of a non-certificate area is complex or the gradient change of a certificate foreground area is small, and (2) compared with a character detection algorithm based on deep learning, the algorithm operation efficiency is improved, the operation resources are saved, and the processing logic of the non-certificate area does not need to be designed manually. In conclusion, the identity card number detection method provided by the invention does not need to perform inclination correction on the identity card, can improve the information extraction of the identity card in a complex shooting scene, greatly improves the recognition rate, and can be widely applied to the fields of security, finance and the like.
Drawings
FIG. 1 is a flow chart of the ID card number detection method of the present invention;
fig. 2 is a schematic view of a structural module of the id number detection device.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
First embodiment
A method for detecting an identification number, referring to FIG. 1, comprises the following steps:
the first step is as follows: and detecting the identity card, namely detecting the position of the identity card image in the image by applying a target detection algorithm, wherein S is (a, b, c and d), wherein S is the area where the identity is located, a is the horizontal coordinate of the upper left point of the area, b is the vertical coordinate of the upper left point of the area, c is the horizontal coordinate of the lower right point of the area, and d is the vertical coordinate of the lower right point of the area.
Wherein the target detection algorithm adopted in the first step comprises one of yolo and ssd.
The acquired image is detected by adopting a deep neural network model based on the YOLO algorithm to obtain a corresponding identity card area, so that when the area occupied by the target information is too small, the missing detection caused by directly searching the target information from the whole complex scene image can be prevented. The deep neural network model training process based on the YOLO algorithm may specifically include:
firstly, an identity card image under a complex background containing identity card region labeling information is obtained and used as a training sample, and the obtained sample is divided into a training set, a verification set and a test set. Then, the obtained identification card image under the complex background containing the identification card region labeling information is preprocessed to remove samples which do not contain valid identification card regions, the size of the image is scaled to a preset size, such as 484 × 484, and the obtained samples are subjected to data enhancement through affine transformation, random clipping, blurring and other operations.
Subsequently, a network structure of the deep neural network model is constructed. In an embodiment of the present invention, the network structure of the constructed deep neural network model includes 24 convolutional layers and 2 fully-connected layers. Wherein for 24 convolutional layers, channel reduction is performed using mainly 1 × 1 convolution followed by 3 × 3 convolution. For convolutional and fully-connected layers, the Leaky ReLU activation function max (x, 0.1x) is used, and the last layer uses a linear activation function.
Extracting the characteristics of a sample image through a Convolutional Neural Network (CNN) in the early stage of the Network, outputting a 539 vector at the last layer of Fully Connected (FC), and obtaining a 7 × 11 multidimensional matrix through reshaping (reshape). In the 7 × 11 multidimensional matrix, each cell in 7 × 7 cells may be used to predict a target region, where "2" in the first 5 × 2 bits of the following 11 bits represents a foreground and a background, "5" represents center points cx and cy of the predicted region, respectively, and confidence levels × c in the width w, the height h, and the foreground, and the last 1 bit of the 11 bits represents a target category confidence level.
The second step is that: drawing the size of an area of the identity card, cutting an image of the identity card according to the position detected in the first step, drawing a long edge into a fixed size under the condition of not changing the original length-width ratio, and drawing a short edge into a fixed size in the same proportion; let the length of the image after one stroke be L, the width be H, and the image be R.
The third step: the identification number area is gelatinized, a mask corresponding to the second step of planning the size is designed, and the mask is used for carrying out morphological operation on the image, so that the purpose of communicating and gelatinizing the character area image is achieved; setting a rectangular mask, and performing expansion operation on the image after the image is planned, wherein the size of the mask is the size of the character to be detected; a corrected image after the dilation operation is obtained.
The fourth step: and (5) performing edge detection, and obtaining an edge detection image C by applying canny detection.
The fifth step: the straight line detection obtains the inclination angle theta.
In the fifth step, the inclination angle θ is obtained as follows: performing linear detection on the fourth step binary image by using hough change to obtain a linear detection sequence
Keeping the straight line with the longest length, and calculating the inclination angle of the straight line:
And a sixth step: and (5) rotating the image, and rotating the identification image by applying the inclination angle obtained by the fifth step. The rotation relationship adopted in the sixth step is as follows:
in the seventh step, the method of expansion and binarization of the rotated image is as follows
The dilation method is to take a sliding window of size δ +1 to slide on the image R', the smallest pixel within the sliding window being the output of the dilation method in place, and is implemented as follows,
the expanded image is recorded as:
S=[si,j]H×W… … … … … … … … … … … … … the compound of formula 6 is shown in formula 6,
the expansion method comprises the following steps:
si,j=min(R′ij) … … … … … … … … … … … … the method has the advantages that the materials in the formula 7,
wherein R 'is'ijThe sub-images taken for the sliding window at the i, j pixel locations are:
and applying an adaptive threshold algorithm to the expanded image S to obtain two images TS.
And eighthly, extracting a communication area with the aspect ratio meeting the requirement, namely the identity card number area, projecting and cutting the image line by line, acquiring a communication passage, cutting the communication rows and lines of the communication rows by line, and acquiring the communication area, wherein the aspect ratio of the communication area meets the prefabrication condition and is the identity card number area.
For picture TS ═ TSij]Performing line projection to calculate line projection value HORi,
Cutting the line projection to obtain the joint traffic, determining the starting line and the ending line of each joint traffic, wherein the cutting method comprises traversing HOR line by lineiRecording a starting line if the sum of the projection values of the continuous h lines is greater than a fixed threshold TH, not recording a new starting line if no ending line appears, recording an ending starting line if the starting line exists and the sum of the projection values of the continuous h lines is less than the fixed threshold TH, forming a pair of the starting line and the ending line, and recording the m-TH pair of the starting line and the ending line HSm,HEm:
For each linked row projection, for the mth linked row projection:
VERmj=∑itsi,j,i=HSm...HEm。
and (3) carrying out column projection and cutting on the column projection of the cross traffic to obtain a starting column and an ending column of the communication area, wherein the cutting method comprises the following step of traversing the VER column by columnmjThe projection values of the continuous w series of connected rows are greater than a fixed threshold TW, a start row is recorded, if no end row appears, a new start row is not recorded, if a start row exists, and the projection values of the continuous w series of connected rows are less than the fixed threshold TW, a final row is recordedStopping the line, recording the n-th of the m-th connected linemFor the initial column, the end column is
if the following conditions are met:then the region is an identity card number region, where T1,T2Is the aspect ratio threshold of the pre-designed identification number.
The image collected by the camera can be a static image (namely, a single collected image) or an image in a video (namely, an image selected randomly or according to a preset standard from the collected video), and can be used as an image source of the identity card.
As can be appreciated by those skilled in the art based on the description of the embodiments of the present disclosure, in addition to the neural network, for example, but not limited to: character detection is performed on the captured image based on a character detection algorithm for image processing (e.g., a character/number detection algorithm based on histogram coarse segmentation and singular value features, a character/number detection algorithm based on dyadic wavelet transform, etc.). Additionally, in addition to neural networks, embodiments of the present disclosure may also utilize, for example and without limitation: image processing-based certificate detection algorithms (e.g., edge detection methods, mathematical morphology methods, texture analysis-based localization methods, line detection and edge statistics methods, genetic algorithms, Hough (Hough) transforms and contour line methods, wavelet transform-based methods, etc.), and the like.
In the embodiment of the disclosure, when the character detection is performed on the collected image through the neural network, the sample image can be used for training the neural network in advance, so that the trained neural network can realize the effective detection of the character in the image.
Second embodiment
The invention also provides a device for detecting the ID number, which is shown in figure 2 and comprises the following components: the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring image information to be processed; the preprocessing unit is used for preprocessing the acquired image to obtain a normalized image R; the depth processing unit is used for pasting the number region in the preprocessed image R, wherein a rectangular mask with the same size as the size of the character to be detected is adopted to perform expansion operation on the image subjected to the planning and dividing to obtain a corrected image subjected to the expansion operation; then edge detection, image rotation, expansion and binaryzation are carried out; and the data extraction unit is used for detecting target information of the detected identity card area, extracting a communication area with the length-width ratio meeting the requirement, namely the identity card number area, acquiring character detection post-selection areas of each row in the area, fusing the areas to be used as the identity card number area, and extracting the number in the area to be used as the identity card number.
The device is represented in a hardware structure as follows.
The acquisition unit acquires image information on the front surface of the identity card by using hardware equipment including but not limited to a mobile phone, an IPAD (internet protocol ad), a common camera, a CCD (charge coupled device) industrial camera, a scanner and the like, and pays attention to the fact that the acquired image completely contains four boundaries of the identity card and inclines by no more than plus or minus 20 degrees, and the identity card number can be distinguished by human eyes.
Preprocessing unit, depth processing unit and data extraction unit-the acquired image is processed and data extracted accordingly by the processor using algorithms, programs, etc. stored in the memory.
And the output device, including but not limited to a display screen of a tablet computer, a mobile phone and the like, outputs and displays the identity card number extracted by the processor.
The input/output interface and the network interface are used for carrying out signal connection on the acquisition device, the memory, the processor and the output device, and comprise electric connection and telecommunication connection.
Third embodiment
The invention also provides a computer readable storage medium, which stores computer instructions, and the computer instructions execute the steps of the identity card number detection method when running. For the identification number detection method, reference is made to the detailed description of the aforementioned section, which is not repeated herein.
It will be appreciated by those of ordinary skill in the art that all or a portion of the steps of the various methods of the embodiments described above may be performed by associated hardware as instructed by a program that may be stored on a computer readable storage medium, which may include non-transitory and non-transitory, removable and non-removable media, to implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
Fourth embodiment
The invention also provides a terminal which comprises a memory and a processor, wherein the memory is stored with a computer instruction capable of running on the processor, and the processor executes the steps of the identification number detection method when running the computer instruction. For the identification number detection method, reference is made to the detailed description of the aforementioned section, which is not repeated herein.
The scheme solves the problem that under the condition of a complex background, the identity card outline and the image background boundary are fuzzy, and accurate extraction of the identity card number is not facilitated.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. The use of the phrase "including a" does not exclude the presence of other, identical elements in the process, method, article, or apparatus that comprises the same element, whether or not the same element is present in all of the same element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, apparatus, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (10)
1. A method for detecting an identity card number is characterized by comprising the following steps:
the first step is as follows: detecting the identity card, namely detecting the position of an identity card image in the image by applying a target detection algorithm, wherein S is (a, b, c and d), wherein S is an area where the identity is located, a is the horizontal coordinate of the upper left point of the area, b is the vertical coordinate of the upper left point of the area, c is the horizontal coordinate of the lower right point of the area, and d is the vertical coordinate of the lower right point of the area;
the second step is that: drawing the size of an area of the identity card, cutting an image of the identity card according to the position detected in the first step, drawing a long edge into a fixed size under the condition of not changing the original length-width ratio, and drawing a short edge into a fixed size in the same proportion; setting the length of the image after the first stroke as L, the width as H and the image as R;
the third step: the identification number area is gelatinized, a mask corresponding to the second step of planning the size is designed, and the mask is used for carrying out morphological operation on the image, so that the purpose of communicating and gelatinizing the character area image is achieved; setting a rectangular mask, and performing expansion operation on the image after the image is planned, wherein the size of the mask is the size of the character to be detected; obtaining a corrected image after the expansion operation;
the fourth step: edge detection, namely applying canny detection to obtain an edge detection image C;
the fifth step: detecting a straight line to obtain an inclination angle theta;
and a sixth step: rotating the image, namely rotating the identification image by applying the inclination angle obtained by the fifth step;
the seventh step: expanding and binarizing the rotating image;
eighth step: and extracting a communication area with the length-width ratio meeting the requirement, namely an identity card number area, binarizing the image, firstly obtaining character detection and post-selection areas of all rows, and then fusing production character candidate areas of all rows to serve as the identity card number area.
2. The method for detecting an identification number of claim 1, wherein:
the target detection algorithm employed in the first step comprises one of yolo, ssd.
3. The method for detecting an identification number of claim 1, wherein:
in the fifth step, the inclination angle θ is obtained as follows: performing linear detection on the fourth step binary image by using hough change to obtain a linear detection sequence
Keeping the straight line with the longest length, and calculating the inclination angle of the straight line:
5. the method for detecting an identification number of claim 1, wherein:
in the seventh step, the expansion and binarization method of the rotated image is as follows:
S=[si,j]H×W… … … … … … … … … … … … … the compound of formula 6 is shown in formula 6,
the expansion method comprises the following steps:
si,j=min(R′ij) … … … … … … … … … … … … the method has the advantages that the materials in the formula 7,
wherein R 'is'ijThe sub-images taken for the sliding window at the i, j pixel locations are:
and applying an adaptive threshold algorithm to the expanded image S to obtain two images TS.
6. The method for detecting an identification number of claim 1, wherein:
in the eighth step, the binary image is scanned line by line with the starting points and the end points of the character area, the area in the middle of the starting points and the end points is recorded as a character continuous area, and the area of each line of continuous area meeting the prior condition is recorded as a character detection candidate area of each line.
7. The identification number detection method according to claim 1 or 6, wherein: in the eighth step, carrying out contour detection on the binary image; obtaining a sequence of a rectangle circumscribed to the outline,
wherein r isi=[xi,yi,wi,hi]Selecting a region with the aspect ratio satisfying the following prior conditions as a character region to be detected,
S=[xi,yi,wi,hi],wi/hi< T … … … … … … … … formula 10,
8. An identification number detection device, comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring image information to be processed;
the preprocessing unit is used for preprocessing the acquired image to obtain a normalized image R;
the depth processing unit is used for pasting the number region in the preprocessed image R, wherein a rectangular mask with the same size as the size of the character to be detected is adopted to perform expansion operation on the image subjected to the planning and dividing to obtain a corrected image subjected to the expansion operation; then edge detection, image rotation, expansion and binaryzation are carried out;
and the data extraction unit is used for detecting target information of the detected identity card area, extracting a communication area with the length-width ratio meeting the requirement, namely the identity card number area, acquiring character detection post-selection areas of each row in the area, fusing the areas to be used as the identity card number area, and extracting the number in the area to be used as the identity card number.
9. A computer readable storage medium having stored thereon computer instructions, wherein the computer instructions when executed perform the steps of the identification number detection method of any of claims 1 to 7.
10. A terminal comprising a memory and a processor, wherein the memory stores computer instructions capable of running on the processor, and the processor executes the computer instructions to perform the steps of the identification number detection method of any one of claims 1 to 7.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011455531.1A CN112686247A (en) | 2020-12-10 | 2020-12-10 | Identification card number detection method and device, readable storage medium and terminal |
PCT/CN2020/140583 WO2022121021A1 (en) | 2020-12-10 | 2020-12-29 | Identity card number detection method and apparatus, and readable storage medium and terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011455531.1A CN112686247A (en) | 2020-12-10 | 2020-12-10 | Identification card number detection method and device, readable storage medium and terminal |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112686247A true CN112686247A (en) | 2021-04-20 |
Family
ID=75448938
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011455531.1A Pending CN112686247A (en) | 2020-12-10 | 2020-12-10 | Identification card number detection method and device, readable storage medium and terminal |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112686247A (en) |
WO (1) | WO2022121021A1 (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115804579B (en) * | 2022-11-21 | 2024-01-26 | 江西长冈医疗科技有限公司 | Process control system for normalized blood pressure measurement and implementation method |
CN118135579A (en) * | 2022-12-01 | 2024-06-04 | 唯思电子商务(深圳)有限公司 | Certificate number font anomaly detection method |
CN117315664B (en) * | 2023-09-18 | 2024-04-02 | 山东博昂信息科技有限公司 | Scrap steel bucket number identification method based on image sequence |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103729645A (en) * | 2013-12-20 | 2014-04-16 | 湖北微模式科技发展有限公司 | Second-generation ID card area positioning and extraction method and device based on monocular camera |
CN106446881A (en) * | 2016-07-29 | 2017-02-22 | 北京交通大学 | Method for extracting lab test result from medical lab sheet image |
CN108446699A (en) * | 2018-02-08 | 2018-08-24 | 东华大学 | Identity card pictorial information identifying system under a kind of complex scene |
CN108694393A (en) * | 2018-05-30 | 2018-10-23 | 深圳市思迪信息技术股份有限公司 | A kind of certificate image text area extraction method based on depth convolution |
CN109344727A (en) * | 2018-09-07 | 2019-02-15 | 苏州创旅天下信息技术有限公司 | Identity card text information detection method and device, readable storage medium storing program for executing and terminal |
CN110781890A (en) * | 2019-10-25 | 2020-02-11 | 上海德启信息科技有限公司 | Identification card identification method and device, electronic equipment and readable storage medium |
CN111898601A (en) * | 2020-07-14 | 2020-11-06 | 浙江大华技术股份有限公司 | Identity card element extraction method and device |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2000341501A (en) * | 1999-03-23 | 2000-12-08 | Minolta Co Ltd | Device and method for processing image and recording medium with image processing program stored therein |
CN104050450A (en) * | 2014-06-16 | 2014-09-17 | 西安通瑞新材料开发有限公司 | Vehicle license plate recognition method based on video |
CN106156712A (en) * | 2015-04-23 | 2016-11-23 | 信帧电子技术(北京)有限公司 | A kind of based on the ID (identity number) card No. recognition methods under natural scene and device |
CN104834929B (en) * | 2015-04-28 | 2018-10-30 | 安徽清新互联信息科技有限公司 | A kind of VLP correction method based on Variance feature |
-
2020
- 2020-12-10 CN CN202011455531.1A patent/CN112686247A/en active Pending
- 2020-12-29 WO PCT/CN2020/140583 patent/WO2022121021A1/en active Application Filing
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103729645A (en) * | 2013-12-20 | 2014-04-16 | 湖北微模式科技发展有限公司 | Second-generation ID card area positioning and extraction method and device based on monocular camera |
CN106446881A (en) * | 2016-07-29 | 2017-02-22 | 北京交通大学 | Method for extracting lab test result from medical lab sheet image |
CN108446699A (en) * | 2018-02-08 | 2018-08-24 | 东华大学 | Identity card pictorial information identifying system under a kind of complex scene |
CN108694393A (en) * | 2018-05-30 | 2018-10-23 | 深圳市思迪信息技术股份有限公司 | A kind of certificate image text area extraction method based on depth convolution |
CN109344727A (en) * | 2018-09-07 | 2019-02-15 | 苏州创旅天下信息技术有限公司 | Identity card text information detection method and device, readable storage medium storing program for executing and terminal |
CN110781890A (en) * | 2019-10-25 | 2020-02-11 | 上海德启信息科技有限公司 | Identification card identification method and device, electronic equipment and readable storage medium |
CN111898601A (en) * | 2020-07-14 | 2020-11-06 | 浙江大华技术股份有限公司 | Identity card element extraction method and device |
Also Published As
Publication number | Publication date |
---|---|
WO2022121021A1 (en) | 2022-06-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112686812B (en) | Bank card inclination correction detection method and device, readable storage medium and terminal | |
US11830230B2 (en) | Living body detection method based on facial recognition, and electronic device and storage medium | |
CN110414507B (en) | License plate recognition method and device, computer equipment and storage medium | |
CN106709436B (en) | Track traffic panoramic monitoring-oriented cross-camera suspicious pedestrian target tracking system | |
Al-Ghaili et al. | Vertical-edge-based car-license-plate detection method | |
CN113255659B (en) | License plate correction detection and identification method based on MSAFF-yolk 3 | |
CN112686247A (en) | Identification card number detection method and device, readable storage medium and terminal | |
CN108108734B (en) | License plate recognition method and device | |
CN112686248B (en) | Certificate increase and decrease type detection method and device, readable storage medium and terminal | |
CN113052170B (en) | Small target license plate recognition method under unconstrained scene | |
CN114049499A (en) | Target object detection method, apparatus and storage medium for continuous contour | |
CN110969164A (en) | Low-illumination imaging license plate recognition method and device based on deep learning end-to-end | |
CN110689003A (en) | Low-illumination imaging license plate recognition method and system, computer equipment and storage medium | |
CN112784834A (en) | Automatic license plate identification method in natural scene | |
CN111709377B (en) | Feature extraction method, target re-identification method and device and electronic equipment | |
CN116503622A (en) | Data acquisition and reading method based on computer vision image | |
KR20220049864A (en) | Method of recognizing license number of vehicle based on angle of recognized license plate | |
Barodi et al. | An enhanced artificial intelligence-based approach applied to vehicular traffic signs detection and road safety enhancement | |
CN111105436B (en) | Target tracking method, computer device and storage medium | |
CN110633705A (en) | Low-illumination imaging license plate recognition method and device | |
CN110826564A (en) | Small target semantic segmentation method and system in complex scene image | |
CN117079313A (en) | Image processing method, device, equipment and storage medium | |
CN114445788A (en) | Vehicle parking detection method and device, terminal equipment and readable storage medium | |
CN114387308A (en) | Machine vision characteristic tracking system | |
CN114037996A (en) | License plate recognition model training method, recognition method, device, equipment and medium |
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 |
Application publication date: 20210420 |
|
RJ01 | Rejection of invention patent application after publication |