Last active
August 29, 2015 14:04
-
-
Save shurru/34aea07695c387025daf to your computer and use it in GitHub Desktop.
Used for demo.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from SimpleCV import * | |
from tesseract import * | |
import datetime | |
import json | |
import re | |
import os, time | |
# path= "/home/shruthi/Desktop/cxa/images/" | |
path= "/home/shruthi/x/images/07/" | |
# path2= "/home/shruthi/x/files/07/" | |
# for i in xrange (6,15): | |
filename="0101.jpg" | |
# filename= "Electric15.jpg" | |
os.system('clear') | |
img= Image(path+filename) | |
a= img.show() | |
time.sleep(5) | |
bined= img.binarize(200) | |
b= bined.show() | |
text = bined.readText() | |
date= str(datetime.datetime.now()) | |
convert= re.findall('\d+', text) | |
convert= int(convert[0]) | |
time.sleep(4) | |
# listes = [{"postcode": 600001, "unit":"#01-01", "time": date, "value": convert, "imgUrl": "images/07/0101.jpg"}, | |
# {"postcode": 600001, "unit":"#01-02", "time": "2014-07-01 12:00:00", "value": 69568, "imgUrl": "images/07/0102.jpg"}, | |
# {"postcode": 600001, "unit":"#01-03", "time": "2014-07-01 12:00:00", "value": 7576, "imgUrl": "images/07/0103.jpg"}, | |
# {"postcode": 600001, "unit":"#01-04", "time": "2014-07-01 12:00:00", "value": 19676, "imgUrl": "images/07/0104.jpg"} | |
# ] | |
# with open(path2+ '600001.json', 'w') as outfile: | |
# json.dump(listes, outfile) | |
# vartime= time.ctime(mtime) | |
print "###############################################################" | |
print "\n" | |
print "Number extracted from image: %r" %convert | |
print "\n" | |
print "###############################################################" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment