-
Notifications
You must be signed in to change notification settings - Fork 3
/
BCJA.py
126 lines (103 loc) · 3.71 KB
/
BCJA.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#
# _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
# /\ _ `\ /\ _ _ _\/\_ _ _ \/\ _ _ `\
# \ \ \_\ \_\ \ \_ _ /\/_ _ _/\ \ \ \ \ \
# \ \ _ _ `\ \ \ _ \ \ \ \ \_ _\ \
# \ \ \_ _\ \ \ \_ _ _ /\`\_\/ \ \ _ _ \
# \ \_ _ _ _\ \_ _ _ _\ \_ _ _ _\ \_\_ /\_\
# \/_ _ _ _/\/_ _ _ _/\/_ _ _ _/\/_/ \/_/
#
# ================================================
# Library used to detect facial features, gestures
# and other thigs, finally used to detect and cla-
# -ssify different instances of blended classical
# joint attention. For further information and us-
# -age see ReadMe.md.
# ================================================
#
# Liscence is hereby provided to everyone abiding
# by the liscecnces of the dependencies to use this
# library when and where needed without a need to
# state.
# ================================================
import fdetect
import getcascades
import scenes
import gaze
import head
# ======================================================
#
# Face and facial feature module
#
# ======================================================
#
# Returns a 3 element array (used for internal functions only)
def get_frontal_face_cascade():
return getcascades.frontal_face()
# Returns a 2 element array (used for internal functions only)
def get_profile_face_cascade():
return getcascades.profile_face()
def get_all_face_cascade():
facecascade = getcascades.frontal_face()
facecascade1 = getcascades.profile_face()
for i in range(len(facecascade1)):
facecascade.append(facecascade1[i])
return facecascade
# Returns a 2 element array (used for internal functions only)
def get_facial_landmarks():
return getcascades.facial_landmarks()
# Takes input from webcam and detects a single frontal face out of many
def get_webcam_frontal_face_single():
facecascade = get_frontal_face_cascade()
fdetect.webcam_face_detect_single(facecascade)
# Takes input from webcam and detects all frontal faces
def get_webcam_frontal_face():
facecascade = get_frontal_face_cascade()
fdetect.webcam_face_detect(facecascade)
# Takes input from webcam and detects a single profile face out of many
def get_webcam_profile_face_single():
facecascade = get_profile_face_cascade()
fdetect.webcam_face_detect_single(facecascade)
# Takes input from webcam and detects all profile faces
def get_webcam_profile_face():
facecascade = get_profile_face_cascade()
fdetect.webcam_face_detect(facecascade)
# Takes input from webcam and detects single face of all kinds
def get_webcam_face_single():
facecascade = get_all_face_cascade()
fdetect.webcam_face_detect_single(facecascade)
# Takes input from webcam and detects all face of all kinds
def get_webcam_face():
facecascade = get_all_face_cascade()
fdetect.webcam_face_detect_single(facecascade)
# Takes input from webcam and detects a single face of any kind with template matching boost
def get_webcam_face_template():
facecascade = get_all_face_cascade()
fdetect.webcam_face_detect_template_matching(facecascade)
# ======================================================
#
# Scene change module
#
# ======================================================
#
def scene_change(video_capture):
scenes.scene_change(video_capture)
# ======================================================
#
# Gaze direction module
#
# ======================================================
#
#
def gaze_direction(video_capture):
predictor = getcascades.facial_landmarks()
gaze.detect_gaze_direction(video_capture,predictor)
# ======================================================
#
# Head pose and context module
#
# ======================================================
#
def head_pose(video_capture):
predictor = getcascades.facial_landmarks()
head.face_pose(video_capture,predictor)