Skip to content

Commit 3ef08c1

Browse files
committed
run_calibrate_camera: won't quit the application if failed to calibrate
Make the calibration process is more user-friendly. Signed-off-by: JoshWu <[email protected]>
1 parent 1f5a62b commit 3ef08c1

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

run_calibrate_camera.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,14 @@ def main():
123123
cv2.imshow("corners", img)
124124
key = cv2.waitKey(1) & 0xFF
125125
if key == ord("c"):
126-
do_calib = True
127-
break
126+
print("\nPerforming calibration...\n")
127+
N_OK = len(objpoints)
128+
if N_OK < 12:
129+
print("Less than 12 corners (%d) detected, calibration failed" %(N_OK))
130+
continue
131+
else:
132+
do_calib = True
133+
break
128134

129135
elif key == ord("q"):
130136
quit = True
@@ -136,12 +142,7 @@ def main():
136142
cv2.destroyAllWindows()
137143

138144
if do_calib:
139-
print("\nPerforming calibration...\n")
140145
N_OK = len(objpoints)
141-
if N_OK < 12:
142-
print("Less than 12 corners detected, calibration failed")
143-
return
144-
145146
K = np.zeros((3, 3))
146147
D = np.zeros((4, 1))
147148
rvecs = [np.zeros((1, 1, 3), dtype=np.float64) for _ in range(N_OK)]

0 commit comments

Comments
 (0)