Python中文
首页
教程
问答
标签
搜索
登录
注册
如何使用python3.x检测字符的位置
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我想检测图像中每个字符的位置。在</p> <p>我按照<a href="https://stackoverflow.com/questions/32175014/how-to-get-character-position-in-pytesseract">how to get character position in pytesseract</a>中的建议尝试了pytesseract,但给出了一个错误</p> <pre><code>import csv import cv2 from pytesseract import pytesseract as pt pt.run_tesseract('bw.png', 'output', lang=None, boxes=True, config="hocr") # To read the coordinates boxes = [] with open('output.box', 'rb') as f: reader = csv.reader(f, delimiter = ' ') for row in reader: if(len(row)==6): boxes.<a href="https://www.cnpython.com/list/append" class="inner-link">append</a>(row) # Draw the bounding box img = cv2.imread('bw.png') h, w, _ = img.shape for b in boxes: img = cv2.rectangle(img,(int(b[1]),h-int(b[2])),(int(b[3]),h-int(b[4])),(255,0,0),2) cv2.imshow('output',img) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-38-bad5c94b3e13> in <module>() 3 from pytesseract import pytesseract as pt 4 ----> 5 pt.run_tesseract('input/1230.jpg', 'output', lang=None, boxes=True, config="hocr") 6 7 # To read the coordinates TypeError: run_tesseract() got an unexpected keyword argument 'boxes' </code></pre> <p>我知道它是为Python2.7开发的,有人能指导我或者给我一个如何在Python3.x上实现它的方法吗</p> <p>然后我尝试了tesserocr,它似乎无论如何都无法解析tessdata的路径,我尝试使用tesseracct ocr,尝试手动下载tessdata,但仍然存在相同的错误。在</p> ^{pr2}$
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>要使用pytesseract和方法image_To_box获取字符及其在图像中的位置:</p> <pre><code>ret = pt.image_to_boxes(pil_img) </code></pre> <p>结果是一个字符串,其中每一行都是一个字符,其位置(x1,y1,X2,y2)用空格隔开:</p> ^{pr2}$
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
无法使用Django restfram生成PDF
7 回答
无法使用Django Rest框架发送压缩的gzip数据
6 回答
无法使用Django rest框架进行身份验证(请求用户=匿名用户)
7 回答
无法使用Django、Python和JavaScrip触发onclick函数
2 回答
无法使用Django.views.generic.View保存表单
1 回答
无法使用Django(python 2.7,OS X 10.11.1)
3 回答
无法使用Django/mongoengine连接到MongoDB(身份验证失败)
4 回答
无法使用Django\u mssql\u后端迁移到外部hos
9 回答
无法使用Django&Python3.4连接到MySql
5 回答
无法使用Django+nginx上载媒体文件
5 回答
无法使用Django1.6导入名称模式
5 回答
无法使用Django1.7和mongodb登录管理站点
8 回答
无法使用Djangoadmin创建项目,进程使用了错误的路径,因为我事先安装了错误的Python
1 回答
无法使用Djangockedi验证CBV中的字段
6 回答
无法使用Djangocketditor上载图像(错误400)
5 回答
无法使用Djangocron进行函数调用
10 回答
无法使用Djangofiler djang上载文件
2 回答
无法使用Djangokronos
5 回答
无法使用Djangomssql provid
8 回答
无法使用Djangomssql连接到带有Django 1.11的MS SQL Server 2016
6 回答