Image detection method, device, equipment and storage medium

By rotating, binarizing and histogram analysis of the ID picture, we can determine whether there is a reflective area in the ID picture, which solves the problem of low recognition efficiency caused by concentrated reflection in the ID picture, and achieves more efficient ID picture recognition.

CN112434687BActive Publication Date: 2025-03-14TIANMIAN INFORMATION TECHNOLOGY (SHENZHEN) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202011386422.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-01
Publication Date
2025-03-14
Estimated Expiration
2040-12-01

AI Technical Summary

Technical Problem

During the process of document collection, due to factors such as shooting ambient light and shooting angle, the document image may have a reflective area, resulting in the text information and portrait information being unable to be recognized, and the terminal equipment needs to re-collect it, reducing the efficiency of document identification.

Method used

By obtaining the uploaded ID picture, analyzing its ID type and rotating it to make it in a regular placement state. Then obtain the binarized image and histogram to analyze whether the key information area and the highlighted area overlap. If there is a overlapping area, further determine whether it is a reflective area. If it is reflective, it is prompted to upload again, otherwise it will be sent to the server for identification.

Benefits of technology

It improves the efficiency of document image recognition, avoids recognition failure caused by reflection, and reduces customer waiting time and waste of system resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112434687B_ABST
    Figure CN112434687B_ABST
Patent Text Reader

Abstract

The present invention relates to an image detection method, device, equipment and storage medium, the method comprising: obtaining an uploaded ID image, analyzing the ID type of the ID image; if the ID type of the ID image is a predetermined ID type, rotating the ID image so that the ID image is in a right position; obtaining a binary image of the ID image in a right position, obtaining a key information area based on the binary image; obtaining a histogram of the ID image in a right position, obtaining a highlight area of ​​the ID image based on the histogram; analyzing whether the key information area and the highlight area have overlapping areas, if the key information area and the highlight area have overlapping areas, analyzing whether the overlapping areas are reflective areas; if so, prompting to re-upload the ID image, if not, sending the ID image to a server for identification. The present invention can improve the efficiency of ID image recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a picture detection method, device, equipment and storage medium. Background Art

[0002] During the ID collection process, the terminal device takes an ID image and uploads it to the backend server, which performs text and portrait recognition on the ID. During recognition, due to the influence of factors such as the ambient light and the shooting angle, the ID image may contain reflective areas. The text and portrait information in the reflective area cannot be recognized, and the terminal device needs to re-collect and upload it to the backend server until the text and portrait information are successfully recognized. Repeated shooting and waiting for recognition results will reduce the efficiency of ID recognition and waste customer time and system resources. Summary of the invention

[0003] The purpose of the present invention is to provide an image detection method, device, equipment and storage medium, aiming to improve the efficiency of document image recognition.

[0004] The present invention provides a picture detection method, comprising:

[0005] Obtain the uploaded ID picture and analyze the ID type of the ID picture;

[0006] If the certificate type of the certificate image is a predetermined certificate type, the certificate image is rotated so that the certificate image is in a normal position;

[0007] Obtain a binary image of the certificate image in a normal state, and obtain a key information area based on the binary image;

[0008] Obtaining a histogram of the ID card image in a normal state, and obtaining a highlight area of ​​the ID card image based on the histogram;

[0009] Analyze whether the key information area and the highlight area have overlapping areas, and if the key information area and the highlight area have overlapping areas, analyze whether the overlapping areas are reflective areas;

[0010] If yes, the user is prompted to re-upload the ID picture. If no, the ID picture is sent to the server for identification.

[0011] The present invention also provides a picture detection device, comprising:

[0012] An analysis module is used to obtain the uploaded ID image and analyze the ID type of the ID image;

[0013] A rotation module, for rotating the ID picture if the ID type of the ID picture is a predetermined ID type, so that the ID picture is in a normal position;

[0014] A first acquisition module is used to acquire a binary image of the certificate image in a normal state, and acquire a key information area based on the binary image;

[0015] A second acquisition module is used to acquire a histogram of the ID card image in a normal state, and acquire a highlight area of ​​the ID card image based on the histogram;

[0016] A detection module, used for analyzing whether the key information area and the highlight area have overlapping areas, and if the key information area and the highlight area have overlapping areas, analyzing whether the overlapping areas are reflective areas;

[0017] The processing module is used to prompt the user to re-upload the ID card image if yes, and to send the ID card image to the server for identification if no.

