Skip to content

Commit 63d9230

Browse files
committed
Fix cal bug fixes
1 parent 4390839 commit 63d9230

File tree

4 files changed

+27
-200
lines changed

4 files changed

+27
-200
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"camPath": "platform-fc800000.usb-usb-0:1:1.0-video-index0", "K": [[1022.1123580224721, 0.0, 640.0356135752214], [0.0, 1028.577231930545, 360.3806518758506], [0.0, 0.0, 1.0]], "dist": [[0.029080945115192047, 0.12545977000185524, -0.06344552719163812, -0.05650900366931294, -1.4505190969808648, -0.026520991234485498, -0.045282024241329814, 2.4851707053467926, 0.0540452987111509, -0.023321160650432594, 0.06635102607977282, 0.017782330202466796, 0.15836692410457276, -0.1095345758731561]], "r": [[[-0.020363375487993295], [-0.42421631034087043], [-0.010670860993315955]]], "t": [[[-3.054077475053525], [-3.2607693682459407], [13.30214371095907]]], "reproj": 0.04290054709812047, "resolution": [1280, 720]}
1+
{"camPath": "platform-fc800000.usb-usb-0:1:1.0-video-index0", "K": [[1119.7390776117077, 0.0, 643.2722704461252], [0.0, 1159.7998515310892, 361.9853922671329], [0.0, 0.0, 1.0]], "dist": [[0.1025528543619095, 0.3227946060072488, -0.13223717480467928, -0.04345968422967146, 10.476848320253449, -0.06955691740545955, 1.3321686245586764, 12.704038068252054, 0.042187965420487396, -0.13419033692836535, 0.13247959331738435, -0.017758167082087845, 0.20122374567192763, -0.0858023399918667]], "r": [[[-0.38109224642055917], [0.6150046119430361], [1.4861145104268187]]], "t": [[[2.1298307889150783], [-2.725279336957316], [16.91427591721092]]], "reproj": 0.03973065673156971, "resolution": [1280, 720]}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"Resolution": [1600, 1200], "Gain": 0.0, "Exposure": 54.0}
1+
{"Resolution": [1280, 720], "Gain": -1.0, "Exposure": 54.0}

init.py

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979

8080
# Prepare a calibration object for the camera that is being calibrated with pre-set data
8181
# only if cal object does not exist yet
82-
if walleyeData.cameraInCalibration not in calibrators:
82+
if walleyeData.cameraInCalibration not in calibrators or calibrators[walleyeData.cameraInCalibration] is None:
8383
calibrators[walleyeData.cameraInCalibration] = Calibration(
8484
walleyeData.calDelay,
8585
walleyeData.boardDims,
@@ -120,26 +120,31 @@
120120
walleyeData.cameras.info[walleyeData.cameraInCalibration].resolution,
121121
)
122122

123-
# Generate a calibration file to the file path
124-
hasGenerated = calibrators[walleyeData.cameraInCalibration].generateCalibration(
125-
walleyeData.cameras.info[
126-
walleyeData.cameraInCalibration
127-
].calibrationPath
128-
)
129-
130-
if hasGenerated:
131-
# Get reproj error
132-
walleyeData.reprojectionError = calibrators[
133-
walleyeData.cameraInCalibration
134-
].getReprojectionError()
135-
136-
# Set the cameras calibration, save off the file path, and go to idle
137-
walleyeData.cameras.setCalibration(
138-
walleyeData.cameraInCalibration,
139-
calibrators[walleyeData.cameraInCalibration].calibrationData["K"],
140-
calibrators[walleyeData.cameraInCalibration].calibrationData["dist"],
123+
if calibrators[walleyeData.cameraInCalibration] is not None:
124+
# Generate a calibration file to the file path
125+
hasGenerated = calibrators[walleyeData.cameraInCalibration].generateCalibration(
126+
walleyeData.cameras.info[
127+
walleyeData.cameraInCalibration
128+
].calibrationPath
141129
)
142-
walleyeData.cameras.info[walleyeData.cameraInCalibration].calibrationPath = Calibration.calibrationPathByCam(walleyeData.cameraInCalibration, walleyeData.cameras.info[walleyeData.cameraInCalibration].resolution)
130+
131+
if hasGenerated:
132+
# Get reproj error
133+
walleyeData.reprojectionError = calibrators[
134+
walleyeData.cameraInCalibration
135+
].getReprojectionError()
136+
137+
# Set the cameras calibration, save off the file path, and go to idle
138+
walleyeData.cameras.setCalibration(
139+
walleyeData.cameraInCalibration,
140+
calibrators[walleyeData.cameraInCalibration].calibrationData["K"],
141+
calibrators[walleyeData.cameraInCalibration].calibrationData["dist"],
142+
)
143+
walleyeData.cameras.info[walleyeData.cameraInCalibration].calibrationPath = Calibration.calibrationPathByCam(walleyeData.cameraInCalibration, walleyeData.cameras.info[walleyeData.cameraInCalibration].resolution)
144+
else:
145+
walleyeData.status = "Could not generate calibration"
146+
else:
147+
walleyeData.status = "Calibrator for current calibration camera is None"
143148
walleyeData.currentState = States.IDLE
144149
calibrators[walleyeData.cameraInCalibration] = None
145150

0 commit comments

Comments
 (0)