diff --git a/README.md b/README.md index ccacd17..b3e605b 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Once all the requirements are installed, the program is ready to use. There are 1. manually list filter names and parameters from command line ```sh - python3 src/main.py res/examples/Palec_P4.tif res/examples/Palec_P4.png 600 denoise_tv_chambolle iterations=1 weight=0.2 median ksize=5 + python3 src/main.py res/examples/Palec_P4.tif res/examples/Palec_P4_from_shell.png 600 total_variation weight=0.15 median ksize=5 ``` 2. from preset saved in a json config file, that can be used to tune and modify existing presetrs, or create new ones @@ -76,7 +76,30 @@ Once all the requirements are installed, the program is ready to use. There are There is an option to input the filter series as a preset from json configuration file. -```diff + + + + + + + + + + + + + + + + +
General formatWoking example
+

 {
     "preset": [
         {
@@ -94,11 +117,10 @@ There is an option to input the filter series as a preset from json configuratio
     ]
     ...
 }
-```
-
-For example 
-
-```diff
+        
+
+

 {
     "git_example": [
         {
@@ -112,7 +134,13 @@ For example
         }
     ]
 }
-```
+        
+
+ + All the filters used and their parameters are described below. @@ -186,12 +214,12 @@ First optional parameter is papilar line height, second rate of curvature along * General form for curved stl generation ```sh - python3 src/main.py input_file output_file dpi --config config_file preset --stl height_line height_base curvature_x curvature_y + python3 src/main.py input_file output_file dpi --config config_file preset --stl c height_line height_base curvature_x curvature_y ``` * Working example curved stl generation ```sh - python3 src/main.py res/examples/Palec_P4.tif res/examples/Palec_P4_from_preset.png 600 --config config/config.json git_example --stl 2 10 2 2 + python3 src/main.py res/examples/Palec_P4.tif res/examples/Palec_P4_from_preset.png 600 --config config/config.json git_example --stl c 2 10 2 2 ``` # Generating planar finger model @@ -201,21 +229,26 @@ Optional parameters are model base thickness and papilar lines height, they are * General form for planar stl generation ```sh - python3 src/main.py input_file output_file dpi --config config_file preset --stl height_line height_base -p + python3 src/main.py input_file output_file dpi --config config_file preset --stl p height_line height_base ``` * Working example planar stl generation ```sh - python3 src/main.py res/examples/Palec_P4.tif res/examples/Palec_P4_from_preset.png 600 --config config/config.json git_example --stl 2 10 -p + python3 src/main.py res/examples/Palec_P4.tif res/examples/Palec_P4_from_preset.png 600 --config config/config.json git_example --stl p 2 10 ``` # Mapping to existing finger model This section will be added later, (if implemented) mapping of fingerprint to a given finger model. +* General form for planar stl generation + ```sh + python3 src/main.py input_file output_file dpi --config config_file preset --stl m height_line height_base finger_file + ``` + # Usage -usage: main.py [-h] [-m | --mirror | --no-mirror] [-p] input_file output_file dpi ([-c | --config config_file preset] | [filters ...]) [-s | --stl height_line height_base | --stl_file height_line curv_rate_x curv_rate_y] +usage: main.py [-h] [-m | --mirror | --no-mirror] input_file output_file dpi ([-c | --config config_file preset] | [filters ...]) [-s | --stl_file p height_line height_base | --stl_file c height_line height_base curv_rate_x curv_rate_y | --stl_file m height_line height_base finger_file] Program for processing a 2D image into 3D fingerprint. @@ -232,8 +265,6 @@ options: switch to mirror input image -s [STL_FILE ...], --stl_file [STL_FILE ...] create stl model from processed image - -p, --planar, --no-planar - make stl shape planar instead of curved one -c CONFIG CONFIG, --config CONFIG CONFIG pair: name of the config file with presets, name of the preset diff --git a/conf/conf.json b/conf/conf.json index 5a1dbe3..b7f10c6 100644 --- a/conf/conf.json +++ b/conf/conf.json @@ -132,11 +132,11 @@ "git_example": [ { "name": "total_variation", - "weight": 0.01 + "weight": 0.15 }, { "name": "median", - "ksize": 3 + "ksize": 5 } ] } diff --git a/src/test.sh b/src/test.sh index 3e33077..86be6f9 100644 --- a/src/test.sh +++ b/src/test.sh @@ -24,7 +24,7 @@ config_file=conf/conf.json # name of preset in conf. file #presets=("strong" "test-weak" "test-repeat" "test-strong") -presets=("ridge" "weak") +presets=("ridge") # generate stl files and set generation mode {"planar", "curved", "mapped"} generate_stl=true @@ -43,46 +43,36 @@ apply_filter() { for in in ${file_arr[@]} do # check that the file exists - if test -f "$in" - then - # append preset name to filename for easier identification, if not generating stl (that would result in very long names) - if $generate_stl; then - out="${in%%${match1}*}${match1}$format" - else - out="${in%%${match1}*}_$preset${match1}$format" - fi - - # skip stl files and files with preset name in them - if [[ $in == *".stl"* ]] || [[ $in == *_* ]]; then - ((j++)) - continue - fi - - ((i++)) - echo -e "|\n|----------------------- File no. $i: $in ------------------------------|\n" - - if $generate_stl; then - ((i++)) - if [[ "$generate_stl_mode" = "planar" ]]; then - python3 $exec_path $in $out $dpi -c $config_file $1 --stl p $height_line $height_base || break + [[ -f "$in" ]] || continue - elif [[ "$generate_stl" = "curved" ]]; then - python3 $exec_path $in $out $dpi -c $config_file $1 --stl c $height_line $height_base $curv_x $curv_y || break + # skip stl files and files with preset name in them + [[ "$in" == *_* ]] && continue + [[ "$in" == *".stl" ]] && continue + + ((i++)) + echo -e "|\n|----------------------- File no. $i: $in ------------------------------|\n" - elif [[ "$generate_stl" = "mapped" ]]; then - pass + if $generate_stl; then + out="${in%%${match1}*}${match1}$format" + case "$generate_stl_mode" in + "planar") + python3 $exec_path $in $out $dpi -c $config_file $1 --stl p $height_line $height_base || break + ;; + "curved") + python3 $exec_path $in $out $dpi -c $config_file $1 --stl c $height_line $height_base $curv_x $curv_y || break + ;; + "mapped") python3 $exec_path $in $out $dpi -c $config_file $1 --stl m $height_line $height_base $fp_file|| break - else + ;; + *) echo "Invalid stl generation mode" - break - fi - else - python3 $exec_path $in $out $dpi -c $config_file $1 || break - fi - else - echo "File $file does not exist" - fi - + exit 1 + ;; + esac + else + out="${in%%${match1}*}_$preset${match1}$format" + python3 $exec_path $in $out $dpi -c $config_file $1 || break + fi done }