poulet_py.hardware.camera package#
- class BaslerCamera(max_cameras=2)[source]#
Bases:
objectA class to interact with multiple Basler cameras using pypylon and OpenCV. Each camera will record to its own video file and log timestamps to a CSV.
- __init__(max_cameras=2)[source]#
Initializes the BaslerCamera object by enumerating devices and attaching up to max_cameras.
- Args:
max_cameras (int): The maximum number of cameras to use.
- capture_frame()[source]#
Captures a single frame from whichever camera has a frame ready. The frame is written to its corresponding video file and timestamp logged.
- recording(data_save_folder, cage_id, n_mouse, condition, mouse_ids=[], duration_s=10, buffer_s=10, total_rec=4, fps=30, video_format='mp4')[source]#
- save_metadata(base_file_name='basler-camera', extra_name='')[source]#
Saves metadata about the recording for each camera to a JSON file.
- Args:
path (str): Directory to save the metadata files. base_file_name (str, optional): Base name for the metadata files. extra_name (str, optional): Extra name to add to the file names.
- save_timestamp(camera_index, timestamp)[source]#
Save a timestamp to the CSV file for the specified camera.
- Args:
camera_index (int): Index of the camera. timestamp (float): Timestamp to record.
- set_error_log_path(path, file_name)[source]#
Sets the error log file.
- Args:
path (str): Directory for the error log. file_name (str): Name of the error log file.
- set_frames_per_second(frames_per_second)[source]#
Sets the frame rate for each camera.
- Args:
frames_per_second (float): Desired frame rate in frames per second.
- set_output_file(path, extra_name, base_file_name='basler-camera')[source]#
Sets up output video files and timestamp CSV files for all cameras.
- Args:
path (str): Directory to save the output files. extra_name (str): Extra name to add to the file names. base_file_name (str): Base name for the files.
Submodules#
- poulet_py.hardware.camera.basler module
BaslerCameraBaslerCamera.__init__()BaslerCamera.set_frames_per_second()BaslerCamera.set_error_log_path()BaslerCamera.set_output_file()BaslerCamera.save_timestamp()BaslerCamera.start_streaming()BaslerCamera.stop_streaming()BaslerCamera.capture_frame()BaslerCamera.stream_video()BaslerCamera.save_metadata()BaslerCamera.recording()BaslerCamera.set_timer()BaslerCamera.log_error()
- poulet_py.hardware.camera.thermal_camera module
- poulet_py.hardware.camera.uvctypes module
uvc_contextuvc_deviceuvc_stream_ctrluvc_stream_ctrl.bFormatIndexuvc_stream_ctrl.bFrameIndexuvc_stream_ctrl.bInterfaceNumberuvc_stream_ctrl.bMaxVersionuvc_stream_ctrl.bMinVersionuvc_stream_ctrl.bPreferredVersionuvc_stream_ctrl.bmFramingInfouvc_stream_ctrl.bmHintuvc_stream_ctrl.dwClockFrequencyuvc_stream_ctrl.dwFrameIntervaluvc_stream_ctrl.dwMaxPayloadTransferSizeuvc_stream_ctrl.dwMaxVideoFrameSizeuvc_stream_ctrl.wCompQualityuvc_stream_ctrl.wCompWindowSizeuvc_stream_ctrl.wDelayuvc_stream_ctrl.wKeyFrameRateuvc_stream_ctrl.wPFrameRate
uvc_format_descuvc_format_desc.bAspectRatioXuvc_format_desc.bAspectRatioYuvc_format_desc.bBitsPerPixeluvc_format_desc.bCopyProtectuvc_format_desc.bDefaultFrameIndexuvc_format_desc.bDescriptorSubtypeuvc_format_desc.bFormatIndexuvc_format_desc.bNumFrameDescriptorsuvc_format_desc.bVariableSizeuvc_format_desc.bmInterlaceFlagsuvc_format_desc.frame_descsuvc_format_desc.guidFormatuvc_format_desc.nextuvc_format_desc.parentuvc_format_desc.prev
uvc_frame_descuvc_frame_desc.bDescriptorSubtypeuvc_frame_desc.bFrameIndexuvc_frame_desc.bFrameIntervalTypeuvc_frame_desc.bmCapabilitiesuvc_frame_desc.dwBytesPerLineuvc_frame_desc.dwDefaultFrameIntervaluvc_frame_desc.dwFrameIntervalStepuvc_frame_desc.dwMaxBitRateuvc_frame_desc.dwMaxFrameIntervaluvc_frame_desc.dwMaxVideoFrameBufferSizeuvc_frame_desc.dwMinBitRateuvc_frame_desc.dwMinFrameIntervaluvc_frame_desc.intervalsuvc_frame_desc.nextuvc_frame_desc.parentuvc_frame_desc.prevuvc_frame_desc.wHeightuvc_frame_desc.wWidth
timevaluvc_frameuvc_device_handleuvc_device_handle.button_cbuvc_device_handle.button_user_ptruvc_device_handle.devuvc_device_handle.infouvc_device_handle.is_isightuvc_device_handle.nextuvc_device_handle.prevuvc_device_handle.status_bufuvc_device_handle.status_cbuvc_device_handle.status_user_ptruvc_device_handle.status_xferuvc_device_handle.streamsuvc_device_handle.usb_devh
lep_oem_sw_versionlep_sys_shutter_modelep_sys_shutter_mode.desiredFfcPeriodlep_sys_shutter_mode.desiredFfcTempDeltalep_sys_shutter_mode.elapsedTimeSinceLastFfclep_sys_shutter_mode.explicitCmdToOpenlep_sys_shutter_mode.ffcDesiredlep_sys_shutter_mode.imminentDelaylep_sys_shutter_mode.shutterModelep_sys_shutter_mode.tempLockoutStatelep_sys_shutter_mode.videoFreezeDuringFFC
call_extension_unit()set_extension_unit()print_device_info()uvc_iter_formats()uvc_iter_frames_for_format()print_device_formats()uvc_get_frame_formats_by_guid()set_manual_ffc()set_auto_ffc()set_external_ffc()print_shutter_info()perform_manual_ffc()set_gain_low()set_gain_high()set_gain_auto()