WO2021212873A1 - Defect detection method and apparatus for four corners of certificate, and device and storage medium - Google Patents

Defect detection method and apparatus for four corners of certificate, and device and storage medium Download PDF

Info

Publication number
WO2021212873A1
WO2021212873A1 PCT/CN2020/135850 CN2020135850W WO2021212873A1 WO 2021212873 A1 WO2021212873 A1 WO 2021212873A1 CN 2020135850 W CN2020135850 W CN 2020135850W WO 2021212873 A1 WO2021212873 A1 WO 2021212873A1
Authority
WO
WIPO (PCT)
Prior art keywords
certificate
standard
target
picture
document
Prior art date
Application number
PCT/CN2020/135850
Other languages
French (fr)
Chinese (zh)
Inventor
黄泽浩
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021212873A1 publication Critical patent/WO2021212873A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • G06F18/232Non-hierarchical techniques
    • G06F18/2321Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions
    • G06F18/23213Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions with fixed number of clusters, e.g. K-means clustering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/22Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition

Definitions

  • This application relates to the field of detection technology, and in particular to a method, device, equipment, and storage medium for detecting the four corners of a certificate.
  • the inventor realizes that other objects may be mistakenly collected during the collection process of the ID image, such as the background of the environment where the ID is located when the photo is taken. As a result, it causes interference in the detection of the entire ID image, which makes the detection exist. Large errors lead to inaccurate detection results.
  • the embodiment of the present application provides a method for detecting defects in the four corners of a document.
  • the method for detecting defects in the four corners of a document includes the following steps:
  • This application also provides a device for detecting defects in four corners of a document, the device for detecting defects in four corners of a document includes:
  • the obtaining module is used to obtain, when a picture containing a certificate is received, the coordinate of the feature point of the face in the certificate contained in the picture, obtain the coordinate clustering center and the minimum bounding rectangle based on the coordinate of the feature point, and obtain the minimum The area of the circumscribing rectangle;
  • a calculation module configured to calculate the rectangular boundary of the certificate in the picture based on the area of the smallest bounding rectangle and the coordinate clustering center;
  • the extraction module is used to extract the rectangular area formed by the rectangular boundary of the certificate in the picture, and to detect whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, determine whether there are missing corners in the received picture.
  • the certificate is incomplete.
  • the application also provides a four-corner defect detection device for a document.
  • the four-corner defect detection device includes a memory, a processor, and a four-corner defect detection program that is stored on the memory and can run on the processor. When the detection program is executed by the processor, the following steps are implemented:
  • the present application also provides a storage medium on which a four-corner defect detection program is stored, and the four-corner defect detection program is executed by a processor to implement the following steps:
  • FIG. 1 is a schematic diagram of the structure of a detection device for four corners of a credential defect in a hardware operating environment involved in a solution of an embodiment of the application;
  • FIG. 2 is a schematic flowchart of a first embodiment of a method for detecting four corners of a credential incompleteness of the application
  • FIG. 3 is a schematic diagram of functional modules of a preferred embodiment of a device for detecting defects at four corners of a document in this application.
  • FIG. 1 is a schematic diagram of the structure of the four corners of the credential defect detection device of the hardware operating environment involved in the solution of the embodiment of the present application.
  • the four-corner defect detection device of the examples of this application can be a PC, or a portable terminal device such as a tablet computer and a portable computer.
  • the device for detecting defects in the four corners of the document may include a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002.
  • the communication bus 1002 is used to implement connection and communication between these components.
  • the user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface.
  • the network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
  • the memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as a magnetic disk memory.
  • the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
  • FIG. 1 does not constitute a limitation on the four-corner defect detection device of the document, and may include more or less components than shown in the figure, or a combination of certain components, Or different component arrangements.
  • the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a detection program.
  • the network interface 1004 is mainly used to connect to the back-end server and communicate with the back-end server;
  • the user interface 1003 is mainly used to connect to the client (user side) and communicate with the client;
  • the processor 1001 can be used to call the detection program stored in the memory 1005 and perform the following operations:
  • the step of calculating the rectangular boundary of the certificate in the picture based on the area of the smallest bounding rectangle and the coordinate clustering center includes:
  • Identify the type of the certificate in the picture determine the target standard certificate corresponding to the type according to the type of the certificate, and obtain the target standard area of the target circumscribed rectangle in the target standard certificate;
  • the length and width of the certificate are calculated, wherein the proportional relationship includes the difference between the target standard length of the target standard certificate and the target standard area The first target proportional relationship between the two, and the second target proportional relationship between the target standard width of the target standard certificate and the target standard area;
  • the relative position relationship includes the target standard of the target standard certificate
  • the step of determining the rectangular boundary of the document based on the relative position relationship of the target standard document, the length and width of the document, and the coordinate clustering center includes:
  • the length boundary of the document is determined based on the length of the document and the direction of the length boundary
  • the width boundary of the document is determined based on the width of the document and the direction of the width boundary.
  • the width boundary determines the rectangular boundary of the document.
  • the processor 1001 may be used to call the detection program stored in the memory 1005 and perform the following operations:
  • the rectangular area is divided according to the first preset segmentation method Is a plurality of sub-pictures, and the sub-pictures corresponding to the four corners of the rectangular area among the plurality of sub-pictures are used as target sub-pictures to detect whether there are defects in the four corners of the rectangular area based on each of the target sub-pictures.
  • the rectangular area is divided into multiple segments according to the second preset segmentation method. And use multiple sub-pictures as target sub-pictures to detect whether there are missing corners in the four corners of the rectangular area based on each of the target sub-pictures.
  • the step of detecting whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, determining that the certificate in the received picture is a broken certificate includes:
  • the target sub-pictures all contain a complete ID corner, it is determined that the received picture is valid
  • the certificate in the received picture is a broken certificate
  • the received picture is determined to be invalid, and a re-collection prompt message is output.
  • the feature point coordinates of the face in the credential included in the picture are obtained, the coordinate clustering center and the smallest bounding rectangle are obtained based on the feature point coordinates, and the smallest bounding rectangle is obtained.
  • the steps to circumscribe the area of the rectangle include:
  • the processor 1001 may be used to call the detection stored in the memory 1005 Program and do the following:
  • a first relative positional relationship between the standard cluster center and the standard length is generated, and based on the standard width and the standard cluster center, the standard cluster is generated The second relative positional relationship between the class center and the standard width.
  • the first embodiment of the present application provides a schematic flowchart of a method for detecting the four corners of a credential defect.
  • the method for detecting defects in the four corners of the document includes the following steps:
  • Step S10 when a picture containing a certificate is received, the feature point coordinates of the face in the certificate contained in the picture are obtained, the coordinate clustering center and the minimum circumscribed rectangle are obtained based on the characteristic point coordinates, and the minimum circumscribed rectangle is obtained Area
  • the method for detecting incomplete four corners of a document in this embodiment is applied to a server, where the server is in communication connection with a computer, a tablet, a smart phone, and other terminals.
  • the server is provided with an identification program and a preset neural network, and the identification program at least includes identification technology with a document
  • a program based on OCR recognition and a program based on face recognition technology such as feature point recognition are used for document recognition and face recognition, respectively.
  • document recognition can identify various types of documents.
  • the types of documents can be ID cards, driving licenses, marriage certificates, etc.
  • Face recognition can identify facial feature points and extract the coordinates of the feature points.
  • the feature points are based on the nose, Face features such as mouth, eyes, ears, etc. are generated.
  • the preset neural network is used to detect facial feature points.
  • the neural network can be dlib or face recognize.
  • a user when a user conducts online remote account opening or identification of a certificate due to certain circumstances, he needs to take a picture containing his certificate and upload the captured picture to the terminal. Understandably, if the user uses a smart phone to take a picture, then The pictures can be uploaded directly to the server. Further, when the terminal receives the picture containing the certificate uploaded by the user, it transmits the picture to the server, so that the server can recognize the face in the picture through the recognition program and extract the coordinates of the facial feature points in the certificate. Further, the server clusters the extracted coordinates of each feature point to obtain a coordinate clustering center that characterizes the center position of each feature point of the face.
  • the server determines the smallest enclosing rectangle that includes all the feature points of the face in the picture according to the coordinates of each feature point, and further detects the length and width of the smallest enclosing rectangle to calculate the area of the smallest enclosing rectangle based on the length and width.
  • the characteristic point coordinates of the face in the certificate contained in the picture are obtained, the coordinate clustering center and the minimum circumscribed rectangle are obtained based on the characteristic point coordinates, and the minimum circumscribed rectangle is obtained.
  • Step S11 when a picture containing a document is received, extract multiple feature points of the face in the document through a preset neural network, and obtain feature point coordinates of the multiple feature points;
  • the terminal receives the image uploaded by the user that contains the certificate
  • the image is sent to the server
  • the server uses the edge line detection function of opencv (Open Source Computer Vision Library) to check the tilt in the image of the verification piece.
  • opencv Open Source Computer Vision Library
  • the degree of perspective transformation is further used.
  • the server transmits the corrected picture to the preset neural network, and through the detection of the preset neural network, recognizes the face with the most feature points in the picture, extracts multiple feature points from the face, and obtains each feature The characteristic point coordinates of the point.
  • Step S12 clustering the coordinates of each feature point of the face in the document by a preset algorithm to obtain the center coordinates of the coordinates of each feature point of the face in the document as the coordinate clustering center;
  • the server clusters the coordinates of each feature point by using a preset algorithm.
  • the knn clustering algorithm is used to calculate the center coordinates of the coordinates of each feature point through the knn clustering algorithm, which is used to characterize the location of each feature point.
  • the cluster center of the center point of the area For example, the server recognizes the coordinates of facial feature points such as eyes, nose, mouth, ears, etc. through a recognition program, and calculates the center coordinates of the coordinates of the above multiple facial feature points through a clustering algorithm, and uses the center coordinates as the coordinate clustering center .
  • Step S13 Determine a minimum circumscribed rectangle according to the position of each of the feature point coordinates of the face in the document, and detect the length and width of the minimum circumscribed rectangle, and calculate the minimum circumscribed rectangle by the length and width of the minimum circumscribed rectangle. State the area of the smallest enclosing rectangle.
  • the server determines the smallest enclosing rectangle that represents the feature points of all human faces according to the position of the coordinates of each feature point in the face, and detects the length and width of the smallest enclosing rectangle, which is obtained by combining the length and width with the rectangular area calculation formula
  • the area of the smallest enclosing rectangle For example, the server obtains the location of facial features such as eyes, mouth, ears, nose, etc., and uses a smallest circumscribed rectangle to include all the acquired facial features, and measures the length and width of the smallest circumscribed rectangle. Then calculate the area of the smallest enclosing rectangle according to the rectangle area formula.
  • Step S20 Based on the area of the smallest bounding rectangle and the coordinate clustering center, the rectangular boundary of the certificate in the picture is calculated;
  • the server pre-identifies various types of standard certificates, obtains the length, width, area, and other size data of each type of standard certificate, and stores the standard certificate type and the size data of the standard certificate.
  • the standard certificates are produced according to national standards. Such as ID card, marriage certificate, driver's license and other types of documents.
  • the server recognizes the certificate in the received picture through the recognition program, and searches for the standard certificate corresponding to the certificate type in the picture from the stored standard certificates of various types, and determines the standard certificate corresponding to the certificate type in the picture as the target Standard documents.
  • the coordinate clustering center obtained by the above calculation and the area of the smallest circumscribed rectangle in the picture are combined with the proportional relationship, relative position relationship and the target standard area of the target circumscribed rectangle in the target standard certificate, and then the target standard area of the target circumscribed rectangle The rectangular border formed in the picture.
  • Step S30 Extract the rectangular area formed by the rectangular boundary of the certificate in the picture, and detect whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, it is determined that the received certificate in the picture is Incomplete documents.
  • this embodiment is provided with an adjustment mechanism; an adjustment value a for adjustment is preset, and the adjustment value a is preferably 30 based on experience.
  • the x1, x2, y1, and y2 of the composition coordinates (x1, y1), (x1, y2), (x2, y2), (x2, y1) they can be adjusted by the following formula: x1-(x2-x1)/ a, x2+(x2-x1)/a, y1-(y2-y1)/a, y2+(y2-y1)/a.
  • the coordinate values of the vertices of the four corners of the rectangle are extracted, and the coordinates of the vertices of the four corners of the extracted rectangle are connected by a preset method, to obtain a rectangular area that characterizes the location of the document. Further, the rectangular area is segmented according to the first preset segmentation method or the second preset segmentation method according to different definitions, and multiple target sub-pictures are generated, and the target sub-images corresponding to the four corner areas of the rectangular area are detected.
  • the ID in the received image is determined to be a broken ID, and the invalid ID information is output and the user is prompted to take a new photo containing the ID picture of. It is understandable that the certificate in the received picture is incomplete, which may be due to the incompleteness of the certificate itself, or it may be due to the fact that the certificate was blocked by the customer when the picture was taken. Further, if it is detected that there are no missing corners in all target sub-pictures, it is determined that the credentials in the received pictures are valid, and the business is processed according to the user's request.
  • the feature point coordinates of the face in the credential contained in the picture are obtained, and the coordinate clustering center and the smallest bounding rectangle are obtained based on the feature point coordinates, And obtain the area of the smallest bounding rectangle; based on the area of the smallest bounding rectangle and the coordinate clustering center, calculate the rectangular boundary of the certificate in the picture; extract the rectangle of the certificate in the picture A rectangular area formed by the boundary, and detecting whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, it is determined that the certificate in the received picture is a broken certificate.
  • a second embodiment of the four-corner defect detection method of the present application is proposed.
  • clustering is based on the area of the smallest bounding rectangle and the coordinate In the center, the step of calculating the rectangular boundary of the certificate in the picture includes:
  • Step S21 Identify the type of the certificate in the picture, determine the target standard certificate corresponding to the type according to the type of the certificate, and obtain the target standard area of the target circumscribed rectangle in the target standard certificate;
  • the server recognizes the type of the certificate in the picture through the recognition program. For example, if it recognizes that the type of the certificate is an ID card, it determines that the target standard certificate corresponding to the type of the certificate in the picture is an ID card, and obtains that the standard ID card contains all faces. The target standard area of the target circumscribed rectangle of the feature point.
  • Step S22 Calculate the length and width of the document based on the proportional relationship of the target standard document and the area of the minimum circumscribed rectangle, wherein the proportional relationship includes the target standard length of the target standard document and the target A first target proportional relationship between standard areas, and a second target proportional relationship between the target standard width of the target standard certificate and the target standard area;
  • the length of the certificate in the picture is calculated, and the target standard width and target standard width of the target standard certificate are calculated.
  • the second target ratio relationship between the standard areas, combined with the minimum circumscribed rectangle area calculates the width of the document in the picture.
  • the first target proportional relationship in the target standard document proportional relationship is a1, and the minimum circumscribed rectangle area is m, then the length of the document in the picture can be obtained as a1*m, and the second target proportional relationship is a2, and the smallest circumscribed rectangle area is m, the width of the certificate in the picture can be obtained as a2*m, and the corresponding length of the certificate is determined as a1*m, and the width of the rectangular area is a2*m.
  • Step S23 Determine the rectangular boundary of the document based on the relative position relationship of the target standard document, the length and width of the document, and the coordinate clustering center, wherein the relative position relationship includes the target standard document The first target relative position relationship between the target standard length of the target standard certificate and the target cluster center of the target standard certificate, and the first target standard width between the target standard width of the target standard certificate and the target cluster center of the target standard certificate 2. The relative position of the target.
  • the step of determining the rectangular boundary of the document includes:
  • Step S231 Determine the length boundary direction of the document in the picture based on the relative positional relationship between the coordinate clustering center and the first target;
  • the first target relative position relationship between the target standard length of the target standard certificate and the target cluster center is obtained, and the coordinate cluster center is taken as the center, and the target cluster center and the target are characterized by the relative position relationship of the first target.
  • the distance relationship between the standard lengths that is, the distance from the target cluster center to the length direction of the target standard length, determines the distance extending in the length direction perpendicular to the minimum bounding rectangle, and the end point is determined by the extended distance. Further, extending from the end point to the length direction parallel to the minimum circumscribed rectangle, the length boundary direction of the rectangle is obtained.
  • Step S232 Determine the width boundary direction of the document in the picture based on the relative positional relationship between the coordinate clustering center and the second target;
  • the relative position relationship of the second target between the target standard width of the target standard certificate and the target cluster center is obtained, and the coordinate cluster center is taken as the center, and the target cluster center and the target are characterized by the relative position relationship of the second target.
  • the distance relationship between the standard widths that is, the distance from the target cluster center to the width direction where the target standard width is located, determines the distance extending in the width direction perpendicular to the minimum bounding rectangle, and the end point is determined by the extended distance. Further, extending from the end point to the width direction parallel to the minimum circumscribed rectangle, the width boundary direction of the rectangle is obtained.
  • Step S233 Determine the length boundary of the document based on the length of the document and the direction of the length boundary, and determine the width boundary of the document based on the width of the document and the direction of the width boundary, and determine the width boundary of the document based on the length of the document. And the width boundary determine the rectangular boundary of the document.
  • the determined length boundary direction is extended to both sides and the width boundary direction is extended to both sides to obtain the intersection point of the length boundary direction and the width boundary direction, and the intersection point is determined as the vertex coordinates representing one of the four corner vertices of the document.
  • the vertex coordinates are combined with the length boundary direction and the length of the document in the picture to determine the length boundary, and the vertex coordinates are combined with the width boundary direction and the width of the document in the picture to determine the width boundary.
  • a rectangular frame is formed based on the length boundary and the width boundary to obtain the rectangular boundary of the certificate in the picture.
  • the area of the smallest enclosing rectangle that contains the most facial feature points of the document in the picture and the coordinate clustering center representing the center of the facial feature points are combined with the proportional relationship and relative position relationship of the target standard document to calculate that the document is in the picture.
  • the rectangular boundary corresponds to the rectangular boundary in, accurately obtain the rectangular area boundary corresponding to the document, so that the detection result is more accurate.
  • a third embodiment of the four-corner defect detection method of the present application is proposed.
  • the image is extracted by the certificate
  • the steps following the step of forming a rectangular area by the rectangular boundary include:
  • Step S31 Obtain the length and width of the rectangular area, and calculate the pixel value corresponding to the length of the rectangular area, and whether any one of the pixel values corresponding to the width of the rectangular area is greater than a preset threshold;
  • the server obtains the length and width of the rectangular area corresponding to the certificate, and calculates the pixel value corresponding to the length of the rectangular area according to the length value and pixels of the rectangular area, and calculates the pixel value corresponding to the rectangular area according to the width and pixels of the rectangle.
  • the pixel value corresponding to the width it is judged whether any one of the pixel value corresponding to the length of the rectangular area and the pixel value corresponding to the width of the rectangular area is greater than a preset threshold that characterizes sufficient or insufficient sharpness, to determine the rectangle in the picture that characterizes the document. Whether the content of the area is clear, it is convenient to determine whether the rectangular area is divided into equal parts of sub-pictures.
  • Step S32 if any one of the pixel value corresponding to the length of the rectangular area and the pixel corresponding to the width of the rectangular area is greater than a preset threshold, the rectangular area is divided according to a first preset
  • the method is divided into multiple sub-pictures, and the sub-pictures corresponding to the four corners of the rectangular area among the multiple sub-pictures are used as target sub-pictures to detect the four corners of the rectangular area based on each of the target sub-pictures. Whether there are missing corners;
  • the preset threshold in this embodiment is set to 2000 based on experience, It means that the content of the rectangular area is clear enough, and the rectangular area is divided into a plurality of sub-pictures according to the preset first preset segmentation method, wherein the first preset segmentation method is set according to requirements, as in this embodiment. Set the nine-equal division method to divide the rectangular area into 9 sub-pictures. Thereafter, from the segmented sub-pictures, the sub-pictures located in the four corners of the rectangular area are determined as the target sub-pictures.
  • the 4 sub-pictures located in the upper left corner, upper right corner, lower left corner, and lower right corner are the sub-pictures corresponding to the four corners of the rectangular area, and they are used as the target sub-pictures to facilitate Detect whether there are missing corners in the 4 sub-pictures.
  • Step S33 If the pixel value corresponding to the length of the rectangular area and the pixel corresponding to the width of the rectangular area are both less than or equal to a preset threshold, the rectangular area is cut according to a second preset splitting method. Divide into a plurality of sub-pictures, and use the plurality of sub-pictures as target sub-pictures to detect whether there are missing corners in the four corners of the rectangular area based on each of the target sub-pictures.
  • the second preset segmentation method is divided into a plurality of sub-pictures as target sub-pictures, and the second preset segmentation method is set according to requirements. For example, in this embodiment, a four-equal division method is preset, and the rectangular area is divided into 4 sub-pictures, and the 4 sub-pictures are used as target sub-pictures, so as to detect whether there are missing corners in the 4 target sub-pictures.
  • the step of detecting whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, determining that the certificate in the received picture is a broken certificate includes;
  • Step S34 Detect each of the target sub-pictures one by one in a preset manner, and determine whether the target sub-pictures all include a complete document corner;
  • this embodiment is preset with a preset method for detecting whether a picture is incomplete, such as the inceptionv3 detection method, to detect the 4 target sub-pictures obtained by segmentation one by one through the preset method, specifically, the 4 target sub-pictures are detected one by one.
  • the sub-pictures are imported into inceptionv3 one by one for detection to determine whether the four target sub-pictures all contain a complete ID corner. Understandably, the integrity of the document corner is obtained by comparing it with the document corner of the target standard document. For example, if the document corner of the ID card is rounded, it will be detected whether the document corner contained in the target sub-picture is the same as that of the ID card. The document angle is the same.
  • Step S35 if the target sub-pictures all contain a complete ID corner, it is determined that the received picture is valid;
  • the business processing corresponding to the user's request is performed.
  • Step S36 if there is a missing corner in any one of the target sub-images in the target sub-picture, determine that the certificate in the received picture is a broken certificate, determine that the received picture is invalid, and output the re-collected Prompt information.
  • the four target sub-pictures are detected one by one, and it is detected that the certificate corner in any one of the four target sub-pictures is incomplete, it means that the certificate in the picture is incomplete. It is determined that it is a broken document, where the broken document may be that the document itself is worn or accidentally caused by the loss of the document corner when the document is in use, or it may be that the user covers the corner of the document when the document is photographed. As a result, one of the document corners of the document in the photographed picture is missing. Further, it is determined that the received picture is invalid, and a message is output to prompt the user to take the photo of the certificate again.
  • the server detects the pixel value corresponding to the length of the rectangular area and the pixel value corresponding to the width of the rectangular area to determine whether the content of the rectangular area that characterizes the document is sufficiently clear, and differentiates the rectangular area based on different definitions.
  • the number of sub-pictures are segmented to more accurately detect the four corners of the rectangular area. By detecting whether the target sub-pictures selected from the sub-pictures all contain a complete ID corner, it is determined whether the received picture is valid.
  • This embodiment realizes that the complete document angle detection is performed on the segmented pictures to determine whether the document is complete, so as to facilitate the user to perform business processing such as document recognition or remote account opening.
  • the step of obtaining the rectangular boundary of the certificate in the picture includes:
  • Step S40 Obtain the standard area, standard length, standard width, standard cluster center of each type of standard certificate, and the minimum standard area of the characteristic circumscribed rectangle of the facial feature points in the standard certificate;
  • the size data of various types of standard certificates actually used are obtained in advance, and the obtained content includes the standard area, standard length, and standard width of the standard certificate, as well as the characteristic circumscribed rectangle containing the facial feature points in the standard certificate.
  • the minimum standard area of, and the standard cluster center for clustering each face feature point so that the server can call the size data for comparison and calculation. Understandably, considering that different types of standard documents have different outer frame sizes, or even if the outer frame sizes are the same, they may have different sizes of faces or faces in different positions, so that different types of standard documents are in the standard area. There are differences in standard length, standard width, minimum standard area, and standard clustering center. Therefore, the above-mentioned size data can be obtained for different types of standard documents. Steps S50, S60, and S70 are processed one by one.
  • Step S50 based on the standard length and the minimum standard area, generate a first proportional relationship between the standard length and the minimum standard area, and generate the standard width and the minimum standard area based on the standard width and the minimum standard area.
  • the ratio between the standard length of the standard document and the minimum standard area is generated to generate the first proportional relationship that characterizes the relationship between the standard length and the minimum standard area.
  • the ratio between the standard width and the minimum standard area of the standard document is used to generate the standard width and the minimum standard area.
  • the second proportional relationship of the minimum standard area relationship is used to generate the first proportional relationship that characterizes the relationship between the standard length and the minimum standard area.
  • Step S60 based on the standard length and the standard cluster center, generate a first relative positional relationship between the standard cluster center and the standard length, and generate all the standard cluster centers based on the standard width and the standard cluster centers.
  • the second relative positional relationship between the standard cluster center and the standard width is based on the standard length and the standard cluster center.
  • the distance between the standard cluster center in the standard document and the standard length of the standard document is calculated. This distance represents the positional relationship of the standard cluster center relative to the standard length, and it is regarded as the standard cluster center and the standard length.
  • the first relative positional relationship between the long is calculated.
  • the size data information of each type of standard certificate is obtained in advance, and based on the size data information of the standard certificate, the proportional relationship and relative position relationship of the standard certificate are generated, so that the server can call the size data of the standard certificate and the proportion of the standard certificate. Relationship and relative position relationship, calculate the length and width of the certificate in the received picture and determine the specific position of the rectangular area corresponding to the certificate.
  • this application also provides a device for detecting the four corners of the credential.
  • FIG. 3 is a schematic diagram of the functional modules of the first embodiment of the device for detecting four corners of the credential defect of this application.
  • the four-corner defect detection device of the document includes:
  • the obtaining module 10 is configured to, when a picture containing a certificate is received, obtain the feature point coordinates of the face in the certificate contained in the picture, obtain the coordinate cluster center and the smallest bounding rectangle based on the feature point coordinates, and obtain the The area of the smallest enclosing rectangle;
  • the calculation module 20 is configured to calculate the rectangular boundary of the certificate in the picture based on the area of the smallest bounding rectangle and the coordinate clustering center;
  • the extraction module 30 is configured to extract the rectangular area formed by the rectangular boundary of the certificate in the picture, and detect whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, determine whether there is a missing corner in the received picture
  • the document is incomplete.
  • the acquiring module 10 when a picture containing a document is received, the acquiring module 10 first obtains the coordinates of the characteristic points of the face in the document contained in the picture, and obtains the coordinate clustering center based on the coordinates of the characteristic points.
  • the calculation module 20 calculates the rectangular boundary of the document in the picture based on the area of the smallest circumscribed rectangle and the coordinate clustering center;
  • the extraction module 30 extracts the rectangular area formed by the rectangular border of the certificate in the picture, and detects whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, it is determined that the certificate in the received picture is It is a broken document. Determine the rectangular area corresponding to the document through the smallest enclosing rectangle and coordinate clustering center of the document in the picture, and check whether the four corners of the rectangular area are missing corners one by one. Compared with the detection based on the entire document picture, the detection accuracy is improved. It can accurately detect whether the certificate in the picture is incomplete.
  • the acquisition module 10 includes:
  • the first acquiring unit is configured to extract multiple feature points of the face in the document through a preset neural network when a picture containing the document is received, and acquire the feature point coordinates of the multiple feature points;
  • the clustering unit is used to cluster the coordinates of each feature point of the face in the certificate by using a preset algorithm to obtain the center coordinates of the coordinates of each feature point of the face in the certificate, as the coordinate clustering center;
  • the first determining unit is configured to determine the minimum circumscribed rectangle according to the position of each of the characteristic point coordinates of the face in the document, and detect the length and width of the minimum circumscribed rectangle, and pass the length and the sum of the minimum circumscribed rectangle The width is calculated to obtain the area of the minimum circumscribed rectangle.
  • calculation module 20 includes:
  • An identification unit configured to identify the type of the certificate in the picture, determine the target standard certificate corresponding to the type according to the type of the certificate, and obtain the target standard area of the target circumscribed rectangle in the target standard certificate;
  • the calculation unit is configured to calculate the length and width of the document based on the proportional relationship of the target standard document and the area of the minimum circumscribed rectangle, wherein the proportional relationship includes the target standard length of the target standard document and the area The first target proportional relationship between the target standard areas, and the second target proportional relationship between the target standard width of the target standard certificate and the target standard area;
  • the second determining unit is configured to determine the rectangular boundary of the document based on the relative positional relationship of the target standard document, the length and width of the document, and the coordinate clustering center, wherein the relative positional relationship includes all The first target relative position relationship between the target standard length of the target standard certificate and the target cluster center of the target standard certificate, and the target standard width of the target standard certificate and the target cluster center of the target standard certificate The relative positional relationship between the second target.
  • calculation module 20 further includes:
  • a third determining unit configured to determine the length boundary direction of the document in the picture based on the relative positional relationship between the coordinate clustering center and the first target;
  • a fourth determining unit configured to determine the width boundary direction of the document in the picture based on the relative positional relationship between the coordinate clustering center and the second target;
  • the fifth determining unit is configured to determine the length boundary of the document based on the length of the document and the length boundary direction, and determine the width boundary of the document based on the width of the document and the width boundary direction, and The length boundary and the width boundary determine the rectangular boundary of the document.
  • calculation module 20 further includes:
  • the second acquiring unit is used to acquire the standard area, standard length, standard width, standard clustering center, and the minimum standard area of the characteristic circumscribed rectangle of the facial feature points in the standard certificate of various types of standard certificates;
  • the execution unit is used to execute the following steps one by one for each type of the standard certificate:
  • the first generating unit is configured to generate a first proportional relationship between the standard length and the minimum standard area based on the standard length and the minimum standard area, and generate the standard width and the minimum standard area based on the standard length and the minimum standard area.
  • the second generating unit is configured to generate a first relative positional relationship between the standard cluster center and the standard length based on the standard length and the standard cluster center, and based on the standard width and the standard cluster Center, generating a second relative positional relationship between the standard cluster center and the standard width.
  • the extraction module 30 includes:
  • the third acquiring unit is configured to acquire the length and width of the rectangular area, and calculate the pixel value corresponding to the length of the rectangular area, and whether any one of the pixel values corresponding to the width of the rectangular area is greater than Preset threshold;
  • the first segmentation unit is used for if any one of the pixel value corresponding to the length of the rectangular area and the pixel corresponding to the width of the rectangular area is greater than a preset threshold, then the rectangular area is set according to the first
  • a preset segmentation method is divided into a plurality of sub-pictures, and the sub-pictures corresponding to the four corners of the rectangular area among the plurality of sub-pictures are used as target sub-pictures to detect the Whether there are missing corners in the four corners of the rectangular area;
  • the second segmentation unit is configured to: if the pixel value corresponding to the length of the rectangular area and the pixel corresponding to the width of the rectangular area are both less than or equal to the preset threshold, then the rectangular area is divided according to the second preset threshold.
  • the segmentation method is divided into multiple sub-pictures, and the multiple sub-pictures are used as target sub-pictures to detect whether there are missing corners in the four corners of the rectangular area based on each of the target sub-pictures.
  • the extraction module 30 further includes:
  • the detection unit is configured to detect each of the target sub-pictures one by one in a preset manner to determine whether the target sub-pictures all include a complete document corner;
  • the first determining unit is configured to determine that the received image is valid if all the target sub-pictures contain a complete document corner;
  • the second determining unit is configured to determine that the credential in the received picture is a broken credential if there is a missing corner in any one of the target sub-images, determine that the received picture is invalid and The prompt message for re-collection is output.
  • the application also provides a four-corner defect detection device for a document.
  • the four-corner defect detection device includes a memory, a processor, and a four-corner defect detection program that is stored on the memory and can run on the processor. When the detection program is executed by the processor, the following steps are implemented:
  • the present application also provides a storage medium, the storage medium may be volatile or non-volatile, the storage medium stores a four-corner defect detection program of the document, and the four-corner defect detection program is executed by a processor.
  • the blockchain referred to in this application is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information for verification. The validity of the information (anti-counterfeiting) and the generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
  • the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM) as described above. , Magnetic disks, optical disks), including several instructions to make a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the method described in each embodiment of the present application.
  • a terminal device which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Health & Medical Sciences (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Probability & Statistics with Applications (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Image Analysis (AREA)

Abstract

A defect detection method and apparatus for four corners of a certificate, and a device and a storage medium. The method comprises: when a picture including a certificate is received, acquiring a feature point coordinate of a face in the certificate included in the picture, obtaining a coordinate clustering center and the minimum bounding rectangle on the basis of the feature point coordinate, and acquiring the area of the minimum bounding rectangle; calculating and obtaining a rectangular boundary of the certificate in the picture on the basis of the area of the minimum bounding rectangle and the coordinate clustering center; and determining a rectangular region formed by the rectangular boundary of the certificate in the picture, cutting the rectangular region into a plurality of sub-pictures, detecting whether there is a missing corner in the plurality of sub-pictures, and if there is a missing corner, determining that the certificate in the received picture is a defective certificate. In the method, by means of the minimum bounding rectangle and a coordinate clustering center of a certificate in a picture, a rectangular region corresponding to the certificate is determined, and whether each of the four corners of the rectangular region is missing is detected one by one, such that the detection accuracy is improved. The method further relates to blockchain technology, and the picture of the certificate can be stored in a blockchain node.

Description

证件四角残缺检测方法、装置、设备及存储介质Method, device, equipment and storage medium for detecting incomplete four corners of certificate
本申请要求于2020年4月24日提交中国专利局、申请号为CN202010336193.3、名称为“证件四角残缺检测方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on April 24, 2020, the application number is CN202010336193.3, and the title is "Detection method, device, equipment and storage medium for four corners of the document", and the entire content of it is approved The reference is incorporated in this application.
技术领域Technical field
本申请涉及检测技术领域,尤其涉及一种证件四角残缺检测方法、装置、设备及存储介质。This application relates to the field of detection technology, and in particular to a method, device, equipment, and storage medium for detecting the four corners of a certificate.
背景技术Background technique
随着人工智能的发展,人工智能对证件的分析的场景越来越多。如在基金在线远程开户或者证件鉴伪或识别过程中,均需要对采集到的证件图像进行完整性分析。若采集到的证件图像四角有残缺,会对后面的卡片分析,比如文字定位,文字识别等产生不利影响。因而如何精确地对证件图像进行四角是否残缺检测,也成为一个备受图像研究者关注的课题。目前判断证件图像四角是否残缺,业内采用的主要方式是采用类似inceptionv3的神经网络对整张证件图像进行检测。发明人意识到证件图像在采集过程中可能会误采集到其他物件,如拍照采集时拍摄到证件所在环境的背景,如此一来,造成了对整张证件图像进行检测的干扰,使得检测时存在较大误差,导致得出的检测结果不准确。With the development of artificial intelligence, there are more and more scenarios for the analysis of documents by artificial intelligence. For example, in the process of fund online remote account opening or credential authentication or identification, the integrity of the collected credential images needs to be analyzed. If the four corners of the collected ID image are incomplete, it will adversely affect the subsequent card analysis, such as text positioning and text recognition. Therefore, how to accurately detect whether the four corners of a document image are incomplete or not has become a topic that has attracted much attention from image researchers. At present, to determine whether the four corners of the document image are incomplete, the main method used in the industry is to use a neural network similar to inceptionv3 to detect the entire document image. The inventor realizes that other objects may be mistakenly collected during the collection process of the ID image, such as the background of the environment where the ID is located when the photo is taken. As a result, it causes interference in the detection of the entire ID image, which makes the detection exist. Large errors lead to inaccurate detection results.
发明内容Summary of the invention
本申请实施例提供一种证件四角残缺检测方法,所述证件四角残缺检测方法包括以下步骤:The embodiment of the present application provides a method for detecting defects in the four corners of a document. The method for detecting defects in the four corners of a document includes the following steps:
当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与最小外接矩形,并获取所述最小外接矩形的面积;When a picture containing a certificate is received, obtaining the feature point coordinates of the face in the certificate included in the picture, obtaining the coordinate cluster center and the smallest bounding rectangle based on the characteristic point coordinates, and obtaining the area of the smallest bounding rectangle;
基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界;Based on the area of the smallest bounding rectangle and the coordinate clustering center, the rectangular boundary of the certificate in the picture is calculated;
提取所述图片中由所述证件的矩形边界形成的矩形区域,并检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件。Extract the rectangular area formed by the rectangular border of the certificate in the picture, and detect whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, it is determined that the certificate in the received picture is a broken certificate.
本申请还提供一种证件四角残缺检测装置,所述证件四角残缺检测装置包括:This application also provides a device for detecting defects in four corners of a document, the device for detecting defects in four corners of a document includes:
获取模块,用于当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与最小外接矩形,并获取所述最小外接矩形的面积;The obtaining module is used to obtain, when a picture containing a certificate is received, the coordinate of the feature point of the face in the certificate contained in the picture, obtain the coordinate clustering center and the minimum bounding rectangle based on the coordinate of the feature point, and obtain the minimum The area of the circumscribing rectangle;
计算模块,用于基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界;A calculation module, configured to calculate the rectangular boundary of the certificate in the picture based on the area of the smallest bounding rectangle and the coordinate clustering center;
提取模块,用于提取所述图片中由所述证件的矩形边界形成的矩形区域,并检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件。The extraction module is used to extract the rectangular area formed by the rectangular boundary of the certificate in the picture, and to detect whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, determine whether there are missing corners in the received picture. The certificate is incomplete.
本申请还提供证件四角残缺检测设备,所述证件四角残缺检测设备包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的证件四角残缺检测程序,所述证件四角残缺检测程序被所述处理器执行时实现如下步骤:The application also provides a four-corner defect detection device for a document. The four-corner defect detection device includes a memory, a processor, and a four-corner defect detection program that is stored on the memory and can run on the processor. When the detection program is executed by the processor, the following steps are implemented:
当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与最小外接矩形,并获取所述最小外接矩形的面积;When a picture containing a certificate is received, obtaining the feature point coordinates of the face in the certificate included in the picture, obtaining the coordinate cluster center and the smallest bounding rectangle based on the characteristic point coordinates, and obtaining the area of the smallest bounding rectangle;
基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界;Based on the area of the smallest bounding rectangle and the coordinate clustering center, the rectangular boundary of the certificate in the picture is calculated;
提取所述图片中由所述证件的矩形边界形成的矩形区域,并检测所述矩形区域的四角 中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件。Extract the rectangular area formed by the rectangular border of the certificate in the picture, and detect whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, it is determined that the certificate in the received picture is a broken certificate.
本申请还提供一种存储介质,所述存储介质上存储有证件四角残缺检测程序,所述证件四角残缺检测程序被处理器执行时实现如下步骤:The present application also provides a storage medium on which a four-corner defect detection program is stored, and the four-corner defect detection program is executed by a processor to implement the following steps:
当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与最小外接矩形,并获取所述最小外接矩形的面积;When a picture containing a certificate is received, obtaining the feature point coordinates of the face in the certificate included in the picture, obtaining the coordinate cluster center and the smallest bounding rectangle based on the characteristic point coordinates, and obtaining the area of the smallest bounding rectangle;
基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界;Based on the area of the smallest bounding rectangle and the coordinate clustering center, the rectangular boundary of the certificate in the picture is calculated;
提取所述图片中由所述证件的矩形边界形成的矩形区域,并检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件。Extract the rectangular area formed by the rectangular border of the certificate in the picture, and detect whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, it is determined that the certificate in the received picture is a broken certificate.
附图说明Description of the drawings
图1为本申请实施例方案涉及的硬件运行环境的证件四角残缺检测设备结构示意图;FIG. 1 is a schematic diagram of the structure of a detection device for four corners of a credential defect in a hardware operating environment involved in a solution of an embodiment of the application;
图2为本申请证件四角残缺检测方法第一实施例的流程示意图;2 is a schematic flowchart of a first embodiment of a method for detecting four corners of a credential incompleteness of the application;
图3为本申请证件四角残缺检测装置较佳实施例的功能模块示意图。FIG. 3 is a schematic diagram of functional modules of a preferred embodiment of a device for detecting defects at four corners of a document in this application.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics, and advantages of the purpose of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings.
具体实施方式Detailed ways
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。It should be understood that the specific embodiments described here are only used to explain the present application, and are not used to limit the present application.
如图1所示,图1是本申请实施例方案涉及的硬件运行环境的证件四角残缺检测设备结构示意图。As shown in FIG. 1, FIG. 1 is a schematic diagram of the structure of the four corners of the credential defect detection device of the hardware operating environment involved in the solution of the embodiment of the present application.
在后续的描述中,使用用于表示元件的诸如“模块”、“部件”或“单元”的后缀仅为了有利于本申请的说明,其本身没有特定的意义。因此,“模块”、“部件”或“单元”可以混合地使用。In the following description, the use of suffixes such as “module”, “part” or “unit” used to indicate elements is only for the description of the present application, and has no specific meaning in itself. Therefore, "module", "part" or "unit" can be used in a mixed manner.
本申请实施例证件四角残缺检测设备可以是PC,也可以是平板电脑、便携计算机等可移动式终端设备。The four-corner defect detection device of the examples of this application can be a PC, or a portable terminal device such as a tablet computer and a portable computer.
如图1所示,该证件四角残缺检测设备可以包括:处理器1001,例如CPU,网络接口1004,用户接口1003,存储器1005,通信总线1002。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。As shown in FIG. 1, the device for detecting defects in the four corners of the document may include a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to implement connection and communication between these components. The user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as a magnetic disk memory. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
本领域技术人员可以理解,图1中示出的证件四角残缺检测设备结构并不构成对证件四角残缺检测设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。Those skilled in the art can understand that the structure of the four-corner defect detection device shown in FIG. 1 does not constitute a limitation on the four-corner defect detection device of the document, and may include more or less components than shown in the figure, or a combination of certain components, Or different component arrangements.
如图1所示,作为一种存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及检测程序。As shown in FIG. 1, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a detection program.
在图1所示的设备中,网络接口1004主要用于连接后台服务器,与后台服务器进行数据通信;用户接口1003主要用于连接客户端(用户端),与客户端进行数据通信;而处理器1001可以用于调用存储器1005中存储的检测程序,并执行以下操作:In the device shown in FIG. 1, the network interface 1004 is mainly used to connect to the back-end server and communicate with the back-end server; the user interface 1003 is mainly used to connect to the client (user side) and communicate with the client; and the processor 1001 can be used to call the detection program stored in the memory 1005 and perform the following operations:
当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与最小外接矩形,并获取所述最小外接矩形的面积;When a picture containing a certificate is received, obtaining the feature point coordinates of the face in the certificate included in the picture, obtaining the coordinate cluster center and the smallest bounding rectangle based on the characteristic point coordinates, and obtaining the area of the smallest bounding rectangle;
基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界;Based on the area of the smallest bounding rectangle and the coordinate clustering center, the rectangular boundary of the certificate in the picture is calculated;
提取所述图片中由所述证件的矩形边界形成的矩形区域,并检测所述矩形区域的四角 中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件。Extract the rectangular area formed by the rectangular border of the certificate in the picture, and detect whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, it is determined that the certificate in the received picture is a broken certificate.
进一步地,所述基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界的步骤包括:Further, the step of calculating the rectangular boundary of the certificate in the picture based on the area of the smallest bounding rectangle and the coordinate clustering center includes:
识别所述图片中证件的类型,并根据所述证件的类型确定与所述类型对应的目标标准证件,获取所述目标标准证件中目标外接矩形的目标标准面积;Identify the type of the certificate in the picture, determine the target standard certificate corresponding to the type according to the type of the certificate, and obtain the target standard area of the target circumscribed rectangle in the target standard certificate;
基于所述目标标准证件的比例关系与所述最小外接矩形的面积,计算得到所述证件的长度和宽度,其中所述比例关系包括所述目标标准证件的目标标准长与所述目标标准面积之间的第一目标比例关系,以及所述目标标准证件的目标标准宽与所述目标标准面积之间的第二目标比例关系;Based on the proportional relationship between the target standard document and the area of the smallest circumscribed rectangle, the length and width of the certificate are calculated, wherein the proportional relationship includes the difference between the target standard length of the target standard certificate and the target standard area The first target proportional relationship between the two, and the second target proportional relationship between the target standard width of the target standard certificate and the target standard area;
基于所述目标标准证件的相对位置关系、所述证件的长度和宽度,以及所述坐标聚类中心,确定所述证件的矩形边界,其中所述相对位置关系包括所述目标标准证件的目标标准长与所述目标标准证件的目标聚类中心之间的第一目标相对位置关系,以及所述目标标准证件的目标标准宽与所述目标标准证件的目标聚类中心之间的第二目标相对位置关系。Based on the relative position relationship of the target standard certificate, the length and width of the certificate, and the coordinate clustering center, the rectangular boundary of the certificate is determined, wherein the relative position relationship includes the target standard of the target standard certificate The first target relative positional relationship between the length and the target cluster center of the target standard certificate, and the second target relative between the target standard width of the target standard certificate and the target cluster center of the target standard certificate Positional relationship.
进一步地,所述基于所述目标标准证件的相对位置关系、所述证件的长度和宽度,以及所述坐标聚类中心,确定所述证件的矩形边界的步骤包括:Further, the step of determining the rectangular boundary of the document based on the relative position relationship of the target standard document, the length and width of the document, and the coordinate clustering center includes:
基于所述坐标聚类中心和所述第一目标相对位置关系,确定所述证件在所述图片中的长度边界方向;Determine the length boundary direction of the certificate in the picture based on the relative positional relationship between the coordinate clustering center and the first target;
基于所述坐标聚类中心和所述第二目标相对位置关系,确定所述证件在所述图片中的宽度边界方向;Determine the width boundary direction of the document in the picture based on the relative positional relationship between the coordinate clustering center and the second target;
基于所述证件的长度和所述长度边界方向确定所述证件的长度边界,以及基于所述证件的宽度和所述宽度边界方向确定所述证件的宽度边界,并由所述长度边界和所述宽度边界确定所述证件的矩形边界。The length boundary of the document is determined based on the length of the document and the direction of the length boundary, and the width boundary of the document is determined based on the width of the document and the direction of the width boundary. The width boundary determines the rectangular boundary of the document.
进一步地,所述提取所述图片中由所述证件的矩形边界形成的矩形区域的步骤之后,处理器1001可以用于调用存储器1005中存储的检测程序,并执行以下操作:Further, after the step of extracting the rectangular area formed by the rectangular boundary of the certificate in the picture, the processor 1001 may be used to call the detection program stored in the memory 1005 and perform the following operations:
获取所述矩形区域的长度和宽度,并计算与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素值中是否存在任一项大于预设阈值;Acquiring the length and width of the rectangular area, and calculating the pixel value corresponding to the length of the rectangular area, and whether any one of the pixel values corresponding to the width of the rectangular area is greater than a preset threshold;
若与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素中存在任一项大于预设阈值,则将所述矩形区域按照第一预设切分方式切分为多个子图片,并将多个所述子图片中与所述矩形区域的四角区域对应的子图片作为目标子图片,以基于各所述目标子图片检测所述矩形区域的四角中是否存在缺角;If any one of the pixel value corresponding to the length of the rectangular area and the pixel corresponding to the width of the rectangular area is greater than the preset threshold, the rectangular area is divided according to the first preset segmentation method Is a plurality of sub-pictures, and the sub-pictures corresponding to the four corners of the rectangular area among the plurality of sub-pictures are used as target sub-pictures to detect whether there are defects in the four corners of the rectangular area based on each of the target sub-pictures. Horn;
若与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素均小于或等于预设阈值,则将所述矩形区域按照第二预设切分方式切分为多个子图片,并将多个所述子图片作为目标子图片,以基于各所述目标子图片检测所述矩形区域的四角中是否存在缺角。If the pixel value corresponding to the length of the rectangular area and the pixel corresponding to the width of the rectangular area are both less than or equal to the preset threshold value, the rectangular area is divided into multiple segments according to the second preset segmentation method. And use multiple sub-pictures as target sub-pictures to detect whether there are missing corners in the four corners of the rectangular area based on each of the target sub-pictures.
进一步地,所述检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件的步骤包括:Further, the step of detecting whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, determining that the certificate in the received picture is a broken certificate includes:
通过预设方式对各所述目标子图片进行逐一检测,确定所述目标子图片是否均包含有完整的证件角;Detect each of the target sub-pictures one by one through a preset method, and determine whether the target sub-pictures all include a complete ID corner;
若所述目标子图片均包含有完整的证件角,则判定接收的所述图片有效;If the target sub-pictures all contain a complete ID corner, it is determined that the received picture is valid;
若所述目标子图片中存在任意一张所述目标子图像中存在缺角,则确定接收的所述图片中的证件为残缺证件,判定接收的所述图片无效并输出重新采集的提示信息。If there is a missing corner in any one of the target sub-images in the target sub-picture, it is determined that the certificate in the received picture is a broken certificate, the received picture is determined to be invalid, and a re-collection prompt message is output.
进一步地,所述当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与最小外接矩形,并获取所述最小外接矩形的面积的步骤包括:Further, when the picture containing the credential is received, the feature point coordinates of the face in the credential included in the picture are obtained, the coordinate clustering center and the smallest bounding rectangle are obtained based on the feature point coordinates, and the smallest bounding rectangle is obtained. The steps to circumscribe the area of the rectangle include:
当接收到包含证件的图片时,通过预设神经网络提取所述证件中人脸的多个特征点, 并获取多个所述特征点的特征点坐标;When a picture containing a certificate is received, extract multiple feature points of the face in the certificate through a preset neural network, and obtain feature point coordinates of the multiple feature points;
通过预设算法对所述证件中人脸的各所述特征点坐标进行聚类,得到所述证件中人脸的各所述特征点坐标的中心坐标,作为坐标聚类中心;Clustering the coordinate of each feature point of the face in the certificate by a preset algorithm, and obtain the center coordinate of the coordinate of each feature point of the face in the certificate as a coordinate clustering center;
根据所述证件中人脸的各所述特征点坐标所在位置,确定最小外接矩形,并检测所述最小外接矩形的长和宽,通过所述最小外接矩形的长和宽计算得到所述最小外接矩形的面积。Determine the minimum circumscribed rectangle according to the position of each of the feature point coordinates of the face in the document, and detect the length and width of the minimum circumscribed rectangle, and calculate the minimum circumscribed rectangle by the length and width of the minimum circumscribed rectangle The area of the rectangle.
进一步地,所述基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界的步骤之前,处理器1001可以用于调用存储器1005中存储的检测程序,并执行以下操作:Further, before the step of calculating the rectangular boundary of the document in the picture based on the area of the smallest bounding rectangle and the coordinate clustering center, the processor 1001 may be used to call the detection stored in the memory 1005 Program and do the following:
获取各个类型的标准证件的标准面积、标准长、标准宽、标准聚类中心和所述标准证件中人脸特征点的特征外接矩形的最小标准面积;Obtain the standard area, standard length, standard width, standard clustering center, and the minimum standard area of the feature circumscribed rectangle of the facial feature points in the standard certificate of each type of standard certificate;
针对各个类型的所述标准证件逐一执行以下步骤:Perform the following steps one by one for each type of the standard certificate:
基于所述标准长与所述最小标准面积,生成所述标准长与所述最小标准面积的第一比例关系,基于所述标准宽与所述最小标准面积,生成所述标准宽与所述最小标准面积的第二比例关系;Based on the standard length and the minimum standard area, generate a first proportional relationship between the standard length and the minimum standard area, and generate the standard width and the minimum standard width based on the standard width and the minimum standard area. The second proportional relationship of the standard area;
基于所述标准长与所述标准聚类中心,生成所述标准聚类中心与所述标准长的第一相对位置关系,基于所述标准宽与所述标准聚类中心,生成所述标准聚类中心与所述标准宽的第二相对位置关系。Based on the standard length and the standard cluster center, a first relative positional relationship between the standard cluster center and the standard length is generated, and based on the standard width and the standard cluster center, the standard cluster is generated The second relative positional relationship between the class center and the standard width.
为了更好的理解上述技术方案,下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。In order to better understand the above technical solutions, exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the drawings show exemplary embodiments of the present disclosure, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
为了更好的理解上述技术方案,下面将结合说明书附图以及具体的实施方式对上述技术方案进行详细的说明。In order to better understand the above technical solutions, the above technical solutions will be described in detail below in conjunction with the accompanying drawings of the specification and specific implementations.
参照图2,本申请第一实施例提供一种证件四角残缺检测方法的流程示意图。该实施例中,所述证件四角残缺检测方法包括以下步骤:2, the first embodiment of the present application provides a schematic flowchart of a method for detecting the four corners of a credential defect. In this embodiment, the method for detecting defects in the four corners of the document includes the following steps:
步骤S10,当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与最小外接矩形,并获取所述最小外接矩形的面积;Step S10, when a picture containing a certificate is received, the feature point coordinates of the face in the certificate contained in the picture are obtained, the coordinate clustering center and the minimum circumscribed rectangle are obtained based on the characteristic point coordinates, and the minimum circumscribed rectangle is obtained Area
本实施例中的证件四角残缺检测方法应用于服务器,其中服务器与计算机、平板电脑、智能手机等终端通信连接,服务器中设置有识别程序和预设神经网络,其中识别程序至少包括以证件识别技术例如OCR识别为基础所设置的程序,以及以人脸识别技术例如特征点识别为基础所设置的程序,以分别用于进行证件识别和人脸识别。其中,证件识别可以识别各种类型的证件,证件的类型可以为身份证、驾驶证、结婚证等,人脸识别可对人脸特征点进行识别并提取特征点的坐标,特征点依据鼻子、嘴巴、眼睛、耳朵等人脸特征生成,预设神经网络用于对人脸特征点进行检测,神经网络可以是dlib,也可以是face recognize。The method for detecting incomplete four corners of a document in this embodiment is applied to a server, where the server is in communication connection with a computer, a tablet, a smart phone, and other terminals. The server is provided with an identification program and a preset neural network, and the identification program at least includes identification technology with a document For example, a program based on OCR recognition and a program based on face recognition technology such as feature point recognition are used for document recognition and face recognition, respectively. Among them, document recognition can identify various types of documents. The types of documents can be ID cards, driving licenses, marriage certificates, etc. Face recognition can identify facial feature points and extract the coordinates of the feature points. The feature points are based on the nose, Face features such as mouth, eyes, ears, etc. are generated. The preset neural network is used to detect facial feature points. The neural network can be dlib or face recognize.
进一步地,当用户由于某种情况例如进行线上远程开户或者进行证件识别时,需要拍摄包含证件的图片,并将拍摄的图片上传到终端,可以理解地,若用户使用智能手机拍摄图片,则可将图片直接上传到服务器中。进一步地,终端接收到用户上传的包含有证件的图片时,将图片传送至服务器,以便服务器通过识别程序识别图片中的人脸并提取证件中的人脸特征点坐标。进一步地,服务器将提取的各特征点坐标进行聚类,以得出表征人脸各特征点的中心位置的坐标聚类中心。进一步地,服务器根据各特征点坐标,确定包含了图片中人脸所有特征点的最小外接矩形,并进一步检测最小外接矩形的长和宽,以根据长和宽计算最小外接矩形的面积。Further, when a user conducts online remote account opening or identification of a certificate due to certain circumstances, he needs to take a picture containing his certificate and upload the captured picture to the terminal. Understandably, if the user uses a smart phone to take a picture, then The pictures can be uploaded directly to the server. Further, when the terminal receives the picture containing the certificate uploaded by the user, it transmits the picture to the server, so that the server can recognize the face in the picture through the recognition program and extract the coordinates of the facial feature points in the certificate. Further, the server clusters the extracted coordinates of each feature point to obtain a coordinate clustering center that characterizes the center position of each feature point of the face. Further, the server determines the smallest enclosing rectangle that includes all the feature points of the face in the picture according to the coordinates of each feature point, and further detects the length and width of the smallest enclosing rectangle to calculate the area of the smallest enclosing rectangle based on the length and width.
进一步地,当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与最小外接矩形,并获取所述最小外接矩形的面积的步骤包括:Further, when a picture containing a certificate is received, the characteristic point coordinates of the face in the certificate contained in the picture are obtained, the coordinate clustering center and the minimum circumscribed rectangle are obtained based on the characteristic point coordinates, and the minimum circumscribed rectangle is obtained The steps of the area include:
步骤S11,当接收到包含证件的图片时,通过预设神经网络提取所述证件中人脸的多个特征点,并获取多个所述特征点的特征点坐标;Step S11, when a picture containing a document is received, extract multiple feature points of the face in the document through a preset neural network, and obtain feature point coordinates of the multiple feature points;
进一步地,当终端接收到用户上传的包含有证件的图片时,将图片传送至服务器,服务器基于opencv(Open Source Computer Vision Library,开源计算机视觉库)的边缘直线检测功能来检验证件图片中的倾斜程度,进一步利用透视变换,将证件字体正向时,左下角作为原点,左下角所在的位置视为0度,把证件纠正到0度、90度、180度、270度,以将证件纠正到与图片的边界平行,便于对证件进行识别与检测。进一步地,服务器将纠正的图片传输到预设神经网络中,通过预设神经网络的检测,识别图片中包含特征点最多的人脸,从人脸中提取出多个特征点,并获取各特征点的特征点坐标。Further, when the terminal receives the image uploaded by the user that contains the certificate, the image is sent to the server, and the server uses the edge line detection function of opencv (Open Source Computer Vision Library) to check the tilt in the image of the verification piece. The degree of perspective transformation is further used. When the document font is positive, the lower left corner is taken as the origin, and the position of the lower left corner is regarded as 0 degree, and the document is corrected to 0 degree, 90 degree, 180 degree, and 270 degree to correct the document to Parallel to the border of the picture, it is easy to identify and detect the document. Further, the server transmits the corrected picture to the preset neural network, and through the detection of the preset neural network, recognizes the face with the most feature points in the picture, extracts multiple feature points from the face, and obtains each feature The characteristic point coordinates of the point.
步骤S12,通过预设算法对所述证件中人脸的各所述特征点坐标进行聚类,得到所述证件中人脸的各所述特征点坐标的中心坐标,作为坐标聚类中心;Step S12, clustering the coordinates of each feature point of the face in the document by a preset algorithm to obtain the center coordinates of the coordinates of each feature point of the face in the document as the coordinate clustering center;
进一步地,服务器通过预设算法对各特征点坐标进行聚类,本实施例中采用knn聚类算法,通过knn聚类算法计算出各特征点坐标的中心坐标,作为表征各人脸特征点所在区域的中心点的聚类中心。例如,服务器通过识别程序识别到眼睛、鼻子、嘴巴、耳朵等人脸特征点的坐标,并通过聚类算法计算出上述多个人脸特征点的坐标的中心坐标,将中心坐标作为坐标聚类中心。Further, the server clusters the coordinates of each feature point by using a preset algorithm. In this embodiment, the knn clustering algorithm is used to calculate the center coordinates of the coordinates of each feature point through the knn clustering algorithm, which is used to characterize the location of each feature point. The cluster center of the center point of the area. For example, the server recognizes the coordinates of facial feature points such as eyes, nose, mouth, ears, etc. through a recognition program, and calculates the center coordinates of the coordinates of the above multiple facial feature points through a clustering algorithm, and uses the center coordinates as the coordinate clustering center .
步骤S13,根据所述证件中人脸的各所述特征点坐标所在位置,确定最小外接矩形,并检测所述最小外接矩形的长和宽,通过所述最小外接矩形的长和宽计算得到所述最小外接矩形的面积。Step S13: Determine a minimum circumscribed rectangle according to the position of each of the feature point coordinates of the face in the document, and detect the length and width of the minimum circumscribed rectangle, and calculate the minimum circumscribed rectangle by the length and width of the minimum circumscribed rectangle. State the area of the smallest enclosing rectangle.
进一步地,服务器根据人脸中各特征点的坐标的位置,确定表征包含所有人脸特征点的最小外接矩形,并检测最小外接矩形的长和宽,由长和宽结合矩形面积计算公式得出最小外接矩形的面积。例如,服务器获取了眼睛、嘴巴、耳朵、鼻子等人脸特征的定位,并用一个最小的外接矩形将获取的所有人脸特征都包含在内,度量出最小外接矩形的长和宽各为多少,再根据矩形面积公式计算出最小外接矩形的面积。Further, the server determines the smallest enclosing rectangle that represents the feature points of all human faces according to the position of the coordinates of each feature point in the face, and detects the length and width of the smallest enclosing rectangle, which is obtained by combining the length and width with the rectangular area calculation formula The area of the smallest enclosing rectangle. For example, the server obtains the location of facial features such as eyes, mouth, ears, nose, etc., and uses a smallest circumscribed rectangle to include all the acquired facial features, and measures the length and width of the smallest circumscribed rectangle. Then calculate the area of the smallest enclosing rectangle according to the rectangle area formula.
步骤S20,基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界;Step S20: Based on the area of the smallest bounding rectangle and the coordinate clustering center, the rectangular boundary of the certificate in the picture is calculated;
进一步地,服务器预先识别各个类型的标准证件,获取各个类型的标准证件的长、宽、面积等尺寸数据,并存储标准证件类型与标准证件的尺寸数据,其中标准证件有根据国家的标准制作的诸如身份证、结婚证、驾驶证等类型的证件。进一步地,服务器通过识别程序识别接收到的图片中的证件,并从存储的各个类型的标准证件中查找与图片中证件类型对应的标准证件,将与图片中证件类型对应的标准证件确定为目标标准证件。进一步地,获取目标标准证件中包含的由目标标准证件的目标标准面积分别与目标标准长和目标标准宽形成的比例关系、由目标标准证件的目标聚类中心分别与目标标准长和目标标准宽形成的相对位置关系,以及目标标准证件中包含所有人脸特征点的目标外接矩形的目标标准面积。进一步地,由上述计算得出的坐标聚类中心以及图片中的最小外接矩形的面积,结合目标标准证件中的比例关系、相对位置关系以及目标外接矩形的目标标准面积,通过计算得出由证件在图片中形成的矩形边界。Further, the server pre-identifies various types of standard certificates, obtains the length, width, area, and other size data of each type of standard certificate, and stores the standard certificate type and the size data of the standard certificate. The standard certificates are produced according to national standards. Such as ID card, marriage certificate, driver's license and other types of documents. Further, the server recognizes the certificate in the received picture through the recognition program, and searches for the standard certificate corresponding to the certificate type in the picture from the stored standard certificates of various types, and determines the standard certificate corresponding to the certificate type in the picture as the target Standard documents. Further, obtain the proportional relationship between the target standard area of the target standard certificate and the target standard length and target standard width included in the target standard certificate, and the target cluster center of the target standard certificate and the target standard length and target standard width respectively. The relative position relationship formed, and the target standard area of the target circumscribed rectangle containing the feature points of all faces in the target standard certificate. Further, the coordinate clustering center obtained by the above calculation and the area of the smallest circumscribed rectangle in the picture are combined with the proportional relationship, relative position relationship and the target standard area of the target circumscribed rectangle in the target standard certificate, and then the target standard area of the target circumscribed rectangle The rectangular border formed in the picture.
步骤S30,提取所述图片中由所述证件的矩形边界形成的矩形区域,并检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件。Step S30: Extract the rectangular area formed by the rectangular boundary of the certificate in the picture, and detect whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, it is determined that the received certificate in the picture is Incomplete documents.
进一步地,检测矩形边界的顶点坐标,得到矩形四角顶点的坐标值。为了确保坐标值的正确性,本实施例设置有调整机制;预先设置有用于调整的调整值a,该调整值a依据经验优选为30。对于组成坐标(x1,y1)、(x1,y2)、(x2,y2)、(x2,y1)的x1、x2、 y1、y2,可分别通过以下公式调整:x1-(x2-x1)/a,x2+(x2-x1)/a,y1-(y2-y1)/a,y2+(y2-y1)/a。进一步地,提取矩形四角顶点的坐标值,通过预设方法如将提取的矩形四角顶点坐标进行连线,得到表征与证件所在位置对应的矩形区域。进一步地,将矩形区域根据不同的清晰度按照第一预设切分方式或第二预设切分方式进行切分并生成多个目标子图片,检测与矩形区域的四角区域对应的目标子图片中是否有任一目标子图片存在缺角,若检测到有任一目标子图片存在缺角,则判定接收到的图片中的证件为残缺证件,输出证件无效的信息并提示用户重新拍摄包含证件的图片。可以理解地,接收到的图片中的证件为残缺证件可能是证件本身存在残缺,也可能是由于客户在进行图片拍摄时对证件进行了遮挡。进一步地,若检测到所有的目标子图片都不存在缺角,则判定接收到的图片中的证件有效,并根据用户的请求进行业务办理。Further, the coordinates of the vertices of the rectangle boundary are detected, and the coordinates of the vertices of the four corners of the rectangle are obtained. In order to ensure the correctness of the coordinate values, this embodiment is provided with an adjustment mechanism; an adjustment value a for adjustment is preset, and the adjustment value a is preferably 30 based on experience. For the x1, x2, y1, and y2 of the composition coordinates (x1, y1), (x1, y2), (x2, y2), (x2, y1), they can be adjusted by the following formula: x1-(x2-x1)/ a, x2+(x2-x1)/a, y1-(y2-y1)/a, y2+(y2-y1)/a. Further, the coordinate values of the vertices of the four corners of the rectangle are extracted, and the coordinates of the vertices of the four corners of the extracted rectangle are connected by a preset method, to obtain a rectangular area that characterizes the location of the document. Further, the rectangular area is segmented according to the first preset segmentation method or the second preset segmentation method according to different definitions, and multiple target sub-pictures are generated, and the target sub-images corresponding to the four corner areas of the rectangular area are detected. If there is a missing corner in any of the target sub-pictures, if any of the target sub-pictures is detected as a missing corner, the ID in the received image is determined to be a broken ID, and the invalid ID information is output and the user is prompted to take a new photo containing the ID picture of. It is understandable that the certificate in the received picture is incomplete, which may be due to the incompleteness of the certificate itself, or it may be due to the fact that the certificate was blocked by the customer when the picture was taken. Further, if it is detected that there are no missing corners in all target sub-pictures, it is determined that the credentials in the received pictures are valid, and the business is processed according to the user's request.
本实施例的证件四角残缺检测方法,当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与最小外接矩形,并获取所述最小外接矩形的面积;基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界;提取所述图片中由所述证件的矩形边界形成的矩形区域,并检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件。通过图片中证件的最小外接矩形和坐标聚类中心,确定与证件对应的矩形区域,逐一检测矩形区域的四角区域是否缺角,相对于以整张证件图片为基础进行检测,提高了检测的精确性,实现精确地检测图片中证件是否残缺。According to the method for detecting the four corners of a credential incompleteness of this embodiment, when a picture containing a credential is received, the feature point coordinates of the face in the credential contained in the picture are obtained, and the coordinate clustering center and the smallest bounding rectangle are obtained based on the feature point coordinates, And obtain the area of the smallest bounding rectangle; based on the area of the smallest bounding rectangle and the coordinate clustering center, calculate the rectangular boundary of the certificate in the picture; extract the rectangle of the certificate in the picture A rectangular area formed by the boundary, and detecting whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, it is determined that the certificate in the received picture is a broken certificate. Determine the rectangular area corresponding to the document through the smallest enclosing rectangle and coordinate clustering center of the document in the picture, and detect whether the four corners of the rectangular area are missing corners one by one. Compared with the detection based on the entire document picture, the detection accuracy is improved. It can accurately detect whether the certificate in the picture is incomplete.
进一步的,基于本申请证件四角残缺检测方法第一实施例,提出本申请证件四角残缺检测方法第二实施例,在第二实施例中,基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界的步骤包括:Further, based on the first embodiment of the four-corner defect detection method of the present application, a second embodiment of the four-corner defect detection method of the present application is proposed. In the second embodiment, clustering is based on the area of the smallest bounding rectangle and the coordinate In the center, the step of calculating the rectangular boundary of the certificate in the picture includes:
步骤S21,识别所述图片中证件的类型,并根据所述证件的类型确定与所述类型对应的目标标准证件,获取所述目标标准证件中目标外接矩形的目标标准面积;Step S21: Identify the type of the certificate in the picture, determine the target standard certificate corresponding to the type according to the type of the certificate, and obtain the target standard area of the target circumscribed rectangle in the target standard certificate;
进一步地,服务器通过识别程序识别图片中证件的类型例如识别到证件类型为身份证,则确定与图片中的证件的类型对应的目标标准证件为身份证,并获取标准身份证中包含所有人脸特征点的目标外接矩形的目标标准面积。Further, the server recognizes the type of the certificate in the picture through the recognition program. For example, if it recognizes that the type of the certificate is an ID card, it determines that the target standard certificate corresponding to the type of the certificate in the picture is an ID card, and obtains that the standard ID card contains all faces. The target standard area of the target circumscribed rectangle of the feature point.
步骤S22,基于所述目标标准证件的比例关系与所述最小外接矩形的面积,计算得到所述证件的长度和宽度,其中所述比例关系包括所述目标标准证件的目标标准长与所述目标标准面积之间的第一目标比例关系,以及所述目标标准证件的目标标准宽与所述目标标准面积之间的第二目标比例关系;Step S22: Calculate the length and width of the document based on the proportional relationship of the target standard document and the area of the minimum circumscribed rectangle, wherein the proportional relationship includes the target standard length of the target standard document and the target A first target proportional relationship between standard areas, and a second target proportional relationship between the target standard width of the target standard certificate and the target standard area;
进一步地,根据目标标准证件的目标标准长与目标标准面积之间的第一目标比例关系,结合最小外接矩形面积,计算出图片中的证件的长度,以及根据目标标准证件的目标标准宽与目标标准面积之间的第二目标比例关系,结合最小外接矩形面积,计算得到图片中证件宽度。例如目标标准证件的比例关系中第一目标比例关系为a1,最小外接矩形面积为m,则可得到图片中证件的长度为a1*m,而第二目标比例关系为a2,最小外接矩形面积为m,则可得到图片中证件的宽度为a2*m,由此确定与证件对应的长度为a1*m,宽度为a2*m的矩形区域。Further, according to the first target ratio relationship between the target standard length of the target standard certificate and the target standard area, combined with the minimum circumscribed rectangle area, the length of the certificate in the picture is calculated, and the target standard width and target standard width of the target standard certificate are calculated. The second target ratio relationship between the standard areas, combined with the minimum circumscribed rectangle area, calculates the width of the document in the picture. For example, the first target proportional relationship in the target standard document proportional relationship is a1, and the minimum circumscribed rectangle area is m, then the length of the document in the picture can be obtained as a1*m, and the second target proportional relationship is a2, and the smallest circumscribed rectangle area is m, the width of the certificate in the picture can be obtained as a2*m, and the corresponding length of the certificate is determined as a1*m, and the width of the rectangular area is a2*m.
步骤S23,基于所述目标标准证件的相对位置关系、所述证件的长度和宽度,以及所述坐标聚类中心,确定所述证件的矩形边界,其中所述相对位置关系包括所述目标标准证件的目标标准长与所述目标标准证件的目标聚类中心之间的第一目标相对位置关系,以及所述目标标准证件的目标标准宽与所述目标标准证件的目标聚类中心之间的第二目标相对位置关系。Step S23: Determine the rectangular boundary of the document based on the relative position relationship of the target standard document, the length and width of the document, and the coordinate clustering center, wherein the relative position relationship includes the target standard document The first target relative position relationship between the target standard length of the target standard certificate and the target cluster center of the target standard certificate, and the first target standard width between the target standard width of the target standard certificate and the target cluster center of the target standard certificate 2. The relative position of the target.
进一步地,根据目标标准证件的目标标准长与其目标聚类中心之间的第一目标相对位置关系,结合坐标聚类中心,得到矩形边界中长度边界方向。由证件的长度和长度边界方向,得到长度边界。进一步地,根据目标标准证件的目标标准宽与其目标聚类中心之间的 第二目标相对位置关系,结合坐标聚类中心,得到矩形边界中宽度边界方向。由证件的宽度和宽度边界方向,得到宽度边界。进一步地,由长度边界和证件的长度,以及宽度边界和证件的宽度,得到证件的矩形边界。具体地,基于所述目标标准证件的相对位置关系、所述证件的长度和宽度,以及所述坐标聚类中心,确定所述证件的矩形边界的步骤包括:Further, according to the relative positional relationship of the first target between the target standard length of the target standard certificate and the target cluster center, combined with the coordinate cluster center, the length boundary direction in the rectangular boundary is obtained. From the length of the document and the direction of the length boundary, the length boundary is obtained. Further, according to the relative positional relationship of the second target between the target standard width of the target standard certificate and the target cluster center, combined with the coordinate cluster center, the width boundary direction in the rectangular boundary is obtained. From the width of the document and the direction of the width boundary, the width boundary is obtained. Further, from the length boundary and the length of the document, as well as the width boundary and the width of the document, the rectangular boundary of the document is obtained. Specifically, based on the relative position relationship of the target standard document, the length and width of the document, and the coordinate clustering center, the step of determining the rectangular boundary of the document includes:
步骤S231,基于所述坐标聚类中心和所述第一目标相对位置关系,确定所述证件在所述图片中的长度边界方向;Step S231: Determine the length boundary direction of the document in the picture based on the relative positional relationship between the coordinate clustering center and the first target;
进一步地,获取目标标准证件的目标标准长与目标聚类中心之间的第一目标相对位置关系,以坐标聚类中心为中心,根据由第一目标相对位置关系表征的目标聚类中心与目标标准长之间的距离关系,即目标聚类中心到目标标准长所在长度方向的距离,来确定向垂直于最小外接矩形的长度方向延伸的距离,并由延伸的距离确定终点。进一步地,由终点向平行于最小外接矩形的长度方向延伸,得到矩形的长度边界方向。Further, the first target relative position relationship between the target standard length of the target standard certificate and the target cluster center is obtained, and the coordinate cluster center is taken as the center, and the target cluster center and the target are characterized by the relative position relationship of the first target. The distance relationship between the standard lengths, that is, the distance from the target cluster center to the length direction of the target standard length, determines the distance extending in the length direction perpendicular to the minimum bounding rectangle, and the end point is determined by the extended distance. Further, extending from the end point to the length direction parallel to the minimum circumscribed rectangle, the length boundary direction of the rectangle is obtained.
步骤S232,基于所述坐标聚类中心和所述第二目标相对位置关系,确定所述证件在所述图片中的宽度边界方向;Step S232: Determine the width boundary direction of the document in the picture based on the relative positional relationship between the coordinate clustering center and the second target;
进一步地,获取目标标准证件的目标标准宽与目标聚类中心之间的第二目标相对位置关系,以坐标聚类中心为中心,根据由第二目标相对位置关系表征的目标聚类中心与目标标准宽之间的距离关系,即目标聚类中心到目标标准宽所在宽度方向的距离,来确定向垂直于最小外接矩形的宽度方向延伸的距离,并由延伸的距离确定终点。进一步地,由终点向平行于最小外接矩形的宽度方向延伸,得到矩形的宽度边界方向。Further, the relative position relationship of the second target between the target standard width of the target standard certificate and the target cluster center is obtained, and the coordinate cluster center is taken as the center, and the target cluster center and the target are characterized by the relative position relationship of the second target. The distance relationship between the standard widths, that is, the distance from the target cluster center to the width direction where the target standard width is located, determines the distance extending in the width direction perpendicular to the minimum bounding rectangle, and the end point is determined by the extended distance. Further, extending from the end point to the width direction parallel to the minimum circumscribed rectangle, the width boundary direction of the rectangle is obtained.
步骤S233,基于所述证件的长度和所述长度边界方向确定所述证件的长度边界,以及基于所述证件的宽度和所述宽度边界方向确定所述证件的宽度边界,并由所述长度边界和所述宽度边界确定所述证件的矩形边界。Step S233: Determine the length boundary of the document based on the length of the document and the direction of the length boundary, and determine the width boundary of the document based on the width of the document and the direction of the width boundary, and determine the width boundary of the document based on the length of the document. And the width boundary determine the rectangular boundary of the document.
进一步地,将确定的长度边界方向向两边延长以及将宽度边界方向向两边延长,得到长度边界方向与宽度边界方向的交点,将交点确定为表征证件四角顶点之一的顶点坐标。由顶点坐标结合长度边界方向和图片中证件的长度,确定长度边界,由顶点坐标结合宽度边界方向和图片中证件的宽度,确定宽度边界。进一步地,基于长度边界和宽度边界形成矩形框,得到图片中证件的矩形边界。Further, the determined length boundary direction is extended to both sides and the width boundary direction is extended to both sides to obtain the intersection point of the length boundary direction and the width boundary direction, and the intersection point is determined as the vertex coordinates representing one of the four corner vertices of the document. The vertex coordinates are combined with the length boundary direction and the length of the document in the picture to determine the length boundary, and the vertex coordinates are combined with the width boundary direction and the width of the document in the picture to determine the width boundary. Further, a rectangular frame is formed based on the length boundary and the width boundary to obtain the rectangular boundary of the certificate in the picture.
本实施例通过图片中包含证件人脸特征点最多的最小外接矩形的面积和表征人脸特征点中心的坐标聚类中心,结合目标标准证件的比例关系以及相对位置关系,计算得出证件在图片中对应的矩形边界,精确地得出与证件对应的矩形区域边界,使得检测的结果更为准确。In this embodiment, the area of the smallest enclosing rectangle that contains the most facial feature points of the document in the picture and the coordinate clustering center representing the center of the facial feature points are combined with the proportional relationship and relative position relationship of the target standard document to calculate that the document is in the picture. Corresponding to the rectangular boundary in, accurately obtain the rectangular area boundary corresponding to the document, so that the detection result is more accurate.
进一步的,基于本申请证件四角残缺检测方法第一实施例或第二实施例,提出本申请证件四角残缺检测方法第三实施例,在第三实施例中,提取所述图片中由所述证件的矩形边界形成的矩形区域的步骤之后的步骤包括:Further, based on the first embodiment or the second embodiment of the four-corner defect detection method of the present application, a third embodiment of the four-corner defect detection method of the present application is proposed. In the third embodiment, the image is extracted by the certificate The steps following the step of forming a rectangular area by the rectangular boundary include:
步骤S31,获取所述矩形区域的长度和宽度,并计算与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素值中是否存在任一项大于预设阈值;Step S31: Obtain the length and width of the rectangular area, and calculate the pixel value corresponding to the length of the rectangular area, and whether any one of the pixel values corresponding to the width of the rectangular area is greater than a preset threshold;
进一步地,服务器获取与证件对应的矩形区域的长度和宽度,并根据矩形区域的长度数值和像素,计算与矩形区域的长度对应的像素值,以及根据矩形的宽度和像素,计算与矩形区域的宽度对应的像素值。进一步地,判断与矩形区域的长度对应的像素值和与矩形区域的宽度对应的像素值中是否存在任一项大于表征清晰度足够与不足的预设阈值,以确定图片中表征证件所在的矩形区域的内容是否清晰,便于确定将矩形区域切分为子图片的等分。Further, the server obtains the length and width of the rectangular area corresponding to the certificate, and calculates the pixel value corresponding to the length of the rectangular area according to the length value and pixels of the rectangular area, and calculates the pixel value corresponding to the rectangular area according to the width and pixels of the rectangle. The pixel value corresponding to the width. Further, it is judged whether any one of the pixel value corresponding to the length of the rectangular area and the pixel value corresponding to the width of the rectangular area is greater than a preset threshold that characterizes sufficient or insufficient sharpness, to determine the rectangle in the picture that characterizes the document. Whether the content of the area is clear, it is convenient to determine whether the rectangular area is divided into equal parts of sub-pictures.
步骤S32,若与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素中存在任一项大于预设阈值,则将所述矩形区域按照第一预设切分方式切分为多个子图片,并将多个所述子图片中与所述矩形区域的四角区域对应的子图片作为目标子图片,以基于各所述目标子图片检测所述矩形区域的四角中是否存在缺角;Step S32, if any one of the pixel value corresponding to the length of the rectangular area and the pixel corresponding to the width of the rectangular area is greater than a preset threshold, the rectangular area is divided according to a first preset The method is divided into multiple sub-pictures, and the sub-pictures corresponding to the four corners of the rectangular area among the multiple sub-pictures are used as target sub-pictures to detect the four corners of the rectangular area based on each of the target sub-pictures. Whether there are missing corners;
进一步地,若计算得到的与矩形区域的长度对应的像素值,和与矩形区域的宽度对应的像素值中存在任一项大于预设阈值,本实施例中预设阈值依据经验设置为2000,则说明矩形区域的内容足够清晰,将矩形区域按照预先设定的第一预设切分方式切分为多个子图片,其中第一预设切分方式依据需求设定,如本实施例中预设为九等分切分方式,将矩形区域切分为9个子图片。此后,从切分的子图片中确定出位于矩形区域四角区域的子图片作为目标子图片。如对于上述切分的9个子图片,其中位于左上角、右上角、左下角和右下角的4个子图片即为与矩形区域的四角区域对应的子图片,而将其作为目标子图片,以便于检测4个子图片中是否存在缺角。Further, if any one of the calculated pixel value corresponding to the length of the rectangular area and the pixel value corresponding to the width of the rectangular area is greater than the preset threshold, the preset threshold in this embodiment is set to 2000 based on experience, It means that the content of the rectangular area is clear enough, and the rectangular area is divided into a plurality of sub-pictures according to the preset first preset segmentation method, wherein the first preset segmentation method is set according to requirements, as in this embodiment. Set the nine-equal division method to divide the rectangular area into 9 sub-pictures. Thereafter, from the segmented sub-pictures, the sub-pictures located in the four corners of the rectangular area are determined as the target sub-pictures. For example, for the above-mentioned 9 sub-pictures, the 4 sub-pictures located in the upper left corner, upper right corner, lower left corner, and lower right corner are the sub-pictures corresponding to the four corners of the rectangular area, and they are used as the target sub-pictures to facilitate Detect whether there are missing corners in the 4 sub-pictures.
步骤S33,若与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素均小于或等于预设阈值,则将所述矩形区域按照第二预设切分方式切分为多个子图片,并将多个所述子图片作为目标子图片,以基于各所述目标子图片检测所述矩形区域的四角中是否存在缺角。Step S33: If the pixel value corresponding to the length of the rectangular area and the pixel corresponding to the width of the rectangular area are both less than or equal to a preset threshold, the rectangular area is cut according to a second preset splitting method. Divide into a plurality of sub-pictures, and use the plurality of sub-pictures as target sub-pictures to detect whether there are missing corners in the four corners of the rectangular area based on each of the target sub-pictures.
进一步地,若计算得到的与矩形区域的长度对应的像素值,和与矩形区域的宽度对应的像素都小于或等于预设阈值,则说明矩形区域的清晰度不足,将矩形区域按照预先设定的第二预设切分方式切分为多个子图片作为目标子图片,其中第二预设切分方式依据需求设定。如本实施例中预设为四等分切分方式,将矩形区域切分为4个子图片,并将4个子图片作为目标子图片,以便于检测4个目标子图片中是否存在缺角。Further, if the calculated pixel value corresponding to the length of the rectangular area and the pixel corresponding to the width of the rectangular area are both less than or equal to the preset threshold, it indicates that the definition of the rectangular area is insufficient, and the rectangular area is set according to the preset threshold. The second preset segmentation method is divided into a plurality of sub-pictures as target sub-pictures, and the second preset segmentation method is set according to requirements. For example, in this embodiment, a four-equal division method is preset, and the rectangular area is divided into 4 sub-pictures, and the 4 sub-pictures are used as target sub-pictures, so as to detect whether there are missing corners in the 4 target sub-pictures.
进一步地,检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件的步骤包括;Further, the step of detecting whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, determining that the certificate in the received picture is a broken certificate includes;
步骤S34,通过预设方式对各所述目标子图片进行逐一检测,确定所述目标子图片是否均包含有完整的证件角;Step S34: Detect each of the target sub-pictures one by one in a preset manner, and determine whether the target sub-pictures all include a complete document corner;
进一步地,本实施例预先设置有用于检测图片是否残缺的预设方式,例如inceptionv3检测方式,以通过预设方式对切分得到的4个目标子图片进行逐一检测,具体地,将4个目标子图片一一导入到inceptionv3中进行检测,以确定4个目标子图片是否都含有完整的证件角。可以理解地,证件角的完整与否是通过和目标标准证件的证件角对比得出的,例如,身份证的证件角为圆角,则检测目标子图片中包含的证件角是否与身份证的证件角相同。Further, this embodiment is preset with a preset method for detecting whether a picture is incomplete, such as the inceptionv3 detection method, to detect the 4 target sub-pictures obtained by segmentation one by one through the preset method, specifically, the 4 target sub-pictures are detected one by one. The sub-pictures are imported into inceptionv3 one by one for detection to determine whether the four target sub-pictures all contain a complete ID corner. Understandably, the integrity of the document corner is obtained by comparing it with the document corner of the target standard document. For example, if the document corner of the ID card is rounded, it will be detected whether the document corner contained in the target sub-picture is the same as that of the ID card. The document angle is the same.
步骤S35,若所述目标子图片均包含有完整的证件角,则判定接收的所述图片有效;Step S35, if the target sub-pictures all contain a complete ID corner, it is determined that the received picture is valid;
进一步地,如果将4个目标子图片经过一一检测后,确定4个目标子图片中都包含有完整的证件角,说明图片中的证件中四个角都是完整的,没有损坏,则接收的图片中的证件是完整的,判定接收的图片有效。进一步地,根据用户的请求,进行与用户的请求对应的业务办理。Further, if the four target sub-pictures are checked one by one, and it is determined that the four target sub-pictures all contain complete certificate corners, it means that the four corners of the certificate in the picture are complete and not damaged, then accept The certificate in the picture is complete, and the picture received is judged to be valid. Further, according to the user's request, the business processing corresponding to the user's request is performed.
步骤S36,若所述目标子图片中存在任意一张所述目标子图像中存在缺角,则确定接收的所述图片中的证件为残缺证件,判定接收的所述图片无效并输出重新采集的提示信息。Step S36, if there is a missing corner in any one of the target sub-images in the target sub-picture, determine that the certificate in the received picture is a broken certificate, determine that the received picture is invalid, and output the re-collected Prompt information.
进一步地,如果将4个目标子图片经过一一检测后,检测到4个目标子图片中有任一一个目标子图片中的证件角是不完整的,则说明图片中的证件不完整,确定为残缺证件,其中残缺证件可能为证件本身在使用时因为磨损或者意外因素导致证件角缺失,也可能是用户在进行证件拍摄时遮挡了证件角例如用户用手拿着证件的一角进行拍摄,而导致拍摄的图片中证件的其中一个证件角缺失。进一步地,判定接收的图片无效,并输出信息提示用户重新进行证件的拍摄。Further, if the four target sub-pictures are detected one by one, and it is detected that the certificate corner in any one of the four target sub-pictures is incomplete, it means that the certificate in the picture is incomplete. It is determined that it is a broken document, where the broken document may be that the document itself is worn or accidentally caused by the loss of the document corner when the document is in use, or it may be that the user covers the corner of the document when the document is photographed. As a result, one of the document corners of the document in the photographed picture is missing. Further, it is determined that the received picture is invalid, and a message is output to prompt the user to take the photo of the certificate again.
本实施例服务器通过检测与矩形区域的长度对应的像素值和与矩形区域的宽度对应的像素值,确定表征证件所在的矩形区域的内容是否足够清晰,并基于不同的清晰度对矩形区域进行不同数量的子图片切分,以便更精确地对矩形区域的四角区域进行检测。通过检测从子图片中选取的目标子图片是否均包含有完整的证件角,以判定接收到的图片是否有效。本实施例实现了通过对切分后的图片进行完整证件角检测,判定证件是否完整,以 便于帮助用户进行诸如证件识别或者远程开户等业务办理。In this embodiment, the server detects the pixel value corresponding to the length of the rectangular area and the pixel value corresponding to the width of the rectangular area to determine whether the content of the rectangular area that characterizes the document is sufficiently clear, and differentiates the rectangular area based on different definitions. The number of sub-pictures are segmented to more accurately detect the four corners of the rectangular area. By detecting whether the target sub-pictures selected from the sub-pictures all contain a complete ID corner, it is determined whether the received picture is valid. This embodiment realizes that the complete document angle detection is performed on the segmented pictures to determine whether the document is complete, so as to facilitate the user to perform business processing such as document recognition or remote account opening.
进一步的,基于本申请证件四角残缺检测方法第一实施例、第二实施例或第三实施例,提出本申请证件四角残缺检测方法第四实施例,在第四实施例中,基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界的步骤之前包括:Further, based on the first embodiment, the second embodiment or the third embodiment of the four-corner defect detection method of the present application, a fourth embodiment of the four-corner defect detection method of the present application is proposed. In the fourth embodiment, based on the minimum Before calculating the area of the circumscribed rectangle and the coordinate clustering center, the step of obtaining the rectangular boundary of the certificate in the picture includes:
步骤S40,获取各个类型的标准证件的标准面积、标准长、标准宽、标准聚类中心和所述标准证件中人脸特征点的特征外接矩形的最小标准面积;Step S40: Obtain the standard area, standard length, standard width, standard cluster center of each type of standard certificate, and the minimum standard area of the characteristic circumscribed rectangle of the facial feature points in the standard certificate;
进一步地,预先针对实际使用的各种类型的标准证件的尺寸数据进行获取,获取的内容包括标准证件的标准面积、标准长、标准宽,还包括包含标准证件中人脸特征点的特征外接矩形的最小标准面积,以及对各人脸特征点进行聚类的标准聚类中心,以便服务器调用尺寸数据进行对比与计算。可以理解地,考虑到不同类型的标准证件具有不同的外框尺寸,或者即便外框尺寸相同也可能具有不同尺寸的人脸或者不同位置的人脸,而使得不同类型的标准证件在标准面积,标准长、标准宽、最小标准面积和标准聚类中心上存在差异性,从而针对不同类型的标准证件可分别获取各自的上述尺寸数据,并依据各个类型标准证件的尺寸数据,对各个类型标准证件逐一进行步骤S50、S60、S70的处理。Further, the size data of various types of standard certificates actually used are obtained in advance, and the obtained content includes the standard area, standard length, and standard width of the standard certificate, as well as the characteristic circumscribed rectangle containing the facial feature points in the standard certificate. The minimum standard area of, and the standard cluster center for clustering each face feature point, so that the server can call the size data for comparison and calculation. Understandably, considering that different types of standard documents have different outer frame sizes, or even if the outer frame sizes are the same, they may have different sizes of faces or faces in different positions, so that different types of standard documents are in the standard area. There are differences in standard length, standard width, minimum standard area, and standard clustering center. Therefore, the above-mentioned size data can be obtained for different types of standard documents. Steps S50, S60, and S70 are processed one by one.
步骤S50,基于所述标准长与所述最小标准面积,生成所述标准长与所述最小标准面积的第一比例关系,基于所述标准宽与所述最小标准面积,生成所述标准宽与所述最小标准面积的第二比例关系;Step S50, based on the standard length and the minimum standard area, generate a first proportional relationship between the standard length and the minimum standard area, and generate the standard width and the minimum standard area based on the standard width and the minimum standard area. The second proportional relationship of the minimum standard area;
将标准证件的标准长与最小标准面积之间做比值,生成表征标准长与最小标准面积关系的第一比例关系,将标准证件的标准宽与最小标准面积之间做比值,生成表征标准宽与最小标准面积关系的第二比例关系。The ratio between the standard length of the standard document and the minimum standard area is generated to generate the first proportional relationship that characterizes the relationship between the standard length and the minimum standard area. The ratio between the standard width and the minimum standard area of the standard document is used to generate the standard width and the minimum standard area. The second proportional relationship of the minimum standard area relationship.
步骤S60,基于所述标准长与所述标准聚类中心,生成所述标准聚类中心与所述标准长的第一相对位置关系,基于所述标准宽与所述标准聚类中心,生成所述标准聚类中心与所述标准宽的第二相对位置关系。Step S60, based on the standard length and the standard cluster center, generate a first relative positional relationship between the standard cluster center and the standard length, and generate all the standard cluster centers based on the standard width and the standard cluster centers. The second relative positional relationship between the standard cluster center and the standard width.
进一步地,计算标准证件中标准聚类中心到标准证件的标准长所在方向的距离,该距离表征了标准聚类中心相对于标准长所在方向的位置关系,而将其作为标准聚类中心与标准长之间的第一相对位置关系。并且,计算标准证件中标准聚类中心到标准证件的标准宽所在方向的距离,该距离表征了标准聚类中心相对于标准宽所在方向的位置关系,而将其作为标准聚类中心与标准宽之间第二相对位置关系。Further, the distance between the standard cluster center in the standard document and the standard length of the standard document is calculated. This distance represents the positional relationship of the standard cluster center relative to the standard length, and it is regarded as the standard cluster center and the standard length. The first relative positional relationship between the long. In addition, calculate the distance between the standard cluster center in the standard document and the standard width of the standard document. This distance represents the positional relationship between the standard cluster center and the standard width. The second relative position relationship between.
本实施例通过预先获取各个类型的标准证件的尺寸数据信息,并基于标准证件的尺寸数据信息,生成标准证件的比例关系以及相对位置关系,以便于服务器调用标准证件的尺寸数据以及标准证件的比例关系以及相对位置关系,计算接收到的图片中证件的长度、宽度以及确定证件对应的矩形区域的具体位置。In this embodiment, the size data information of each type of standard certificate is obtained in advance, and based on the size data information of the standard certificate, the proportional relationship and relative position relationship of the standard certificate are generated, so that the server can call the size data of the standard certificate and the proportion of the standard certificate. Relationship and relative position relationship, calculate the length and width of the certificate in the received picture and determine the specific position of the rectangular area corresponding to the certificate.
进一步地,本申请还提供一种证件四角残缺检测装置。Furthermore, this application also provides a device for detecting the four corners of the credential.
参照图3,图3为本申请证件四角残缺检测装置第一实施例的功能模块示意图。Referring to FIG. 3, FIG. 3 is a schematic diagram of the functional modules of the first embodiment of the device for detecting four corners of the credential defect of this application.
所述证件四角残缺检测装置包括:The four-corner defect detection device of the document includes:
获取模块10,用于当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与最小外接矩形,并获取所述最小外接矩形的面积;The obtaining module 10 is configured to, when a picture containing a certificate is received, obtain the feature point coordinates of the face in the certificate contained in the picture, obtain the coordinate cluster center and the smallest bounding rectangle based on the feature point coordinates, and obtain the The area of the smallest enclosing rectangle;
计算模块20,用于基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界;The calculation module 20 is configured to calculate the rectangular boundary of the certificate in the picture based on the area of the smallest bounding rectangle and the coordinate clustering center;
提取模块30,用于提取所述图片中由所述证件的矩形边界形成的矩形区域,并检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件。The extraction module 30 is configured to extract the rectangular area formed by the rectangular boundary of the certificate in the picture, and detect whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, determine whether there is a missing corner in the received picture The document is incomplete.
本实施例的证件四角残缺检测装置,当接收到包含证件的图片时,先由获取模块10获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与 最小外接矩形,并获取所述最小外接矩形的面积;再由计算模块20基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界;进而由提取模块30提取所述图片中由所述证件的矩形边界形成的矩形区域,并检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件。通过图片中证件的最小外接矩形和坐标聚类中心,确定与证件对应的矩形区域,逐一检测矩形区域的四角区域是否缺角,相对于以整张证件图片为基础进行检测,提高了检测的精确性,实现精确地检测图片中证件是否残缺。In the four-corner defect detection device of a document of this embodiment, when a picture containing a document is received, the acquiring module 10 first obtains the coordinates of the characteristic points of the face in the document contained in the picture, and obtains the coordinate clustering center based on the coordinates of the characteristic points. And the smallest circumscribed rectangle, and obtain the area of the smallest circumscribed rectangle; then the calculation module 20 calculates the rectangular boundary of the document in the picture based on the area of the smallest circumscribed rectangle and the coordinate clustering center; The extraction module 30 extracts the rectangular area formed by the rectangular border of the certificate in the picture, and detects whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, it is determined that the certificate in the received picture is It is a broken document. Determine the rectangular area corresponding to the document through the smallest enclosing rectangle and coordinate clustering center of the document in the picture, and check whether the four corners of the rectangular area are missing corners one by one. Compared with the detection based on the entire document picture, the detection accuracy is improved. It can accurately detect whether the certificate in the picture is incomplete.
进一步地,所述获取模块10包括:Further, the acquisition module 10 includes:
第一获取单元,用于当接收到包含证件的图片时,通过预设神经网络提取所述证件中人脸的多个特征点,并获取多个所述特征点的特征点坐标;The first acquiring unit is configured to extract multiple feature points of the face in the document through a preset neural network when a picture containing the document is received, and acquire the feature point coordinates of the multiple feature points;
聚类单元,用于通过预设算法对所述证件中人脸的各所述特征点坐标进行聚类,得到所述证件中人脸的各所述特征点坐标的中心坐标,作为坐标聚类中心;The clustering unit is used to cluster the coordinates of each feature point of the face in the certificate by using a preset algorithm to obtain the center coordinates of the coordinates of each feature point of the face in the certificate, as the coordinate clustering center;
第一确定单元,用于根据所述证件中人脸的各所述特征点坐标所在位置,确定最小外接矩形,并检测所述最小外接矩形的长和宽,通过所述最小外接矩形的长和宽计算得到所述最小外接矩形的面积。The first determining unit is configured to determine the minimum circumscribed rectangle according to the position of each of the characteristic point coordinates of the face in the document, and detect the length and width of the minimum circumscribed rectangle, and pass the length and the sum of the minimum circumscribed rectangle The width is calculated to obtain the area of the minimum circumscribed rectangle.
进一步地,所述计算模块20包括:Further, the calculation module 20 includes:
识别单元,用于识别所述图片中证件的类型,并根据所述证件的类型确定与所述类型对应的目标标准证件,获取所述目标标准证件中目标外接矩形的目标标准面积;An identification unit, configured to identify the type of the certificate in the picture, determine the target standard certificate corresponding to the type according to the type of the certificate, and obtain the target standard area of the target circumscribed rectangle in the target standard certificate;
计算单元,用于基于所述目标标准证件的比例关系与所述最小外接矩形的面积,计算得到所述证件的长度和宽度,其中所述比例关系包括所述目标标准证件的目标标准长与所述目标标准面积之间的第一目标比例关系,以及所述目标标准证件的目标标准宽与所述目标标准面积之间的第二目标比例关系;The calculation unit is configured to calculate the length and width of the document based on the proportional relationship of the target standard document and the area of the minimum circumscribed rectangle, wherein the proportional relationship includes the target standard length of the target standard document and the area The first target proportional relationship between the target standard areas, and the second target proportional relationship between the target standard width of the target standard certificate and the target standard area;
第二确定单元,用于基于所述目标标准证件的相对位置关系、所述证件的长度和宽度,以及所述坐标聚类中心,确定所述证件的矩形边界,其中所述相对位置关系包括所述目标标准证件的目标标准长与所述目标标准证件的目标聚类中心之间的第一目标相对位置关系,以及所述目标标准证件的目标标准宽与所述目标标准证件的目标聚类中心之间的第二目标相对位置关系。The second determining unit is configured to determine the rectangular boundary of the document based on the relative positional relationship of the target standard document, the length and width of the document, and the coordinate clustering center, wherein the relative positional relationship includes all The first target relative position relationship between the target standard length of the target standard certificate and the target cluster center of the target standard certificate, and the target standard width of the target standard certificate and the target cluster center of the target standard certificate The relative positional relationship between the second target.
进一步地,所述计算模块20还包括:Further, the calculation module 20 further includes:
第三确定单元,用于基于所述坐标聚类中心和所述第一目标相对位置关系,确定所述证件在所述图片中的长度边界方向;A third determining unit, configured to determine the length boundary direction of the document in the picture based on the relative positional relationship between the coordinate clustering center and the first target;
第四确定单元,用于基于所述坐标聚类中心和所述第二目标相对位置关系,确定所述证件在所述图片中的宽度边界方向;A fourth determining unit, configured to determine the width boundary direction of the document in the picture based on the relative positional relationship between the coordinate clustering center and the second target;
第五确定单元,用于基于所述证件的长度和所述长度边界方向确定所述证件的长度边界,以及基于所述证件的宽度和所述宽度边界方向确定所述证件的宽度边界,并由所述长度边界和所述宽度边界确定所述证件的矩形边界。The fifth determining unit is configured to determine the length boundary of the document based on the length of the document and the length boundary direction, and determine the width boundary of the document based on the width of the document and the width boundary direction, and The length boundary and the width boundary determine the rectangular boundary of the document.
进一步地,所述计算模块20还包括:Further, the calculation module 20 further includes:
第二获取单元,用于获取各个类型的标准证件的标准面积、标准长、标准宽、标准聚类中心和所述标准证件中人脸特征点的特征外接矩形的最小标准面积;The second acquiring unit is used to acquire the standard area, standard length, standard width, standard clustering center, and the minimum standard area of the characteristic circumscribed rectangle of the facial feature points in the standard certificate of various types of standard certificates;
执行单元,用于针对各个类型的所述标准证件逐一执行以下步骤:The execution unit is used to execute the following steps one by one for each type of the standard certificate:
第一生成单元,用于基于所述标准长与所述最小标准面积,生成所述标准长与所述最小标准面积的第一比例关系,基于所述标准宽与所述最小标准面积,生成所述标准宽与所述最小标准面积的第二比例关系;The first generating unit is configured to generate a first proportional relationship between the standard length and the minimum standard area based on the standard length and the minimum standard area, and generate the standard width and the minimum standard area based on the standard length and the minimum standard area. The second proportional relationship between the standard width and the minimum standard area;
第二生成单元,用于基于所述标准长与所述标准聚类中心,生成所述标准聚类中心与所述标准长的第一相对位置关系,基于所述标准宽与所述标准聚类中心,生成所述标准聚类中心与所述标准宽的第二相对位置关系。The second generating unit is configured to generate a first relative positional relationship between the standard cluster center and the standard length based on the standard length and the standard cluster center, and based on the standard width and the standard cluster Center, generating a second relative positional relationship between the standard cluster center and the standard width.
进一步地,所述提取模块30包括:Further, the extraction module 30 includes:
第三获取单元,用于获取所述矩形区域的长度和宽度,并计算与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素值中是否存在任一项大于预设阈值;The third acquiring unit is configured to acquire the length and width of the rectangular area, and calculate the pixel value corresponding to the length of the rectangular area, and whether any one of the pixel values corresponding to the width of the rectangular area is greater than Preset threshold;
第一切分单元,用于若与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素中存在任一项大于预设阈值,则将所述矩形区域按照第一预设切分方式切分为多个子图片,并将多个所述子图片中与所述矩形区域的四角区域对应的子图片作为目标子图片,以基于各所述目标子图片检测所述矩形区域的四角中是否存在缺角;The first segmentation unit is used for if any one of the pixel value corresponding to the length of the rectangular area and the pixel corresponding to the width of the rectangular area is greater than a preset threshold, then the rectangular area is set according to the first A preset segmentation method is divided into a plurality of sub-pictures, and the sub-pictures corresponding to the four corners of the rectangular area among the plurality of sub-pictures are used as target sub-pictures to detect the Whether there are missing corners in the four corners of the rectangular area;
第二切分单元,用于若与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素均小于或等于预设阈值,则将所述矩形区域按照第二预设切分方式切分为多个子图片,并将多个所述子图片作为目标子图片,以基于各所述目标子图片检测所述矩形区域的四角中是否存在缺角。The second segmentation unit is configured to: if the pixel value corresponding to the length of the rectangular area and the pixel corresponding to the width of the rectangular area are both less than or equal to the preset threshold, then the rectangular area is divided according to the second preset threshold. Suppose the segmentation method is divided into multiple sub-pictures, and the multiple sub-pictures are used as target sub-pictures to detect whether there are missing corners in the four corners of the rectangular area based on each of the target sub-pictures.
进一步地,所述提取模块30还包括:Further, the extraction module 30 further includes:
检测单元,用于通过预设方式对各所述目标子图片进行逐一检测,确定所述目标子图片是否均包含有完整的证件角;The detection unit is configured to detect each of the target sub-pictures one by one in a preset manner to determine whether the target sub-pictures all include a complete document corner;
第一判定单元,用于若所述目标子图片均包含有完整的证件角,则判定接收的所述图片有效;The first determining unit is configured to determine that the received image is valid if all the target sub-pictures contain a complete document corner;
第二判定单元,用于若所述目标子图片中存在任意一张所述目标子图像中存在缺角,则确定接收的所述图片中的证件为残缺证件,判定接收的所述图片无效并输出重新采集的提示信息。The second determining unit is configured to determine that the credential in the received picture is a broken credential if there is a missing corner in any one of the target sub-images, determine that the received picture is invalid and The prompt message for re-collection is output.
本申请还提供证件四角残缺检测设备,所述证件四角残缺检测设备包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的证件四角残缺检测程序,所述证件四角残缺检测程序被所述处理器执行时实现如下步骤:The application also provides a four-corner defect detection device for a document. The four-corner defect detection device includes a memory, a processor, and a four-corner defect detection program that is stored on the memory and can run on the processor. When the detection program is executed by the processor, the following steps are implemented:
当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与最小外接矩形,并获取所述最小外接矩形的面积;When a picture containing a certificate is received, obtaining the feature point coordinates of the face in the certificate included in the picture, obtaining the coordinate cluster center and the smallest bounding rectangle based on the characteristic point coordinates, and obtaining the area of the smallest bounding rectangle;
基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界;Based on the area of the smallest bounding rectangle and the coordinate clustering center, the rectangular boundary of the certificate in the picture is calculated;
提取所述图片中由所述证件的矩形边界形成的矩形区域,并检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件。Extract the rectangular area formed by the rectangular border of the certificate in the picture, and detect whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, it is determined that the certificate in the received picture is a broken certificate.
本申请还提供一种存储介质,所述存储介质可以是易失性,也可以是非易失性,所述存储介质上存储有证件四角残缺检测程序,所述证件四角残缺检测程序被处理器执行时实现如下步骤:The present application also provides a storage medium, the storage medium may be volatile or non-volatile, the storage medium stores a four-corner defect detection program of the document, and the four-corner defect detection program is executed by a processor. When implementing the following steps:
当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与最小外接矩形,并获取所述最小外接矩形的面积;When a picture containing a certificate is received, obtaining the feature point coordinates of the face in the certificate included in the picture, obtaining the coordinate cluster center and the smallest bounding rectangle based on the characteristic point coordinates, and obtaining the area of the smallest bounding rectangle;
基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界;Based on the area of the smallest bounding rectangle and the coordinate clustering center, the rectangular boundary of the certificate in the picture is calculated;
提取所述图片中由所述证件的矩形边界形成的矩形区域,并检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件。Extract the rectangular area formed by the rectangular border of the certificate in the picture, and detect whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, it is determined that the certificate in the received picture is a broken certificate.
在本申请证件四角残缺检测装置和存储介质的实施例中,包含了上述证件四角残缺检测方法各实施例的全部技术特征,说明和解释内容与上述证件四角残缺检测方法各实施例基本相同,在此不做累述。In the embodiments of the four-corner defect detection device and storage medium of the present application, all the technical features of each embodiment of the four-corner defect detection method of the above-mentioned document are included. This will not be exhausted.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。It should be noted that in this article, the terms "include", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements not only includes those elements, It also includes other elements that are not explicitly listed, or elements inherent to the process, method, article, or system. If there are no more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other identical elements in the process, method, article, or system that includes the element.
本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。The blockchain referred to in this application is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain, essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information for verification. The validity of the information (anti-counterfeiting) and the generation of the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the foregoing embodiments of the present application are for description only, and do not represent the superiority or inferiority of the embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above implementation manners, those skilled in the art can clearly understand that the above-mentioned embodiment method can be implemented by means of software plus the necessary general hardware platform, of course, it can also be implemented by hardware, but in many cases the former is better.的实施方式。 Based on this understanding, the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM) as described above. , Magnetic disks, optical disks), including several instructions to make a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the method described in each embodiment of the present application.
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above are only the preferred embodiments of the application, and do not limit the scope of the patent for this application. Any equivalent structure or equivalent process transformation made using the content of the description and drawings of the application, or directly or indirectly applied to other related technical fields , The same reason is included in the scope of patent protection of this application.

