|
@@ -6,6 +6,7 @@ import os
|
|
|
import sys
|
|
|
import copy
|
|
|
import time
|
|
|
+import argparse
|
|
|
|
|
|
from skimage.io import imread, imsave
|
|
|
from skimage.color import rgb2gray
|
|
@@ -311,11 +312,16 @@ def getLeadingLine(imgpath, outPath):
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
- print(sys.argv[1])
|
|
|
- print(sys.argv[2])
|
|
|
+ parser = argparse.ArgumentParser(description='Find the Probable leading lines, please provide 1) your input image path or a folder path for input images, and 2) the output folder you wish.')
|
|
|
+ parser.add_argument('input', type=str, help='The path for your input image or folder')
|
|
|
+ parser.add_argument('-o', '--output', type=str, default='./OUTPUT', help='The path for your output folder ')
|
|
|
+ args = parser.parse_args()
|
|
|
|
|
|
- INPUT_DIRECTORY = sys.argv[1]
|
|
|
- OUTPUT_DIRECTORY = sys.argv[2]
|
|
|
+ INPUT_DIRECTORY = args.input
|
|
|
+ OUTPUT_DIRECTORY = args.output
|
|
|
+
|
|
|
+ print('INPUT : ', INPUT_DIRECTORY)
|
|
|
+ print('OUTPUT : ', OUTPUT_DIRECTORY)
|
|
|
|
|
|
if not (os.path.exists(OUTPUT_DIRECTORY)):
|
|
|
print('Create output path:' , OUTPUT_DIRECTORY)
|