Document edge detection method, device, equipment and medium

The facial recognition model extracts the subject image of the certificate and inputs it to the edge detection model. Combined with discrete point classification and support vector machine, the problem of large recognition errors in the edge detection of the certificate is solved, and the accuracy of document information recognition and edge detection are improved. sex.

CN111582134BActive Publication Date: 2024-11-26PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010362784.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-30
Publication Date
2024-11-26
Estimated Expiration
2040-04-30

AI Technical Summary

Technical Problem

The prior art has a problem of large identification errors in document edge detection, especially when the edge is incomplete or damaged, resulting in information identification errors.

Method used

By obtaining the target image, using the face recognition model to extract face feature points, determine face photos, and extract the subject image of the certificate based on the photo information, input it to the edge detection model, analyze the edge segment of the card, output the edge detection results of the certificate, and combine it with discrete points Classification and support vector machines perform angle detection.

Benefits of technology

It improves the accuracy of document edge detection and information identification, and is suitable for various document types, especially when the edge is incomplete, it can effectively identify and output the detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111582134B_ABST
    Figure CN111582134B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of financial technology, and discloses a method, device, equipment and medium for detecting the edge of a certificate. The method comprises: upon receiving an image certificate edge detection request, obtaining a target image associated with the image certificate edge detection request; inputting the target image into a preset face recognition model, extracting face feature points in the target image, and determining a face photo in the target image based on the face feature points and the feature coordinates of the face feature points; extracting a certificate main body image containing a face photo from the target image based on the photo information of the face photo; inputting the certificate main body image into a preset edge detection model, obtaining a card edge segment, analyzing the card edge segment, and outputting a certificate edge detection result. The present invention improves the accuracy of certificate edge detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of financial technology (Fintech), and in particular to a document edge detection method, device, equipment and medium. Background Art

[0002] With the development of artificial intelligence, there are more and more scenarios for artificial intelligence to analyze documents.

[0003] In research fields such as image processing and analysis, pattern recognition, and computer vision, it is usually necessary to extract the complete outline of the target area in order to obtain a lot of valuable information about the target. For example, image processing algorithms are currently used to identify ID card scan images. By identifying the ID card edge lines in the ID card scan images, and then identifying the information in the ID card, the effective identification of the edge of the document can improve the accuracy of subsequent card analysis. The existing recognition of edge lines in images is mainly based on the shape of the image. However, when the edge of the document is incomplete or damaged, it will lead to large recognition errors. Summary of the invention

[0004] The main purpose of the present invention is to propose a document edge detection method, device, equipment and medium, aiming to solve the technical problem that the current document edge detection is inaccurate, resulting in incorrect document information recognition.

[0005] To achieve the above object, the present invention provides a document edge detection method, which comprises the following steps:

[0006] Upon receiving an image document edge detection request, obtaining a target image associated with the image document edge detection request;

[0007] Input the target image into a preset face recognition model, extract facial feature points in the target image, and determine a face photo in the target image based on the facial feature points and feature coordinates of the facial feature points;

[0008] Extracting a main body image of the certificate including the face photo from the target image according to the photo information of the face photo;

[0009] The main body image of the certificate is input into a preset edge detection model to obtain the card edge line segment, the card edge line segment is analyzed, and the certificate edge detection result is output.

[0010] Optionally, after the step of acquiring a target image associated with the image document edge detection request when receiving the image document edge detection request, the method includes:

[0011] Inputting the target image into a preset edge detection model, outputting a line segment recognition result, and judging whether there is a straight line in the target image according to the line segment recognition result;

[0012] If there is a straight line in the target image, the tilt angle of the target image is determined according to the straight line and the direct projection, and the target image is moved in the opposite direction according to the tilt angle.

[0013] Optionally, the step of inputting the target image into a preset face recognition model, extracting facial feature points in the target image, and determining a face photo in the target image according to the facial feature points and feature coordinates of the facial feature points includes:

[0014] Inputting the target image into a preset face recognition model, obtaining a recognition result and determining whether the target image contains a face image according to the recognition result;

[0015] If the target image does not contain a face image, the target image is input into a preset edge detection model to obtain a card edge segment, analyze the card edge segment, and output a document edge detection result;

[0016] If the target image includes a face image, facial feature points in the target image are extracted, and a face photo in the target image is determined based on the facial feature points and feature coordinates of the facial feature points.

