소스 검색

Started to separate book settings

Thomas Chef 7 년 전
부모
커밋
d16a8cdbb1
4개의 변경된 파일29개의 추가작업 그리고 12개의 파일을 삭제
  1. 11 0
      .gitignore
  2. 2 2
      RefImageCreator/imgmanipbs.h
  3. 8 0
      TestProject/book_settings.py
  4. 8 10
      TestProject/build.py

+ 11 - 0
.gitignore

@@ -1,8 +1,19 @@
 *~
 *.user
 *.o
+*.pyc
 TestProject/input
 TestProject/temp
 TestProject/output
 PageNormalizer/build-Mac/PageNormalizer
 RefImageCreator/build-Mac/RefImageCreator
+RefImageCreator/build-Mac/ref*.jpg
+TestProject/*.pdf
+TestProject/readme.txt
+
+# Exclude all other folder than the 3 main-folders
+# This is because we store project folders in the root-folder, but we don't want them commited.
+/*/
+!/TestProject/
+!/PageNormalizer/
+!/RefImageCreator/

+ 2 - 2
RefImageCreator/imgmanipbs.h

@@ -33,8 +33,8 @@ public:
     int noOfHSquares;
 
     // Constants that affect the sizes of differents measurements in the image process
-    const int squareSize = 140;
-    const int measureSquareSize = 60;
+    const int squareSize = 150;
+    const int measureSquareSize = 70;
     const int squareMargin = measureSquareSize / 2;
 
     const int noOfMeanValues = 10;

+ 8 - 0
TestProject/book_settings.py

@@ -0,0 +1,8 @@
+# Dynamic Input arguments. These very for every book that is scanned and for every scan
+refImg =   3                    # The image used as reference image
+coverImage = 12               # Image used for cover (Will be placed 1st)
+firstLeftHandPage = 8         # The first image covering the left pages
+cropX1 = 333                    # Crop coordinates of all the images
+cropY1 = 30
+cropX2 = 3342
+cropY2 = 2380

+ 8 - 10
TestProject/build.py

@@ -1,13 +1,15 @@
 #!/usr/bin/python
 
 #--------------------------------------------------------------------------------------------------------
-# This python file is processing a complete book
-# It assumes that there is a folder named 'input' that contains all input data
+# This python file is used for processing a complete book.
+# It assumes that there is a folder named 'input' that contains all input images
 # The output is generated into a folder called 'output'
 # A folder called 'temp' is also used for intermediate files (that can be cleaned later)
 # In the 'input'-folder, there should only be image-files ending with a jpg-file-extension
+# You also need a book_settings.py that store all book specific settings.
 #
 # To scan a book, start with all the right hand pages from the start to the end, then take all left hand pages
+# When starting over with the left hande page, its important to start with the same spread (page-pair) as the right-hand.
 # The number of right/left-pages must be equal
 #
 # The reference image and cover image can be taken in any order, but must be pointed out below in the 'arguments'
@@ -21,14 +23,9 @@ image_pre_name = 'IMG_'         # The part of the filename before the numerical
 image_post_name = '.JPG'        # Part of the filename after the numerical part
 numberNumericalsInName=4        # Number of numericals in file name-index. For example 4 in 0304 and 1234
 
-# Dynamic Input arguments. These very for every book that is scanned and for every scan
-refImg =   3                    # The image used as reference image
-coverImage = 12               # Image used for cover (Will be placed 1st)
-firstLeftHandPage = 8         # The first image covering the left pages
-cropX1 = 333                    # Crop coordinates of all the images
-cropY1 = 30
-cropX2 = 3342
-cropY2 = 2380
+# All the dynamic (book specific) settings are store in an external python-file.
+# This makes it easier to share this file while maintaining multiple settings-files.
+from book_settings import *
 
 #--------------------------------------------------------------------------------------------------------
 import os
@@ -45,6 +42,7 @@ shutil.rmtree(opath, ignore_errors=True)
 if not os.path.exists(opath): os.makedirs(opath)
 if not os.path.exists(tpath): os.makedirs(tpath)
 
+# Check that there is an input folder
 if not os.path.exists(ipath):
     print('ERROR: No input folder !')
     exit()