-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
60 lines (54 loc) · 1.67 KB
/
test.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
import os
from fingercode import fingercode
from fingercode import dist
from biohashing import BioCode
from cv2 import cv2 as cv
from GUI import interactive
import time
import statistics
def draw(image):
cv.namedWindow("Image")
#显示图片,窗口自适应图片大小,可以指定多个窗口名称,显示多个图片
print('图片尺寸:', image.shape)
print('图片数据:', type(image), image)
cv.imshow("Image",image)
#等待键盘事件,如果为0则一直等待
cv.waitKey(0)
#释放窗口
cv.destroyAllWindows()
def main():
tezhengtiqu = []
tezhengjiami = []
flag = 0
while 1:
if flag==101:
break
img = interactive.GetIMG()
try:
preTime = time.time()
finger = fingercode.fingercode(img)
tezhengtiqu.append(time.time()-preTime)
preTime = time.time()
finger = BioCode.BioCode(123456,finger)
tezhengjiami.append(time.time()-preTime)
flag += 1
print("特征提取均值",statistics.mean(tezhengtiqu),"特征加密平均值",statistics.mean(tezhengjiami),flag)
except:
print("失败")
print("特征提取均值",statistics.mean(tezhengtiqu),"特征加密平均值",statistics.mean(tezhengjiami))
def compare():
preTime = time.time()
for i in range(640):
h = 1+1
b = 1^0
print(time.time()-preTime)
def biocodeDemo():
img = interactive.GetIMG()
finger = fingercode.fingercode(img)
finger = BioCode.BioCode(123456,finger)
result = ""
for i in finger:
result += str(i)
print(result)
if __name__ == "__main__":
biocodeDemo()