@@ -16,6 +16,7 @@ def __init__(self, config, comms):
1616 self .ml_model = None
1717 self .min_confidence = 0.4
1818 self .threshold_list = [(math .ceil (self .min_confidence * 255 ), 255 )]
19+ self .detector = ""
1920
2021 self .extra_fb = sensor .alloc_extra_fb (sensor .width (), sensor .height (), sensor .GRAYSCALE )
2122
@@ -39,6 +40,7 @@ def detect(self, img, global_variance):
3940
4041 for (x , y , w , h ), score in detection_list :
4142 self .face_object = (x - w , y - h , w * 4 , h * 4 )
43+ self .detector = "TensorFlow"
4244 self .has_face = True
4345 return
4446
@@ -57,6 +59,7 @@ def detect(self, img, global_variance):
5759
5860 if face_objects :
5961 self .face_object = face_objects [0 ]
62+ self .detector = "HaarCascade"
6063 self .has_face = True
6164
6265 if self .config .get ('TrackEyes' ):
@@ -76,7 +79,11 @@ def draw_region(self, img):
7679 if self .face_object [2 ] == img .width ():
7780 return
7881
79- img .draw_rectangle (self .face_object , color = (70 , 130 , 180 ))
82+ if self .detector == "TensorFlow" :
83+ img .draw_rectangle (self .face_object , color = (70 , 130 , 180 ))
84+
85+ if self .detector == "HaarCascade" :
86+ img .draw_rectangle (self .face_object )
8087
8188 if self .correct_angle :
8289 face_x = self .face_object [0 ]
0 commit comments