CN111768344B - Correction method, device, equipment and storage medium for front image of identity card - Google Patents

Correction method, device, equipment and storage medium for front image of identity card Download PDF

Info

Publication number
CN111768344B
CN111768344B CN202010398741.5A CN202010398741A CN111768344B CN 111768344 B CN111768344 B CN 111768344B CN 202010398741 A CN202010398741 A CN 202010398741A CN 111768344 B CN111768344 B CN 111768344B
Authority
CN
China
Prior art keywords
rotation angle
rectangle
circumscribed
front image
identity card
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010398741.5A
Other languages
Chinese (zh)
Other versions
CN111768344A (en
Inventor
王晨旭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202010398741.5A priority Critical patent/CN111768344B/en
Publication of CN111768344A publication Critical patent/CN111768344A/en
Application granted granted Critical
Publication of CN111768344B publication Critical patent/CN111768344B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/80Geometric correction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/40Analysis of texture
    • G06T7/41Analysis of texture based on statistical description of texture
    • G06T7/44Analysis of texture based on statistical description of texture using image operators, e.g. filters, edge density metrics or local histograms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Geometry (AREA)
  • Probability & Statistics with Applications (AREA)
  • Character Input (AREA)

Abstract

The application relates to a correction method, a device, equipment and a storage medium of an identity card front image, wherein the method comprises the following steps: detecting and obtaining an external rectangle of each text line in the front image of the identity card; acquiring a clockwise rotation angle and a counterclockwise rotation angle of each circumscribed rectangle, and acquiring the median of all the clockwise rotation angles as a first rotation angle and the median of all the counterclockwise rotation angles as a second rotation angle; acquiring the circumscribed rectangle with the largest height value in all circumscribed rectangles as a first circumscribed rectangle, and acquiring the circumscribed rectangle with the smallest height value in all circumscribed rectangles as a second circumscribed rectangle; and correcting the front image of the identity card according to the relative position relationship between the first external rectangle and the second external rectangle after correction according to the first rotation angle and the second rotation angle. The front side of the identity card is corrected, and the speed and accuracy of reading the front side information of the identity card are improved.

Description

Correction method, device, equipment and storage medium for front image of identity card
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a setting, and a storage medium for correcting a front image of an identification card.
Background
In modern society, real-name authentication is often required to be carried out on users, and the authenticity of the identity card information is checked, so that a reliable credit basis can be conveniently established among various industries. Nowadays, real-name authentication not only becomes a necessary means for network management, but also is widely applied to industries such as finance, banking, telecommunication, education and the like. The real-name authentication needs to be used for identification of the identity card, namely intelligent identification is carried out on the identity card information, manual input is omitted, and therefore the purpose of rapidly reading the information is achieved.
Therefore, how to quickly and accurately read the identity card information is a problem to be solved.
Disclosure of Invention
The application provides a correction method, device, equipment and storage medium for an identity card front image, which are used for correcting the front of an identity card before reading the identity card information so as to improve the speed and accuracy of reading the identity card front information.
In a first aspect, the present application provides a method for correcting a front image of an identification card, including:
acquiring a front image of an identity card;
detecting and obtaining all text lines in the front image of the identity card, and obtaining respective circumscribed rectangles of each text line;
acquiring respective clockwise rotation angles and anticlockwise rotation angles of each external rectangle according to respective rotation angles of each external rectangle, and acquiring the median of all the clockwise rotation angles as a first rotation angle and the median of all the anticlockwise rotation angles as a second rotation angle;
acquiring all circumscribed rectangles with the largest height values in the circumscribed rectangles as a first circumscribed rectangle, and acquiring all circumscribed rectangles with the smallest height values in the circumscribed rectangles as a second circumscribed rectangle;
correcting the front image of the identity card according to the first rotation angle, the second rotation angle and the corrected relative position relationship between the first external rectangle and the second external rectangle.
Optionally, correcting the front image of the identification card according to the first rotation angle, the second rotation angle and the corrected relative positional relationship between the first circumscribed rectangle and the second circumscribed rectangle, including:
clockwise rotating the front image of the identity card according to the first rotation angle to obtain a first correction image;
according to the second rotation angle, the front image of the identity card is rotated anticlockwise, and a second correction image is obtained;
if the first external rectangle is positioned above the second external rectangle in the first correction image, the first correction image is used as the corrected front image of the identity card; and if the first external rectangle is positioned above the second external rectangle in the second correction image, taking the second correction image as the corrected front image of the identity card.
Optionally, after obtaining the respective circumscribed rectangle of each text line, before obtaining the respective clockwise rotation angle and the counterclockwise rotation angle of each circumscribed rectangle according to the respective rotation angle of each circumscribed rectangle, the method further includes:
acquiring a rotation angle of each circumscribed rectangle relative to a reference direction, wherein the reference direction is an X-axis direction of a pre-defined reference coordinate system;
dividing angle intervals by taking preset angle values as intervals, classifying each external rectangle into the corresponding angle interval according to the rotation angle, counting the number of the classified external rectangles in each angle interval, and obtaining the external rectangle with the largest number in the angle interval as the effective external rectangle obtained after filtering.
Optionally, the clockwise rotation angle is equal to the rotation angle, and the counterclockwise rotation angle is equal to an angle value obtained by subtracting the rotation angle from 180 degrees.
Optionally, acquiring a rotation angle of each circumscribed rectangle relative to a reference direction, including:
the following processing is respectively carried out on each circumscribed rectangle:
acquiring a minimum angle required for anticlockwise rotation from the X-axis direction of the reference coordinate system to the long side of the circumscribed rectangle;
judging whether the minimum angle is smaller than a preset angle value or not;
if yes, calculating a difference value of 180 degrees minus the minimum angle, and taking the obtained difference value as the rotation angle of the circumscribed rectangle;
and if not, taking the minimum angle as the rotation angle of the circumscribed rectangle.
Optionally, the first external rectangle is a text line where the resident identification card is located or a text line where the people's republic of China is located; the second circumscribed rectangle is a circumscribed rectangle of a text line where an issuing authority or an effective date is located.
Optionally, the difference between the upper and lower limits of the angle interval is equal to 10 degrees.
In a second aspect, an embodiment of the present application provides a correction device for a front image of an identification card, including:
the acquisition module is used for acquiring the front image of the identity card;
the detection module is used for detecting and obtaining all text lines in the front image of the identity card and obtaining respective circumscribed rectangles of each text line;
the first selection module is used for acquiring the respective clockwise rotation angle and the counterclockwise rotation angle of each external rectangle according to the respective rotation angle of each external rectangle, acquiring the median in all the clockwise rotation angles as a first rotation angle and the median in all the counterclockwise rotation angles as a second rotation angle;
the second selection module is used for obtaining all circumscribed rectangles with the largest height values in the circumscribed rectangles as a first circumscribed rectangle, and obtaining all circumscribed rectangles with the smallest height values in the circumscribed rectangles as a second circumscribed rectangle;
the correction module is used for correcting the front image of the identity card according to the first rotation angle, the second rotation angle and the corrected relative position relationship between the first external rectangle and the second external rectangle.
In a third aspect, the present application provides an electronic device, including: the device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus; the memory is used for storing a computer program; the processor is configured to execute the program stored in the memory, and implement the method for correcting the front image of the identification card according to the first aspect.
In a fourth aspect, the present application provides a computer readable storage medium storing a computer program, where the computer program when executed by a processor implements the method for correcting a front image of an identification card according to the first aspect.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages: according to the method, the respective external rectangles of all text lines of the front image of the identity card are detected, the median of the clockwise rotation angles of all the external rectangles is obtained according to the respective rotation angles of each external rectangle, and the median of the anticlockwise rotation angles of all the external rectangles is obtained, so that the initial rotation angle values for correcting the front image of the identity card are obtained, after the front image of the identity card is rotated according to the two initial rotation angle values, the corrected front image of the identity card can be selected according to the relative position relationship between the effective external rectangle with the largest height value and the external rectangle with the smallest height value in the rotated image, and therefore the corrected front image of the identity card can be identified by utilizing the position relationship of each text line of the front of the identity card during forward placement. By correcting the front image of the identity card, the method provides guarantee for improving the speed and accuracy of subsequent extraction and identification of the information of the identity card.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
FIG. 1 is a schematic flow chart of a method for correcting an image on the front side of an ID card in an embodiment of the application;
FIG. 2 is a schematic diagram of a specific process for correcting a front image of an ID card in an embodiment of the present application;
FIG. 3 is a schematic diagram of a correction device for front image of an ID card in an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
The embodiment of the application provides an identity card front image correction method which can be applied to any type of electronic equipment, including a terminal and a server.
It should be noted that, the front side of the identification card in the embodiment of the application refers to the side of the Chinese resident identification card including the national emblem pattern.
As shown in fig. 1, the specific process of correcting the front image of the identification card is as follows:
and step 101, acquiring an identity card front image.
Specifically, the front image of the identity card can be obtained by directly shooting the front of the identity by the electronic equipment or can be obtained from other equipment. For example, the server acquires the front image of the identity card transmitted after the terminal device shoots the front image.
Whether the acquired identity card image is an identity card front image is not a problem concerned in the scheme, and various ways can be known in implementation, for example, whether the acquired identity card image contains typical features of the front or not is identified, or indication information that the identity card image is the front image is directly acquired.
Step 102, detecting and obtaining all text lines in the front image of the identity card, and obtaining respective circumscribed rectangles of each text line.
Wherein, a line of text in the front image of the identity card is called a text line. The front of the resident identification card of the people's republic of China is provided with 4 text lines, namely a first text line in which the people's republic of China is located, a second text line in which the resident identification card is located, a third text line in which an issuing authority is located and a fourth text line in which the effective date is located.
If the text line is detected after the text line detection is finished, the image is not considered to be an identity card image.
The bounding rectangle of a text line is the smallest bounding rectangle of that text line.
In a specific embodiment, in order to filter out invalid circumscribed rectangles in all circumscribed rectangles, so as to improve correction efficiency and accuracy, valid circumscribed rectangles after the invalid circumscribed rectangles are filtered out are identified from all circumscribed rectangles, wherein the valid circumscribed rectangles are circumscribed rectangles with rotation angles intensively distributed in the same angle interval. And in the subsequent correction process, the effective external rectangle obtained after filtering is used.
In one embodiment, the specific process of identifying valid bounding rectangles is: acquiring the rotation angle of each circumscribed rectangle relative to the reference direction; dividing angle intervals by taking a preset angle value as an interval, classifying each external rectangle into a corresponding angle interval according to a rotation angle, counting the number of the classified external rectangles in each angle interval, and obtaining the external rectangle with the largest number in the angle interval as the effective external rectangle obtained after filtering, namely the effective external rectangle.
The reference direction is the X-axis direction of a pre-defined reference coordinate system, and the reference coordinate system is a plane rectangular coordinate system.
For example, the rotation angle of each circumscribed rectangle is saved in an angle list (denoted as Alist), an angle histogram of the angle list is counted with a preset angle value as an interval (for example, with 15 degrees as an interval), an interval containing the maximum number of rotation angles in the angle histogram is selected, the circumscribed rectangle corresponding to each rotation angle in the interval is used as an effective circumscribed rectangle, that is, the circumscribed rectangle corresponding to the rotation angle not in the interval is used as an ineffective circumscribed rectangle, and the ineffective circumscribed rectangle is filtered.
In one embodiment, for any circumscribed rectangle, the specific process of obtaining the rotation angle of the circumscribed rectangle relative to the reference direction is as follows: acquiring a minimum angle required for anticlockwise rotation from the X-axis direction of a reference coordinate system to the long side of the circumscribed rectangle, wherein the minimum angle is denoted as Amin; judging whether the minimum angle is smaller than a preset angle value or not; if yes, calculating a difference value of 180 degrees minus the minimum angle, and taking the obtained difference value as the rotation angle of the circumscribed rectangle; if not, the minimum angle is taken as the rotation angle of the circumscribed rectangle. Here, considering a text line approximately horizontal to the X-axis, the minimum angle of the corresponding circumscribed rectangle is close to zero degrees or close to 180 degrees, and thus, for the case where Amin is smaller than a preset angle value (for example, smaller than 5 degrees), the rotation angle is uniformly recorded to be 180-Amin.
Step 103, according to the respective rotation angles of each external rectangle, acquiring the respective clockwise rotation angle and the counterclockwise rotation angle of each external rectangle, and acquiring the median of all the clockwise rotation angles as a first rotation angle and the median of all the counterclockwise rotation angles as a second rotation angle.
Specifically, the clockwise rotation angle of one circumscribed rectangle is equal to the rotation angle of the circumscribed rectangle, and the counterclockwise rotation angle of one circumscribed rectangle is equal to the angle value obtained by subtracting the rotation angle of the circumscribed rectangle from 180 degrees. The identity card image rotates according to the clockwise rotation angle, the long side of the rotated identity card image can be parallel to the X axis of the reference coordinate system, the identity card image rotates according to the anticlockwise rotation angle, and the long side of the rotated identity card image can be parallel to the X axis of the reference coordinate system. Under the condition of filtering invalid circumscribed rectangles, the circumscribed rectangles are replaced by effective circumscribed rectangles, so that the correction efficiency can be further improved.
Step 104, obtaining the effective circumscribed rectangle with the largest height value in all circumscribed rectangles as a first circumscribed rectangle, and obtaining the circumscribed rectangle with the smallest height value in all circumscribed rectangles as a second circumscribed rectangle.
For the Chinese resident identity card, in the case that the circumscribed rectangle (in the case of filtering an invalid circumscribed rectangle, here an effective circumscribed rectangle) comprises the circumscribed rectangle of the text line where the resident identity card is located, the first circumscribed rectangle is the circumscribed rectangle of the text line where the resident identity card is located or the text line where the people's republic of China is located; the second circumscribed rectangle is the circumscribed rectangle of the text line where the issuing authority or the effective date is located. Here, considering the height value of the circumscribed rectangle of the text line where the resident identification card is located in the front side of the identification card and the height value of the circumscribed rectangle of the text line where the people's republic of China is located in the front side of the identification card are obviously higher than the height value of the text line where the issuing agency or the effective date is located, the text line located above the national emblem and the text line located below the national emblem can be distinguished through the height values of the circumscribed rectangles when the identification card is placed in the forward direction.
And 105, correcting the front image of the identity card according to the first rotation angle, the second rotation angle and the relative position relation of the corrected first external rectangle and the corrected second external rectangle.
In one embodiment, the correction is performed as follows: clockwise rotating the front image of the identity card according to the first rotation angle to obtain a first correction image; according to the second rotation angle, the front image of the identity card rotates anticlockwise to obtain a second correction image; if the first external rectangle is positioned above the second external rectangle in the first correction image, the first correction image is used as a corrected front image of the identity card; if the first external rectangle is positioned above the second external rectangle in the second correction image, the second correction image is used as the corrected front image of the identity card. Here, one of the first correction image and the second correction image is a forward-placed image, and the other is a reverse-placed image, and considering that the first external rectangle is necessarily located above the second external rectangle under the condition of forward-placed front of the identification card, the front-side image of the identification card which is forward-placed can be directly identified from the first correction image and the second correction image through the relative position relationship of the first external rectangle and the second external rectangle, so that the correct correction image is obtained.
The following describes the correction process by taking the case of filtering an invalid external rectangle as an example with reference to fig. 2, and for the case of not filtering, only the steps of replacing the valid external rectangle in the process with the external rectangle and removing the valid external rectangle for identification are needed, and the correction process of the front image of the identity card is specifically described:
step 201, acquiring an identity card front image, and detecting a text line of the identity card front image;
step 202, obtaining a respective circumscribed rectangle of each detected text line, for example, a minimum circumscribed rectangle of a text line area;
step 203, obtaining the rotation angle of each circumscribed rectangle relative to the X axis of the reference coordinate system, carrying out histogram statistics on the rotation angle, obtaining the interval with the most number of rotation angles distributed in the histogram, and filtering the circumscribed rectangle corresponding to the rotation angle outside the interval as the circumscribed rectangle in the non-main direction to obtain the effective circumscribed rectangle in the main direction;
step 204, acquiring a clockwise rotation angle and a counterclockwise rotation angle of each effective circumscribed rectangle, obtaining a clockwise rotation angle list and a counterclockwise rotation angle list, and acquiring a median Mcw in the clockwise rotation angle list and a median Mccw in the counterclockwise rotation angle list;
step 205, obtaining a circumscribed rectangle M with the largest height value and a circumscribed rectangle N with the smallest height value in all the effective circumscribed rectangles;
step 206, respectively adopting the two angles Mcw and Mcc to rotate the front image of the identity card, and selecting the angle of M above N after rotation as the final rotation angle;
step 207, the front image of the identity card rotated according to the final rotation angle is used as a corrected image and is output.
According to the method, effective external rectangles with rotation angles distributed in the same angle interval in a concentrated mode are screened out from respective external rectangles of all text lines of the front image of the identity card, so that interference is reduced, then, according to the respective rotation angles of each effective external rectangle, the median of the clockwise rotation angles of all the effective external rectangles and the median of the anticlockwise rotation angles of all the effective external rectangles are obtained, initial rotation angle values for correcting the front image of the identity card are obtained, after the front image of the identity card is rotated according to the two initial rotation angle values, the corrected front image of the identity card can be selected according to the relative position relation between the effective external rectangle with the largest height value and the external rectangle with the smallest height value in the rotated image, and therefore, the corrected front image of the identity card can be identified by utilizing the position relation of each text line of the front image of the identity card during forward placement. By correcting the front image of the identity card, the method provides guarantee for improving the speed and accuracy of subsequent extraction and identification of the information of the identity card.
Based on the same conception, the embodiment of the application provides a correction device for the front image of the identity card, the specific implementation of the device can be referred to the description of the embodiment part of the method, and the repetition is omitted. As shown in fig. 3, the apparatus mainly includes:
the acquiring module 301 is configured to acquire an image of the front face of the identity card;
the detection module 302 is configured to detect and obtain all text lines in the front image of the identification card, and obtain respective circumscribed rectangles of each text line;
a first selection module 303, configured to obtain, according to respective rotation angles of each of the circumscribed rectangles, respective clockwise rotation angles and counterclockwise rotation angles of each of the circumscribed rectangles, obtain a median of all the clockwise rotation angles as a first rotation angle, and obtain a median of all the counterclockwise rotation angles as a second rotation angle;
a second selecting module 304, configured to obtain, as a first circumscribed rectangle, a circumscribed rectangle with the largest height value among all the circumscribed rectangles, and obtain, as a second circumscribed rectangle, a circumscribed rectangle with the smallest height value among all the circumscribed rectangles;
the correction module 305 is configured to correct the front image of the identification card according to the first rotation angle, the second rotation angle, and the corrected relative positional relationship between the first external rectangle and the second external rectangle.
Based on the same conception, the embodiment of the application also provides an electronic device, as shown in fig. 4, which mainly includes: processor 401, communication interface 402, memory 403 and communication bus 404, wherein processor 401, communication interface 402 and memory 403 accomplish the communication each other through communication bus 404. The memory 403 stores a program executable by the processor 401, and the processor 401 executes the program stored in the memory 403 to implement the following steps: acquiring a front image of an identity card; detecting and obtaining all text lines in the front image of the identity card, and obtaining respective circumscribed rectangles of each text line; acquiring respective clockwise rotation angles and anticlockwise rotation angles of each external rectangle according to respective rotation angles of each external rectangle, and acquiring the median of all the clockwise rotation angles as a first rotation angle and the median of all the anticlockwise rotation angles as a second rotation angle; acquiring all circumscribed rectangles with the largest height values in the circumscribed rectangles as a first circumscribed rectangle, and acquiring all circumscribed rectangles with the smallest height values in the circumscribed rectangles as a second circumscribed rectangle; correcting the front image of the identity card according to the first rotation angle, the second rotation angle and the corrected relative position relationship between the first external rectangle and the second external rectangle.
The communication bus 404 mentioned in the above electronic device may be a peripheral component interconnect standard (Peripheral Component Interconnect, abbreviated to PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, abbreviated to EISA) bus, or the like. The communication bus 404 may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, only one thick line is shown in fig. 4, but not only one bus or one type of bus.
The communication interface 402 is used for communication between the electronic device and other devices described above.
The memory 403 may include a random access memory (Random Access Memory, abbreviated as RAM) or may include a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory. Alternatively, the memory may be at least one memory device located remotely from the aforementioned processor 401.
The processor 401 may be a general-purpose processor including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), a digital signal processor (Digital Signal Processing, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a Field programmable gate array (Field-Programmable Gate Array, FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components.
In yet another embodiment of the present application, there is also provided a computer-readable storage medium having stored therein a computer program which, when run on a computer, causes the computer to perform the method for correcting an identification card front image described in the above embodiment.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the processes or functions described in accordance with the embodiments of the present application are produced in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, by a wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, microwave, etc.) means from one website, computer, server, or data center to another. The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape, etc.), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk), etc.
It should be noted that in this document, relational terms such as "first" and "second" and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, 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. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing is only a specific embodiment of the invention to enable those skilled in the art to understand or practice the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (9)

