def reboot_camera(self):
try:
# Path to ZED Explorer
zed_explorer_path = r"C:\Program Files (x86)\ZED SDK\tools"
zed_explorer_command = r'"ZED Explorer.exe" --reboot'
# Change the working directory and execute the command
self.logger.debug("*** Rebooting Camera ***")
result = subprocess.run(
zed_explorer_command,
cwd=zed_explorer_path,
shell=True,
capture_output=True,
text=True,
)
if result.returncode == 0:
self.logger.debug("[Success] Camera has been rebooted")self.zed = sl.Camera()
self.logger.info("Initializing Camera Parameters")
self.zed.set_camera_settings(sl.VIDEO_SETTINGS.AEC_AGC, 1)
init_params = sl.InitParameters()
init_params.coordinate_units = sl.UNIT.METER
init_params.depth_mode = sl.DEPTH_MODE.NEURAL
init_params.camera_resolution = sl.RESOLUTION.HD2K
init_params.enable_image_validity_check = True
init_params.camera_fps = 15
self.logger.info("Opening Camera")
status = self.zed.open(init_params)
if status != sl.ERROR_CODE.SUCCESS:
self.logger.debug("Camera Open:"+str(status))
# Reboot the Camera
self.reboot_camera()
self.logger.info("Camera Setup Successful!")
Above is the code I use to close and open the camera for every 45 mins , the problem is i am getting stuck either at
self.zed.close()
(or)
status = self.zed.open(init_params)
So can you help me out here…