[0017] Optionally, the step of extracting the main body image of the certificate including the face photo from the target image according to the photo information of the face photo comprises:

[0018] Acquire photo information of the face photo, wherein the photo information includes location information and size information of the face photo;

[0019] Query a preset person-document mapping table to obtain the document type corresponding to the location information, and determine the document size information according to the document type and the size information of the face photo;

[0020] According to the document size information and the photo information of the face photo, a main document image including the face photo is extracted from the target image.

[0021] Optionally, the step of inputting the document main body image into a preset edge detection model, obtaining a card edge segment, analyzing the card edge segment, and outputting a document edge detection result includes:

[0022] Inputting the main body image of the certificate into a preset edge detection model to obtain the card edge segment;

[0023] Processing each of the card edge segments according to a preset discrete point classification statistical algorithm to obtain the midpoint of the card edge segment;

[0024] The midpoint is subjected to the nearest four-class classification, the points on the edge line segment of the card corresponding to the same midpoint are taken as a cluster, the abnormal points in each cluster are deleted, and the remaining points in each cluster are subjected to the support vector machine binary classification;

[0025] Count the distances from all points in each cluster to the support vector, cube the distance and divide it by the number of all points in this cluster to obtain a calculation result, and compare the calculation result with a preset threshold;

[0026] If the calculation result is greater than a preset threshold, the detection result of the card edge chipping is output.

[0027] Optionally, the step of inputting the document main body image into a preset edge detection model, obtaining a card edge segment, analyzing the card edge segment, and outputting a document edge detection result includes:

[0028] Inputting the main body image of the certificate into a preset edge detection model to obtain the card edge segment;

[0029] Obtaining the number of pixels contained in each of the card edge segments, and comparing the number of pixels with a preset number of pixels;

[0030] Delete the noise card edge line segments whose number of pixels is less than the preset number of pixels, process the remaining card edge line segments according to the preset clustering algorithm, and obtain the number of card edge line segments;

[0031] If the number of line segments is greater than 4, the detection result of the missing corners on the edge of the card is output.

[0032] Optionally, after the step of inputting the main body image of the certificate into a preset edge detection model, obtaining a card edge segment, analyzing the card edge segment, and outputting a certificate edge detection result, the method further comprises:

[0033] Performing text recognition on the rectangular area enclosed by the edge segments of the card to obtain text information contained in the main image of the certificate;

[0034] The target image is classified and saved in a corresponding document image database according to the text information.

[0035] In addition, to achieve the above-mentioned purpose, the present invention further provides a document edge detection device, the document edge detection device comprising:

[0036] A request receiving module, configured to, upon receiving an image document edge detection request, obtain a target image associated with the image document edge detection request;

[0037] A face recognition module, used to input the target image into a preset face recognition model, extract facial feature points in the target image, and determine a face photo in the target image based on the facial feature points and feature coordinates of the facial feature points;

[0038] The certificate image extraction module is used to extract the certificate main body image containing the face photo from the target image according to the photo information of the face photo;

[0039] The result output module is used to input the main image of the certificate into a preset edge detection model, obtain the card edge segment, analyze the card edge segment, and output the certificate edge detection result.

[0040] In addition, to achieve the above-mentioned purpose, the present invention also provides a certificate edge detection device, which includes: a memory, a processor, and a computer program corresponding to the certificate edge detection stored in the memory and executable on the processor, and the computer program corresponding to the certificate edge detection is executed by the processor to implement the steps of the certificate edge detection method as described above.

[0041] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which a computer program corresponding to document edge detection is stored. When the computer program corresponding to document edge detection is executed by a processor, the steps of the document edge detection method as described above are implemented.

[0042] The present invention provides a document edge detection method, device, equipment and medium. In an embodiment of the present invention, when an image document edge detection request is received, a target image associated with the image document edge detection request is obtained; the target image is input into a preset face recognition model, face feature points in the target image are extracted, and a face photo in the target image is determined according to the face feature points and the feature coordinates of the face feature points; a document main body image containing a face photo is extracted from the target image according to the photo information of the face photo; the document main body image is input into a preset edge detection model, a card edge segment is obtained, the card edge segment is analyzed, and a document edge detection result is output. In this embodiment, by identifying the face photo in the target image, the document main body image is extracted in reverse according to the face photo, so that the document main body image is input into the preset edge detection model, a card edge segment is obtained, the card edge segment is analyzed, and the document edge detection result is output, thereby improving the accuracy of the document edge detection in the target image and further improving the accuracy of the document information recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention;

