2017-07-07 15 views
-1

画像からテキストを読み込む方法、Pythonを使ってテキスト認識を行う方法がありますか?Pythonの画像からテキストを読む

私はいくつかの画像を読んでそれらに書かれたテキストを取得する必要があります。

私はpytesser、PIL、pillowなどのライブラリを検索していましたが、誰かが何かを知っていますか?窓やPython 3.6.1

については

はありがとう、

マーカス

+0

たぶん、あなたはここに助けを見つける:http://www.manejandodatos.es/2014/11/ocr -python-easy/ – am2

+0

これはOCR(光学式文字認識)と呼ばれています。多くのOCRプログラムとライブラリアンがあり、ほとんどが商用です。 [pytesseract](https://pypi.python.org/pypi/pytesseract)は無料のOCRであるGoogle TesseractのPythonラッパーです。 – phd

答えて

1

GoogleのビジョンAPIは役立つかもしれません。画像内のどのオブジェクトが存在するのか、他の情報(ブランド、色、顔検出など)を引き出すことができます。テキストをかなり確実に引き出すことができます。ここで

https://cloud.google.com/vision/

のPythonクライアントライブラリを使用して自分のウェブサイトからいくつかのサンプルコードです:

import io 
import os 

# Imports the Google Cloud client library 
from google.cloud import vision 

# Instantiates a client 
vision_client = vision.Client() 

# The name of the image file to annotate 
file_name = os.path.join(
    os.path.dirname(__file__), 
    'resources/wakeupcat.jpg') 

# Loads the image into memory 
with io.open(file_name, 'rb') as image_file: 
    content = image_file.read() 
    image = vision_client.image(
     content=content) 

# Performs label detection on the image file 
labels = image.detect_labels() 

print('Labels:') 
for label in labels: 
    print(label.description) 
関連する問題