import cv2 import time,os.path from time import sleep import os # initialiser les caméras #camera1 = cv2.VideoCapture(0) camera2 = cv2.VideoCapture(2) while True: #ret1, frame1 = camera1.read() ret2, frame2 = camera2.read() # Déclaration du chemin des répertoires #path1 ="./Bureau/Imagetest/Camera1" path2 ="Imagetest/Camera2" # Déclaration du timelapse sleep(60) #if ret1: # cv2.imshow("camera1", frame1) #cv2.imwrite(os.path.join(path1, "image1_" + time.strftime("%d-%m-%Y-%H-%M-%S_") + ".tif"),frame1) if ret2: cv2.imshow("camera2", frame2) cv2.imwrite(os.path.join(path2, "image2_" + time.strftime("%d-%m-%Y-%H-%M-%S_") + ".tif"),frame2) camera2.set(cv2.CAP_PROP_FRAME_WIDTH, 1920) camera2.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080) if cv2.waitKey(1) & 0xff ==ord('a'): break #camera1.release() camera2.release() cv2.destroyAllWindows()