[0044] Figure 2 It is a flowchart of the first embodiment of the document edge detection method of the present invention;

[0045] Figure 3 This is a schematic diagram of the functional modules of an embodiment of a document edge detection device of the present invention.

[0046] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0047] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0048] like Figure 1 As shown, Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention.

[0049] The document edge detection device in the embodiment of the present invention may be a server device, such as Figure 1 As shown, the document edge detection device 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 realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the 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 stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0050] Those skilled in the art will understand that Figure 1 The device structure shown in the figure does not constitute a limitation of the device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0051] like Figure 1 As shown, the memory 1005 as a computer storage medium may include computer programs corresponding to the operation network communication module, the user interface module and the document edge detection.

[0052] exist Figure 1In the device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the computer program corresponding to the document edge detection stored in the memory 1005, and execute the operations in the following document edge detection method.

[0053] Based on the above hardware structure, an embodiment of the document edge detection method of the present invention is proposed.

[0054] Reference Figure 2 , Figure 2 This is a flow chart of a first embodiment of a method for detecting an edge of a certificate according to the present invention. In this embodiment, the method for detecting an edge of a certificate includes:

[0055] Step S10: upon receiving an image document edge detection request, obtaining a target image associated with the image document edge detection request.

[0056] In this embodiment, the document edge detection method is applied to document edge detection equipment in financial institutions (banks, insurance institutions, securities institutions, etc.) in the financial industry.

[0057] The document edge detection device receives an image document edge detection request, and the triggering method of the image document edge detection request is not specifically limited, that is, the image document edge detection request can be actively triggered by the user, for example, the user clicks the "edge detection" button on the display page of the document edge detection device to actively trigger the image document edge detection request; in addition, the image document edge detection request can also be automatically triggered, for example, the document edge detection device is pre-set: when a new document scan image is received, the image document edge detection request is automatically triggered.

[0058] The document edge detection device receives an image document edge detection request, and obtains a target image associated with the image document edge detection request. It can be understood that in this embodiment, the target image includes card information and may also include other information besides the card. In addition, the color and size of the target image are not specifically limited. For example, the target image can be color or black and white.

[0059] Step S20, inputting the target image into a preset face recognition model, extracting facial feature points in the target image, and determining a face photo in the target image based on the facial feature points and feature coordinates of the facial feature points.

[0060] A face recognition model is preset in the ID card edge detection device, that is, the ID card edge detection device uses the face image as sample data, and pre-trains according to the face image to obtain a preset face recognition model. The ID card edge detection device inputs the target image into the preset face recognition model, processes the target image through the preset face recognition model, extracts the face feature points in the target image, obtains the feature coordinates of the face feature points, and determines the face photo in the target image according to the face feature points and the feature coordinates of the face feature points. That is, the ID card edge detection device analyzes the feature point coordinates of the face feature points according to the clustering algorithm to obtain a cluster center (x0, y0). Then, the ID card edge detection device obtains a minimum circumscribed rectangle according to the feature coordinates of each face feature point, and the ID card edge detection device uses this circumscribed rectangle as the face photo in the target image.

[0061] Step S30: extracting the main body image of the certificate including the face photo from the target image according to the photo information of the face photo.

[0062] The document edge detection device extracts the document main body image including the face photo from the target image according to the photo information of the face photo. The implementation method is not specifically limited:

[0063] Implementation method 1: The document edge detection device first reduces and enlarges the standard document (the standard document can be an identity card, a library card, a student card or a passport, etc.) to obtain the minimum circumscribed rectangle of multiple document areas, document length, width and facial feature points, and the coordinates of the cluster center. The document edge detection device saves the proportional relationship between the document length and width and the corresponding aspect ratio of the circumscribed rectangle and the coordinates of the cluster center, as well as the proportional relationship between the cluster center and the distance from the cluster center to the document. The document edge detection device records the proportional relationship to generate a preset document face ratio mapping table. Then, the document edge detection device obtains the document body containing the face photo in the target image according to the face photo and the preset document face ratio mapping table. For example, the document edge detection device records the ratio of the library card face image to the document body in the preset document face ratio mapping table as 1:6. When the document edge detection device determines that the size of the face photo is 2cm*3cm, the document edge detection device obtains a 4cm*9cm area as the document body image according to the document face ratio mapping relationship.

