Simplified test script, fixed readme

master
Rostislav Lán 2 years ago
parent 239c675524
commit b12a0d3e9b

@ -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 1. manually list filter names and parameters from command line
```sh ```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 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. There is an option to input the filter series as a preset from json configuration file.
```diff
<style>
table {
width: 100%;
}
th, td {
padding: 10px;
font-family: monospace;
width: 50%;
vertical-align: top;
}
</style>
<table>
<thead>
<tr>
<th>General format</th>
<th>Woking example</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<pre><code class="language-json">
{ {
"preset": [ "preset": [
{ {
@ -94,11 +117,10 @@ There is an option to input the filter series as a preset from json configuratio
] ]
... ...
} }
``` </code></pre>
</td>
For example <td>
<pre><code class="language-json">
```diff
{ {
"git_example": [ "git_example": [
{ {
@ -112,7 +134,13 @@ For example
} }
] ]
} }
``` </code></pre>
</td>
</tr>
</tbody>
</table>
All the filters used and their parameters are described below. 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 * General form for curved stl generation
```sh ```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 * Working example curved stl generation
```sh ```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 # 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 * General form for planar stl generation
```sh ```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 * Working example planar stl generation
```sh ```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 # Mapping to existing finger model
This section will be added later, (if implemented) mapping of fingerprint to a given 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
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. Program for processing a 2D image into 3D fingerprint.
@ -232,8 +265,6 @@ options:
switch to mirror input image switch to mirror input image
-s [STL_FILE ...], --stl_file [STL_FILE ...] -s [STL_FILE ...], --stl_file [STL_FILE ...]
create stl model from processed image create stl model from processed image
-p, --planar, --no-planar
make stl shape planar instead of curved one
-c CONFIG CONFIG, --config CONFIG CONFIG -c CONFIG CONFIG, --config CONFIG CONFIG
pair: name of the config file with presets, name of the preset pair: name of the config file with presets, name of the preset

@ -132,11 +132,11 @@
"git_example": [ "git_example": [
{ {
"name": "total_variation", "name": "total_variation",
"weight": 0.01 "weight": 0.15
}, },
{ {
"name": "median", "name": "median",
"ksize": 3 "ksize": 5
} }
] ]
} }

@ -24,7 +24,7 @@ config_file=conf/conf.json
# name of preset in conf. file # name of preset in conf. file
#presets=("strong" "test-weak" "test-repeat" "test-strong") #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 files and set generation mode {"planar", "curved", "mapped"}
generate_stl=true generate_stl=true
@ -43,46 +43,36 @@ apply_filter() {
for in in ${file_arr[@]} for in in ${file_arr[@]}
do do
# check that the file exists # check that the file exists
if test -f "$in" [[ -f "$in" ]] || continue
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 # skip stl files and files with preset name in them
if [[ $in == *".stl"* ]] || [[ $in == *_* ]]; then [[ "$in" == *_* ]] && continue
((j++)) [[ "$in" == *".stl" ]] && continue
continue
fi
((i++)) ((i++))
echo -e "|\n|----------------------- File no. $i: $in ------------------------------|\n" echo -e "|\n|----------------------- File no. $i: $in ------------------------------|\n"
if $generate_stl; then if $generate_stl; then
((i++)) out="${in%%${match1}*}${match1}$format"
if [[ "$generate_stl_mode" = "planar" ]]; then case "$generate_stl_mode" in
"planar")
python3 $exec_path $in $out $dpi -c $config_file $1 --stl p $height_line $height_base || break python3 $exec_path $in $out $dpi -c $config_file $1 --stl p $height_line $height_base || break
;;
elif [[ "$generate_stl" = "curved" ]]; then "curved")
python3 $exec_path $in $out $dpi -c $config_file $1 --stl c $height_line $height_base $curv_x $curv_y || break python3 $exec_path $in $out $dpi -c $config_file $1 --stl c $height_line $height_base $curv_x $curv_y || break
;;
elif [[ "$generate_stl" = "mapped" ]]; then "mapped")
pass
python3 $exec_path $in $out $dpi -c $config_file $1 --stl m $height_line $height_base $fp_file|| break 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" echo "Invalid stl generation mode"
break exit 1
fi ;;
esac
else else
out="${in%%${match1}*}_$preset${match1}$format"
python3 $exec_path $in $out $dpi -c $config_file $1 || break python3 $exec_path $in $out $dpi -c $config_file $1 || break
fi fi
else
echo "File $file does not exist"
fi
done done
} }

Loading…
Cancel
Save