def record(cam, runtime, mat):
vid = tp.PyERROR_CODE.PyERROR_CODE_FAILURE
out = False
while vid != tp.PyERROR_CODE.PySUCCESS and not out:
filepath = input("Enter filepath name: ")
vid = cam.enable_recording(filepath)
print(repr(vid))
if vid == tp.PyERROR_CODE.PySUCCESS:
print("Recording started...")
out = True
print("Hit spacebar to stop recording: ")
key = False
while key != 32: # for spacebar
err = cam.grab(runtime)
if err == tp.PyERROR_CODE.PySUCCESS:
cam.retrieve_image(mat)
cv2.imshow("ZED", mat.get_data())
key = cv2.waitKey(5)
cam.record()
else:
print("Help: you must enter the filepath + filename + SVO extension.")
print("Recording not started.")
cam.disable_recording()
print("Recording finished.")
cv2.destroyAllWindows()
评论列表
文章目录