-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecord_multi_cam_params.py
128 lines (117 loc) · 4.22 KB
/
record_multi_cam_params.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import PySpin
SAVE_LOCATION = "/mnt/Data4TB"
# SAVE_LOCATION = "/home/oconnorlab/Data"
SAVE_PREFIX = "" # String appended to beginning of each image filename. Can be left blank.
GRAB_TIMEOUT = 100 # (ms) length of time before cam.GrabNextImage() will timeout and stop hanging
NUM_THREADS_PER_CAM = 10 # The number of saving threads per camera; each system has different best value
VIDEO_FPS = 100.0 # What fps to save the video file as
VIDEO_WIDTH = 960
VIDEO_HEIGHT = 960
# PIXEL_FORMAT = (
# PySpin.PixelFormat_BayerRG8
# ) # What color format to convert from bayer; must match above
# FILETYPE = ".bmp" #
# QUALITY_LEVEL = (
# 75 # 0 is worst; 95 is best; 100 disbles jpeg compression. Only matters if save_format_extension is jpg.
# )
MIN_BATCH_INTERVAL = 1 # (s) If time between this and previous image is more than this, a new directory is created (this separates images into directories for each new trial)
# Assign custom names to cameras based on their serial numbers. Comment out to ignore that camera.
CAMERA_NAMES_DICT_COLOR = {
# "19472072": "camTR-orig",
# "19472089": "camBo-orig",
} # Indicate which cameras need to be debayered
CAMERA_NAMES_DICT_MONO = {
"23398259": "camTL-orig",
"23398260": "camBL-orig",
"23398261": "camBR-orig",
"23428985": "camTo-orig",
"24048476": "camTR-orig",
}
# Camera for software-triggered, webcam-type view
CAMERA_OVERHEAD_LIST = [
"19472072",
# "23398259",
]
# According to the API, trigger mode needs to be turned off for other parameters (like TriggerSource) to be changed. For this reason, the order of the items in this list matters. After setting the parameters, TriggerMode is turned back to True.
CAMERA_PARAMS_COLOR = [
["AcquisitionMode", PySpin.AcquisitionMode_Continuous],
["DecimationHorizontal", 1], # 1 is off, 2 is on
["DecimationVertical", 1],
["ExposureAuto", False],
["ExposureTime", 500], # us
["GainAuto", False],
["PixelFormat", PySpin.PixelFormat_BayerRG8], # Which Bayer filter the camera uses
["BalanceWhiteAuto", False],
["IspEnable", False], # Necessary to reach max framerate at full resolution
["TriggerMode", False],
["TriggerSource", PySpin.TriggerSource_Line3],
["TriggerActivation", PySpin.TriggerActivation_RisingEdge],
["TriggerOverlap", True],
["TriggerDelay", 32],
]
CAMERA_PARAMS_MONO = [
["AcquisitionMode", PySpin.AcquisitionMode_Continuous],
["DecimationHorizontal", 1], # 1 is off, 2 is on
["DecimationVertical", 1],
["ExposureAuto", False],
["ExposureTime", 1000], # us
["GainAuto", False],
["PixelFormat", PySpin.PixelFormat_Mono8], # Which Bayer filter the camera uses
["IspEnable", False], # Necessary to reach max framerate at full resolution
["TriggerMode", False],
["TriggerSource", PySpin.TriggerSource_Line3],
["TriggerActivation", PySpin.TriggerActivation_RisingEdge],
["TriggerOverlap", True],
["TriggerDelay", 32],
]
CAMERA_SPECIFIC_DICT = {
"23428985": [
["Width", VIDEO_WIDTH],
["Height", VIDEO_HEIGHT],
["OffsetX", 592],
["OffsetY", 212],
["Gain", 13],
],
"19472089": [
["Width", VIDEO_WIDTH],
["Height", VIDEO_HEIGHT],
["OffsetX", 472],
["OffsetY", 100],
["Gain", 25],
],
# "19472072": [
# ["Width", VIDEO_WIDTH],
# ["Height", VIDEO_HEIGHT],
# ["OffsetX", 400],
# ["OffsetY", 50],
# ["Gain", 25],
# ],
"23398259": [
["Width", VIDEO_WIDTH],
["Height", VIDEO_HEIGHT],
["OffsetX", 400],
["OffsetY", 100],
["Gain", 22],
],
"23398260": [
["Width", VIDEO_WIDTH],
["Height", VIDEO_HEIGHT],
["OffsetX", 400],
["OffsetY", 200],
["Gain", 15],
],
"23398261": [
["Width", VIDEO_WIDTH],
["Height", VIDEO_HEIGHT],
["OffsetX", 300],
["OffsetY", 132],
["Gain", 20],
],
"24048476": [
["Width", VIDEO_WIDTH],
["Height", VIDEO_HEIGHT],
["OffsetX", 480],
["OffsetY", 238],
["Gain", 15],
],
}