Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Google Vision OCR返回具有不同ascii值的相似字符_Python_Python 3.x_Ascii_Ocr_Google Cloud Vision - Fatal编程技术网

Python Google Vision OCR返回具有不同ascii值的相似字符

Python Google Vision OCR返回具有不同ascii值的相似字符,python,python-3.x,ascii,ocr,google-cloud-vision,Python,Python 3.x,Ascii,Ocr,Google Cloud Vision,我最近一直在使用Google Cloud Vision API从图像中提取文本 它给出了惊人的结果,但是,我一直在一个特定的步骤,我需要比较提取的文本,相同的是不同的ASCII值,因此没有得到匹配 例如: for i in [77,924,1018,1052]: print(chr(i)) 上面的代码将显示与英文字符“M”相似的字符,但是它们都不同,因此当我尝试比较时,它返回False。此问题包含多个字符 如果能就如何处理这些问题提供任何帮助/建议,那就太好了 用于文本提取的Goog

我最近一直在使用Google Cloud Vision API从图像中提取文本

它给出了惊人的结果,但是,我一直在一个特定的步骤,我需要比较提取的文本,相同的是不同的ASCII值,因此没有得到匹配

例如:

for i in [77,924,1018,1052]:

    print(chr(i))
上面的代码将显示与英文字符“M”相似的字符,但是它们都不同,因此当我尝试比较时,它返回False。此问题包含多个字符

如果能就如何处理这些问题提供任何帮助/建议,那就太好了

用于文本提取的Google Vision代码:

def detect_text(img_path,x,y,w,h):
    data = []
    client = vision.ImageAnnotatorClient()
    im = cv2.imdecode(np.fromfile(img_path, dtype=np.uint8), cv2.IMREAD_UNCHANGED)[y:y+h, x:x+w]
    _, im_buf_arr = cv2.imencode(".jpg", I'm)
    content = im_buf_arr.tobytes()
    image = vision.Image(content=content)
    response = client.text_detection(image=image)
    texts = response.text_annotations
    for text in texts:
        data.append('\n"{}"'.format(text.description))
    return data
    if response.error.message:
        raise Exception('{}\nFor more info on error messages, check: '
                    'https://cloud.google.com/apis/design/errors'.format(
                        response.error.message))

也许是语言提示?请建议我在哪里使用该参数?这将帮助您->