|
|
@ -46,6 +46,7 @@ class Main: |
|
|
|
area = abs(top-bottom)*abs(left-right) |
|
|
|
area = abs(top-bottom)*abs(left-right) |
|
|
|
array_faces.append((area, face_encoding)) |
|
|
|
array_faces.append((area, face_encoding)) |
|
|
|
if len(array_faces) == 0: |
|
|
|
if len(array_faces) == 0: |
|
|
|
|
|
|
|
time.sleep(0.2) |
|
|
|
continue |
|
|
|
continue |
|
|
|
array_faces_sorted = sorted(array_faces, key=lambda x: -x[0]) |
|
|
|
array_faces_sorted = sorted(array_faces, key=lambda x: -x[0]) |
|
|
|
chosen_face_area = array_faces_sorted[0][0] |
|
|
|
chosen_face_area = array_faces_sorted[0][0] |
|
|
@ -76,7 +77,7 @@ class Main: |
|
|
|
|
|
|
|
|
|
|
|
else: |
|
|
|
else: |
|
|
|
self.log.error("Falha ao acessar frame da camera") |
|
|
|
self.log.error("Falha ao acessar frame da camera") |
|
|
|
self.ip_camera = IPCamera(self.src) |
|
|
|
self.ip_camera.create_connection() |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
self.log.critical(str(e)) |
|
|
|
self.log.critical(str(e)) |
|
|
|
break |
|
|
|
break |
|
|
@ -91,9 +92,11 @@ class Main: |
|
|
|
self.log = logging.getLogger(__name__) |
|
|
|
self.log = logging.getLogger(__name__) |
|
|
|
|
|
|
|
|
|
|
|
def insere_buffer(self, tupla): |
|
|
|
def insere_buffer(self, tupla): |
|
|
|
|
|
|
|
self.log.info("Inserindo no buffer") |
|
|
|
self.buffer.appendleft(tupla) |
|
|
|
self.buffer.appendleft(tupla) |
|
|
|
|
|
|
|
|
|
|
|
def descarrega_buffer(self): |
|
|
|
def descarrega_buffer(self): |
|
|
|
|
|
|
|
self.log.info("Descarregando buffer") |
|
|
|
for (image_filename, frame) in self.buffer: |
|
|
|
for (image_filename, frame) in self.buffer: |
|
|
|
try: |
|
|
|
try: |
|
|
|
cv2.imwrite(filename=image_filename,img=frame) |
|
|
|
cv2.imwrite(filename=image_filename,img=frame) |
|
|
|