From f73ccf271fb10862f9ba6d04be7bf10000e6a21b Mon Sep 17 00:00:00 2001
From: mhoeschle <markus.hoeschle@tuebingen.mpg.de>
Date: Mon, 12 Sep 2022 10:54:29 +0200
Subject: [PATCH] update function and comments

---
 BaslerChangeParameter.py | 55 +++++++++++++++++++++++++---------------
 1 file changed, 35 insertions(+), 20 deletions(-)

diff --git a/BaslerChangeParameter.py b/BaslerChangeParameter.py
index 2dbcc48..41d6a00 100644
--- a/BaslerChangeParameter.py
+++ b/BaslerChangeParameter.py
@@ -17,7 +17,7 @@ Function
 """
 
 #
-# First step is to list all the connected cameras at the system:
+# list all the connected cameras at the system:
 #
 
 def listcam():
@@ -42,7 +42,7 @@ def listcam():
 listcam()
 
 #
-# Second step is open camara device
+# open camara device
 #
 
 def opencam(): 
@@ -57,12 +57,31 @@ def opencam():
 
 #opencam()
 
+#
+# close camera interface
+#
+
+def closecam():
+    """ 
+        close interface to camera
+    """
+    # close camera
+    ## camera = pylon.InstantCamera(pylon.TlFactory.GetInstance().CreateFirstDevice())
+    print("closeDevice:", "\n")
+    return camera.Close()
+#closecam()
+
+#
+# read parameters in camara
+#
+
 def readcam():
     """ 
         read out current settings from camera via interface
     """
     # open camera interface:
     opencam()
+
     # Read Gain value in Camera:
     print("Gain in (dB):")
     # Gain value
@@ -73,28 +92,19 @@ def readcam():
     # TriggerDelay value 
     print(camera.TriggerDelay.Value, "\n")
 
-    # for chaning the value uncomment the comment in the next line (camera.TriggerDelay.Value = YourValue)
-    #camera.TriggerDelay.Value = 0
+    # Exposure parameter
+    oldexposure = camera.ExposureTime.GetValue()
+    print(f'exposure: {oldexposure}',"\n")
+
+    oldfps = camera.AcquisitionFrameRate.GetValue()
+    print(f'fps: {oldfps}')
 
     # Gamma value:
     print("Camera gamma value: ")
     print(camera.Gamma.GetValue(), "\n")
 
     closecam()
-
-#
-# close camera interface
-#
-
-def closecam():
-    """ 
-        close interface to camera
-    """
-    # close camera
-    ## camera = pylon.InstantCamera(pylon.TlFactory.GetInstance().CreateFirstDevice())
-    print("closeDevice:", "\n")
-    return camera.Close()
-#closecam()
+readcam()
 
 #
 # Funktion for changing the value (uncomment the comment in the next line (camera.Gain = YourValue))
@@ -104,8 +114,13 @@ def gaincam():
         changes the gain in (dB) 
     """
     opencam()
-    gainvalue = input("Please enter the new gain in (dB): ")
-    camera.Gain = float(gainvalue)
+    # Read Gain value in Camera:
+    print(" Gain in (dB):")
+    # Gain value
+    print(camera.Gain.Value, "\n")
+    # Input new gain value
+    gainvalue = float(input("Please enter the new gain in (dB): "))
+    camera.Gain = (gainvalue)
     # Read Gain value in Camera:
     print("New Gain in (dB):")
     # Gain value
-- 
GitLab