[0018] The present invention also provides a computer device, which includes a memory and a processor connected to the memory, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the steps of the image detection method as described above are implemented.

[0019] The present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned image detection method are implemented.

[0020] The beneficial effect of the present invention is that before the server recognizes the text and portrait in the certificate image, the present invention obtains the key information area and the highlight area of ​​the certificate image, analyzes whether there is an overlapping area between the key information area and the highlight area, and if there is an overlapping area, further analyzes whether the overlapping area is a reflective area. Reflection will cause the key information to be unable to be accurately recognized. If it is reflective, it is directly re-photographed without waiting for server recognition. If it is detected as not reflective, it is uploaded to the server for text recognition and portrait recognition. The present invention can improve the efficiency of certificate image recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 A schematic diagram of an application environment of an embodiment of a picture detection method of the present invention;

[0022] Figure 2 This is a schematic diagram of the process of the first embodiment of the image detection method of the present invention;

[0023] Figure 3 for Figure 2A detailed flow chart of step S5 in FIG.

[0024] Figure 4 It is a structural schematic diagram of an embodiment of a picture detection device of the present invention;

[0025] Figure 5 FIG. 4 is a schematic diagram of a hardware architecture of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0027] It should be noted that the descriptions of "first", "second", etc. in the present invention are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0028] See also Figure 1 FIG. 1 is a schematic diagram of an application environment of an embodiment of the image detection method of the present invention. Figure 1 In the process, computer device 1 is connected to server 2 through a network. Computer device 1 obtains an uploaded ID card image and detects the ID card image. If the detection shows that the ID card image has no reflective area, the ID card image is sent to server 2 for identification. If the detection shows that the ID card image has a reflective area, the customer is prompted to upload the ID card image again.

[0029] The method provided by the present invention can be applied in Figure 1 The computer device 1 may include but is not limited to various personal computers, laptop computers, tablet computers, smart phones and portable wearable devices.

[0030] See also Figure 2 FIG. 1 is a flow chart of a first embodiment of the image detection method of the present invention. Figure 1 The following is an example of an environment:

[0031] Step S1, obtaining the uploaded ID picture and analyzing the ID type of the ID picture;

[0032] Among them, the document image is classified using a pre-trained classifier to obtain the document type corresponding to the document image;

[0033] The classifier can be constructed by collecting a large number of different ID images. First, each ID image collected is labeled with its type, and then the labeled ID images are used as sample data and input into the classifier for training.

[0034] The classifier can adopt common classification models, such as CNN (convolutional neural network model), RNN (recurrent neural network), SVM (support vector machine) model, etc., whose input is the ID card image, and the output is the ID card type corresponding to the input ID card image, or the output is the score of the input ID card image belonging to various ID card types. In the latter case, the ID card type with the highest score can be obtained as the ID card type to which the corresponding ID card image belongs.

[0035] Step S2, if the certificate type of the certificate image is a predetermined certificate type, rotating the certificate image so that the certificate image is in a normal position;

[0036] The predetermined document types may include: identity card, passport, driver's license, etc. This step can rotate the document image of the predetermined document type in two ways:

[0037] The first method: By detecting the edge of the ID card in the ID card image, extracting the edge line of the ID card, judging whether the ID card is in the correct state according to the angle between the edge line and the horizontal direction, if the angle is 0 degrees, it is in the correct state, if the angle is not 0 degrees, it is not in the correct state, and the ID card image needs to be rotated, and the rotation angle is the angle of the above angle until the document is in the correct state.

[0038] The second method: a deep learning model for classifying the orientation of the ID in the ID image can be provided, and the ID image can be input into the trained deep learning model to obtain the orientation of the ID in the ID image, for example, including a first orientation of 45-135 degrees, a second orientation of 135-225 degrees, a third orientation of 225-315 degrees, and a fourth orientation of 315-45 degrees. After obtaining the orientation of the ID in the ID image, it is rotated according to the angle corresponding to the orientation until it is rotated to 0 degrees. In order to improve the accuracy, the first method can be used for further rotation processing after the second method to fine-tune the ID image.

[0039] Among them, the deep learning model is, for example, CNN (convolutional neural network model), RNN (recurrent neural network model), etc., and you can refer to the above-mentioned classifier, which will not be repeated here.

[0040] Step S3, obtaining a binary image of the certificate image in a normal state, and obtaining a key information area based on the binary image;

