ID card recognition method, device, system and medium
By judging the grayscale value and pixel density of the ID card image information, combined with edge line screening and rotation processing, the problem of low identification efficiency in the existing technology is solved, and the accurate identification and automatic adjustment of the ID card is realized, which improves the Identification efficiency.
Patent Information
- Application Number
- CN202410180416.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-18
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2044-02-18
AI Technical Summary
In the prior art, the identity document identification system cannot accurately identify the content of the identity document according to the user's identity document, resulting in low recognition efficiency and poor user experience.
By obtaining the image information of the ID document, the grayscale value comparison process is performed based on the coordinate information and grayscale information of the pixel point, the image abnormality is determined and the adjustment process is performed, including grayscale threshold comparison, pixel density value judgment, edge line screening and reference line determination. , and finally perform image rotation for accurate recognition.
It realizes accurate identification and automatic adjustment of identity documents, improves identification efficiency, and solves the problem of low identification efficiency.
Smart Images

Figure CN117994788B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of identity document detection, and in particular to an identity document recognition method, device, system and medium. Background Art
[0002] Optical character recognition technology (OCR) is currently being widely used in various industries and has become the core technology of various systems, involving many industries such as government, finance, and corporate units. For example, in the financial industry, when users open an electronic second-class account online, their personal documents will be identified and their basic personal information will be extracted. Extracting information through OCR technology can save users time in filling out forms and reduce the error rate of information caused by manual input by users.
[0003] In the prior art, most of the current bank mobile clients on the market can only perform template scanning by manually placing the identity document in the corresponding position according to the requirements (region identification side, portrait side, upright, inverted, etc.). This will indeed reduce the recognition error rate, but it will also reduce the user experience; for example, Figure 1 and Figure 2 As shown in the figure, when the user tries to turn the ID card upside down and scan it again, most financial software cannot recognize it normally; when the user tries again and moves the scanning frame of the portrait side to the scanning area identification side, it is also unable to obtain normal information. In other words, the current technology can only respond to and recognize specific content within a specific range.
[0004] Based on this, it is necessary to propose an identity document recognition method, device, system and medium to solve or at least alleviate the above-mentioned defects. Summary of the invention
[0005] The main purpose of this application is to provide an identity document recognition method, device, system and medium to solve the problem in the prior art that the content of the identity document cannot be accurately identified based on the user's identity document.
[0006] According to an embodiment of the present invention, a method for identifying an identity document is provided, comprising:
[0007] Acquire the identity document image information of the target area, wherein the identity document image information includes image pixel information and image grayscale information, and the image pixel information includes coordinate information of image pixel points;
[0008] Based on the coordinate information and the image grayscale information of the first pixel point, compare the image grayscale information of the first pixel point located in the first area contained in the identity document image information with a preset first grayscale threshold, wherein the image pixel points include the first pixel point;
[0009] When the image grayscale information of the first pixel does not satisfy a first grayscale condition, obtaining first coordinate information of a pixel that satisfies the first grayscale condition in the identity document image information, wherein the first grayscale condition includes that a difference between the image grayscale information of the first pixel and the preset first grayscale threshold is less than the first threshold;
[0010] When the first coordinate information satisfies a first position condition, the identity document image information is determined to be abnormal, and the identity document image information is adjusted and processed according to a preset rule, wherein the first position condition includes that the coordinate difference between the first coordinate information and the coordinate information of the first pixel point is greater than or equal to a second threshold.
[0011] In an exemplary embodiment, after acquiring the identity document image information of the target area, the method further includes:
[0012] Based on the image grayscale information of the first pixel point, determining a pixel density value of a second pixel point whose grayscale value contained in the identity document image information meets a first grayscale condition, the image pixel points including the second pixel point;
[0013] When the pixel density value satisfies the first density condition, performing position comparison processing on the second coordinate information of the second pixel point and preset third coordinate information;
[0014] When the second coordinate information does not meet the second position condition, the identity document image information is determined to be abnormal and the identity document image information is adjusted and processed according to preset rules, wherein the second position condition includes that the difference between the second coordinate information and the first coordinate information is less than a preset fourth threshold.
[0015] In an exemplary embodiment, after acquiring the identity document image information of the target area, the method further includes:
[0016] Performing screening and detection processing on the identity document image based on a preset first algorithm to determine edge lines of the identity document, wherein the edge lines include long-side edge lines and short-side edge lines;
[0017] Based on the short side edge line, determining a first reference line and a second reference line of the short side edge line by a second algorithm, wherein the first reference line, the second reference line and the short side edge line are parallel to each other;
[0018] Determine, based on the image grayscale information of the first pixel and the coordinate information, a first distance difference between a third pixel whose grayscale value contained in the identity document image information satisfies the first grayscale condition and the first reference line, and a second distance difference between the third pixel and the second reference line;
[0019] When both the first distance difference and the second distance difference satisfy a first distance condition, the identity document image information is determined to be abnormal, and the identity document image information is adjusted and processed according to a preset rule, wherein the first distance condition includes that the first distance difference is less than or equal to a fifth threshold and the second distance difference is greater than or equal to a sixth threshold.
[0020] In an exemplary embodiment, the adjusting the identity document image information according to a preset rule includes:
[0021] Determine the image center point of the identity document image information based on the edge line;
[0022] The identity document image information is subjected to a center rotation process at a first angle with the center point of the image as the center to obtain a target image.
[0023] According to another embodiment of the present invention, there is provided an identity document recognition device, comprising:
[0024] An information acquisition module, used to obtain the identity document image information of the target area, wherein the identity document image information includes image pixel information and image grayscale information, and the image pixel information includes coordinate information of image pixel points;
[0025] a grayscale comparison module, configured to compare the image grayscale information of a first pixel located in a first area and included in the identity document image information with a preset first grayscale threshold value based on the coordinate information and the image grayscale information of the first pixel, wherein the image pixel points include the first pixel point;
[0026] a coordinate determination module, configured to obtain first coordinate information of a pixel point in the identity document image information that meets the first grayscale condition when the image grayscale information of the first pixel point does not meet the first grayscale condition, wherein the first grayscale condition includes that a difference between the image grayscale information of the first pixel point and the preset first grayscale threshold is less than the first threshold;
[0027] The first adjustment module is used to determine that the identity document image information is abnormal and adjust the identity document image information according to a preset rule when the first coordinate information meets a first position condition, wherein the first position condition includes that the coordinate difference between the first coordinate information and the coordinate information of the first pixel point is greater than or equal to a second threshold.
[0028] In an exemplary embodiment, the apparatus further comprises:
[0029] a density determination module, configured to determine, after acquiring the identity document image information of the target area, based on the image grayscale information of the first pixel point, a pixel density value of a second pixel point whose grayscale value contained in the identity document image information satisfies a first grayscale condition, wherein the image pixel points include the second pixel point;
[0030] A position comparison module, configured to perform position comparison processing on the second coordinate information of the second pixel point and preset third coordinate information when the pixel density value satisfies a first density condition;
[0031] The second adjustment module is used to determine that the identity document image information is abnormal and adjust the identity document image information according to preset rules when the second coordinate information does not meet the second position condition, wherein the second position condition includes that the difference between the second coordinate information and the first coordinate information is less than a preset fourth threshold.
[0032] In an exemplary embodiment, the apparatus further comprises:
[0033] After acquiring the identity document image information of the target area, screening and detecting the identity document image based on a preset first algorithm to determine edge lines of the identity document, wherein the edge lines include long side edge lines and short side edge lines;
[0034] A reference line determination module, configured to determine, based on the short side edge line, a first reference line and a second reference line of the short side edge line by a second algorithm, wherein the first reference line, the second reference line and the short side edge line are parallel to each other;
[0035] a distance determination module, configured to determine, based on the image grayscale information of the first pixel and the coordinate information, a first distance difference between a third pixel whose grayscale value contained in the identity document image information satisfies the first grayscale condition and the first reference line, and a second distance difference between the third pixel and the second reference line;
[0036] The third adjustment module is used to determine that the identity document image information is abnormal and adjust the identity document image information according to a preset rule when the first distance difference and the second distance difference both meet the first distance condition, wherein the first distance condition includes that the first distance difference is less than or equal to the fifth threshold and the second distance difference is greater than or equal to the sixth threshold.
[0037] In an exemplary embodiment, the third adjustment module includes:
[0038] A center determination unit, configured to determine the image center point of the identity document image information based on the edge line;
[0039] The image rotation unit is used to perform a center rotation process of the identity document image information at a first angle with the center point of the image as the center to obtain a target image.
[0040] The present invention also provides an identity document recognition system, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of any of the aforementioned identity document recognition accuracy assessment methods are implemented.
[0041] The present invention also provides a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the identity card recognition method as described above is implemented.
[0042] Compared with the prior art, the present invention has the following beneficial effects:
[0043] The present invention provides an identity document recognition method, device, system and medium, which can improve the identity document recognition efficiency and solve the problem of low identity document recognition efficiency by accurately recognizing the identity document and automatically adjusting the identity document according to the recognition result without manual adjustment. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a prior art Figure 1 ;
[0045] Figure 2 It is a prior art Figure 2 ;
[0046] Figure 3 A flow chart of an identity document recognition method according to an embodiment of the present invention;
[0047] Figure 4 Effect diagram according to a specific embodiment of the present invention;
[0048] Figure 5 A structural block diagram of an identity card recognition device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0049] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0051] It should be noted that all directional indications in the embodiments of the present invention (such as up, down, left, right, front, back, etc.) are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0052] In addition, the descriptions of "first", "second", etc. in the present invention are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0053] First, please refer to the attached Figure 1 In one embodiment of the present invention, a method for identifying an identity document includes:
[0054] Step S101, obtaining identity document image information of a target area, wherein the identity document image information includes image pixel information and image grayscale information, and the image pixel information includes coordinate information of image pixel points;
[0055] In this embodiment, when performing identity document recognition, it is usually necessary to place the identity document in a specific area and then capture the image through a camera, wherein the camera can be a visible light camera or an infrared camera, and can be adjusted according to the usage scenario and requirements.
[0056] The image grayscale information includes the grayscale value of the pixel, which is usually a value of 0-255; the image pixel information includes not only the coordinate information of the image pixel, but also the area size of the image pixel and other information.
[0057] It should be noted that the grayscale information and coordinate information of the image are obtained by self-analysis through relevant algorithms after the image is captured, such as the common Opencv grayscale value algorithm.
[0058] Step S102, based on the coordinate information and the image grayscale information of the first pixel, compare the image grayscale information of the first pixel located in the first area contained in the identity document image information with a preset first grayscale threshold, wherein the image pixel includes the first pixel;
[0059] In this embodiment, the format of the identity document is unified, and the position of each identity information (such as area identification, face) is fixed. Therefore, when identifying the identity document, if the placement direction of the identity document is incorrect, the position of the corresponding identity information will also change. Therefore, at this time, it is only necessary to determine whether the grayscale value of the pixel point at the fixed position meets the requirements to determine whether the identity document is placed correctly.
[0060] Among them, the first area can be a fixed position area of identity information in the identity document format, such as a face area, an area identification area, etc.; the first pixel points include pixel points in the first area; the preset first grayscale value can be a grayscale threshold range with higher recognition obtained according to model training, such as the grayscale value of the red area identification, the grayscale value of the face, the grayscale value of the hair color, the grayscale value of the clothing, etc.; the number of first pixel points can be multiple, and generally, the more pixel points there are, the higher the recognition accuracy.
[0061] It should be noted that when performing pixel recognition in the first area, the first area can be first segmented through a cutting algorithm and then relevant recognition can be performed. This method can reduce the interference of pixels other than the first area and also reduce the computing power consumption of the recognition process. Among them, the more common cutting algorithms include the FCN series algorithms or the VGG series algorithms.
[0062] Step S103, when the image grayscale information of the first pixel does not satisfy a first grayscale condition, obtaining first coordinate information of a pixel in the identity document image information that satisfies the first grayscale condition, wherein the first grayscale condition includes that a difference between the image grayscale information of the first pixel and the preset first grayscale threshold is less than the first threshold;
[0063] In this embodiment, during the capture of the face of the person on the identification document, there may be local interference caused by clothing, skin color, lighting, etc., which may interfere with the grayscale recognition of the pixel points. Therefore, when the grayscale value of the first area does not meet the first grayscale condition, it is necessary to further determine whether the coordinates of the pixel points that meet the first grayscale condition meet the corresponding position condition, so as to determine whether there is a recognition error.
[0064] Among them, the first threshold is the threshold that can be obtained with good recognition accuracy when the algorithm model is trained on massive images through big data. Generally, when the identity document is placed correctly, the proportion of pixels occupied by skin color and hair color is higher, and the proportion of clothing is lower. The variation range of grayscale values of skin color and hair color of different people can be determined through big data statistics. Therefore, at this time, interference such as clothing can be eliminated by whether the difference in grayscale values is within the threshold range.
[0065] Step S104, when the first coordinate information satisfies the first position condition, it is determined that the identity document image information is abnormal, and the identity document image information is adjusted and processed according to a preset rule, wherein the first position condition includes that the coordinate difference between the first coordinate information and the coordinate information of the first pixel point is greater than or equal to a second threshold.
[0066] In this embodiment, when the coordinate difference between the pixel point whose grayscale value meets the first grayscale condition and the first pixel point is greater than the second threshold, it can be determined that the current identification document may be placed incorrectly, for example, it is placed upside down so that the facial image originally on the right is now on the left, or the area identification pattern originally on the left is now on the right, etc.
[0067] Among them, the preset rules can be to directly adjust the image position (such as rotation, etc.), without reminding relevant personnel to adjust the identity document itself, thereby improving the efficiency of identity document recognition and reducing the time wasted on re-identification by re-placing the identity document.
[0068] It should be noted that before performing region identification pixel or face pixel recognition, the relevant algorithm model needs to be trained, and the training process can be achieved through the following steps.
[0069] Step S1, taking image contents in four pre-defined ranges (region identification frame when the region identification face is upright (corresponding to the aforementioned first region), region identification frame when the region identification face is inverted (corresponding to the aforementioned first region), portrait frame when the portrait face is upright (corresponding to the aforementioned first region), and portrait frame when the portrait face is inverted (corresponding to the aforementioned first region));
[0070] Step S2: After dividing the four ranges, two convolutional neural networks need to be trained. One of them supports judging whether the input image is a regional logo (both upright and inverted can be recognized), and the other supports judging whether the input image is a face (both upright and inverted can be recognized).
[0071] Step S3, when training the convolutional neural network, the training set needs to perform certain operations such as rotation, mirroring, and stretching on the regional logo, on the one hand to increase the training data, and on the other hand to increase the generalization ability of the final model. In particular, the rotation and stretching operations are the key to whether the inverted and stretched images can be recognized.
[0072] Step S4 is to put the contents in the two area identification boxes into the convolutional neural network for identifying area identification pixels to identify whether they are area identification pixels.
[0073] The specific recognition process is the same as the process of the aforementioned steps S102-104; in particular, if the content of one of the region identification boxes is successfully recognized as a region identification pixel, it can be determined that the current ID document image is a region identification face, and based on which region identification frame it is, it can be further determined whether it is upright or inverted. If the content of both region identification boxes is not recognized as a region identification, the ID document image may be a portrait face.
[0074] Similarly, the contents of the two portrait frames are put into the neural network for recognizing face pixels. If one of them recognizes a face, it can be determined that the current image is a portrait face, and based on which portrait frame it is, it can be determined whether the current image is upright or inverted. If neither of the two frames is recognized as a portrait, it provides indirect evidence for determining that the current image is a regional identification face.
[0075] This application improves the efficiency of ID card recognition by performing grayscale recognition and position judgment on patterns such as faces and area logos, and adjusting the image based on the recognition results, without the need to re-place the ID card.
[0076] In an optional embodiment, after acquiring the identity document image information of the target area, the method further includes:
[0077] Step S1011, based on the image grayscale information of the first pixel point, determining the pixel density value of a second pixel point whose grayscale value contained in the identity document image information meets a first grayscale condition, the image pixel points including the second pixel point;
[0078] Step S1012, when the pixel density value satisfies the first density condition, performing position comparison processing on the second coordinate information of the second pixel point and preset third coordinate information;
[0079] Step S1013: When the second coordinate information does not satisfy the second position condition, it is determined that the identity document image information is abnormal and the identity document image information is adjusted according to a preset rule.
[0080] In this embodiment, in order to further judge the placement of the identification document, it can be judged according to the density of pixel points of relevant grayscale values in the image. This is because in the standard of the identification document, the color (i.e., grayscale value) and position of the area logo are relatively fixed, and the skin color, hair color, etc. of the people are less different, so the density of the same pixel points in the corresponding area is also high. Therefore, at this time, by judging whether the position of the pixel points with higher density is located at the preset position (i.e., the third position information), it can be judged whether the identification document is placed incorrectly.
[0081] Among them, the first density condition includes that the pixel density value is greater than or equal to a third threshold, and the second position condition includes that the difference between the second coordinate information and the first coordinate information is less than a fourth threshold, wherein the third threshold and the fourth threshold are both preset based on big data statistical results.
[0082] It should be noted that the density value of a pixel can be determined according to the number of pixels in the area, and the determination process can be implemented by a counting algorithm, such as an Opencv series algorithm.
[0083] In an optional embodiment, after acquiring the identity document image information of the target area, the method further includes:
[0084] Step S1014, performing screening detection processing on the identity document image based on a preset first algorithm to determine edge lines of the identity document, wherein the edge lines include long side edge lines and short side edge lines;
[0085] Step S1015, based on the short side edge line, determine a first reference line and a second reference line of the short side edge line by a second algorithm, wherein the first reference line, the second reference line and the short side edge line are parallel to each other;
[0086] Step S1016, determining, based on the image grayscale information of the first pixel and the coordinate information, a first distance difference between a third pixel whose grayscale value contained in the identity document image information satisfies the first grayscale condition and the first reference line, and a second distance difference between the third pixel and the second reference line;
[0087] Step S1017, when the first distance difference and the second distance difference both meet the first distance condition, determine that the identity document image information is abnormal, and adjust the identity document image information according to a preset rule, wherein the first distance condition includes that the first distance difference is less than or equal to the fifth threshold and the second distance difference is greater than or equal to the sixth threshold.
[0088] In this embodiment, the edge line and the baseline are determined to facilitate the determination of the position information of the pixel points of the area marker or the face, thereby reducing the position coordinate recognition errors caused by improper placement, thereby improving the identification document recognition accuracy.
[0089] Among them, the screening detection process includes detecting straight lines based on Hough transform, screening and sorting the obtained straight lines, obtaining the four edge lines of the ID card, and correcting them to a rectangle with long sides as horizontal and short sides as vertical. This step is to determine the ID card image and stretch the ID card to a fixed shape and position, laying the foundation for subsequent judgment; then all the line segments in the current image are obtained through the Canny edge algorithm, as shown in the following example. Figure 4 As shown; the first reference line is a straight line segment located on the left side of the identity document, and the second reference line is a straight line segment located on the right side of the identity document. The first reference line and the second reference line are parallel to the short side edge line of the identity document.
[0090] The first distance condition includes that the first distance difference is less than or equal to a fifth threshold and the second distance difference is greater than or equal to a sixth threshold, and the fifth threshold and the sixth threshold are threshold results obtained based on big data statistics.
[0091] In an optional embodiment, the adjusting the identity document image information according to a preset rule includes:
[0092] Step S10171, determining the image center point of the identity document image information based on the edge line;
[0093] Step S10172, performing a center rotation process of a first angle on the identity document image information with the center point of the image as the center to obtain a target image.
[0094] According to another embodiment of the present invention, Figure 5 As shown, an identity document recognition device is provided, comprising:
[0095] The information acquisition module 51 is used to obtain the identity document image information of the target area, wherein the identity document image information includes image pixel information and image grayscale information, and the image pixel information includes the coordinate information of the image pixel points;
[0096] A grayscale comparison module 52 is used to compare the image grayscale information of a first pixel located in a first area included in the identity document image information with a preset first grayscale threshold based on the coordinate information and the image grayscale information of the first pixel, wherein the image pixel includes the first pixel;
[0097] A coordinate determination module 53 is used to obtain first coordinate information of a pixel point in the identity document image information that meets the first grayscale condition when the image grayscale information of the first pixel point does not meet the first grayscale condition, wherein the first grayscale condition includes that the difference between the image grayscale information of the first pixel point and the preset first grayscale threshold is less than the first threshold;
[0098] The first adjustment module 54 is used to determine that the identity document image information is abnormal and adjust the identity document image information according to a preset rule when the first coordinate information satisfies a first position condition, wherein the first position condition includes that the coordinate difference between the first coordinate information and the coordinate information of the first pixel point is greater than or equal to a second threshold.
[0099] In an optional embodiment, the device further comprises:
[0100] a density determination module, configured to determine, after acquiring the identity document image information of the target area, based on the image grayscale information of the first pixel point, a pixel density value of a second pixel point whose grayscale value contained in the identity document image information satisfies a first grayscale condition, wherein the image pixel points include the second pixel point;
[0101] A position comparison module, configured to perform position comparison processing on the second coordinate information of the second pixel point and preset third coordinate information when the pixel density value satisfies a first density condition;
[0102] The second adjustment module is used to determine that the identity document image information is abnormal and adjust the identity document image information according to a preset rule when the second coordinate information does not meet the second position condition.
[0103] In an optional embodiment, the device further comprises:
[0104] An edge line determination module is used for, after acquiring the identity document image information of the target area, screening and detecting the identity document image based on a preset first algorithm to determine the edge line of the identity document, wherein the edge line includes a long side edge line and a short side edge line;
[0105] A reference line determination module, configured to determine, based on the short side edge line, a first reference line and a second reference line of the short side edge line by a second algorithm, wherein the first reference line, the second reference line and the short side edge line are parallel to each other;
[0106] a distance determination module, configured to determine, based on the image grayscale information of the first pixel and the coordinate information, a first distance difference between a third pixel whose grayscale value contained in the identity document image information satisfies the first grayscale condition and the first reference line, and a second distance difference between the third pixel and the second reference line;
[0107] The third adjustment module is used to determine that the identity document image information is abnormal and adjust the identity document image information according to a preset rule when the first distance difference and the second distance difference both meet the first distance condition, wherein the first distance condition includes that the first distance difference is less than or equal to the fifth threshold and the second distance difference is greater than or equal to the sixth threshold.
[0108] In an optional embodiment, the third adjustment module includes:
[0109] A center determination unit, configured to determine the image center point of the identity document image information based on the edge line;
[0110] The image rotation unit is used to perform a center rotation process of the identity document image information at a first angle with the center point of the image as the center to obtain a target image.
[0111] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0112] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0113] An embodiment of the present invention further provides an identity document recognition system, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0114] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0115] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0116] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
Claims
1. A method for identifying an identity document, characterized in that: include: Acquire the identity document image information of the target area, wherein the identity document image information includes image pixel information and image grayscale information, and the image pixel information includes coordinate information of image pixel points; Based on the coordinate information and the image grayscale information, compare the image grayscale information of a first pixel point located in a first area contained in the identity document image information with a preset first grayscale threshold, wherein the image pixel points include the first pixel point; When the image grayscale information of the first pixel does not satisfy a first grayscale condition, obtaining first coordinate information of a pixel that satisfies the first grayscale condition in the identity document image information, wherein the first grayscale condition includes that a difference between the image grayscale information of the first pixel and the preset first grayscale threshold is less than the first threshold; In the case where the first coordinate information satisfies a first position condition, determining that the identity document image information is abnormal, and adjusting the identity document image information according to a preset rule, wherein the first position condition includes that the coordinate difference between the first coordinate information and the coordinate information of the first pixel point is greater than or equal to a second threshold; Wherein, after acquiring the identity document image information of the target area, the method further includes: Performing screening and detection processing on the identity document image based on a preset first algorithm to determine edge lines of the identity document, wherein the edge lines include long-side edge lines and short-side edge lines; Based on the short side edge line, determining a first reference line and a second reference line of the short side edge line by a second algorithm, wherein the first reference line, the second reference line and the short side edge line are parallel to each other; Determine, based on the image grayscale information of the first pixel and the coordinate information, a first distance difference between a third pixel whose grayscale value contained in the identity document image information satisfies the first grayscale condition and the first reference line, and a second distance difference between the third pixel and the second reference line; When both the first distance difference and the second distance difference satisfy a first distance condition, determining that the identity document image information is abnormal, and adjusting the identity document image information according to a preset rule, wherein the first distance condition includes that the first distance difference is less than or equal to a fifth threshold value and the second distance difference is greater than or equal to a sixth threshold value; The adjusting and processing of the identity document image information according to the preset rules includes: Determine the image center point of the identity document image information based on the edge line; The identity document image information is subjected to a center rotation process at a first angle with the center point of the image as the center to obtain a target image.
2. The method according to claim 1, characterized in that After acquiring the identity document image information of the target area, the method further includes: Based on the image grayscale information of the first pixel point, determining a pixel density value of a second pixel point whose grayscale value contained in the identity document image information meets a first grayscale condition, the image pixel points including the second pixel point; When the pixel density value satisfies the first density condition, performing position comparison processing on the second coordinate information of the second pixel point and preset third coordinate information; When the second coordinate information does not meet the second position condition, the identity document image information is determined to be abnormal and the identity document image information is adjusted and processed according to preset rules, wherein the second position condition includes that the difference between the second coordinate information and the first coordinate information is less than a preset fourth threshold.
3. An identity document recognition device, characterized in that: include: An information acquisition module, used to obtain the identity document image information of the target area, wherein the identity document image information includes image pixel information and image grayscale information, and the image pixel information includes coordinate information of image pixel points; a grayscale comparison module, configured to compare the image grayscale information of a first pixel located in a first area contained in the identity document image information with a preset first grayscale threshold value based on the coordinate information and the image grayscale information of the first pixel, wherein the image pixel points include the first pixel point; a coordinate determination module, configured to obtain first coordinate information of a pixel point in the identity document image information that meets the first grayscale condition when the image grayscale information of the first pixel point does not meet the first grayscale condition, wherein the first grayscale condition includes that a difference between the image grayscale information of the first pixel point and the preset first grayscale threshold is less than the first threshold; A first adjustment module, configured to determine that the identity document image information is abnormal and adjust the identity document image information according to a preset rule when the first coordinate information satisfies a first position condition, wherein the first position condition includes that a coordinate difference between the first coordinate information and the coordinate information of the first pixel point is greater than or equal to a second threshold; Wherein, the device further comprises: An edge line determination module is used for, after acquiring the identity document image information of the target area, screening and detecting the identity document image based on a preset first algorithm to determine the edge line of the identity document, wherein the edge line includes a long side edge line and a short side edge line; A reference line determination module, configured to determine, based on the short side edge line, a first reference line and a second reference line of the short side edge line by a second algorithm, wherein the first reference line, the second reference line and the short side edge line are parallel to each other; a distance determination module, configured to determine, based on the image grayscale information of the first pixel and the coordinate information, a first distance difference between a third pixel whose grayscale value contained in the identity document image information satisfies the first grayscale condition and the first reference line, and a second distance difference between the third pixel and the second reference line; A third adjustment module, configured to determine that the identity document image information is abnormal and adjust the identity document image information according to a preset rule when both the first distance difference and the second distance difference satisfy a first distance condition, wherein the first distance condition includes that the first distance difference is less than or equal to a fifth threshold and the second distance difference is greater than or equal to a sixth threshold; The third adjustment module comprises: A center determination unit, configured to determine the image center point of the identity document image information based on the edge line; The image rotation unit is used to perform a center rotation process of the identity document image information at a first angle with the center point of the image as the center to obtain a target image.
4. The device according to claim 3, characterized in that The device also includes: a density determination module, configured to determine, after acquiring the identity document image information of the target area, based on the image grayscale information of the first pixel point, a pixel density value of a second pixel point whose grayscale value contained in the identity document image information satisfies a first grayscale condition, wherein the image pixel points include the second pixel point; A position comparison module, configured to perform position comparison processing on the second coordinate information of the second pixel point and preset third coordinate information when the pixel density value satisfies a first density condition; The second adjustment module is used to determine that the identity document image information is abnormal and adjust the identity document image information according to preset rules when the second coordinate information does not meet the second position condition, wherein the second position condition includes that the difference between the second coordinate information and the first coordinate information is less than a preset fourth threshold.
5. An identity document recognition system, the system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the identity document recognition method as claimed in any one of claims 1 to 2 when executing the computer program.
6. A storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the identity document recognition method according to any one of claims 1 to 2 are implemented.
Citation Information
Patent Citations
Identity card number identification method and device thereof
CN107346427A
Identity card information identification method and device
CN111353497A
Certificate image identification method and device
CN115482540A
Identity card identification method based on OCR technology, storage medium and device
CN115641594A
