from pypylon import pylon import time import sys try: # Get the Transport Layer Factory tl_factory = pylon.TlFactory.GetInstance() devices = tl_factory.EnumerateDevices() if not devices: print("No cameras found!") sys.exit(1) print(f"Found {len(devices)} cameras. Checking Camera 1...") # Connect to first camera cam = pylon.InstantCamera(tl_factory.CreateDevice(devices[0])) cam.Open() # 1. Reset to Defaults print("Reseting to Defaults...") cam.UserSetSelector.Value = "Default" cam.UserSetLoad.Execute() # 2. Enable Auto Exposure/Gain print("Enabling Auto Exposure & Gain...") cam.ExposureAuto.Value = "Continuous" cam.GainAuto.Value = "Continuous" # 3. Wait for it to settle (Camera adjusts to light) print("Waiting 3 seconds for auto-adjustment...") for i in range(3): print(f"{3-i}...") time.sleep(1) # 4. READ VALUES current_exposure = cam.ExposureTime.GetValue() # In Microseconds (us) current_fps_readout = cam.ResultingFrameRate.GetValue() print("-" * 30) print(f"REPORT FOR SERIAL: {cam.GetDeviceInfo().GetSerialNumber()}") print("-" * 30) print(f"Current Exposure Time: {current_exposure:.1f} us ({current_exposure/1000:.1f} ms)") print(f"Theoretical Max FPS: {1000000 / current_exposure:.1f} FPS") print(f"Camera Internal FPS: {current_fps_readout:.1f} FPS") print("-" * 30) if current_exposure > 33000: print("⚠️ PROBLEM FOUND: Exposure is > 33ms.") print(" This physically prevents the camera from reaching 30 FPS.") print(" Solution: Add more light or limit AutoExposureUpperLimit.") else: print("✅ Exposure looks fast enough for 30 FPS.") cam.Close() except Exception as e: print(f"Error: {e}")