[0041] Among them, a binary image has only two grayscale levels in the image, that is, the grayscale value of any pixel in the image is 0 or 255, representing black and white respectively.

[0042] In one embodiment, the key information area can be obtained by performing image detection on the binary image using an existing method; or, in another embodiment, templates corresponding to various types of certificates can be pre-made, and the templates include the key information area corresponding to the certificate type. The key information area is extracted by matching the binary image with the template corresponding to the certificate type.

[0043] Among them, for the certificate image, the key information area includes the portrait area and various text areas.

[0044] Step S4, obtaining a histogram of the ID card image in a normal state, and obtaining a highlight area of ​​the ID card image based on the histogram;

[0045] The histogram is used to represent the distribution of pixel values ​​in an image. A certain number of small intervals are used to specify the range of pixel values. Each small interval will get the number of pixels that fall into the range represented by the small interval. For grayscale images, the pixel value range is 0-255.

[0046] Among them, for the histogram of the document image, the area where multiple pixels with pixel values ​​greater than the preset pixel value are located is defined as the highlight area. For example, the preset pixel value is 99% of the maximum pixel value in the histogram. The preset pixel value in this embodiment is not fixed. Considering that different document images are taken in different environments and angles, it is necessary to determine the corresponding preset pixel value for each document image so that its highlight area can be found.

[0047] Step S5, analyzing whether the key information area and the highlight area have overlapping areas, and if the key information area and the highlight area have overlapping areas, analyzing whether the overlapping areas are reflective areas;

[0048] This embodiment analyzes whether there is any overlapping area between the key information area and the highlight area of ​​the ID picture. If there is no overlapping area, the ID picture can be directly sent to the server for key information recognition. If there is an overlapping area, it is necessary to further analyze whether the overlapping area is reflective. If it is reflective, the key information cannot be recognized and the ID picture needs to be uploaded again.

[0049] Furthermore, if Figure 3 As shown, the above step S5 specifically includes:

[0050] Step S51, analyzing whether each text area has an overlapping area with the highlight area, and if there is an overlapping area between the text area and the highlight area, analyzing whether the overlapping area between the text area and the highlight area is a reflective area; and

[0051] Step S52, analyzing whether the portrait area and the highlight area have overlapping areas, and if the portrait area and the highlight area have overlapping areas, analyzing whether the overlapping areas of the portrait area and the highlight area are reflective areas.

[0052] Among them, if there is a text area overlapping with the highlight area, or a portrait area overlapping with the highlight area, or the text area overlaps with the highlight area and the portrait area overlaps with the highlight area, then it is necessary to perform a specific analysis on the overlapping area to determine whether the overlapping area is reflective.

[0053] Furthermore, the above step S51 specifically includes:

[0054] For each text area, vertical projection is performed, and a character area corresponding to the text area is obtained based on the vertical projection image;

[0055] If the character area and the highlight area have an overlapping area, then the clarity of the area where the character area and the highlight area overlap is calculated, and if the clarity is less than a predetermined first threshold, the area where the character area and the highlight area overlap is a reflective area;

[0056] Among them, for each text area, it is binarized and then vertically projected to obtain a vertical projection image. The character area and the character spacing area can be obtained through the vertical projection image. For the character spacing area, its length is the character spacing length. The character spacing lengths corresponding to the two text areas may be the same or different.

[0057] When the character area and the highlight area overlap, the Laplace operator is used to calculate the clarity of the area where the character area and the highlight area overlap. If the clarity is less than a predetermined first threshold, the overlapping area is a reflective area. If the clarity is greater than or equal to the predetermined first threshold, the overlapping area is not a reflective area and the character can be recognized normally. The predetermined first threshold is determined according to a priori value.

[0058] The above step S51 further comprises:

[0059] Acquire a character spacing region corresponding to the text region based on the vertical projection image;

[0060] If the character spacing area and the highlight area have an overlapping area, and the length of the character spacing area is greater than or equal to a predetermined length threshold, then the overlapping area between the character spacing area and the highlight area is a reflective area.