[0064] Implementation method 2: The document edge detection device determines the document main body image according to the coordinate relationship between the coordinates of the face image and the document main body in the target image. That is, the document edge detection device obtains the coordinates x1, y1 of the face image, and the document edge detection device obtains the coordinates x2, y2 of the document main body; the document edge detection device obtains the document main body image containing the face photo in the target image according to x1 < x2, y1 < y2, and x1 - (x2 - x1) / a, x2 + (x2 - x1) / a, y1 - (y2 - y1) / a, y2 + (y2 - y1) / a, where the value of a can be taken around 30 (it can also be changed in different situations).

[0065] In addition, Implementation method 3 is also given in this embodiment. In this embodiment, step S20 includes:

[0066] Step a1, obtain the photo information of the face photo, where the photo information includes the position information and size information of the face photo;

[0067] Step a2, query the preset human-document mapping table, obtain the document type corresponding to the position information, and determine the document size information according to the document type and the size information of the face photo;

[0068] Step a3, extract the document main body image containing the face photo from the target image according to the document size information and the photo information of the face photo.

[0069] That is, the document edge detection device obtains the photo information of the face photo, where the photo information includes the position information and size information of the face photo; the document edge detection device queries the preset human-document mapping table (the preset human-document mapping table refers to the mapping table of photo position information and document types set in advance), obtains the document type corresponding to the position information, and the document edge detection device determines the document size information according to the document type and the size information of the face photo; the document edge detection device extracts the document main body image containing the face photo from the target image according to the document size information and the photo information of the face photo.

[0070] In this embodiment, according to the photo information of the face photo, the document main body image containing the face photo is extracted, and the document main body image is input into the preset edge detection model for document edge detection. In this embodiment, only the document main body image is processed, reducing the data processing volume and further improving the efficiency and accuracy of edge detection.

[0071] Step S40, input the document main body image into the preset edge detection model to obtain the card edge line segment, analyze the card edge line segment, and output the document edge detection result.

[0072] The certificate edge detection device has a preset edge detection model, which refers to a preset line segment monitoring algorithm. The certificate edge detection device inputs the main image of the certificate into the preset edge detection model to obtain the card edge segments. The certificate edge detection device analyzes the card edge segments to determine whether the card edge segments form a matrix. If the card edge segments form a matrix, the certificate edge detection device outputs that the certificate edge is complete. If the card edge segments do not form a matrix, the certificate edge detection device outputs that the certificate edge is incomplete.

[0073] In this embodiment, by identifying the face photo in the target image, the main image of the certificate is extracted in reverse based on the face photo, and then the main image of the certificate is input into a preset edge detection model to obtain the card edge segments, analyze the card edge segments, and output the certificate edge detection results, thereby improving the accuracy of the certificate edge detection in the target image and further improving the accuracy of the certificate information recognition.

[0074] Furthermore, based on the first embodiment of the method for detecting an edge of a certificate of the present invention, a second embodiment of the method for detecting an edge of a certificate of the present invention is proposed.

[0075] This embodiment is the step after step S10 in the first embodiment. The difference between this embodiment and the above embodiment is that:

[0076] Inputting the target image into a preset face recognition model, obtaining a recognition result and determining whether the target image contains a face image according to the recognition result;

[0077] If the target image does not contain a face image, the target image is input into a preset edge detection model to obtain a card edge segment, analyze the card edge segment, and output a document edge detection result;

[0078] If the target image includes a face image, facial feature points in the target image are extracted, and a face photo in the target image is determined based on the facial feature points and feature coordinates of the facial feature points.

[0079] It is understandable that some certificates do not contain facial images. If the scheme in the first embodiment is directly executed, recognition errors may occur. In order to improve the accuracy of certificate edge detection, the certificate edge detection device inputs the target image into a preset face recognition model (the preset face recognition model is the same as the first embodiment and is not repeated in this embodiment) to obtain a recognition result (the recognition result refers to whether the facial feature information is extracted). The certificate edge detection device determines whether the target image contains a facial image based on the recognition result; if the target image does not contain a facial image, the certificate edge detection device inputs the target image into a preset edge detection model to obtain a card edge segment, and the certificate edge detection device analyzes the card edge segment and outputs the certificate edge detection result; if the target image contains a facial image, the certificate edge detection device extracts facial feature points in the target image, and the certificate edge detection device determines the facial photo in the target image based on the facial feature points and the feature coordinates of the facial feature points. In this embodiment, when the document does not contain a face image, the preset face recognition model can also be used for accurate recognition, so that the application scope of the document edge detection is wider.

