Multicamera control and acquisition.
This aims to facilitate video acquisition and automation of experimens, uses separate processes to record and store data. Interfaces with other computers via UDP or ZeroMQ for automating experiments. Uses hardware and FFMPEG to compress in real-time.
Instalation from pip (recommended but not the latest version):
pip install labcams or add the
--no-deps flag to install no dependencies.
Install camera drivers:
Open a terminal and type
labcams -h for help.
The first time you run
labcams it will create a folder in the user home directory where the default preference file is stored.
Command line options:
||start with software trigger OFF|
||start with hardware trigger ON|
||start only some cameras
||create a configuration file|
||do not start the ZMQ nor the UDP server|
Configuration files ensure you always use the same parameters during your experiments.
The configuration files are simple
json files. There are 2 parts to the files.
cams- camera descriptions - each camera has a section to store acquisition and recording parameters.
Available camera drivers:
PCO- install pco.sdk
AVT- install Vimba SDK and pymba
pointgrey- FLIR cameras - install Spinnaker
openCV- webcams and so on
For calcium or voltage imaging with the PCO (or another) camera use the arduino code in the
duino folder and instructions.
Each camera has its own parameters, there are some parameters that are common to all:
recorder- the type of recorder
intelfor use with ffmpeg for compression.
NOTE: You need to get ffmpeg compiled with
NVENC from here - precompiled versions are avaliable -
conda install ffmpeg works. Make sure to have python recognize it in the path (using for example
which ffmpeg to confirm from git bash)/
NOTE To use
intel acceleration you need to download the mediaSDK.
- general parameters to control the remote communication ports and general gui or recording parameters.
recorder_frames_per_filenumber of frames per file
recorder_paththe path of the recorder, how to handle substitutions - needs more info.
- Aditional parameters:
- 'CamStimTrigger' - controls the arduino camera trigger, see the duino examples folder.
UDP and ZMQ:
labcams can listen for UDP or ZMQ commands.
To configure use the command
"server":"udp" in the end of the config file.
The port can be configured with
The UDP commands are:
- Set the experiment name
- Software trigger the cameras
softtrigger=1(multiple cameras are not in sync)
- Hardware trigger mode and save
- Start/stop saving
- Add a message to the log
Supported cameras - see instructions here:
- Allied Vision Technologies (via pymba)
- PointGrey cameras (via PySpin)
- QImaging cameras via the legacy driver (only windows)
- PCO cameras (only windows)
- Basler cameras (via pypylon)
- Ximea cameras
- Separates viewer, camera control/acquisition and file writer in different processes.
- Data from camera acquisition process placed on a cue.
- Display options: background subtraction; histogram equalization; pupil tracking via the mptracker .
- Multiple buffers on Allied vision technologies cameras allows high speed data acquisition.
- Online compression using ffmpeg (supports hardware acceleration)
Instalation on Ubuntu 20.04
sudo apt install python3-matplotlib ipython3 python3-opencv python3-pyqt5 python3-tqdm python3-pip python3-pyqtgraph python3-serial python3-zmq python3-natsort python3-pandas emacs git ssh ffmpeg
pip3 install labcams - this may end up in
$HOME/.local/bin so add the following to the end of the
Instalation - from git:
Note: On windows get the git bash terminal . I had issues running from cmd.exe when installed with conda.
- Get anaconda . Add conda to system PATH when asked. Open a terminal (use git bash if on windows) and type
conda init bash.
- Clone the repository:
git clone [email protected]:jpcouto/labcams.git
- Go into the cloned
- Install the required packages, use e.g.
pip install -r requirements.txtor conda install...
python setup.py develop
- Follow the camera specific instalation and instructions for syncronization. Each camera must have a section in the
~/labcams/default.jsonfile that is created the first time you try to run the software with the command
labcamsfrom the terminal. Use a text editor to add the correct options. There are examples in the examples folder.
You can run
labcams from the command terminal. Install FFMPEG if you need to save in compressed video formats.
Please drop me a line for feedback and let the world know if you use this.
Joao Couto - [email protected]