Certificate picture sensitive information shielding coding processing method, system and equipment and medium
Through deep learning OCR technology and Internet development, combined with image preprocessing and automated coding processing, the problem of insufficient accuracy of certificate information identification in the existing technology is solved, and efficient, accurate and safe certificate information processing is achieved, suitable for a variety of purposes Document type.
Patent Information
- Application Number
- CN202411212880.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2025-01-14
AI Technical Summary
The prior art lacks the accuracy of identification when processing complex or diversified document information, and cannot fully accurately identify and process all relevant text blocks, which affects the comprehensiveness and reliability of the processing, and relies on manual operations or simple automation tools, and is efficient. Low and unreliable.
Using OCR text recognition technology based on deep learning, combined with Internet development technology, through image preprocessing, text recognition and automated coding processing, multiple layout templates are designed to adapt to different certificate types, and using Baidu OCR API and OpenCV library for image classification and Cropping to realize automatic identification and blocking of document information.
It significantly improves the accuracy and speed of information identification, reduces the risks of human errors and information leakage, improves the flexibility and applicability of processing, and achieves efficient, accurate and safe document information processing.
Smart Images

Figure CN119314179A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence and image recognition technology, and in particular to a method, system, device and medium for shielding and coding sensitive information of a certificate image. Background Art
[0002] With the popularization of digital information and the widespread use of personal data, personal privacy protection is particularly important. In campus and social life, the processing of certificate information involves a variety of business scenarios, including school registration, borrowing books, entering and leaving the campus, as well as identity verification and medical services in social activities. These certificates contain personal sensitive information, such as name, ID number, address, etc. If not protected, they may be used by hackers or other criminals for identity theft, fraud and other illegal activities, causing serious damage to individuals. Therefore, effective privacy protection technology is crucial to protecting the security of personal information.
[0003] Traditionally, the protection of document information usually relies on manual processing or simple automated tools. These methods often require human intervention, such as manually coding or covering sensitive information using graphic software. This is not only time-consuming and labor-intensive, but also prone to errors. It is inefficient and unreliable, especially when processing large-scale data. In addition, common automated tools may use rule engines or simple image processing algorithms to identify and code document information. However, these tools often lack intelligence and adaptability and cannot handle complex document structures and diverse information layouts.
[0004] The patent application with publication number CN118158334A and titled "Information Coding Processing Method, Device, Electronic Device and Readable Storage Medium" proposes a method of obtaining an uploaded image, determining multiple text blocks in the image, obtaining the type of each text block, determining the association between different types of text blocks, determining the target text block to be processed based on the information to be processed and the association, and coding the target text block. This method improves the automation and universality of the processing and effectively reduces the risk of privacy information leakage. However, this patent application may have problems with insufficient recognition accuracy when processing very complex or highly variable text information. In particular, when faced with images with extremely diverse text layouts, the system may not be able to fully and accurately identify and process all relevant text blocks, which may affect the comprehensiveness and reliability of the processing. Summary of the invention
[0005] In order to overcome the problems existing in the above-mentioned prior art, the purpose of the present invention is to propose a method, system, device and medium for shielding and coding sensitive information in certificate images. It adopts OCR text recognition technology based on deep learning, which can automatically identify sensitive information in certificates, greatly improve the accuracy and speed of information recognition, and greatly improve the processing efficiency compared with traditional methods; by analyzing and locating the position of the extracted privacy information, it can accurately and automatically code the private content such as photos and certificate numbers on the certificates, effectively protecting the user's privacy data security and avoiding the risks of errors and information leakage caused by human operations; combined with Internet development technology, it can intelligently call the corresponding program template for processing according to different types of certificate information uploaded by users, making it possible to automatically code the privacy information of different types of certificates, greatly improving the flexibility and applicability of processing; it has the advantages of high recognition efficiency, good security, flexible processing and wide applicability.
[0006] In order to achieve the above object, the technical solution adopted by the present invention is:
[0007] A method for shielding and coding sensitive information of a certificate image, comprising the following steps:
[0008] Step 1: Get the uploaded image file;
[0009] Step 2: Perform image preprocessing on the image file obtained in step 1;
[0010] Step 3: Identify sensitive information of the ID card image on the image preprocessed in step 2;
[0011] Step 4: Automatically shield and encode the sensitive information identified in step 3;
[0012] Step 5: Save the image processed by step 4 to the server root directory and return it to the user through the front-end page so that the user can view and save the document image that has been processed for privacy protection.
[0013] The specific method of step 1 is:
[0014] After the user logs in to the ID card image sensitive information shielding and coding system, select the uploaded image type in the image type drop-down list to upload the ID card image; after the upload is completed, the image file is uploaded through the system front end and saved in the server root directory.
[0015] The specific method of image preprocessing described in step 2 is:
[0016] Send the image obtained in step 1 to the image classification API provided by the AI platform, namely AipImageClassify, select the objectDetect method for classification, return the category information and bounding box position of the object, and use the OpenCV library to crop and tilt the image according to the returned object bounding box coordinates to remove useless background parts to reduce the impact of the background on the subsequent text recognition accuracy and improve the accuracy of text recognition.
[0017] The specific method of step 3 is:
[0018] After the image is preprocessed, the system backend automatically calls the OCR recognition API interface for text recognition. The interface will return text information and text coordinate information in the form of a dictionary.
[0019] The OCR text recognition interface adopts the Baidu OCR API interface. The system backend passes in the image URL link parameters through the PHP program, calls the Baidu OCR API to perform OCR text recognition on the document image, identifies sensitive information, and automatically returns the identified text information and text location coordinates.
[0020] The specific method of step 4 is: the system designs multiple layout templates according to the different layouts of each card. When the user uploads a picture and selects the picture type, the corresponding type template is automatically called. The text information on the picture uploaded by the user is identified through the OCR text recognition interface, and the text information and position coordinates on the picture are returned; keywords are extracted from the text information through regularization technology to obtain the target position coordinates that need to be shielded and coded; coding or covering processing is performed at the target position: covering the identified sensitive information area that needs to be shielded and coded.
[0021] A system for shielding and coding sensitive information of a certificate image, comprising:
[0022] Image upload module: used in step 1, after the user logs in to the system, he selects the type of certificate to be processed and uploads the image; the uploaded image file is transferred to the root directory of the server through the front end for subsequent reading and processing operations;
[0023] Image preprocessing module: used in step 2, calling the image classification API provided by Baidu AI platform, namely AipImageClassify; select the objectDetect method for classification, and return the category information and bounding box position of the object. According to the returned object bounding box coordinates, use the OpenCV library to crop and tilt the image to obtain an image containing only the certificate; eliminate the interference of the card surface tilt, shooting blur, and background information interference factors of the uploaded certificate image on the text recognition result, and improve the accuracy of text recognition;
[0024] Text recognition module: used in step 3. After the image is preprocessed, the system backend automatically calls Baidu OCR recognition interface to perform sensitive information text recognition. The interface will return text information and text coordinate information in the form of a dictionary.
[0025] Sensitive information automatic shielding module: used in step 4, for different types of certificate layouts, when the user uploads the picture and selects the picture type, the corresponding template type is automatically called; the text information returned by the text recognition module is extracted through regularization technology to obtain the target position coordinates that need to be shielded and coded; the target position is coded or covered: the sensitive information area that needs to be shielded and coded is covered;
[0026] Image return module: used in step 5, automatically returns the ID card image after information coding to the front end of the system page; users can view and use the processed image on the front end page.
[0027] A device for shielding and coding sensitive information of a certificate image, comprising:
[0028] Memory for storing computer programs;
[0029] A processor is used to implement the method for shielding and coding sensitive information of a certificate image described in steps 1 to 5 when executing the computer program.
[0030] A computer-readable storage medium stores a computer program, which, when executed by a processor, can realize automatic coding of private information of different types of certificates based on the method for shielding and coding sensitive information of certificate images described in steps 1 to 5.
[0031] Compared with the prior art, the present invention has the following beneficial effects:
[0032] 1. High text recognition accuracy: The present invention uses Baidu OCR API interface, which adapts to different image types and layout changes, and improves the comprehensiveness and accuracy of recognition. This makes the present invention more reliable and efficient when processing diversified document images.
[0033] 2. Automated information shielding and coding: Traditional methods may rely on manual operations or simple image processing tools for information shielding and coding; however, the present invention designs multiple layout templates according to the different layouts of each card, and through regularization technology, can automatically identify and shield sensitive information, ensuring user privacy while ensuring the integrity and accuracy of information. This automated processing not only improves the efficiency of operations, but also reduces the risk of human error, which has obvious advantages, especially in large-scale data processing.
[0034] 3. Intelligent processing and flexibility: The present invention combines Internet development technology and can intelligently call corresponding program templates for processing according to different types of certificate information uploaded by users; this makes it possible to automatically encode the privacy information of different types of certificates, greatly improving the flexibility and applicability of processing.
[0035] In summary, the present invention realizes efficient, accurate and safe processing of document information by adopting OCR text recognition technology, automatic coding processing and intelligent template calling mechanism. Compared with the existing technology, it significantly improves processing speed and accuracy, reduces human errors, enhances privacy protection, and provides wide adaptability to various types of documents. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 It is a system structure diagram of the present invention.
[0037] Figure 2 It is a system flow chart of the present invention.
[0038] Figure 3 This is the OCR text recognition flow chart of the present invention.
[0039] Figure 4 This is a diagram showing the effect of shielding and coding sensitive information on an ID card according to an embodiment of the present invention. DETAILED DESCRIPTION
[0040] The present invention will be further described in detail below in conjunction with the accompanying drawings.
[0041] A method for shielding and coding sensitive information in a certificate image, comprising the following steps: Figure 2 :
[0042] Step 1: Get the uploaded image file
[0043] After the user logs in to the ID card image sensitive information shielding and coding system, select the uploaded image type in the image type drop-down list to upload the ID card image; after the upload is completed, the image file is uploaded through the system front end and saved to the server root directory, with the upload timestamp as the naming format. Currently, the system supports multiple types of images, including ID cards, campus cards, driver's licenses, student cards, bank cards, etc.
[0044] Step 2: Image Preprocessing
[0045] The image obtained in step 1 will be sent to the image classification API provided by Baidu AI platform, namely AipImageClassify. Before use, you need to apply for API credentials from Baidu AI platform, including APP_ID, API_KEY and SECRET_KEY, in order to initialize AipImageClassify. Select the objectDetect method for classification, which can identify objects in the image and return the category information and bounding box position of the object. According to the returned object bounding box coordinates, the OpenCV library is used to crop and tilt the image to obtain an image containing only the certificate. This step is designed to solve problems such as card tilt, blurred shooting or background interference that may exist in the certificate images uploaded by users, so as to improve the accuracy of text recognition.
[0046] Step 3: OCR text recognition
[0047] The image preprocessed in step 2 is used to identify sensitive information in the ID card image; the OCR text recognition flow chart is as follows Figure 3 After the image is preprocessed, the system backend passes the image URL link parameter through the PHP program, calls Baidu OCR's API to perform OCR text recognition on the document image, identifies sensitive information, and automatically returns the recognized text information and text location coordinates.
[0048] Step 4: Automatically block and encode sensitive information
[0049] Based on the differences in layout of different certificates, the embodiment of the present invention defines multiple certificate coding functions. For example, an identity card mainly contains private information such as name, gender, date of birth, address, identity card number and avatar. In order to prevent user privacy leakage, it is often necessary to cover the private information such as address, identity card number and avatar with coding. Since the position of this information is basically the same on all identity cards, the text information returned in step three is firstly extracted by regularization technology in the certificate coding function to obtain the coordinates of the keyword text area. Regularization is used to standardize the text format and ensure that the field value conforms to the expected format. For example, the identity card number should be 18 digits. Then, the position information that needs to be coded is obtained according to the relative position between the text areas of the identity card. For example, if the keyword "ID number" is obtained and the specific ID number is located on the right side of the keyword, the target position coordinates of the 18-digit ID number that needs to be shielded and coded can be obtained by adding a distance to the keyword position coordinates; then the system will call the img.paste() function in Python's Pillow library to code or overwrite the target position: the img.paste() function can overlay a coding layer (such as a black rectangle) on the identified sensitive information area that needs to be shielded and coded to achieve privacy protection and prevent the leakage of sensitive information. Figure 4 As shown, the system performs text recognition on the original image to obtain the text information and coordinate information in the image, and then determines the target location to be coded according to the input image type by matching the pre-set template. Finally, private information such as ID number, profile picture, address, etc. is shielded and coded.
[0050] A system for shielding and coding sensitive information in ID images, see Figure 1 ,include:
[0051] Image upload module: used in step 1, after the user logs in to the system, he selects the type of certificate to be processed and uploads the image; the uploaded image file is transferred to the root directory of the server through the front end for subsequent reading and processing operations;
[0052] Image preprocessing module: used in step 2, calling the image classification API provided by Baidu AI platform, namely AipImageClassify; select the objectDetect method for classification, and return the category information and bounding box position of the object. According to the returned object bounding box coordinates, use the OpenCV library to crop and tilt the image, remove useless background parts, and thus reduce the impact of the background on the subsequent text recognition accuracy.
[0053] Text recognition module: used in step 3. After the image is preprocessed, the system backend automatically calls Baidu OCR recognition interface to perform sensitive information text recognition. The interface will return text information and text coordinate information in the form of a dictionary.
[0054] Sensitive information automatic shielding module: used in step 4, for different types of certificate layouts, when the user uploads the picture and selects the picture type, the corresponding template type is automatically called; the text information returned by the text recognition module is extracted through regularization technology to obtain the target position coordinates that need to be shielded and coded; the target position is coded or covered: the sensitive information area that needs to be shielded and coded is covered;
[0055] Image return module: used in step 5, automatically returns the ID card image after information coding to the front end of the system page; users can view and use the processed image on the front end page.
[0056] In actual application tests, the system of the present invention can achieve an accuracy rate of over 98% in recognizing text information on documents. In terms of processing speed, the system can complete the recognition and coding of each image within 1 second, while the traditional manual coding method usually takes 2-5 minutes. In terms of privacy protection, the system successfully shielded 99% of sensitive information areas without leakage. Through these indicators, the system of the present invention demonstrates its significant advantages in efficiency, accuracy and privacy protection. Figure 4The figure shows the effect diagram of shielding and coding sensitive information of an ID card according to an embodiment of the present invention, which realizes the shielding and coding of private information such as user's head picture, ID card number, address, date of birth, etc.
Claims
1. A method for shielding and coding sensitive information in a certificate image, characterized in that: The specific steps include: Step 1: Get the uploaded image file; Step 2: Perform image preprocessing on the image file obtained in step 1; Step 3: Identify sensitive information of the ID card image on the image preprocessed in step 2; Step 4: Automatically shield and encode the sensitive information identified in step 3; Step 5: Save the image processed by step 4 to the server root directory and return it to the user through the front-end page so that the user can view and save the document image that has been processed for privacy protection.
2. A method for shielding and coding sensitive information of a certificate image according to claim 1, characterized in that: The specific method of step 1 is: After the user logs in to the ID card image sensitive information shielding and coding system, select the uploaded image type in the image type drop-down list to upload the ID card image; after the upload is completed, the image file is uploaded through the system front end and saved in the server root directory.
3. A method for shielding and coding sensitive information of a certificate image according to claim 1, characterized in that: The specific method of image preprocessing described in step 2 is: Send the image obtained in step 1 to the image classification API provided by the AI platform, namely AipImageClassify, select the objectDetect method for classification, return the category information and bounding box position of the object, and use the OpenCV library to crop and tilt the image according to the returned object bounding box coordinates to remove useless background parts to reduce the impact of the background on the subsequent text recognition accuracy and improve the accuracy of text recognition.
4. A method for shielding and coding sensitive information of a certificate image according to claim 1, characterized in that: The specific method of step 3 is: After the image is preprocessed, the system backend automatically calls the OCR recognition API interface for text recognition. The interface will return text information and text coordinate information in the form of a dictionary.
5. A method for shielding and coding sensitive information of a certificate image according to claim 4, characterized in that: The OCR text recognition interface adopts the Baidu OCR API interface. The system backend passes in the image URL link parameters through the PHP program, calls the Baidu OCR API to perform OCR text recognition on the document image, identifies sensitive information, and automatically returns the identified text information and text location coordinates.
6. A method for shielding and coding sensitive information of a certificate image according to claim 1, characterized in that: The specific method of step 4 is: the system designs multiple layout templates according to the different layouts of each card. When the user uploads a picture and selects the picture type, the corresponding type template is automatically called. The text information on the picture uploaded by the user is identified through the OCR text recognition interface, and the text information and position coordinates on the picture are returned; keywords are extracted from the text information through regularization technology to obtain the target position coordinates that need to be shielded and coded; coding or covering processing is performed at the target position: covering the identified sensitive information area that needs to be shielded and coded.
7. A system for shielding and coding sensitive information in ID images, characterized in that: include: Image upload module: used in step 1, after the user logs into the system, selects the type of certificate to be processed and uploads the image; The uploaded image files are transferred to the root directory of the server through the front end for subsequent reading and processing operations; Image preprocessing module: used in step 2, the obtained document image is processed by the image preprocessing module, and the image classification API provided by the AI platform, namely AipImageClassify, is called. The objectDetect method is used to obtain the category information and bounding box position of the object. According to the returned object bounding box coordinates, the OpenCV library is used to crop and tilt the image to remove useless background parts, thereby reducing the impact of the background on the subsequent text recognition accuracy and improving the accuracy of text recognition; Text recognition module: used in step 3. After the image is preprocessed, the system backend automatically calls the OCR recognition interface to perform sensitive information text recognition. The interface will return text information and text coordinate information in the form of a dictionary. Sensitive information automatic shielding module: used in step 4, for different types of certificate layouts, when the user uploads the picture and selects the picture type, the corresponding template type is automatically called; the text information returned by the text recognition module is extracted through regularization technology to obtain the target position coordinates that need to be shielded and coded; the target position is coded or covered: the sensitive information area that needs to be shielded and coded is covered; Image return module: used in step 5 to automatically return the document image after information coding to the front end of the system page; Users can view and use the processed images on the front-end page.
8. A device for shielding and coding sensitive information of a certificate image, characterized in that: include: Memory for storing computer programs; A processor is used to implement the method for shielding and coding sensitive information of a certificate image as described in steps 1 to 5 when executing the computer program.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by the processor, it can realize automatic coding of private information of different types of certificates based on the method for shielding and coding sensitive information of certificate images described in steps 1 to 5.
Citation Information
Patent Citations
Information coding processing method and device, electronic equipment and readable storage medium
CN118158334A
Identity card coding system and method
CN107369086A
Certificate information recognition and collection method based on OCR R
CN109389118A
OCR-based credential recognition method, a device, a computer device and a storage medium
CN109492643A
OCR (Optical Character Recognition)-based certificate lost and found system and method
CN115292578A
Cited By
Method and device for shielding personal sensitive information of clinical test participants
CN120257368A
A method and system for processing sensitive information of engineering data
CN122990739A