Mercurial > hg > multiomr
comparison 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 |
comparison
equal
deleted
inserted
replaced
1:0f7f611deca4 | 2:46fb79167a61 |
---|---|
1 #!/home/alex/anaconda/bin/python | |
2 #!/home/alex/anaconda/bin/python | |
3 | |
4 import sys, getopt | |
5 import preomr | |
6 | |
7 def usage(): | |
8 print "Please provide input and output filenames." | |
9 | |
10 def main(argv): | |
11 if len(argv) < 3: | |
12 usage() | |
13 sys.exit(2) | |
14 infile = argv[0] | |
15 outfileA = argv[1] | |
16 outfileB = argv[2] | |
17 process(infile, outfileA, outfileB) | |
18 | |
19 def process(infile, outfileA, outfileB): | |
20 po = preomr.PreOMR(infile) | |
21 # TODO make deskewing an option | |
22 #po.deskew() | |
23 #po.staffline_removal() | |
24 rv = po.split_movements(outfileA, outfileB) | |
25 if rv != None: | |
26 print "new movement at position %d" % rv | |
27 sys.exit(0) | |
28 else: | |
29 print "no change of movement detected" | |
30 sys.exit(1) | |
31 | |
32 # Commandline parameter processing | |
33 # Make working folder | |
34 # Explode PDFs into PNGs? | |
35 # Deskew (optional) | |
36 # Find staves | |
37 # Print output image(s) | |
38 | |
39 if __name__ == "__main__": | |
40 main(sys.argv[1:]) |