2727import matplotlib .pyplot as plt
2828import numpy as np
2929import zivid
30+ import zivid .calibration
3031from zividsamples .calibration_board_utils import find_white_mask_from_checkerboard
3132from zividsamples .white_balance_calibration import (
3233 camera_may_need_color_balancing ,
@@ -111,30 +112,10 @@ def _capture_rgb(camera: zivid.Camera, settings_2d: zivid.Settings2D) -> np.ndar
111112 rgb: RGB image (H, W, 3)
112113
113114 """
114- rgb = camera .capture (settings_2d ).image_rgba ().copy_data ()[:, :, :3 ]
115+ rgb = camera .capture_2d (settings_2d ).image_rgba ().copy_data ()[:, :, :3 ]
115116 return rgb
116117
117118
118- def _capture_assistant_settings (camera : zivid .Camera ) -> zivid .Settings :
119- """Get settings from capture assistant.
120-
121- Args:
122- camera: Zivid camera
123-
124- Returns:
125- Zivid 3D capture settings from capture assistant
126-
127- """
128- suggest_settings_parameters = zivid .capture_assistant .SuggestSettingsParameters (
129- max_capture_time = timedelta (milliseconds = 1200 ),
130- ambient_light_frequency = zivid .capture_assistant .SuggestSettingsParameters .AmbientLightFrequency .none ,
131- )
132- suggested_settings = zivid .capture_assistant .suggest_settings (camera , suggest_settings_parameters )
133- suggested_settings .sampling .pixel = "all"
134-
135- return suggested_settings
136-
137-
138119def _find_white_mask_and_distance_to_checkerboard (camera : zivid .Camera ) -> Tuple [np .ndarray , float ]:
139120 """Generate a 2D mask of the white checkers on a checkerboard and calculate the distance to it.
140121
@@ -150,8 +131,7 @@ def _find_white_mask_and_distance_to_checkerboard(camera: zivid.Camera) -> Tuple
150131
151132 """
152133 try :
153- settings = _capture_assistant_settings (camera )
154- frame = camera .capture (settings )
134+ frame = zivid .calibration .capture_calibration_board (camera )
155135
156136 checkerboard_pose = zivid .calibration .detect_calibration_board (frame ).pose ().to_matrix ()
157137 distance_to_checkerboard = checkerboard_pose [2 , 3 ]
0 commit comments