我使用googlecloudvisionpythonapi来执行OCR,以便从文档中提取信息,比如ID证明。有没有一种方法可以裁剪图像,只保留文本集中的部分?我试过用槌球,但它只是消除了边界。在
我的代码中的函数有点像:
def detect_text(path):
"""Detects text in the file."""
vision_client = vision.Client()
with io.open(path, 'rb') as image_file:
content = image_file.read()
image = vision_client.image(content=content)
texts = image.detect_text()
您必须遍历响应并处理边界框的坐标。有关API响应的一些示例,请参见this page。在
相关问题 更多 >
编程相关推荐