Claims (20)

  1. 一种证件四角残缺检测方法,其中,所述证件四角残缺检测方法包括以下步骤:A method for detecting defects in the four corners of a document, wherein the method for detecting defects in the four corners of a document includes the following steps:
    当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与最小外接矩形,并获取所述最小外接矩形的面积;When a picture containing a certificate is received, obtaining the feature point coordinates of the face in the certificate included in the picture, obtaining the coordinate cluster center and the smallest bounding rectangle based on the characteristic point coordinates, and obtaining the area of the smallest bounding rectangle;
    基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界;Based on the area of the smallest bounding rectangle and the coordinate clustering center, the rectangular boundary of the certificate in the picture is calculated;
    提取所述图片中由所述证件的矩形边界形成的矩形区域,并检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件。Extract the rectangular area formed by the rectangular border of the certificate in the picture, and detect whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, it is determined that the certificate in the received picture is a broken certificate.
  2. 如权利要求1所述的证件四角残缺检测方法,其中,所述基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界的步骤包括:The method for detecting the four corners of a credential incompleteness according to claim 1, wherein the step of calculating the rectangular boundary of the credential in the picture based on the area of the smallest bounding rectangle and the coordinate clustering center comprises:
    识别所述图片中证件的类型,并根据所述证件的类型确定与所述类型对应的目标标准证件,获取所述目标标准证件中目标外接矩形的目标标准面积;Identify the type of the certificate in the picture, determine the target standard certificate corresponding to the type according to the type of the certificate, and obtain the target standard area of the target circumscribed rectangle in the target standard certificate;
    基于所述目标标准证件的比例关系与所述最小外接矩形的面积,计算得到所述证件的长度和宽度,其中所述比例关系包括所述目标标准证件的目标标准长与所述目标标准面积之间的第一目标比例关系,以及所述目标标准证件的目标标准宽与所述目标标准面积之间的第二目标比例关系;Based on the proportional relationship between the target standard document and the area of the smallest circumscribed rectangle, the length and width of the certificate are calculated, wherein the proportional relationship includes the difference between the target standard length of the target standard certificate and the target standard area The first target proportional relationship between the two, and the second target proportional relationship between the target standard width of the target standard certificate and the target standard area;
    基于所述目标标准证件的相对位置关系、所述证件的长度和宽度,以及所述坐标聚类中心,确定所述证件的矩形边界,其中所述相对位置关系包括所述目标标准证件的目标标准长与所述目标标准证件的目标聚类中心之间的第一目标相对位置关系,以及所述目标标准证件的目标标准宽与所述目标标准证件的目标聚类中心之间的第二目标相对位置关系。Based on the relative position relationship of the target standard certificate, the length and width of the certificate, and the coordinate clustering center, the rectangular boundary of the certificate is determined, wherein the relative position relationship includes the target standard of the target standard certificate The first target relative positional relationship between the length and the target cluster center of the target standard certificate, and the second target relative between the target standard width of the target standard certificate and the target cluster center of the target standard certificate Positional relationship.
  3. 如权利要求2所述的证件四角残缺检测方法,其中,所述基于所述目标标准证件的相对位置关系、所述证件的长度和宽度,以及所述坐标聚类中心,确定所述证件的矩形边界的步骤包括:The method for detecting the incompleteness of the four corners of a document according to claim 2, wherein the rectangle of the document is determined based on the relative position relationship of the target standard document, the length and width of the document, and the coordinate clustering center The boundary steps include:
    基于所述坐标聚类中心和所述第一目标相对位置关系,确定所述证件在所述图片中的长度边界方向;Determine the length boundary direction of the certificate in the picture based on the relative positional relationship between the coordinate clustering center and the first target;
    基于所述坐标聚类中心和所述第二目标相对位置关系,确定所述证件在所述图片中的宽度边界方向;Determine the width boundary direction of the document in the picture based on the relative positional relationship between the coordinate clustering center and the second target;
    基于所述证件的长度和所述长度边界方向确定所述证件的长度边界,以及基于所述证件的宽度和所述宽度边界方向确定所述证件的宽度边界,并由所述长度边界和所述宽度边界确定所述证件的矩形边界。The length boundary of the document is determined based on the length of the document and the direction of the length boundary, and the width boundary of the document is determined based on the width of the document and the direction of the width boundary. The width boundary determines the rectangular boundary of the document.
  4. 如权利要求1所述的证件四角残缺检测方法,其中,所述提取所述图片中由所述证件的矩形边界形成的矩形区域的步骤之后包括:The method for detecting the four corners of a credential incompleteness according to claim 1, wherein the step of extracting the rectangular area formed by the rectangular boundary of the credential in the picture afterwards comprises:
    获取所述矩形区域的长度和宽度,并计算与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素值中是否存在任一项大于预设阈值;Acquiring the length and width of the rectangular area, and calculating the pixel value corresponding to the length of the rectangular area, and whether any one of the pixel values corresponding to the width of the rectangular area is greater than a preset threshold;
    若与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素中存在任一项大于预设阈值,则将所述矩形区域按照第一预设切分方式切分为多个子图片,并将多个所述子图片中与所述矩形区域的四角区域对应的子图片作为目标子图片,以基于各所述目标子图片检测所述矩形区域的四角中是否存在缺角;If any one of the pixel value corresponding to the length of the rectangular area and the pixel corresponding to the width of the rectangular area is greater than the preset threshold, the rectangular area is divided according to the first preset segmentation method Is a plurality of sub-pictures, and the sub-pictures corresponding to the four corners of the rectangular area among the plurality of sub-pictures are used as target sub-pictures to detect whether there are defects in the four corners of the rectangular area based on each of the target sub-pictures. Horn;
    若与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素均小于或等于预设阈值,则将所述矩形区域按照第二预设切分方式切分为多个子图片,并将多个所述子图片作为目标子图片,以基于各所述目标子图片检测所述矩形区域的四角中是否存在缺角。If the pixel value corresponding to the length of the rectangular area and the pixel corresponding to the width of the rectangular area are both less than or equal to the preset threshold value, the rectangular area is divided into multiple segments according to the second preset segmentation method. And use multiple sub-pictures as target sub-pictures to detect whether there are missing corners in the four corners of the rectangular area based on each of the target sub-pictures.
  5. 如权利要求4所述的证件四角残缺检测方法,其中,所述检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件的步骤包括:The method for detecting the defect of four corners of a document according to claim 4, wherein the step of detecting whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, determining that the certificate in the received picture is a broken certificate include:
    通过预设方式对各所述目标子图片进行逐一检测,确定所述目标子图片是否均包含有完整的证件角;Detect each of the target sub-pictures one by one through a preset method, and determine whether the target sub-pictures all include a complete ID corner;
    若所述目标子图片均包含有完整的证件角,则判定接收的所述图片有效;If the target sub-pictures all contain a complete ID corner, it is determined that the received picture is valid;
    若所述目标子图片中存在任意一张所述目标子图像中存在缺角,则确定接收的所述图片中的证件为残缺证件,判定接收的所述图片无效并输出重新采集的提示信息。If there is a missing corner in any one of the target sub-images in the target sub-picture, it is determined that the certificate in the received picture is a broken certificate, the received picture is determined to be invalid, and a re-collection prompt message is output.
  6. 如权利要求1所述的证件四角残缺检测方法,其中,所述当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与最小外接矩形,并获取所述最小外接矩形的面积的步骤包括:The method for detecting the four corners of a credential defect according to claim 1, wherein when a picture containing a credential is received, the feature point coordinates of the face in the credential included in the picture are obtained, and the coordinate cluster is obtained based on the feature point coordinates. The steps of the class center and the smallest enclosing rectangle, and obtaining the area of the smallest enclosing rectangle include:
    当接收到包含证件的图片时,通过预设神经网络提取所述证件中人脸的多个特征点,并获取多个所述特征点的特征点坐标;When a picture containing a document is received, extract multiple feature points of the face in the document through a preset neural network, and obtain the feature point coordinates of the multiple feature points;
    通过预设算法对所述证件中人脸的各所述特征点坐标进行聚类,得到所述证件中人脸的各所述特征点坐标的中心坐标,作为坐标聚类中心;Clustering the coordinate of each feature point of the face in the certificate by a preset algorithm, and obtain the center coordinate of the coordinate of each feature point of the face in the certificate as a coordinate clustering center;
    根据所述证件中人脸的各所述特征点坐标所在位置,确定最小外接矩形,并检测所述最小外接矩形的长和宽,通过所述最小外接矩形的长和宽计算得到所述最小外接矩形的面积。Determine the minimum circumscribed rectangle according to the position of each of the feature point coordinates of the face in the document, and detect the length and width of the minimum circumscribed rectangle, and calculate the minimum circumscribed rectangle by the length and width of the minimum circumscribed rectangle The area of the rectangle.
  7. 如权利要求1-6任一项所述的证件四角残缺检测方法,其中,所述基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界的步骤之前包括:The method for detecting the incompleteness of four corners of a document according to any one of claims 1 to 6, wherein the rectangular boundary of the document in the picture is calculated based on the area of the smallest bounding rectangle and the coordinate clustering center The steps before include:
    获取各个类型的标准证件的标准面积、标准长、标准宽、标准聚类中心和所述标准证件中人脸特征点的特征外接矩形的最小标准面积;Obtain the standard area, standard length, standard width, standard clustering center, and the minimum standard area of the feature circumscribed rectangle of the facial feature points in the standard certificate of each type of standard certificate;
    针对各个类型的所述标准证件逐一执行以下步骤:Perform the following steps one by one for each type of the standard certificate:
    基于所述标准长与所述最小标准面积,生成所述标准长与所述最小标准面积的第一比例关系,基于所述标准宽与所述最小标准面积,生成所述标准宽与所述最小标准面积的第二比例关系;Based on the standard length and the minimum standard area, generate a first proportional relationship between the standard length and the minimum standard area, and generate the standard width and the minimum standard width based on the standard width and the minimum standard area. The second proportional relationship of the standard area;
    基于所述标准长与所述标准聚类中心,生成所述标准聚类中心与所述标准长的第一相对位置关系,基于所述标准宽与所述标准聚类中心,生成所述标准聚类中心与所述标准宽的第二相对位置关系。Based on the standard length and the standard cluster center, a first relative positional relationship between the standard cluster center and the standard length is generated, and based on the standard width and the standard cluster center, the standard cluster is generated The second relative positional relationship between the class center and the standard width.
  8. 一种证件四角残缺检测装置,其中,所述证件四角残缺检测装置包括:A four-corner defect detection device of a document, wherein the four-corner defect detection device of a document includes:
    获取模块,用于当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与最小外接矩形,并获取所述最小外接矩形的面积;The obtaining module is used to obtain, when a picture containing a certificate is received, the coordinate of the feature point of the face in the certificate contained in the picture, obtain the coordinate clustering center and the minimum bounding rectangle based on the coordinate of the feature point, and obtain the minimum The area of the circumscribing rectangle;
    计算模块,用于基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界;A calculation module, configured to calculate the rectangular boundary of the certificate in the picture based on the area of the smallest bounding rectangle and the coordinate clustering center;
    提取模块,用于提取所述图片中由所述证件的矩形边界形成的矩形区域,并检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件。The extraction module is used to extract the rectangular area formed by the rectangular boundary of the certificate in the picture, and to detect whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, determine whether there are missing corners in the received picture. The certificate is incomplete.
  9. 一种证件四角残缺检测设备,其中,所述证件四角残缺检测设备包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的证件四角残缺检测程序,所述证件四角残缺检测程序被所述处理器执行时实现如下步骤:A four-corner defect detection device for a document, wherein the four-corner defect detection device includes a memory, a processor, and a four-corner defect detection program stored in the memory and running on the processor. When the detection program is executed by the processor, the following steps are implemented:
    当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与最小外接矩形,并获取所述最小外接矩形的面积;When a picture containing a certificate is received, obtaining the feature point coordinates of the face in the certificate included in the picture, obtaining the coordinate cluster center and the smallest bounding rectangle based on the characteristic point coordinates, and obtaining the area of the smallest bounding rectangle;
    基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界;Based on the area of the smallest bounding rectangle and the coordinate clustering center, the rectangular boundary of the certificate in the picture is calculated;
    提取所述图片中由所述证件的矩形边界形成的矩形区域,并检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件。Extract the rectangular area formed by the rectangular border of the certificate in the picture, and detect whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, it is determined that the certificate in the received picture is a broken certificate.
  10. 如权利要求9所述的证件四角残缺检测设备,其中,所述基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界的步骤包括:The four-corner defect detection device of the document according to claim 9, wherein the step of calculating the rectangular boundary of the document in the picture based on the area of the smallest bounding rectangle and the coordinate clustering center comprises:
    识别所述图片中证件的类型,并根据所述证件的类型确定与所述类型对应的目标标准证件,获取所述目标标准证件中目标外接矩形的目标标准面积;Identify the type of the certificate in the picture, determine the target standard certificate corresponding to the type according to the type of the certificate, and obtain the target standard area of the target circumscribed rectangle in the target standard certificate;
    基于所述目标标准证件的比例关系与所述最小外接矩形的面积,计算得到所述证件的长度和宽度,其中所述比例关系包括所述目标标准证件的目标标准长与所述目标标准面积之间的第一目标比例关系,以及所述目标标准证件的目标标准宽与所述目标标准面积之间的第二目标比例关系;Based on the proportional relationship between the target standard document and the area of the smallest circumscribed rectangle, the length and width of the certificate are calculated, wherein the proportional relationship includes the difference between the target standard length of the target standard certificate and the target standard area The first target proportional relationship between the two, and the second target proportional relationship between the target standard width of the target standard certificate and the target standard area;
    基于所述目标标准证件的相对位置关系、所述证件的长度和宽度,以及所述坐标聚类中心,确定所述证件的矩形边界,其中所述相对位置关系包括所述目标标准证件的目标标准长与所述目标标准证件的目标聚类中心之间的第一目标相对位置关系,以及所述目标标准证件的目标标准宽与所述目标标准证件的目标聚类中心之间的第二目标相对位置关系。Based on the relative position relationship of the target standard certificate, the length and width of the certificate, and the coordinate clustering center, the rectangular boundary of the certificate is determined, wherein the relative position relationship includes the target standard of the target standard certificate The first target relative positional relationship between the length and the target cluster center of the target standard certificate, and the second target relative between the target standard width of the target standard certificate and the target cluster center of the target standard certificate Positional relationship.
  11. 如权利要求10所述的证件四角残缺检测设备,其中,所述基于所述目标标准证件的相对位置关系、所述证件的长度和宽度,以及所述坐标聚类中心,确定所述证件的矩形边界的步骤包括:The four-corner defect detection device of the document according to claim 10, wherein the rectangle of the document is determined based on the relative position relationship of the target standard document, the length and width of the document, and the coordinate clustering center The boundary steps include:
    基于所述坐标聚类中心和所述第一目标相对位置关系,确定所述证件在所述图片中的长度边界方向;Determine the length boundary direction of the certificate in the picture based on the relative positional relationship between the coordinate clustering center and the first target;
    基于所述坐标聚类中心和所述第二目标相对位置关系,确定所述证件在所述图片中的宽度边界方向;Determine the width boundary direction of the document in the picture based on the relative positional relationship between the coordinate clustering center and the second target;
    基于所述证件的长度和所述长度边界方向确定所述证件的长度边界,以及基于所述证件的宽度和所述宽度边界方向确定所述证件的宽度边界,并由所述长度边界和所述宽度边界确定所述证件的矩形边界。The length boundary of the document is determined based on the length of the document and the direction of the length boundary, and the width boundary of the document is determined based on the width of the document and the direction of the width boundary. The width boundary determines the rectangular boundary of the document.
  12. 如权利要求9所述的证件四角残缺检测设备,其中,所述提取所述图片中由所述证件的矩形边界形成的矩形区域的步骤之后,所述证件四角残缺检测程序被所述处理器执行时还实现如下步骤:The four-corner defect detection device of the document according to claim 9, wherein, after the step of extracting the rectangular area formed by the rectangular boundary of the certificate in the picture, the four-corner defect detection program of the document is executed by the processor It also implements the following steps:
    获取所述矩形区域的长度和宽度,并计算与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素值中是否存在任一项大于预设阈值;Acquiring the length and width of the rectangular area, and calculating the pixel value corresponding to the length of the rectangular area, and whether any one of the pixel values corresponding to the width of the rectangular area is greater than a preset threshold;
    若与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素中存在任一项大于预设阈值,则将所述矩形区域按照第一预设切分方式切分为多个子图片,并将多个所述子图片中与所述矩形区域的四角区域对应的子图片作为目标子图片,以基于各所述目标子图片检测所述矩形区域的四角中是否存在缺角;If any one of the pixel value corresponding to the length of the rectangular area and the pixel corresponding to the width of the rectangular area is greater than the preset threshold, the rectangular area is divided according to the first preset segmentation method Is a plurality of sub-pictures, and the sub-pictures corresponding to the four corners of the rectangular area among the plurality of sub-pictures are used as target sub-pictures to detect whether there are defects in the four corners of the rectangular area based on each of the target sub-pictures. Horn;
    若与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素均小于或等于预设阈值,则将所述矩形区域按照第二预设切分方式切分为多个子图片,并将多个所述子图片作为目标子图片,以基于各所述目标子图片检测所述矩形区域的四角中是否存在缺角。If the pixel value corresponding to the length of the rectangular area and the pixel corresponding to the width of the rectangular area are both less than or equal to the preset threshold value, the rectangular area is divided into multiple segments according to the second preset segmentation method. And use multiple sub-pictures as target sub-pictures to detect whether there are missing corners in the four corners of the rectangular area based on each of the target sub-pictures.
  13. 如权利要求12所述的证件四角残缺检测设备,其中,所述检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件的步骤包括:The four-corner defect detection device of the document according to claim 12, wherein the step of detecting whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, determining that the certificate in the received picture is a defective certificate include:
    通过预设方式对各所述目标子图片进行逐一检测,确定所述目标子图片是否均包含有完整的证件角;Detect each of the target sub-pictures one by one through a preset method, and determine whether the target sub-pictures all include a complete ID corner;
    若所述目标子图片均包含有完整的证件角,则判定接收的所述图片有效;If the target sub-pictures all contain a complete ID corner, it is determined that the received picture is valid;
    若所述目标子图片中存在任意一张所述目标子图像中存在缺角,则确定接收的所述图片中的证件为残缺证件,判定接收的所述图片无效并输出重新采集的提示信息。If there is a missing corner in any one of the target sub-images in the target sub-picture, it is determined that the certificate in the received picture is a broken certificate, the received picture is determined to be invalid, and a re-collection prompt message is output.
  14. 如权利要求9所述的证件四角残缺检测设备,其中,所述当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类 中心与最小外接矩形,并获取所述最小外接矩形的面积的步骤包括:The four-corner defect detection device of the document according to claim 9, wherein when the picture containing the document is received, the feature point coordinates of the face in the document contained in the picture are obtained, and the coordinate cluster is obtained based on the feature point coordinates. The steps of the class center and the smallest enclosing rectangle, and obtaining the area of the smallest enclosing rectangle include:
    当接收到包含证件的图片时,通过预设神经网络提取所述证件中人脸的多个特征点,并获取多个所述特征点的特征点坐标;When a picture containing a document is received, extract multiple feature points of the face in the document through a preset neural network, and obtain the feature point coordinates of the multiple feature points;
    通过预设算法对所述证件中人脸的各所述特征点坐标进行聚类,得到所述证件中人脸的各所述特征点坐标的中心坐标,作为坐标聚类中心;Clustering the coordinate of each feature point of the face in the certificate by a preset algorithm, and obtain the center coordinate of the coordinate of each feature point of the face in the certificate as a coordinate clustering center;
    根据所述证件中人脸的各所述特征点坐标所在位置,确定最小外接矩形,并检测所述最小外接矩形的长和宽,通过所述最小外接矩形的长和宽计算得到所述最小外接矩形的面积。Determine the minimum circumscribed rectangle according to the position of each of the feature point coordinates of the face in the document, and detect the length and width of the minimum circumscribed rectangle, and calculate the minimum circumscribed rectangle by the length and width of the minimum circumscribed rectangle The area of the rectangle.
  15. 如权利要求9-14任一项所述的证件四角残缺检测设备,其中,所述基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界的步骤之前,所述证件四角残缺检测程序被所述处理器执行时还实现如下步骤:The four-corner defect detection device of the document according to any one of claims 9-14, wherein the rectangular boundary of the document in the picture is calculated based on the area of the smallest bounding rectangle and the coordinate clustering center Before the step, when the four corners of the credential defect detection program is executed by the processor, the following steps are also implemented:
    获取各个类型的标准证件的标准面积、标准长、标准宽、标准聚类中心和所述标准证件中人脸特征点的特征外接矩形的最小标准面积;Obtain the standard area, standard length, standard width, standard clustering center, and the minimum standard area of the feature circumscribed rectangle of the facial feature points in the standard certificate of each type of standard certificate;
    针对各个类型的所述标准证件逐一执行以下步骤:Perform the following steps one by one for each type of the standard certificate:
    基于所述标准长与所述最小标准面积,生成所述标准长与所述最小标准面积的第一比例关系,基于所述标准宽与所述最小标准面积,生成所述标准宽与所述最小标准面积的第二比例关系;Based on the standard length and the minimum standard area, generate a first proportional relationship between the standard length and the minimum standard area, and generate the standard width and the minimum standard width based on the standard width and the minimum standard area. The second proportional relationship of the standard area;
    基于所述标准长与所述标准聚类中心,生成所述标准聚类中心与所述标准长的第一相对位置关系,基于所述标准宽与所述标准聚类中心,生成所述标准聚类中心与所述标准宽的第二相对位置关系。Based on the standard length and the standard cluster center, a first relative positional relationship between the standard cluster center and the standard length is generated, and based on the standard width and the standard cluster center, the standard cluster is generated The second relative positional relationship between the class center and the standard width.
  16. 一种存储介质,其中,所述存储介质上存储有证件四角残缺检测程序,所述证件四角残缺检测程序被处理器执行时实现如下步骤:A storage medium, wherein a four-corner defect detection program of a document is stored on the storage medium, and the following steps are implemented when the four-corner defect detection program is executed by a processor:
    当接收到包含证件的图片时,获取所述图片包含的证件中人脸的特征点坐标,基于所述特征点坐标得到坐标聚类中心与最小外接矩形,并获取所述最小外接矩形的面积;When a picture containing a certificate is received, obtaining the feature point coordinates of the face in the certificate included in the picture, obtaining the coordinate cluster center and the smallest bounding rectangle based on the characteristic point coordinates, and obtaining the area of the smallest bounding rectangle;
    基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界;Based on the area of the smallest bounding rectangle and the coordinate clustering center, the rectangular boundary of the certificate in the picture is calculated;
    提取所述图片中由所述证件的矩形边界形成的矩形区域,并检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件。Extract the rectangular area formed by the rectangular border of the certificate in the picture, and detect whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, it is determined that the certificate in the received picture is a broken certificate.
  17. 如权利要求16所述的存储介质,其中,所述基于所述最小外接矩形的面积和所述坐标聚类中心,计算得到所述图片中所述证件的矩形边界的步骤包括:15. The storage medium according to claim 16, wherein the step of calculating the rectangular boundary of the certificate in the picture based on the area of the smallest bounding rectangle and the coordinate clustering center comprises:
    识别所述图片中证件的类型,并根据所述证件的类型确定与所述类型对应的目标标准证件,获取所述目标标准证件中目标外接矩形的目标标准面积;Identify the type of the certificate in the picture, determine the target standard certificate corresponding to the type according to the type of the certificate, and obtain the target standard area of the target circumscribed rectangle in the target standard certificate;
    基于所述目标标准证件的比例关系与所述最小外接矩形的面积,计算得到所述证件的长度和宽度,其中所述比例关系包括所述目标标准证件的目标标准长与所述目标标准面积之间的第一目标比例关系,以及所述目标标准证件的目标标准宽与所述目标标准面积之间的第二目标比例关系;Based on the proportional relationship between the target standard document and the area of the smallest circumscribed rectangle, the length and width of the certificate are calculated, wherein the proportional relationship includes the difference between the target standard length of the target standard certificate and the target standard area The first target proportional relationship between the two, and the second target proportional relationship between the target standard width of the target standard certificate and the target standard area;
    基于所述目标标准证件的相对位置关系、所述证件的长度和宽度,以及所述坐标聚类中心,确定所述证件的矩形边界,其中所述相对位置关系包括所述目标标准证件的目标标准长与所述目标标准证件的目标聚类中心之间的第一目标相对位置关系,以及所述目标标准证件的目标标准宽与所述目标标准证件的目标聚类中心之间的第二目标相对位置关系。Based on the relative position relationship of the target standard certificate, the length and width of the certificate, and the coordinate clustering center, the rectangular boundary of the certificate is determined, wherein the relative position relationship includes the target standard of the target standard certificate The first target relative positional relationship between the length and the target cluster center of the target standard certificate, and the second target relative between the target standard width of the target standard certificate and the target cluster center of the target standard certificate Positional relationship.
  18. 如权利要求17所述的存储介质,其中,所述基于所述目标标准证件的相对位置关系、所述证件的长度和宽度,以及所述坐标聚类中心,确定所述证件的矩形边界的步骤包括:The storage medium according to claim 17, wherein the step of determining the rectangular boundary of the document based on the relative positional relationship of the target standard document, the length and width of the document, and the coordinate clustering center include:
    基于所述坐标聚类中心和所述第一目标相对位置关系,确定所述证件在所述图片中的长度边界方向;Determine the length boundary direction of the certificate in the picture based on the relative positional relationship between the coordinate clustering center and the first target;
    基于所述坐标聚类中心和所述第二目标相对位置关系,确定所述证件在所述图片中的宽度边界方向;Determine the width boundary direction of the document in the picture based on the relative positional relationship between the coordinate clustering center and the second target;
    基于所述证件的长度和所述长度边界方向确定所述证件的长度边界,以及基于所述证件的宽度和所述宽度边界方向确定所述证件的宽度边界,并由所述长度边界和所述宽度边界确定所述证件的矩形边界。The length boundary of the document is determined based on the length of the document and the direction of the length boundary, and the width boundary of the document is determined based on the width of the document and the direction of the width boundary. The width boundary determines the rectangular boundary of the document.
  19. 如权利要求16所述的存储介质,其中,所述提取所述图片中由所述证件的矩形边界形成的矩形区域的步骤之后,所述证件四角残缺检测程序被处理器执行时还实现如下步骤:The storage medium according to claim 16, wherein, after the step of extracting the rectangular area formed by the rectangular boundary of the certificate in the picture, the program for detecting the four corners of the certificate is executed by the processor further implements the following steps :
    获取所述矩形区域的长度和宽度,并计算与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素值中是否存在任一项大于预设阈值;Acquiring the length and width of the rectangular area, and calculating the pixel value corresponding to the length of the rectangular area, and whether any one of the pixel values corresponding to the width of the rectangular area is greater than a preset threshold;
    若与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素中存在任一项大于预设阈值,则将所述矩形区域按照第一预设切分方式切分为多个子图片,并将多个所述子图片中与所述矩形区域的四角区域对应的子图片作为目标子图片,以基于各所述目标子图片检测所述矩形区域的四角中是否存在缺角;If any one of the pixel value corresponding to the length of the rectangular area and the pixel corresponding to the width of the rectangular area is greater than the preset threshold, the rectangular area is divided according to the first preset segmentation method Is a plurality of sub-pictures, and the sub-pictures corresponding to the four corners of the rectangular area among the plurality of sub-pictures are used as target sub-pictures to detect whether there are defects in the four corners of the rectangular area based on each of the target sub-pictures. Horn;
    若与所述矩形区域的长度对应的像素值,和与所述矩形区域的宽度对应的像素均小于或等于预设阈值,则将所述矩形区域按照第二预设切分方式切分为多个子图片,并将多个所述子图片作为目标子图片,以基于各所述目标子图片检测所述矩形区域的四角中是否存在缺角。If the pixel value corresponding to the length of the rectangular area and the pixel corresponding to the width of the rectangular area are both less than or equal to the preset threshold value, the rectangular area is divided into multiple segments according to the second preset segmentation method. And use multiple sub-pictures as target sub-pictures to detect whether there are missing corners in the four corners of the rectangular area based on each of the target sub-pictures.
  20. 如权利要求19所述的存储介质,其中,所述检测所述矩形区域的四角中是否存在缺角,若存在缺角则判定接收到的所述图片中的证件为残缺证件的步骤包括:The storage medium according to claim 19, wherein the step of detecting whether there are missing corners in the four corners of the rectangular area, and if there are missing corners, determining that the certificate in the received picture is a broken certificate comprises:
    通过预设方式对各所述目标子图片进行逐一检测,确定所述目标子图片是否均包含有完整的证件角;Detect each of the target sub-pictures one by one through a preset method, and determine whether the target sub-pictures all include a complete ID corner;
    若所述目标子图片均包含有完整的证件角,则判定接收的所述图片有效;If the target sub-pictures all contain a complete ID corner, it is determined that the received picture is valid;
    若所述目标子图片中存在任意一张所述目标子图像中存在缺角,则确定接收的所述图片中的证件为残缺证件,判定接收的所述图片无效并输出重新采集的提示信息。If there is a missing corner in any one of the target sub-images in the target sub-picture, it is determined that the certificate in the received picture is a broken certificate, the received picture is determined to be invalid, and a re-collection prompt message is output.