[0080] Furthermore, based on the above-mentioned embodiments of the method for detecting an edge of a certificate of the present invention, a third embodiment of the method for detecting an edge of a certificate of the present invention is proposed.

[0081] This embodiment is the step after step S10 in the first embodiment. The difference between this embodiment and the above embodiment is that:

[0082] Inputting the target image into a preset edge detection model, outputting a line segment recognition result, and judging whether there is a straight line in the target image according to the line segment recognition result;

[0083] If there is a straight line in the target image, the tilt angle of the target image is determined according to the straight line and the direct projection, and the target image is moved in the opposite direction according to the tilt angle.

[0084] Specifically, the document edge detection device inputs the target image into a preset edge detection model. The document edge detection device first performs straight line detection on the target image. The document edge detection device transforms each pixel coordinate point into a unified measurement that contributes to the characteristics of the straight line. For example, a straight line in the target image is a collection of a series of discrete points. The document edge detection device expresses the discrete point geometric equation of the straight line through the straight line discrete polar coordinate formula as follows: X*cos(theta)+y*sin(theta)=r, where the angle theta refers to the angle between r and the X-axis, and r is the geometric perpendicular distance to the straight line. Any point x, y on the straight line can be expressed, where r and theta are constants. In the field of image processing, the pixel coordinates P(x,y) of the image are known, and r,theta is the variable to be found. If the ID edge detection device plots the value of each pixel point (r,theta) according to the pixel point coordinate P(x,y) value, then the ID edge detection device converts the image Cartesian coordinates to the polar coordinate Hough space. This transformation from point to curve is called the Hough transform of the line. The transformation is performed by quantizing the Hough parameter space into a finite number of value intervals and equally dividing or accumulating grids. When the Hough transform algorithm starts, each pixel coordinate point P(x,y) is converted to the curve point of (r,theta) and accumulated to the corresponding grid data point. When a peak appears, it means that a straight line exists. When the ID edge detection device determines that a straight line exists, the ID edge detection device projects the straight line to obtain the projection line corresponding to the straight line. The ID edge detection device obtains the inclination angle of the straight line according to the cosine theorem. The ID edge detection device rotates the target image according to the inclination angle to complete the angle correction of the target image. In this embodiment, the document edge detection device recognizes and rotates the target image, thereby improving the recognition accuracy.

[0085] Furthermore, based on the above-mentioned embodiments of the method for detecting an edge of a certificate of the present invention, a fourth embodiment of the method for detecting an edge of a certificate of the present invention is proposed.

[0086] This embodiment is a refinement of step S40 in the first embodiment. The difference between this embodiment and the above embodiment is that:

[0087] Implementation method 1:

[0088] Inputting the main body image of the certificate into a preset edge detection model to obtain the card edge segment;

[0089] Processing each of the card edge segments according to a preset discrete point classification statistical algorithm to obtain the midpoint of the card edge segment;

[0090] The midpoint is subjected to the nearest four-class classification, the points on the edge line segment of the card corresponding to the same midpoint are taken as a cluster, the abnormal points in each cluster are deleted, and the remaining points in each cluster are subjected to the support vector machine binary classification;

[0091] Count the distances from all points in each cluster to the support vector, cube the distance and divide it by the number of all points in this cluster to obtain a calculation result, and compare the calculation result with a preset threshold;

[0092] If the calculation result is greater than a preset threshold, the detection result of the card edge chipping is output.

[0093] The document edge detection device inputs the main image of the document into the preset edge detection model to obtain the card edge segment. The document edge detection device takes the midpoint of all the card edge segments according to the discrete point classification statistical algorithm, and performs k-nearest neighbor four-classification on all the midpoints. At the same time, all the points of the line segment corresponding to this midpoint belong to this cluster. Then, the document edge detection device removes the abnormal points from each cluster after classification, and then performs support vector machine binary classification. The document edge detection device counts the distance from all points in each cluster to the support vector, and the document edge detection device takes the cube and divides it by the number of all points in this cluster. If the final cube sum is greater than the threshold p0 (P0 is a critical value based on the statistics of normal images without missing corners (the threshold p0 can be 100)), the document edge detection device determines that the card edge segment is missing a corner and outputs a prompt message, otherwise.

