File size: 728 Bytes
c29a462
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import sys, getopt
from OCR import detect

def main(argv):
   inputfile = ''
   outputfile = 'result.txt'
   try:
      opts, args = getopt.getopt(argv,"hi:o:m:",["ifile=","ofile=","mode="])
   except getopt.GetoptError:
      print ('test.py -i <inputfile> -o <outputfile> -m <mode>')
      sys.exit(2)
   for opt, arg in opts:
      if opt == '-h':
         print ('test.py -i <inputfile> -o <outputfile> -m <mode>')
         sys.exit()
      elif opt in ("-i", "--ifile"):
         inputfile = arg
      elif opt in ("-o", "--ofile"):
         outputfile = arg
      elif opt in ("-m", "--mode"):
         mode = arg
   detect.main(inputfile=inputfile, outputfile=outputfile)
if __name__ == "__main__":
   main(sys.argv[1:])