Browse Source

Fix image saving for windows + error message on failure

master
Ruben van de Ven 2 years ago
parent
commit
9d1b523c56
  1. 14
      face_recognition/comparison.py

14
face_recognition/comparison.py

@ -606,11 +606,19 @@ def display(image_res, q1, q2, q3, q4, fullscreen, output_dir): @@ -606,11 +606,19 @@ def display(image_res, q1, q2, q3, q4, fullscreen, output_dir):
logger.info("Show frame until %f", override_until)
# save images:
name = datetime.datetime.now().isoformat(timespec='seconds')
cv2.imwrite(os.path.join(output_dir, f'{name}.png'),override_image)
name = datetime.datetime.now().isoformat(timespec='seconds').replace(':','-')
filename = os.path.join(output_dir, f'{name}.png')
print(f"Save to {filename}")
r=cv2.imwrite(filename, override_image)
if not r:
raise RuntimeError(f"Could not save image {filename}")
for result in results:
result_img =result.draw_detections(include_title = True)
cv2.imwrite(os.path.join(output_dir, f'{name}-{result.algorithm}.png'), result_img)
filename = os.path.join(output_dir, f'{name}-{result.algorithm}.png')
r = cv2.imwrite(filename, result_img)
if not r:
raise RuntimeError(f"Could not save image {filename}")

Loading…
Cancel
Save