Created
July 20, 2014 03:58
-
-
Save shurru/68fd812d7f618549a3d2 to your computer and use it in GitHub Desktop.
Imagereader with detection of change in file. Not used for the 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/x/images/07/" | |
path2= "/home/shruthi/x/files/07/" | |
filename= "0101.jpg" | |
vartime= datetime.datetime.now() | |
while True: | |
(mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime) = os.stat(path+filename) | |
if time.ctime(mtime)!= vartime: | |
img= Image(path+filename) | |
bined= img.binarize(200) | |
text = bined.readText() | |
date= str(datetime.datetime.now()) | |
convert= re.findall('\d+', text) | |
convert= int(convert[0]) | |
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment