diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Preprocessing/movements.py	Mon May 04 22:56:18 2015 +0200
@@ -0,0 +1,40 @@
+#!/home/alex/anaconda/bin/python
+#!/home/alex/anaconda/bin/python
+
+import sys, getopt
+import preomr
+
+def usage():
+    print "Please provide input and output filenames."
+
+def main(argv):
+    if len(argv) < 3:
+        usage()
+        sys.exit(2)
+    infile = argv[0]
+    outfileA = argv[1]
+    outfileB = argv[2]
+    process(infile, outfileA, outfileB)
+
+def process(infile, outfileA, outfileB):
+    po = preomr.PreOMR(infile)
+    # TODO make deskewing an option
+    #po.deskew()
+    #po.staffline_removal()
+    rv = po.split_movements(outfileA, outfileB)
+    if rv != None:
+        print "new movement at position %d" % rv
+        sys.exit(0)
+    else:
+        print "no change of movement detected"
+        sys.exit(1)
+
+# Commandline parameter processing
+# Make working folder
+# Explode PDFs into PNGs?
+# Deskew (optional)
+# Find staves
+# Print output image(s)
+
+if __name__ == "__main__":
+   main(sys.argv[1:])
\ No newline at end of file