基于百度AI的身份证识别
import os
import pandas as pd
import requests
import base64
import tkinter as tk
from tkinter import filedialog
class IdCard_Distinguish:
def __init__(self):
self.func_url = 'https://aip.baidubce.com/rest/2.0/ocr/v1/idcard'
self.access_token = '24.d379bcbcd7344f3e8a43db32245998ad.2592000.1624093312.282335-24211563'
self.request_url = self.func_url + "?access_token=" + self.access_token
self.headers = {'content-type': 'application/x-www-form-urlencoded'}
self.col = ['姓名','民族','住址','公民身份号码','出生','性别']
self.dirpath = self.user_select()
self.imgpath = self.get_imgname()
self.imgcode = self.img_decode()
self.info = self.img_distinguish()
def user_select(self):
tk.Tk().withdraw()
dirpath = filedialog.askdir