Parcourir la source

add argparse, add readme

zhJ il y a 1 an
Parent
commit
d92a01b039
2 fichiers modifiés avec 42 ajouts et 4 suppressions
  1. 10 4
      LigneForce.py
  2. 32 0
      README.md

+ 10 - 4
LigneForce.py

@@ -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)

+ 32 - 0
README.md

@@ -0,0 +1,32 @@
+<!-- ABOUT THE PROJECT -->
+## About The Project
+This is the official repo for the paper :
+# Reconstructing image composition features: leading lines computation
+
+<!-- GETTING STARTED -->
+## Required libraries
+python 3.11.3
+numpy 1.24.3
+scikit-image 0.20.0
+PIL 9.4.0
+argparse 1.1
+
+<!-- USAGE EXAMPLES -->
+## Usage
+1. Clone this repo
+```sh
+git clone https://gogs.univ-littoral.fr/jzhang/leading_lines.git
+```
+2. Cd to the directory
+```sh
+cd leading_lines 
+```
+3. Execute
+```sh
+python LigneForce.py YOUR_INPUT_PATH 
+```
+such as 
+```sh
+python LigneForce.py ./testData
+```
+