BaslerCameraArray Class¶
-
class
basler.basler_camera_array.
BaslerCameraArray
(devices_info)¶ A class for basler camera array. Useful for capturing from multiple cameras simultaneously. If the task requires high synchronization, using hardware synchronization is preferred.
-
__init__
(devices_info)¶ The constructor of the array.
- Parameters
devices_info – a list of camera device info stored as dictionaries that has IP address or serial number.
Examples:
devices_info = [{'serial_number': '21939024'}, {'ip': '192.168.0.31'}]
-
get_aoi
(cam_id: int)¶ return the area of interest (AOI) of a certain camera
- Parameters
cam_id – camera ID
- Returns
a tuple of
(offset_x, offset_y, width, height)
-
get_exposure_time
(cam_id: int)¶ return the exposure time of a certain camera in millisecond (ms).
- Parameters
cam_id – camera ID
-
get_resulting_framerate
(cam_id: int)¶ return the resulting framerate of a certain camera.
- Parameters
cam_id – camera ID
-
grab_many
(n: int)¶ grab n frames from each camera, and return a list of numpy arrays of shape
(n, height_i, width_i)
whereheight_i
andwidth_i
are the height and width of the i-th camera- Parameters
n – the number of frames
-
grab_n_save
(n: int, save_patterns: list, n_start: list = None)¶ grab n frames and save them sequentially as TIFF files
- Parameters
n – the number of frames to grab for each camera
save_patterns – a list of strings where each contains one single ‘%d’ as the number.
n_start – a list of integers indicating the start number of the filename. Default is
[1, 1, ...]
, i.e. 1 for each camera.
Example:
grab_n_save(200, ['/home/zhe/data/cam0-%d.tiff', '/home/zhe/data/cam1-%d.tiff'], [3, 5])
Images are saved as
cam0-3.tiff
,cam0-4.tiff
, … for camera 0, andcam1-5.tiff
,cam1-6.tiff
, … for camera 1
-
grab_one
()¶ grab one frame from each camera as a list of numpy arrays
-
set_acquisition_framerate
(cam_id: int, framerate: float = None)¶ set the acquisition frame rates for a certain camera.
- Parameters
cam_id (int) – camera ID.
framerate (float) – frame rate.
See the
set_acquisition_framerate()
of the BaslerCamera class for details.
-
set_aoi
(cam_id: int, aoi: tuple)¶ set the area of interest (AOI) of the camera.
- Parameters
cam_id – camera ID
aoi – a tuple:
(offset_x, offset_y, width, height)
-
set_converter
(convert=True)¶ when saving TIFF files, always use a 16-bit format with the most significant bit (MSB) aligned.
- Parameters
convert – a boolean
-
set_exposure_time
(cam_id: int, exposure_time: float)¶ set exposure time for a certain camera.
- Parameters
cam_id (int) – camera ID.
exposure_time (float) – exposure time.
See the
set_exposure_time()
of BaslerCamera class for details.
-
set_pixel_format
(cam_id: int, pixel_format_string: str)¶ set acquisition pixel format for the camera.
- Parameters
cam_id – camera id
pixel_format_string – a pixel format string, like
Mono8
,Mono12
,Mono12Packed
. Allowed values vary from camera to camera. Refer to camera documentation in the Pylon software for details.
-