Common and Webcam

Hardware cameras

OpenHSI Hardware Camera Implementations

Common Code

Tip

This module can be imported using from openhsi.cameras import *

Wrapper class and example code for getting images from the OpenHSI.

Tip

To use the camera, you will need some calibration files. You can also generate these files following this guide which uses the calibrate module.

Webcams

This uses the OpenCV library to interface with a webcam including the one in your laptop. Mainly for testing but maybe this could be useful.


source

WebCamera

 WebCamera (mode:str=None, n_lines:int=16, processing_lvl:int=-1,
            warn_mem_use:bool=True, json_path:str=None, pkl_path:str=None,
            print_settings:bool=False)

Interface for webcam to test OpenHSI functionality

You can see a picture I held up to the webcam.

plt.subplots(figsize=(12,4))
plt.imshow(cam.dc.data[:,1,:],cmap="gray",aspect=0.3)

Function for collection/saving linked to button

This function is designed to be used using the Multiprocessing library to initiate camera recording when desired inside a script. When the switch is closed, this function then finishes releasing memory back to the system.


source

switched_camera

 switched_camera (cam_class:str=None, n_lines:int=128,
                  processing_lvl:int=0, json_path:str='/media/pi/fastssd/c
                  als/flir_settings.json', pkl_path:str='/media/pi/fastssd
                  /cals/flir_calibration.pkl', preconfig_meta:str='/media/
                  pi/fastssd/cals/preconfig_metadata.json',
                  ssd_dir:str='/media/pi/fastssd', toggle_interface=None)

If toggle_interface.status is True, collect with the camera until switched is False.

Type Default Details
cam_class str None Camera Class Name from openhsi.cameras
n_lines int 128 how many along-track pixels
processing_lvl int 0 desired processing done in real time
json_path str /media/pi/fastssd/cals/flir_settings.json path to settings file
pkl_path str /media/pi/fastssd/cals/flir_calibration.pkl path to calibration file
preconfig_meta str /media/pi/fastssd/cals/preconfig_metadata.json path to metadata file
ssd_dir str /media/pi/fastssd path to SSD
toggle_interface NoneType None toggle_interface that controls collection