[0061] When the character spacing area overlaps with the highlight area, and the length of the character spacing area is greater than or equal to the predetermined length threshold, the overlapping area is a reflective area. The predetermined length threshold is a multiple of the character spacing length in the text area. Taking into account the case of character loss, if the character is lost, the character spacing length becomes larger. In this case, the overlapping area is determined to be a reflective area. In order to obtain the true character spacing length, all character spacing lengths can be analyzed in the vertical projection image, and multiple character spacing lengths with the same length can be taken as the true character spacing length in this embodiment. For example, for a certain text area, the first character spacing length is 2, the second character spacing length is 2, the third character spacing length is 3, and the fourth character spacing length is 2, then the true character spacing length is 2. Preferably, the predetermined length threshold is 1.5 times the character spacing length in the text area.

[0062] The above step S51 further comprises:

[0063] If the character spacing area overlaps with the highlight area, and the length of the character spacing area is less than a predetermined length threshold, then the first brightness variance of the area where the character spacing area overlaps with the highlight area is calculated, and the second brightness variance of the character spacing area adjacent to the character spacing area is calculated. If the difference between the first brightness variance and the second brightness variance is greater than or equal to a predetermined second threshold, then the area where the character spacing area overlaps with the highlight area is a reflective area.

[0064] When the character spacing area and the highlight area have overlapping areas, and the length of the character spacing area is less than a predetermined length threshold, the first brightness variance of the overlapping area is calculated, and the second brightness variance of the adjacent character spacing area is calculated. If the difference between the first brightness variance and the second brightness variance is greater than or equal to the predetermined second threshold, the area where the character spacing area overlaps with the highlight area is a reflective area. This embodiment takes into account the distribution of the brightness of the character spacing area. If the brightness distribution of the character spacing area and the adjacent character spacing area is not much different, the characters can be recognized normally. If the difference is large, the characters cannot be recognized due to the influence of the highlight area. In this case, the overlapping area is determined to be a reflective area. Among them, the predetermined second threshold is determined according to a priori value.

[0065] Furthermore, the above step S52 specifically includes:

[0066] Acquire position information of key points of the portrait, and adjust the portrait area according to the position information;

[0067] If the adjusted portrait area overlaps with the highlight area, then counting the number of first pixels in the area where the adjusted portrait area overlaps with the highlight area, and counting the number of second pixels in the adjusted portrait area;

[0068] If the ratio of the first number of pixels to the second number of pixels is greater than or equal to a predetermined third threshold, the area where the adjusted portrait area overlaps with the highlight area is a reflective area.

[0069] The obtained portrait area may include the area occupied by the person and other areas not related to the person. The position information of the portrait key points at least includes the position information corresponding to the glasses, ears, nose, mouth, and chin. By adjusting the portrait area according to the position information of the portrait key points, other areas not related to the person in the portrait area can be removed.

[0070] When the adjusted portrait area overlaps with the highlight area, the number of first pixels in the area where the adjusted portrait area overlaps with the highlight area is counted, and the number of second pixels in the adjusted portrait area is counted. If the ratio of the first pixel number to the second pixel number is greater than or equal to the predetermined third threshold, it is considered that the highlight area affects the recognition of the portrait and the portrait cannot be recognized. In this case, the overlapping area is determined to be a reflective area. If the ratio is less than the predetermined third threshold, it is considered that the highlight area does not affect the recognition of the portrait. Preferably, the third threshold is 0.1%.

[0071] Step S6: If yes, the user is prompted to re-upload the ID picture; if no, the ID picture is sent to the server for identification.

[0072] This embodiment analyzes whether there is any overlapping area between the key information area and the highlight area of ​​the ID picture. If there is no overlapping area, the ID picture can be directly sent to the server for key information recognition. If there is an overlapping area, it is necessary to further analyze whether the overlapping area is reflective. If it is reflective, the key information cannot be recognized and the ID picture needs to be uploaded again.

[0073] Before the server recognizes the text and portrait in the certificate image, this embodiment obtains the key information area and the highlight area of ​​the certificate image, analyzes whether there is an overlapping area between the key information area and the highlight area, and if there is an overlapping area, further analyzes whether the overlapping area is a reflective area. Reflection will cause the key information to be unable to be accurately recognized. If it is reflective, it is directly re-photographed without waiting for server recognition. If it is detected as not reflective, it is uploaded to the server for text recognition and portrait recognition. This embodiment can improve the efficiency of certificate image recognition.

[0074] In one embodiment, the present invention provides a picture detection device, which corresponds one-to-one to the method in the above embodiment. Figure 4 As shown, the image detection device includes:

[0075] The analysis module 101 is used to obtain the uploaded ID image and analyze the ID type of the ID image;

