From 3297a1d28c3fa8fce890d173d151b26944ce1bf2 Mon Sep 17 00:00:00 2001 From: mhoeschle <mhoeschle> Date: Thu, 13 Jul 2023 12:09:02 +0200 Subject: [PATCH] add function at the end, above __name__ == ... to run from command line --- BaslerChangeParameter.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/BaslerChangeParameter.py b/BaslerChangeParameter.py index b42cb77..dd27b74 100644 --- a/BaslerChangeParameter.py +++ b/BaslerChangeParameter.py @@ -25,7 +25,7 @@ if len(devices) == 0: # Create an array of instant cameras for the found devices and avoid exceeding a maximum number of devices. -> Output-> Pylon::CInstantCameraArray CAMERAS_ARRAY = pylon.InstantCameraArray(min(len(devices), MAX_CAMERAS_TO_USE)) -print(f'cameras: {CAMERAS_ARRAY}') +# print(f'cameras: {CAMERAS_ARRAY}') # for debug l = CAMERAS_ARRAY.GetSize() @@ -47,17 +47,13 @@ def listcams(): for i, camera_instantz in enumerate(CAMERAS_ARRAY): # cam is an instance Swig object of type Pylon::CInstantCamera on cluster on HD camera_instantz.Attach(tlFactory.CreateDevice(devices[i])) - print(f'camInstatnt: {type(camera_instantz)}') - - # - # list all the connected cameras at the system: - # + print(f'camera_instantz: {type(camera_instantz)}') # Print the serial number of the model of the camera. - by replacing .GetSerialNumber() with .GetModelName() outputs the Modelname cam_ids = camera_instantz.GetDeviceInfo().GetSerialNumber() print("Using device ", cam_ids) - return cam_ids + return cam_ids, camera_instantz # Open cameras: @@ -243,6 +239,8 @@ def freeruncam(): # ---> ongoing, not yet in usage. +CAM_ID, CAM_INSTANT = listcams() + if __name__ == '__main__': CAM_ID, CAM_INSTANT = listcams() - readcams() + # readcams() -- GitLab