-
Notifications
You must be signed in to change notification settings - Fork 50
/
call.py
39 lines (33 loc) · 1 KB
/
call.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# -*- coding: utf-8 -*-
"""
Created on Jun 16 22:39:34 2016
@author: AnkitSingh
"""
from Imagehandler import Imagehandler
import yaml
import glob
import os
def App():
with open('config.yml', 'r') as ymlfile:
cfg = yaml.load(ymlfile)
IOPlaces = cfg['Main']
input = IOPlaces['Input']
output = IOPlaces['Output']
directorypath = input
filesTypes = cfg['FileType']
images = []
for filetype in filesTypes:
images.extend(glob.glob(directorypath + '/*.' + filetype))
paths = [os.path.join(directorypath, image) for image in images]
for i in xrange(len(paths)):
obj = Imagehandler(paths[i])
try:
TransformImage = obj.QRCodeInImage()
except ZeroDivisionError:
print 'QR Code not found in image '+paths[i]
continue
if TransformImage is None:
print 'Image is not generated'
obj.WritingImage(TransformImage, str(output), '/output' + str(i) + '.jpg')
if __name__ == '__main__':
App()