Fix image saving for windows + error message on failure
This commit is contained in:
parent
2af58fc170
commit
9d1b523c56
1 changed files with 11 additions and 3 deletions
|
@ -606,11 +606,19 @@ def display(image_res, q1, q2, q3, q4, fullscreen, output_dir):
|
||||||
logger.info("Show frame until %f", override_until)
|
logger.info("Show frame until %f", override_until)
|
||||||
|
|
||||||
# save images:
|
# save images:
|
||||||
name = datetime.datetime.now().isoformat(timespec='seconds')
|
name = datetime.datetime.now().isoformat(timespec='seconds').replace(':','-')
|
||||||
cv2.imwrite(os.path.join(output_dir, f'{name}.png'),override_image)
|
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:
|
for result in results:
|
||||||
result_img =result.draw_detections(include_title = True)
|
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…
Reference in a new issue