Windows.Media.Ocr
Project description
WinOCR
Installation
pip install winocr
Usage
Pillow
import winocr
from PIL import Image
img = Image.open('test.jpg')
print((await winocr.recognize_pil(img, 'ja')).text)
OpenCV
import winocr
import cv2
img = cv2.imread('test.jpg')
print((await winocr.recognize_cv2(img, 'ja')).text)
Web API
Run server
winocr_serve
curl
curl localhost:8000?lang=ja --data-binary @test.jpg
Python
import requests
bytes = open('test.jpg', 'rb').read()
requests.post('http://localhost:8000/?lang=ja', bytes).json()['text']
JavaScript
// File
const file = document.querySelector('[type=file]').files[0]
await fetch('http://localhost:8000/', {method: 'POST', body: file}).then(r => r.json())
// Blob
const blob = await fetch('https://image.itmedia.co.jp/ait/articles/1706/15/news015_16.jpg').then(r=>r.blob())
await fetch('http://localhost:8000/?lang=ja', {method: 'POST', body: blob}).then(r => r.json())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
winocr-0.0.1.tar.gz
(3.4 kB
view hashes)
Built Distribution
winocr-0.0.1-py3-none-any.whl
(3.8 kB
view hashes)