Skip to main content

Windows.Media.Ocr

Project description

WinOCR

Python PyPI

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

pip install winocr[api]
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


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.2.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

winocr-0.0.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file winocr-0.0.2.tar.gz.

File metadata

  • Download URL: winocr-0.0.2.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for winocr-0.0.2.tar.gz
Algorithm Hash digest
SHA256 2a736e1b8637989c316fd0ba619d9c31844861e1ac77de6d02e3028e3a20996b
MD5 dd6386f70020190f7513e8a27bbd0f76
BLAKE2b-256 8deb209dc339f4fe91fc79eb9e148d5284bbe9ebfd905b3f16e27c41237a70a8

See more details on using hashes here.

File details

Details for the file winocr-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: winocr-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for winocr-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d3ac0ea5b8b8bf457e1ef41d6b1db5b26fbcfc0bf6454cc07d8d95d8245eb431
MD5 3c029bdabe947fc1ea4984aa65916d01
BLAKE2b-256 4ae61f716c88f0ba1307ec0a9b0f7eb1f290c43ef7f6215a7a5fb7579dc6db88

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page