Skip to content

arnefmeyer/FrameGrabberPlugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 

Repository files navigation

FrameGrabber

A simple video4linux2-based video frame grabber plugin for the open-ephys plugin-GUI. It retrieves frames from any device supported by v4l2 and displays them using opencv. Moreover, frames can be saved to disk (in jpg format) together with open-ephys hardware time stamps making it easy to synchronize frames and recorded data later on. Depending on your camera this approach should be useful for most (behavioral) tracking experiments. In case the experiment requires very precise time stamps, e.g., high-speed whisker tracking, it might be a good idea to use a camera that can send TTL pulses for each frame.

Currently, the plugin only runs under Linux. However, contributions to make it also run under Windows (e.g., using directshow) are highly welcome.

What should work:

  • capturing frames from any v4l2 supported camera (using mmap; pixel formats: YUYV, MJPG)
  • saving frames in jpeg format; the file name format is "frame_{frame_index}_{experiment_number}_{recording_number}.jpg"
  • saving frame index, experiment number, recording number, and hardware/software time stamps to a separate csv file to make post-processing easier
  • basic controls via ui (image quality, color, recording mode, frame counter resetting, frame directory name)
  • saving/loading parameters

To-do:

  • add further video APIs, e.g., directshow
  • python/matlab functions to read frames and timestamps (including optional interpolation)

Dependencies

This plugin requires the following libraries

  • video4linux2 (i.e. libv4l-0 and libv4l-dev under Ubuntu and Linux Mint)
  • opencv (version 2.4.x; core, dev, and highgui packages)

Installation

Note: when using the old build system (e.g., the current master branch of the open-ephys plugin-GUI) use the "old_makefile" branch of the FrameGrabber plugin.

  1. Build plugin-gui (development branch with cmake) following Building plugin-GUI
  2. Install plugin-GUI Installing plugin-GUI
  3. Follow instructions for building third-party Plugins Building Plugins
    In the FrameGrabberPlugin\FrameGrabber\Build folder run
export GUI_BASE_DIR=path/to/GUI

path/to/GUI should be changed to the absolute path where the plugin-gui folder is located. Finally, run

cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
make
make install

to build and install the plugin.
(Thanks to Ariel Burman for updating the plugin to the new cmake build system.)

Changing camera parameters

The v4l2 library comes with some tools that can be used to control camera parameters. The easiest way to see all available v4l2 controls is to use the v4l2-ctl tool from cmdline:

v4l2-ctl --all

An alternative is to use guvcview.

About

Video frame grabber plugin for the open-ephys plugin GUI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published