annotate Preprocessing/movements.py @ 2:46fb79167a61 tip

Main Code
author Victor Padilla <victor.padilla.mc@gmail.com>
date Mon, 04 May 2015 22:56:18 +0200
parents
children
rev   line source
victor@2 1 #!/home/alex/anaconda/bin/python
victor@2 2 #!/home/alex/anaconda/bin/python
victor@2 3
victor@2 4 import sys, getopt
victor@2 5 import preomr
victor@2 6
victor@2 7 def usage():
victor@2 8 print "Please provide input and output filenames."
victor@2 9
victor@2 10 def main(argv):
victor@2 11 if len(argv) < 3:
victor@2 12 usage()
victor@2 13 sys.exit(2)
victor@2 14 infile = argv[0]
victor@2 15 outfileA = argv[1]
victor@2 16 outfileB = argv[2]
victor@2 17 process(infile, outfileA, outfileB)
victor@2 18
victor@2 19 def process(infile, outfileA, outfileB):
victor@2 20 po = preomr.PreOMR(infile)
victor@2 21 # TODO make deskewing an option
victor@2 22 #po.deskew()
victor@2 23 #po.staffline_removal()
victor@2 24 rv = po.split_movements(outfileA, outfileB)
victor@2 25 if rv != None:
victor@2 26 print "new movement at position %d" % rv
victor@2 27 sys.exit(0)
victor@2 28 else:
victor@2 29 print "no change of movement detected"
victor@2 30 sys.exit(1)
victor@2 31
victor@2 32 # Commandline parameter processing
victor@2 33 # Make working folder
victor@2 34 # Explode PDFs into PNGs?
victor@2 35 # Deskew (optional)
victor@2 36 # Find staves
victor@2 37 # Print output image(s)
victor@2 38
victor@2 39 if __name__ == "__main__":
victor@2 40 main(sys.argv[1:])