Parcourir la source

Changed to using PageNormalizer to rotate output images.

Thomas Chef il y a 7 ans
Parent
commit
4f6a7aa4a5
2 fichiers modifiés avec 21 ajouts et 35 suppressions
  1. 9 15
      TestProject/book_settings.py
  2. 12 20
      TestProject/build.py

+ 9 - 15
TestProject/book_settings.py

@@ -1,15 +1,9 @@
-# Dynamic Input arguments. These vary for every book that is scanned and for every scan
-refImg =   2                    # The image used as reference image
-coverImage = 3                  # Image used for cover (Will be placed 1st)
-firstLeftHandPage = 161          # The first image covering the left pages
-pageNoOfFirstLeftPage = 4       # The page number (printed in the book) of the first left-hand page that is scanned (An even number)
-cropX1 = 288                    # Crop coordinates of all the images Max size is 3240 = 45" at 72dpi
-cropY1 = 34
-cropX2 = 3726
-cropY2 = 2980
-
-# These are the original settings (To big)
-#cropX1 = 258                    # Crop coordinates of all the images
-#cropY1 = 50
-#cropX2 = 3674
-#cropY2 = 2453
+# Dynamic Input arguments. These very for every book that is scanned and for every scan
+refImg =   1                    # The image used as reference image
+coverImage = 80                  # Image used for cover (Will be placed 1st)
+firstLeftHandPage = 81          # The first image covering the left pages
+pageNoOfFirstLeftPage = 6       # The page number (printed in the book) of the first left-hand page that is scanned (An even number)
+cropX1 = 560                    # Crop coordinates of all the images Max size is 3240 = 45" at 72dpi
+cropY1 = 90
+cropX2 = 3388
+cropY2 = 2387

+ 12 - 20
TestProject/build.py

@@ -105,19 +105,16 @@ rightPageNo = pageNoOfFirstLeftPage+1
 
 print( '---------- Processing cover page  ----------' )
 
-# First convert the cover-page as it should be number one
+# ------ First convert the cover-page as it should be number one
 subprocess.call('../PageNormalizer/build-Mac/PageNormalizer ' + \
                 ' -i ' + covFilePath + \
-                ' -o ' + tpath+'/temp.bmp' + \
+                ' -o ' + opath + '/page_'+str(1).zfill(numberNumericalsInName)+'.bmp ' + \
                 ' -wref ' + tpath + '/ref_white.jpg' + \
                 ' -bref ' + tpath + '/ref_black.jpg' + \
-                ' -s ' + settingsFile , shell=True)
+                ' -s ' + settingsFile + \
+                ' -r 270', shell=True)
 
-# Rotate the image and store it in the final position (output-folder)
-subprocess.call( 'sips -r 270 -s dpiHeight 200.0 -s dpiWidth 200.0 temp/temp.bmp --out ' + opath + '/page_'+str(1).zfill(numberNumericalsInName)+'.bmp ', shell=True)
-
-
-# Start doing the rest of the pages. Left pages first
+# ------ Start doing the rest of the pages. Left pages first
 for i in range( len(lHandSides) ):    
     
     # Process it
@@ -125,18 +122,15 @@ for i in range( len(lHandSides) ):
     subprocess.call('../PageNormalizer/build-Mac/PageNormalizer ' + \
                     ' -q ' \
                     ' -i ' + lHandSides[i] + \
-                    ' -o ' + tpath+'/temp.bmp' + \
+                    ' -o ' + opath + '/page_'+str(leftPageNo).zfill(numberNumericalsInName)+'.bmp ' + \
                     ' -wref ' + tpath + '/ref_white.jpg' + \
                     ' -bref ' + tpath + '/ref_black.jpg' + \
-                    ' -s ' + settingsFile , shell=True)
-
-    # Rotate the image
-    subprocess.call( 'sips -r 90 -s dpiHeight 200.0 -s dpiWidth 200.0 temp/temp.bmp --out ' + opath + '/page_'+str(leftPageNo).zfill(numberNumericalsInName)+'.bmp ', shell=True)
-
+                    ' -s ' + settingsFile + \
+                    ' -r 90', shell=True)
 
     leftPageNo = leftPageNo + 2 # Increase the page conter
 
-# Continue with the rest of the right hand pages
+# ------ Continue with the rest of the right hand pages
 for i in range( len(rHandSides) ):    
     
     # Right page after. Process it
@@ -144,13 +138,11 @@ for i in range( len(rHandSides) ):
     subprocess.call('../PageNormalizer/build-Mac/PageNormalizer ' + \
                     ' -q ' \
                     ' -i ' + rHandSides[i]  + \
-                    ' -o ' + tpath+'/temp.bmp' + \
+                    ' -o ' + opath + '/page_'+str(rightPageNo).zfill(numberNumericalsInName)+'.bmp ' + \
                     ' -wref ' + tpath + '/ref_white.jpg' + \
                     ' -bref ' + tpath + '/ref_black.jpg' + \
-                    ' -s ' + settingsFile , shell=True)
-
-    # Rotate the image
-    subprocess.call( 'sips -r 270 -s dpiHeight 200.0 -s dpiWidth 200.0 temp/temp.bmp --out ' + opath + '/page_'+str(rightPageNo).zfill(numberNumericalsInName)+'.bmp ', shell=True)
+                    ' -s ' + settingsFile + \
+                    ' -r 270', shell=True)
     
     rightPageNo = rightPageNo + 2 # Increase the page conter