方法使用的OpenCV
检测图像中的垂直文本欲检测容器文本如本 container with vertical texts方法使用的OpenCV
我试图OpenCV的例子如textdetection.cpp
那些能够仅检测水平文字。除了cloud vision ocr之外,还有其他解决方案来解决这种情况。
您可以使用正方体代替,因为它具有读取文本功能垂直对齐,以及: 这里是一个示例代码:
import Image
import pytesseract
# provide the cropped area with text
def GetOCR(tempFilepath,languages ='eng'):
img = Image.open(tempFilepath)
#img= img.convert('L')
# filters can be applied optionally for reading the proper text from the image
img.load()
# -psm 5 will assume the text allinged vertically
text = pytesseract.image_to_string(img,lang = languages,config='-psm 6')
print "text :{0}".format(text)
注:上述样品将工作,前提是你要有pytesseract模块安装和tesseract-ocr exe安装在您的机器上。 希望这有助于:)
我想我必须培养正方体,以确定那些文字,是有可能做到这一点在树莓派 – cms
是的,你可以有你自己的训练数据 - 这是一个耗时的过程,但这可能不适用于您的场景,如果您可以在图像上应用一些过滤器,您可以轻松获得结果。因为在这种情况下,你已经获得了90 +%的准确度 – csharpcoder
您可以旋转图像,寻找横排文字 – JLev