[0094] Implementation method 2:

[0095] Inputting the main body image of the certificate into a preset edge detection model to obtain the card edge segment;

[0096] Obtaining the number of pixels contained in each of the card edge segments, and comparing the number of pixels with a preset number of pixels;

[0097] Delete the noise card edge line segments whose number of pixels is less than the preset number of pixels, process the remaining card edge line segments according to the preset clustering algorithm, and obtain the number of card edge line segments;

[0098] If the number of line segments is greater than 4, the detection result of the missing corners on the edge of the card is output.

[0099] The certificate edge detection device inputs the certificate main body image into the preset edge detection model to obtain the card edge line segment. The certificate edge detection device obtains the number of pixels contained in each card edge line segment, compares the number of pixels with the preset number of points, and determines whether the length of the card edge line segment is greater than the preset number of points, wherein the preset number of points can be the length of 10 pixels. If the length of the card edge line segment is less than the preset number of points, it is deleted. The certificate edge detection device obtains the vertex coordinates of the remaining pixel points, and then uses the k-nearest neighbor algorithm to cluster according to 4 categories to obtain the number of line segments that determine the card edge line segment. The certificate edge detection device determines whether the number of line segments of the card edge line segment is greater than 4. If the number of card edge line segments is greater than 4, it can be considered that the edge is incomplete, otherwise.

[0100] Furthermore, based on the above-mentioned embodiments of the document edge detection method of the present invention, a fifth embodiment of the document edge detection method of the present invention is proposed.

[0101] This embodiment is the step after step S40 in the first embodiment. The difference between this embodiment and the above embodiment is that:

[0102] Performing text recognition on the rectangular area enclosed by the edge segments of the card to obtain text information contained in the main image of the certificate;

[0103] The target image is classified and saved in a corresponding document image database according to the text information.

[0104] The document edge detection device performs text recognition on the rectangular area enclosed by the card edge segments to obtain the text information contained in the main image of the document. In this embodiment, the text recognition method is not limited. For example, the text recognition method can be OCR (Optical Character Recognition). The document edge detection device determines the type of document in the target image based on the text information, and then saves the target image to the corresponding document image database based on the type of document. In this embodiment, the document edge detection device classifies and saves the target image, which can facilitate user search.

[0105] Reference Figure 3 The present invention also provides a document edge detection device, the document edge detection device comprising:

[0106] The request receiving module 10 is used to obtain a target image associated with the image document edge detection request upon receiving the image document edge detection request;

[0107] The face recognition module 20 is used to input the target image into a preset face recognition model, extract the face feature points in the target image, and determine the face photo in the target image according to the face feature points and the feature coordinates of the face feature points;

[0108] The certificate image extraction module 30 is used to extract the certificate main body image including the face photo from the target image according to the photo information of the face photo;

[0109] The result output module 40 is used to input the document main body image into a preset edge detection model, obtain the card edge line segment, analyze the card edge line segment, and output the document edge detection result.

[0110] In one embodiment, the document edge detection device comprises:

[0111] A line segment recognition module, used to input the target image into a preset edge detection model, output a line segment recognition result, and determine whether there is a straight line in the target image according to the line segment recognition result;

[0112] The image moving module is used to determine the tilt angle of the target image according to the straight line and the direct projection if there is a straight line in the target image, and move the target image in the opposite direction according to the tilt angle.

[0113] In one embodiment, the face recognition module 20 includes:

[0114] A recognition and judgment unit, used for inputting the target image into a preset face recognition model, obtaining a recognition result and judging whether the target image contains a face image according to the recognition result;

[0115] An input detection unit, configured to input the target image into a preset edge detection model if the target image does not contain a face image, obtain a card edge segment, analyze the card edge segment, and output a document edge detection result;

[0116] The extraction and determination unit is used to extract facial feature points in the target image if the target image contains a facial image, and determine the facial photo in the target image based on the facial feature points and the feature coordinates of the facial feature points.

[0117] In one embodiment, the document image extraction module 30 includes:

[0118] An information acquisition unit is used to acquire photo information of the face photo, wherein the photo information includes location information and size information of the face photo;

[0119] A query and determination unit, configured to query a preset person-document mapping table, obtain the document type corresponding to the location information, and determine the document size information according to the document type and the size information of the face photo;