PCT/CN2020/135850 2020-04-24 2020-12-11 Defect detection method and apparatus for four corners of certificate, and device and storage medium WO2021212873A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010336193.3A CN111553251A (en) 2020-04-24 2020-04-24 Certificate four-corner incomplete detection method, device, equipment and storage medium
CN202010336193.3 2020-04-24

Publications (1)

Publication Number Publication Date
WO2021212873A1 true WO2021212873A1 (en) 2021-10-28

Family

ID=72000264

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/135850 WO2021212873A1 (en) 2020-04-24 2020-12-11 Defect detection method and apparatus for four corners of certificate, and device and storage medium

Country Status (2)

Country Link
CN (1) CN111553251A (en)
WO (1) WO2021212873A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117036735A (en) * 2023-10-08 2023-11-10 超创数能科技有限公司 Performance detection method and device for porcelain product based on air hole identification

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111553251A (en) * 2020-04-24 2020-08-18 平安科技(深圳)有限公司 Certificate four-corner incomplete detection method, device, equipment and storage medium
CN112541899B (en) * 2020-12-15 2023-12-22 平安科技(深圳)有限公司 Incomplete detection method and device of certificate, electronic equipment and computer storage medium
CN112883959B (en) * 2021-01-21 2023-07-25 平安银行股份有限公司 Identity card integrity detection method, device, equipment and storage medium
CN113313726A (en) * 2021-06-28 2021-08-27 安徽信息工程学院 Method and system for identifying social security card

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN202815870U (en) * 2012-04-28 2013-03-20 王浩 Certificate photograph and face automatic identification system
KR101792001B1 (en) * 2017-01-02 2017-11-01 주식회사 올아이티탑 Algorithm and system and method of certification card checking fingerprint for nfc and picture
CN107358187A (en) * 2017-07-04 2017-11-17 四川云物益邦科技有限公司 A kind of certificate photograph recognition methods
CN110766007A (en) * 2019-10-28 2020-02-07 深圳前海微众银行股份有限公司 Certificate shielding detection method, device and equipment and readable storage medium
CN111553251A (en) * 2020-04-24 2020-08-18 平安科技(深圳)有限公司 Certificate four-corner incomplete detection method, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN202815870U (en) * 2012-04-28 2013-03-20 王浩 Certificate photograph and face automatic identification system
KR101792001B1 (en) * 2017-01-02 2017-11-01 주식회사 올아이티탑 Algorithm and system and method of certification card checking fingerprint for nfc and picture
CN107358187A (en) * 2017-07-04 2017-11-17 四川云物益邦科技有限公司 A kind of certificate photograph recognition methods
CN110766007A (en) * 2019-10-28 2020-02-07 深圳前海微众银行股份有限公司 Certificate shielding detection method, device and equipment and readable storage medium
CN111553251A (en) * 2020-04-24 2020-08-18 平安科技(深圳)有限公司 Certificate four-corner incomplete detection method, device, equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117036735A (en) * 2023-10-08 2023-11-10 超创数能科技有限公司 Performance detection method and device for porcelain product based on air hole identification
CN117036735B (en) * 2023-10-08 2024-01-30 超创数能科技有限公司 Performance detection method and device for porcelain product based on air hole identification

