Skip to content

Instantly share code, notes, and snippets.

View PeterPan1990's full-sized avatar

Young PeterPan1990

  • Ocean University of China
  • Qindao, China, ShanDong
View GitHub Profile
PeterPan1990 /
Created April 6, 2016 08:07 — forked from dannguyen/
Using Python 3.x and Google Cloud Vision API to OCR scanned documents to extract structured data

Using Python 3 + Google Cloud Vision API's OCR to extract text from photos and scanned documents

Just a quickie test in Python 3 (using Requests) to see if Google Cloud Vision can be used to effectively OCR a scanned data table and preserve its structure, in the way that products such as ABBYY FineReader can OCR an image and provide Excel-ready output.

The short answer: No. While Cloud Vision provides bounding polygon coordinates in its output, it doesn't provide it at the word or region level, which would be needed to then calculate the data delimiters.

On the other hand, the OCR quality is pretty good, if you just need to identify text anywhere in an image, without regards to its physical coordinates. I've included two examples:

####### 1. A low-resolution photo of road signs

PeterPan1990 /
Last active August 29, 2015 14:26 — forked from kevinlin311tw/
Deep Binary Hash Codes CIFAR10
PeterPan1990 / converter
Last active August 29, 2015 14:20 — forked from hiwonjoon/converter
import caffe_pb2 as proto
import leveldb
import sys
db = leveldb.LevelDB('./cifar_test',block_size=40 * (2 << 20) )
import struct
def unpickle(file):
import cPickle