Really-amin commited on
Commit
c29a462
·
verified ·
1 Parent(s): e443853

Upload 2 files

Browse files
Files changed (1) hide show
  1. ocr.py +24 -0
ocr.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys, getopt
2
+ from OCR import detect
3
+
4
+ def main(argv):
5
+ inputfile = ''
6
+ outputfile = 'result.txt'
7
+ try:
8
+ opts, args = getopt.getopt(argv,"hi:o:m:",["ifile=","ofile=","mode="])
9
+ except getopt.GetoptError:
10
+ print ('test.py -i <inputfile> -o <outputfile> -m <mode>')
11
+ sys.exit(2)
12
+ for opt, arg in opts:
13
+ if opt == '-h':
14
+ print ('test.py -i <inputfile> -o <outputfile> -m <mode>')
15
+ sys.exit()
16
+ elif opt in ("-i", "--ifile"):
17
+ inputfile = arg
18
+ elif opt in ("-o", "--ofile"):
19
+ outputfile = arg
20
+ elif opt in ("-m", "--mode"):
21
+ mode = arg
22
+ detect.main(inputfile=inputfile, outputfile=outputfile)
23
+ if __name__ == "__main__":
24
+ main(sys.argv[1:])