1. The correction method of the front image of the identity card is characterized by comprising the following steps of:
acquiring a front image of an identity card;
detecting and obtaining all text lines in the front image of the identity card, and obtaining respective circumscribed rectangles of each text line;
acquiring respective clockwise rotation angles and anticlockwise rotation angles of each external rectangle according to respective rotation angles of each external rectangle, acquiring the median of all the clockwise rotation angles, taking the median of all the clockwise rotation angles as a first rotation angle and the median of all the anticlockwise rotation angles as a second rotation angle, wherein the rotation angle is the minimum angle from the anticlockwise rotation of the X-axis direction of a reference coordinate system to the long side of the external rectangle, the clockwise rotation angle is the rotation angle of the external rectangle, and the anticlockwise rotation angle is an angle value obtained by subtracting the rotation angle of the external rectangle from 180 degrees;
acquiring all circumscribed rectangles with the largest height values in the circumscribed rectangles as a first circumscribed rectangle, and acquiring all circumscribed rectangles with the smallest height values in the circumscribed rectangles as a second circumscribed rectangle;
correcting the front image of the identity card according to the first rotation angle, the second rotation angle and the corrected relative position relationship between the first external rectangle and the second external rectangle;
the correcting the front image of the identity card according to the first rotation angle, the second rotation angle and the corrected relative position relationship between the first external rectangle and the second external rectangle comprises the following steps:
clockwise rotating the front image of the identity card according to the first rotation angle to obtain a first correction image;
according to the second rotation angle, the front image of the identity card is rotated anticlockwise, and a second correction image is obtained;
if the first external rectangle is positioned above the second external rectangle in the first correction image, the first correction image is used as the corrected front image of the identity card; and if the first external rectangle is positioned above the second external rectangle in the second correction image, taking the second correction image as the corrected front image of the identity card.
2. The method for correcting a front image of an identification card according to claim 1, wherein after obtaining respective circumscribed rectangles of each text line, before obtaining respective clockwise rotation angles and counterclockwise rotation angles of each circumscribed rectangle according to respective rotation angles of each circumscribed rectangle, the method further comprises:
acquiring a rotation angle of each circumscribed rectangle relative to a reference direction, wherein the reference direction is an X-axis direction of a pre-defined reference coordinate system;
dividing angle intervals by taking preset angle values as intervals, classifying each external rectangle into the corresponding angle interval according to the rotation angle, counting the number of the classified external rectangles in each angle interval, and obtaining the external rectangle with the largest number in the angle interval as the effective external rectangle obtained after filtering.
3. The method for correcting a front image of an identification card according to claim 2, wherein the clockwise rotation angle is equal to the rotation angle, and the counterclockwise rotation angle is equal to an angle value obtained by subtracting the rotation angle from 180 degrees.
4. A method of calibrating an image of a front face of an identification card according to claim 3, wherein obtaining a rotation angle of each of the bounding rectangles with respect to a reference direction comprises:
the following processing is respectively carried out on each circumscribed rectangle:
acquiring a minimum angle required for anticlockwise rotation from the X-axis direction of the reference coordinate system to the long side of the circumscribed rectangle;
judging whether the minimum angle is smaller than a preset angle value or not;
if yes, calculating a difference value of 180 degrees minus the minimum angle, and taking the obtained difference value as the rotation angle of the circumscribed rectangle;
and if not, taking the minimum angle as the rotation angle of the circumscribed rectangle.
5. The method for correcting a front image of an identification card according to any one of claims 1 to 4, wherein the first circumscribed rectangle is a circumscribed rectangle of a text line where a resident identification card is located or a text line where the people's republic of China is located; the second circumscribed rectangle is a circumscribed rectangle of a text line where an issuing authority or an effective date is located.
6. The method for correcting a front image of an identification card according to claim 2, wherein the difference between the upper limit value and the lower limit value of the angle section is equal to 10 degrees.
7. A correction device for an identity card front image, comprising:
the acquisition module is used for acquiring the front image of the identity card;
the detection module is used for detecting and obtaining all text lines in the front image of the identity card and obtaining respective circumscribed rectangles of each text line;
the first selection module is used for acquiring respective clockwise rotation angles and anticlockwise rotation angles of each external rectangle according to respective rotation angles of each external rectangle, acquiring the median of all the clockwise rotation angles, taking the median of all the clockwise rotation angles as a first rotation angle and the anticlockwise rotation angles as a second rotation angle, wherein the rotation angle is the minimum angle from the anticlockwise rotation of the X-axis direction of a reference coordinate system to the long side of the external rectangle, the clockwise rotation angle is the rotation angle of the external rectangle, and the anticlockwise rotation angle is an angle value obtained by subtracting the rotation angle of the external rectangle from 180 degrees;
the second selection module is used for obtaining all circumscribed rectangles with the largest height values in the circumscribed rectangles as a first circumscribed rectangle, and obtaining all circumscribed rectangles with the smallest height values in the circumscribed rectangles as a second circumscribed rectangle;
the correction module is used for correcting the front image of the identity card according to the first rotation angle, the second rotation angle and the corrected relative position relationship between the first external rectangle and the second external rectangle;
wherein the correction module is configured to:
clockwise rotating the front image of the identity card according to the first rotation angle to obtain a first correction image;
according to the second rotation angle, the front image of the identity card is rotated anticlockwise, and a second correction image is obtained;
if the first external rectangle is positioned above the second external rectangle in the first correction image, the first correction image is used as the corrected front image of the identity card; and if the first external rectangle is positioned above the second external rectangle in the second correction image, taking the second correction image as the corrected front image of the identity card.
8. An electronic device, comprising: the device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus; the memory is used for storing a computer program; the processor is configured to execute the program stored in the memory, and implement the correction method for the front image of the identification card according to any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the method of correcting an identification card front image according to any one of claims 1 to 6.
CN202010398741.5A 2020-05-12 2020-05-12 Correction method, device, equipment and storage medium for front image of identity card Active CN111768344B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010398741.5A CN111768344B (en) 2020-05-12 2020-05-12 Correction method, device, equipment and storage medium for front image of identity card

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010398741.5A CN111768344B (en) 2020-05-12 2020-05-12 Correction method, device, equipment and storage medium for front image of identity card

