diff options
Diffstat (limited to 'src/argaze/utils/camera_calibrate.py')
-rw-r--r-- | src/argaze/utils/camera_calibrate.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/argaze/utils/camera_calibrate.py b/src/argaze/utils/camera_calibrate.py index c42b721..8b3249b 100644 --- a/src/argaze/utils/camera_calibrate.py +++ b/src/argaze/utils/camera_calibrate.py @@ -45,8 +45,8 @@ def main(): # Enable camera video capture video_capture = cv2.VideoCapture(args.device) - frame_width = int(video_capture.get(cv2.CAP_PROP_FRAME_WIDTH)) - frame_height = int(video_capture.get(cv2.CAP_PROP_FRAME_HEIGHT)) + image_width = int(video_capture.get(cv2.CAP_PROP_FRAME_WIDTH)) + image_height = int(video_capture.get(cv2.CAP_PROP_FRAME_HEIGHT)) # Create aruco optic calibrator aruco_optic_calibrator = ArUcoOpticCalibrator.ArUcoOpticCalibrator() @@ -57,7 +57,7 @@ def main(): # Create aruco detector aruco_detector = ArUcoDetector.ArUcoDetector(dictionary=args.dictionary, marker_size=args.marker_size) - print(f'{frame_width}x{frame_height} pixels camera calibration starts') + print(f'{image_width}x{image_height} pixels camera calibration starts') print("Waiting for calibration board...") expected_markers_number = aruco_board.markers_number @@ -66,33 +66,33 @@ def main(): # Capture loop try: - # Capture frames with a full displayed board inside + # Capture images with a full displayed board inside while video_capture.isOpened(): - success, video_frame = video_capture.read() + success, video_image = video_capture.read() if success: # Detect calibration board - aruco_detector.detect_board(video_frame, aruco_board, expected_markers_number) + aruco_detector.detect_board(video_image, aruco_board, expected_markers_number) # Draw detected markers - aruco_detector.draw_detected_markers(video_frame) + aruco_detector.draw_detected_markers(video_image) # Draw current calibration data count - cv2.putText(video_frame, f'Capture: {aruco_optic_calibrator.calibration_data_count}', (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2, cv2.LINE_AA) - cv2.imshow('Optic Calibration', video_frame) + cv2.putText(video_image, f'Capture: {aruco_optic_calibrator.calibration_data_count}', (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2, cv2.LINE_AA) + cv2.imshow('Optic Calibration', video_image) # If all board corners are detected if aruco_detector.board_corners_number == expected_corners_number: # Draw board corners to notify a capture is done - aruco_detector.draw_board(video_frame) + aruco_detector.draw_board(video_image) # Append calibration data aruco_optic_calibrator.store_calibration_data(aruco_detector.board_corners, aruco_detector.board_corners_identifier) - cv2.imshow('Optic Calibration', video_frame) + cv2.imshow('Optic Calibration', video_image) # Stop calibration by pressing 'Esc' key if cv2.waitKey(1) == 27: @@ -102,11 +102,11 @@ def main(): except KeyboardInterrupt: pass - # Stop frame display + # Stop image display cv2.destroyAllWindows() print('\nCalibrating camera...') - optic_parameters = aruco_optic_calibrator.calibrate(aruco_board, dimensions=(frame_width, frame_height)) + optic_parameters = aruco_optic_calibrator.calibrate(aruco_board, dimensions=(image_width, image_height)) if optic_parameters: |