Having issues with camera closing and opening in python , continuously for every 45 mins

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…

Why are you using ZED Explorer to reboot the camera?

You can use the reboot API function: Camera Class Reference | API Reference | Stereolabs

Is that the one causing the isuue?

It’s possible. You should also wait for a while after calling the reboot function before trying to reopen the camera.

But the problem isn’t only occuring when I do reboot , it is happening when I do in normal way as well , that is when I try to close and open the camera like in the below api, and mainly it is not showing any error but its just stuck over there

zed.close()
(or)
status = zed.open(init_params)

What version of the ZED SDK are you using?

Windows CUDA 12.1 ZED SDK 4.2.5 version

I recommend you use the latest v5.0.7.