Publications (2)

Publication Number Publication Date
CN111768344A CN111768344A (en) 2020-10-13
CN111768344B true CN111768344B (en) 2023-06-30

Family

ID=72719142

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010398741.5A Active CN111768344B (en) 2020-05-12 2020-05-12 Correction method, device, equipment and storage medium for front image of identity card

Country Status (1)

Country Link
CN (1) CN111768344B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115457559B (en) * 2022-08-19 2024-01-16 上海通办信息服务有限公司 Method, device and equipment for intelligently correcting texts and license pictures

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102272794A (en) * 2008-10-23 2011-12-07 谷歌公司 Systems and methods for socially-based correction of tilted images
EP2546801A1 (en) * 2011-07-11 2013-01-16 Sagemcom Documents Sas Method for detecting and correcting the direction of a document in a digital image
WO2019104879A1 (en) * 2017-11-30 2019-06-06 平安科技(深圳)有限公司 Information recognition method for form-type image, electronic device and readable storage medium
CN110136069A (en) * 2019-05-07 2019-08-16 语联网(武汉)信息技术有限公司 Text image antidote, device and electronic equipment
CN110188747A (en) * 2019-04-28 2019-08-30 广州华多网络科技有限公司 A kind of sloped correcting method of text image, device and image processing equipment
CN110647882A (en) * 2019-09-20 2020-01-03 上海眼控科技股份有限公司 Image correction method, device, equipment and storage medium
CN110942435A (en) * 2019-11-27 2020-03-31 讯飞智元信息科技有限公司 Document image processing method and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102272794A (en) * 2008-10-23 2011-12-07 谷歌公司 Systems and methods for socially-based correction of tilted images
EP2546801A1 (en) * 2011-07-11 2013-01-16 Sagemcom Documents Sas Method for detecting and correcting the direction of a document in a digital image
WO2019104879A1 (en) * 2017-11-30 2019-06-06 平安科技(深圳)有限公司 Information recognition method for form-type image, electronic device and readable storage medium
CN110188747A (en) * 2019-04-28 2019-08-30 广州华多网络科技有限公司 A kind of sloped correcting method of text image, device and image processing equipment
CN110136069A (en) * 2019-05-07 2019-08-16 语联网(武汉)信息技术有限公司 Text image antidote, device and electronic equipment
CN110647882A (en) * 2019-09-20 2020-01-03 上海眼控科技股份有限公司 Image correction method, device, equipment and storage medium
CN110942435A (en) * 2019-11-27 2020-03-31 讯飞智元信息科技有限公司 Document image processing method and device