[0076] A rotation module 102, configured to rotate the ID picture if the ID picture type is a predetermined ID picture type, so that the ID picture is in a normal position;

[0077] The first acquisition module 103 is used to acquire a binary image of the certificate image in a normal state, and acquire a key information area based on the binary image;

[0078] The second acquisition module 104 is used to acquire a histogram of the ID card image in a normal state, and acquire a highlight area of ​​the ID card image based on the histogram;

[0079] The detection module 105 is used to analyze whether the key information area and the highlight area have overlapping areas, and if the key information area and the highlight area have overlapping areas, analyze whether the overlapping areas are reflective areas;

[0080] The processing module 106 is used to prompt the user to re-upload the ID card image if yes, and to send the ID card image to the server for identification if no.

[0081] The specific definition of the image detection device can be found in the definition of the image detection method above, which will not be repeated here. Each module in the above-mentioned image detection device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0082] In one embodiment, a computer device is provided, which is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. The computer device can be a PC (Personal Computer), or a smart phone, a tablet computer, a computer, or a single network server, a server group consisting of multiple network servers, or a cloud based on cloud computing consisting of a large number of hosts or network servers, wherein cloud computing is a type of distributed computing, a super virtual computer composed of a group of loosely coupled computer sets.

[0083] like Figure 5As shown, the computer device may include, but is not limited to, a memory 11, a processor 12, and a network interface 13 that can be interconnected through a system bus, and the memory 11 stores a computer program that can be run on the processor 12. It should be noted that Figure 5 Only a computer device having components 11 - 13 is shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may alternatively be implemented.

[0084] Among them, the memory 11 can be a non-volatile and / or volatile memory. The non-volatile memory may include a read-only memory (ROM), a programmable ROM (PROM), an electrically programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM) or a flash memory. The volatile memory may include a random access memory (RAM) or an external cache memory. As an illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM). In this embodiment, the readable storage medium of the memory 11 is generally used to store an operating system and various application software installed on a computer device, such as storing the program code of a computer program in an embodiment of the present invention. In addition, the memory 11 can also be used to temporarily store various types of data that have been output or are to be output.

[0085] In some embodiments, the processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip, and is used to run the program code stored in the memory 11 or process data, such as running a computer program.

[0086] The network interface 13 may include a standard wireless network interface or a wired network interface. The network interface 13 is generally used to establish a communication connection between the computer device and other electronic devices.

[0087] The computer program is stored in the memory 11, and includes at least one computer-readable instruction stored in the memory 11. The at least one computer-readable instruction can be executed by the processor 12 to implement the methods of various embodiments of the present application, including:

[0088] Obtain the uploaded ID picture and analyze the ID type of the ID picture;

[0089] If the certificate type of the certificate image is a predetermined certificate type, the certificate image is rotated so that the certificate image is in a normal position;

[0090] Obtain a binary image of the certificate image in a normal state, and obtain a key information area based on the binary image;

[0091] Obtaining a histogram of the ID card image in a normal state, and obtaining a highlight area of ​​the ID card image based on the histogram;

[0092] Analyze whether the key information area and the highlight area have overlapping areas, and if the key information area and the highlight area have overlapping areas, analyze whether the overlapping areas are reflective areas;

[0093] If yes, the user is prompted to re-upload the ID picture. If no, the ID picture is sent to the server for identification.

[0094] In one embodiment, the present invention further provides a computer-readable storage medium, which may be a non-volatile and / or volatile memory, on which a computer program is stored. When the computer program is executed by a processor, the steps of the image detection method in the above embodiment are implemented, for example Figure 2 Alternatively, when the computer program is executed by the processor, the functions of each module / unit of the image detection device in the above embodiment are realized, for example Figure 4 The functions of modules 101 to 106 are shown in Figure 1. To avoid repetition, they are not described here.

[0095] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through a computer program, and the computer program, when executed, can include the processes of the embodiments of the above-mentioned methods.

[0096] 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.

[0097] It should be noted that, in this article, the terms "comprises", "includes" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, apparatus, article or method that includes a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, apparatus, article or method.

