-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfingerprint_matcher.py
63 lines (52 loc) · 1.67 KB
/
fingerprint_matcher.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import subprocess
import sys
import argparse
from pathlib import Path
import os
import time
def main():
start_time = time.time()
arg1 = sys.argv[1]
arg2 = sys.argv[2]
# Define arguments for the MATLAB script
matlab_script = "enhance_test.m" # MATLAB script name (without .m)
matlab_arg1 = "Hello"
matlab_arg2 = "World"
path1 = Path(arg1)
path2 = Path(arg2)
# Define arguments for the Python script
python_script = "./minutiae-extraction/sift_compare.py"
enhanced_1 = f"{path1.stem}{'_enhanced'}{path1.suffix}"
enhanced_2 = f"{path2.stem}{'_enhanced'}{path2.suffix}"
binary_1 = f"{path1.stem}{'_binary'}{path1.suffix}"
binary_2 = f"{path2.stem}{'_binary'}{path2.suffix}"
try:
subprocess.run(
["matlab", "-batch", f"addpath(''); enhance_test('{arg1}', '{arg2}')"],
check=True
)
# subprocess.run(
# [
# "matlab",
# "-batch",
# f"{matlab_script}('{args.f1}', '{args.f2}')"
# ],
# check=True
# )
result = subprocess.run(
[sys.executable, python_script, enhanced_1, enhanced_2,binary_1,binary_2],
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
end_time = time.time()
total_time = end_time - start_time
# print('Total run time: ',total_time)
output = result.stdout.decode()
print(f'{output},{total_time}')
except subprocess.CalledProcessError as e:
# print(f"An error occurred: {e}")
print('ERROR')
return
if __name__ == "__main__":
main()