[0120] The image extraction unit is used to extract the main body image of the certificate including the face photo from the target image according to the certificate size information and the photo information of the face photo.

[0121] In one embodiment, the result output module 40 includes:

[0122] An image input unit, used to input the main body image of the certificate into a preset edge detection model to obtain a card edge segment;

[0123] A classification processing unit, used for processing each of the card edge segments according to a preset discrete point classification statistical algorithm to obtain the midpoint of the card edge segment;

[0124] A deletion classification unit is used to perform neighbor four-classification on the midpoint, take the points on the card edge line segment corresponding to the same midpoint as a cluster, delete the abnormal points in each cluster, and perform support vector machine binary classification on the remaining points in each cluster;

[0125] A statistical comparison unit, used for counting the distances from all points in each cluster to the support vector, cubing the distance and dividing it by the number of all points in the cluster to obtain a calculation result, and comparing the calculation result with a preset threshold;

[0126] The result output unit is used to output the detection result of the card edge chipping if the calculation result is greater than a preset threshold.

[0127] In one embodiment, the result output module 40 includes:

[0128] An image input unit, used to input the main body image of the certificate into a preset edge detection model to obtain a card edge segment;

[0129] A quantity comparison unit, used for obtaining the number of pixel points contained in each of the card edge segments, and comparing the number of pixel points with a preset number of pixels;

[0130] An information quantity unit, used to delete the noise card edge line segments whose number of pixel points is less than a preset number of points, process the remaining card edge line segments according to a preset clustering algorithm, and obtain the number of card edge line segments;

[0131] The result output unit is used to output the detection result of the missing corner of the card edge if the number of the line segments is greater than 4.

[0132] In one embodiment, the document edge detection device further includes:

[0133] A text recognition module, used to perform text recognition on the rectangular area enclosed by the edge segments of the card to obtain text information contained in the main image of the certificate;

[0134] The classification and saving module is used to classify and save the target image into a corresponding document image database according to the text information.

[0135] Among them, the method implemented when the document edge detection device is executed can refer to the various embodiments of the document edge detection method of the present invention, and will not be repeated here.

[0136] In an embodiment of the present invention, the document edge detection device identifies the face photo in the target image, reversely extracts the document main image based on the face photo, and then inputs the document main image into a preset edge detection model to obtain the card edge line segments, analyzes the card edge line segments, and outputs the document edge detection results, thereby improving the accuracy of the document edge detection in the target image and further improving the accuracy of the document information recognition.

[0137] The present invention also provides a computer-readable storage medium.

[0138] The computer-readable storage medium of the present invention stores a computer program corresponding to the document edge detection, and when the computer program corresponding to the document edge detection is executed by a processor, the steps of the document edge detection method described above are implemented.

[0139] Among them, the method implemented when the computer program corresponding to the document edge detection running on the processor is executed can refer to the various embodiments of the document edge detection method of the present invention, and will not be repeated here.

[0140] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0141] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0142] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for enabling a document edge detection device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0143] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A document edge detection method, characterized in that: The document edge detection method comprises the following steps: Upon receiving an image certificate edge detection request, obtaining a target image associated with the image certificate edge detection request; Input the target image into a preset face recognition model, extract facial feature points in the target image, and determine a face photo in the target image based on the facial feature points and feature coordinates of the facial feature points; Extracting a main body image of the certificate including the face photo from the target image according to the photo information of the face photo; Input the main body image of the certificate into a preset edge detection model to obtain the card edge segment, analyze the card edge segment, and output the certificate edge detection result; The step of inputting the main body image of the certificate into a preset edge detection model, obtaining a card edge segment, analyzing the card edge segment, and outputting a certificate edge detection result includes: Inputting the main body image of the certificate into a preset edge detection model to obtain the card edge segment; Processing each of the card edge segments according to a preset discrete point classification statistical algorithm to obtain the midpoint of the card edge segment; The midpoint is subjected to the nearest four-class classification, the points on the edge line segment of the card corresponding to the same midpoint are taken as a cluster, the abnormal points in each cluster are deleted, and the remaining points in each cluster are subjected to the support vector machine binary classification; Count the distances from all points in each cluster to the support vector, cube the distance and divide it by the number of all points in this cluster to obtain a calculation result, and compare the calculation result with a preset threshold; If the calculation result is greater than a preset threshold, the detection result of the card edge chipping is output.

