-
Notifications
You must be signed in to change notification settings - Fork 0
/
evaluate.py
56 lines (38 loc) · 1.16 KB
/
evaluate.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
import cv2
from main import Recognizer
import numpy as np
stereo = True
if stereo:
num_cameras = 2
else:
num_cameras = 1
recognizer = Recognizer(scaleFactor=1, stereo=stereo)
num_files = 24
# Main method
for file in range(0, num_files):
frame_right = cv2.imread('evaluation/img/'+str(file)+'_r.png')
if stereo:
frame_left = cv2.imread('evaluation/img/'+str(file)+'_l.png')
else:
frame_left = None
results = [None] * 4
# Check if the frame right is captured
if frame_right is not None:
while results[2] is None:
results = recognizer.recognize(stereo, frame_right, frame_left)
print("Image {0}: ".format(file))
# Evaluate the whole matching - MATCH
print("MATCH: {0}".format(results[2]))
while True:
# Evaluate the detected face: - ALIGNED
#cv2.imshow('Face Detector', results[1])
# Evaluaate the stereo system:
if stereo:
cv2.imshow('Stereo', np.uint8(results[3]))
k = cv2.waitKey(1)
# ESC pressed
if k % 256 == 27:
print("Escape hit, closing...")
break
# Recognizer thread
recognizer.close(stereo)