Also Published As

Publication number Publication date
CN111553251A (en) 2020-08-18

Similar Documents

Publication Publication Date Title
WO2021212873A1 (en) Defect detection method and apparatus for four corners of certificate, and device and storage medium
US20200410074A1 (en) Identity authentication method and apparatus, electronic device, and storage medium
WO2018028546A1 (en) Key point positioning method, terminal, and computer storage medium
US9760788B2 (en) Mobile document detection and orientation based on reference object characteristics
EP2803016B1 (en) Systems and methods for mobile image capture and processing
WO2020233035A1 (en) Information verification method and related apparatus
AU2012200238B2 (en) Methods and Systems of Authentication
US10410053B2 (en) Method, apparatus, system, and storage medium for detecting information card in image
WO2021017272A1 (en) Pathology image annotation method and device, computer apparatus, and storage medium
WO2018205789A1 (en) Method and apparatus for recognizing card placement direction, and image processing apparatus
WO2022156178A1 (en) Image target comparison method and apparatus, computer device and readable storage medium
US10769489B2 (en) Reading test cards using a mobile device
WO2021147219A1 (en) Image-based text recognition method and apparatus, electronic device, and storage medium
EP4120121A1 (en) Face liveness detection method, system and apparatus, computer device, and storage medium
WO2021189853A1 (en) Flash light spot position recognition method and apparatus, and electronic device and storage medium
CN114359553B (en) Signature positioning method and system based on Internet of things and storage medium
WO2021218183A1 (en) Certificate edge detection method and apparatus, and device and medium
CN110795714A (en) Identity authentication method and device, computer equipment and storage medium
CN113673500A (en) Certificate image recognition method and device, electronic equipment and storage medium
CN112528954A (en) Certificate image character extraction method
CN114694161A (en) Text recognition method and equipment for specific format certificate and storage medium
CN112396047B (en) Training sample generation method and device, computer equipment and storage medium
WO2021051942A1 (en) Information addition method and related apparatus
KR102252286B1 (en) Apparatus and method for detecting and recognizing changes in image documents
CN113239339A (en) Certificate shooting method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20932000

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20932000

Country of ref document: EP

Kind code of ref document: A1