Skip to content

Commit b5b3f79

Browse files
committed
Merge branch 'NewSingleTagAlgo'
2 parents 3afdcae + af32275 commit b5b3f79

15 files changed

+311
-310
lines changed

PiSideCode/Calibration/calibration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ def generateCalibration(self, calFile: str):
184184
self.imgShape,
185185
None,
186186
None,
187-
flags=cv2.CALIB_RATIONAL_MODEL
188-
+ cv2.CALIB_THIN_PRISM_MODEL
189-
+ cv2.CALIB_TILTED_MODEL,
187+
# flags=cv2.CALIB_RATIONAL_MODEL
188+
# + cv2.CALIB_THIN_PRISM_MODEL
189+
# + cv2.CALIB_TILTED_MODEL,
190190
)
191191

192192
# Write to a dictionary
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"Resolution": [1600, 1300], "Brightness": 10.0, "Exposure": 105.0}
1+
{"Resolution": [1600, 1300], "Brightness": 10.0, "Exposure": 670.0}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"Resolution": [1600, 1200], "Brightness": 3.0, "Exposure": 3.0}
1+
{"Resolution": [1600, 1200], "Brightness": 30.0, "Exposure": 642.0}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"Resolution": [1600, 1300], "Brightness": -1.0, "Exposure": 156.0}
1+
{"Resolution": [1280, 720], "Brightness": 30.0, "Exposure": 156.0}

PiSideCode/Camera/camera.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from sys import platform
88
import logging
99
from Camera.CameraInfo import CameraInfo
10+
from pathlib import Path
1011

1112

1213
# Maintains camera info provided by cv2
@@ -29,6 +30,12 @@ def __init__(self):
2930

3031
# Try all cameras found by the PI
3132
for camPath in cameraPaths:
33+
if (
34+
Path("../../../deadeye").is_dir()
35+
and camPath == "platform-xhci-hcd.9.auto-usb-0:1:1.0-video-index0"
36+
):
37+
continue
38+
3239
path = f"/dev/v4l/by-path/{camPath}"
3340

3441
# Open camera and check if it is opened
@@ -84,7 +91,7 @@ def __init__(self):
8491
map(
8592
lambda x: int(x.split("=")[-1]),
8693
re.search(
87-
"exposure_absolute .* min=[0-9]+ max=[0-9]+ step=[0-9]+",
94+
"exposure_absolute .* min=-?[0-9]+ max=-?[0-9]+ step=[0-9]+",
8895
settingParams,
8996
)
9097
.group()
@@ -96,7 +103,7 @@ def __init__(self):
96103
map(
97104
lambda x: int(x.split("=")[-1]),
98105
re.search(
99-
"brightness .* min=[0-9]+ max=[0-9]+ step=[0-9]+",
106+
"brightness .* min=-?[0-9]+ max=-?[0-9]+ step=[0-9]+",
100107
settingParams,
101108
)
102109
.group()
@@ -107,9 +114,7 @@ def __init__(self):
107114
Cameras.logger.info(
108115
f"Supported resolutions: {supportedResolutions}"
109116
)
110-
Cameras.logger.info(
111-
f"Supported formats: {formats}"
112-
)
117+
Cameras.logger.info(f"Supported formats: {formats}")
113118
Cameras.logger.info(
114119
f"Supported exposures (min, max, step): {exposureRange}"
115120
)
@@ -190,9 +195,13 @@ def setResolution(self, identifier, resolution):
190195
# os.system(f"v4l2-ctl -d /dev/v4l/by-path/{identifier} --set-fmt-video=width={resolution[0]},height={resolution[1]}")
191196
self.info[identifier].cam.set(cv2.CAP_PROP_FRAME_HEIGHT, resolution[1])
192197
self.info[identifier].cam.set(cv2.CAP_PROP_FRAME_WIDTH, resolution[0])
193-
self.info[identifier].cam.set(
194-
cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*("MJPG" if "MJPG" in self.info[identifier].validFormats else "GREY"))
195-
)
198+
# self.info[identifier].cam.set(
199+
# cv2.CAP_PROP_FOURCC,
200+
# cv2.VideoWriter_fourcc(
201+
# *("MJPG" if "MJPG" in self.info[identifier].validFormats else "GREY")
202+
# ),
203+
# )
204+
self.info[identifier].cam.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*"YUYV"))
196205
self.info[identifier].cam.set(cv2.CAP_PROP_FPS, 30) # Lower can be better
197206
resolution = tuple(resolution)
198207

@@ -221,6 +230,7 @@ def setBrightness(self, identifier, brightness):
221230
if brightness is None:
222231
Cameras.logger.info("Brightness not set")
223232
return False
233+
224234

225235
# Set brightness through command line
226236
returned = os.system(

0 commit comments

Comments
 (0)