[0098] 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 picture detection method, characterized in that: include: Obtain the uploaded ID picture and analyze the ID type of the ID picture; If the certificate type of the certificate image is a predetermined certificate type, the certificate image is rotated so that the certificate image is in a normal position; Obtain a binary image of the certificate image in a normal state, and obtain a key information area based on the binary image, wherein the key information area includes a portrait area and various text areas; Acquire a histogram of the ID card image in a normal state, and define, based on the histogram, an area where a plurality of pixels having pixel values ​​greater than a preset pixel value are located as a highlight area of ​​the ID card image; By performing vertical projection on each text area, the character area and the character spacing area corresponding to the text area are obtained, and it is determined whether the character area or the character spacing area overlaps with the highlight area. If so, the overlapped area is analyzed to see whether it is a reflective area by calculating the clarity or the length of the character spacing area; and whether the portrait area overlaps with the highlight area. If the portrait area overlaps with the highlight area, it is analyzed to see whether the overlapped area between the portrait area and the highlight area is a reflective area. If one of the overlapping areas is a reflective area, a prompt will be given to re-upload the ID picture. If all the overlapping areas are not reflective areas, the ID picture will be sent to the server for identification.

2. The image detection method according to claim 1, characterized in that: The clarity is calculated to analyze whether the overlapping area is a reflective area, including: If the character area and the highlight area have overlapping areas, the clarity of the overlapping areas is calculated. If the clarity is less than a predetermined first threshold, the overlapping areas of the character area and the highlight area are reflective areas.

3. The image detection method according to claim 1, characterized in that: By calculating the length of the character spacing area, we can analyze whether the overlapping area is a reflective area, including: If the character spacing area and the highlight area have an overlapping area, and the length of the character spacing area is greater than or equal to a predetermined length threshold, then the overlapping area between the character spacing area and the highlight area is a reflective area.

4. The image detection method according to claim 3, characterized in that: Analyzing whether the overlapping area is a reflective area by calculating the length of the character spacing area further includes: If the character spacing area overlaps with the highlight area, and the length of the character spacing area is less than a predetermined length threshold, then the first brightness variance of the area where the character spacing area overlaps with the highlight area is calculated, and the second brightness variance of the character spacing area adjacent to the character spacing area is calculated. If the difference between the first brightness variance and the second brightness variance is greater than or equal to a predetermined second threshold, then the area where the character spacing area overlaps with the highlight area is a reflective area.

5. The image detection method according to claim 1, characterized in that: Analyzing whether the area where the portrait area and the highlight area overlap is a reflective area includes: Acquire position information of key points of the portrait, and adjust the portrait area according to the position information; If the adjusted portrait area overlaps with the highlight area, then counting the number of first pixels in the area where the adjusted portrait area overlaps with the highlight area, and counting the number of second pixels in the adjusted portrait area; If the ratio of the first number of pixels to the second number of pixels is greater than or equal to a predetermined third threshold, the area where the adjusted portrait area overlaps with the highlight area is a reflective area.

6. The image detection method according to claim 5, characterized in that: The third threshold is 0.1%.

7. A picture detection device, characterized in that: include: An analysis module is used to obtain the uploaded ID image and analyze the ID type of the ID image; A rotation module, for rotating the ID picture if the ID type of the ID picture is a predetermined ID type, so that the ID picture is in a normal position; A first acquisition module is used to acquire a binary image of the certificate image in a normal state, and acquire a key information area based on the binary image; A second acquisition module is used to acquire a histogram of the ID card image in a normal state, and based on the histogram, define an area where a plurality of pixels having pixel values ​​greater than a preset pixel value are located as a highlight area of ​​the ID card image; A detection module, for obtaining a character area and a character spacing area corresponding to each text area by performing vertical projection on each text area, determining whether the character area or the character spacing area has an overlapping area with the highlight area, and if so, analyzing whether the overlapping area is a reflective area by calculating the clarity or the length of the character spacing area; analyzing whether a portrait area has an overlapping area with the highlight area, and if so, analyzing whether the overlapping area with the portrait area is a reflective area; The processing module is used to prompt the user to re-upload the ID card image if one of the overlapping areas is a reflective area, and to send the ID card image to the server for identification if all the overlapping areas are not reflective areas.

8. A computer device, comprising a memory and a processor connected to the memory, wherein the memory stores a computer program that can be run on the processor, wherein: When the processor executes the computer program, the steps of the image detection method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the image detection method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Card image reflective detection method and device

    CN106228168A

  • OCR-based credential recognition method, a device, a computer device and a storage medium

    CN109492643A

  • Certificate image reflection detection method, apparatus and device, and storage medium

    CN111091126A