行。我试图在Python配置文件中存储cameralink相机的相机参数,然后通过串口将这些参数传递给相机。有谁知道如何做到这一点?这就是我到目前为止所做的:
[BAUDRATE]
BAUDRATE = 9600
[ROI]
Width = 16
Height = 16
OffsetX = 3
OffsetY = 3
import configparser
import serial
List_of_Camera_Commands = []
# Establish serial port
'''
ser = serial.Serial('/dev/ttyUSB0')
print(ser.name)
ser.baudrate = 192000
ser.write(stuff to write)
ser.read()
'''
CameraConfig = configparser.ConfigParser()
CameraConfig.read("CameraConfig.conf")
#---------Code to read in Config file Options and cast as ints----
for name in CameraConfig.sections():
for option in CameraConfig.options(name):
Number_Value = CameraConfig.getint(name, option)
print(name, ": ", Number_Value)
Temp_command = [name, Number_Value]
List_of_Camera_Commands.append(Temp_command)
print(List_of_Camera_Commands)
#ser.write(List_of_Camera_Commands) ------> write to serial?