2. The document edge detection method according to claim 1, characterized in that: After the step of obtaining the target image associated with the image document edge detection request upon receiving the image document edge detection request, the method comprises: Inputting the target image into a preset edge detection model, outputting a line segment recognition result, and judging whether there is a straight line in the target image according to the line segment recognition result; If there is a straight line in the target image, the tilt angle of the target image is determined according to the straight line and the direct projection, and the target image is moved in the opposite direction according to the tilt angle.

3. The document edge detection method according to claim 1, characterized in that: The step of inputting the target image into a preset face recognition model, extracting facial feature points in the target image, and determining a face photo in the target image according to the facial feature points and the feature coordinates of the facial feature points comprises: Inputting the target image into a preset face recognition model, obtaining a recognition result and determining whether the target image contains a face image according to the recognition result; If the target image does not contain a face image, the target image is input into a preset edge detection model to obtain a card edge segment, analyze the card edge segment, and output a document edge detection result; If the target image includes a face image, facial feature points in the target image are extracted, and a face photo in the target image is determined based on the facial feature points and feature coordinates of the facial feature points.

4. The document edge detection method according to claim 1, characterized in that: The step of extracting the main body image of the certificate including the face photo from the target image according to the photo information of the face photo comprises: Acquire photo information of the face photo, wherein the photo information includes location information and size information of the face photo; Query a preset person-document mapping table to obtain the document type corresponding to the location information, and determine the document size information according to the document type and the size information of the face photo; According to the document size information and the photo information of the face photo, a main document image including the face photo is extracted from the target image.

5. The document edge detection method according to claim 1, characterized in that: The step of inputting the main body image of the certificate into a preset edge detection model, obtaining a card edge segment, analyzing the card edge segment, and outputting a certificate edge detection result comprises: Inputting the main body image of the certificate into a preset edge detection model to obtain the card edge segment; Obtaining the number of pixels contained in each of the card edge segments, and comparing the number of pixels with a preset number of pixels; Delete the noise card edge line segments whose number of pixels is less than the preset number of pixels, process the remaining card edge line segments according to the preset clustering algorithm, and obtain the number of card edge line segments; If the number of line segments is greater than 4, the detection result of the missing corners on the edge of the card is output.

6. The document edge detection method according to any one of claims 1 to 5, characterized in that: After the steps of inputting the main body image of the certificate into a preset edge detection model, obtaining card edge segments, analyzing the card edge segments, and outputting the certificate edge detection results, the method further includes: Performing text recognition on the rectangular area enclosed by the edge segments of the card to obtain text information contained in the main image of the certificate; The target image is classified and saved in a corresponding document image database according to the text information.

7. A document edge detection device, characterized in that: The document edge detection device comprises: A request receiving module, configured to, upon receiving an image document edge detection request, obtain a target image associated with the image document edge detection request; A face recognition module, used to input the target image into a preset face recognition model, extract facial feature points in the target image, and determine a face photo in the target image based on the facial feature points and feature coordinates of the facial feature points; The certificate image extraction module is used to extract the certificate main body image containing the face photo from the target image according to the photo information of the face photo; A result output module, used for inputting the main body image of the certificate into a preset edge detection model, obtaining the card edge line segment, analyzing the card edge line segment, and outputting the certificate edge detection result; The result output module is also used to input the main image of the certificate into a preset edge detection model to obtain the card edge segment; process each of the card edge segments according to a preset discrete point classification statistical algorithm to obtain the midpoint of the card edge segment; perform nearest neighbor four-category classification on the midpoint, take the points on the card edge segment corresponding to the same midpoint as a cluster, delete the abnormal points in each cluster, and perform support vector machine binary classification on the remaining points in each cluster; count the distances from all points in each cluster to the support vector, cube the distance and divide it by the number of all points in this cluster to obtain a calculation result, and compare the calculation result with a preset threshold; if the calculation result is greater than the preset threshold, output the detection result of the card edge missing corner.

8. A document edge detection device, characterized in that: The document edge detection device includes: a memory, a processor, and a computer program corresponding to the document edge detection stored in the memory and executable on the processor. When the computer program corresponding to the document edge detection is executed by the processor, the steps of the document edge detection method as described in any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program corresponding to the document edge detection, and when the computer program corresponding to the document edge detection is executed by the processor, the steps of the document edge detection method according to any one of claims 1 to 6 are implemented.