Also Published As

Publication number Publication date
CN111768344A (en) 2020-10-13

Similar Documents

Publication Publication Date Title
CN110288599B (en) Dead pixel detection method and device, electronic equipment and storage medium
CN111768346B (en) Correction method, device, equipment and storage medium for identity card back image
CN111768345B (en) Correction method, device, equipment and storage medium for identity card back image
CN111062013B (en) Account filtering method and device, electronic equipment and machine-readable storage medium
US8457446B2 (en) Image retrieval apparatus, image retrieval method, and storage medium
CN111768344B (en) Correction method, device, equipment and storage medium for front image of identity card
CN111126098A (en) Certificate image acquisition method, device, equipment and storage medium
CN107909554A (en) Image denoising method, device, terminal device and medium
CN111178347B (en) Ambiguity detection method, ambiguity detection device, ambiguity detection equipment and ambiguity detection storage medium for certificate image
CN108173714B (en) Public export IP address detection method and device and electronic equipment
CN112883765B (en) Target movement track acquisition method and device, storage medium and electronic equipment
CN110880023A (en) Method and device for detecting certificate picture
CN112629828B (en) Optical information detection method, device and equipment
CN114120518B (en) Paper money continuous sheet detection method and device, electronic equipment and storage medium
CN111767787B (en) Method, device, equipment and storage medium for judging front and back sides of identity card image
CN114998942A (en) High-precision optical fingerprint identification method and system
CN108960222B (en) Image binarization method, device, equipment and storage medium
CN110929708A (en) Method, equipment and storage medium for identifying national flag in Thai identity card
CN111160093A (en) Method, device, equipment and storage medium for identifying certificate photo camouflage in certificate
CN115330826B (en) Linear detection method, linear detection device, electronic equipment and computer readable storage medium
CN114882482B (en) Seal anti-counterfeiting identification method and device
CN108961532B (en) Method, device and equipment for processing crown word number image and storage medium
CN111260618B (en) Method and device for constructing focus detection system and electronic equipment
TWI737447B (en) Image processing method, electronic device and storage device
CN117115266A (en) Corner detection method and device, electronic equipment and storage 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
GR01 Patent grant
GR01 Patent grant