截图 识别指定位置文字

def tu():

    browser.get_screenshot_as_file('1.png')
    img = Image.open("1.png")
    bo = ('图片左边到元素左边的距离','图片上面到元素上边的距离','图片左边到元素最右边的距离','图片上面到元素最下边的距离')
    bo= (536,366,660,417)
    im = img.crop(bo)
    im.save('1.png')

    APP_ID = '......'
    API_KEY = '..............'
    SECRET_KEY = '....................'
    client = AipOcr(APP_ID, API_KEY, SECRET_KEY)
    image =open('1.png','rb')
    image = image.read()
    word = client.basicAccurate(image)
    return word['words_result']

猜你喜欢

转载自blog.csdn.net/AnYeZhiYin/article/details/105567186