Contributions:WebcamLogger: Difference between revisions

From BCI2000 Wiki
Jump to navigation Jump to search
Line 26: Line 26:


==Integration into BCI2000==
==Integration into BCI2000==
Compile the extension into your source module by enabling contributed extensions in your CMake configuration. You can do this by going into your root build folder and deleting <code>CMakeCache.txt</code> and re-running the project batch file, or by running <code>cmake -i</code> and enabling '''BUILD_WEBCAMLOGGER'''.  Once the extension is built into the source module, enable it by starting the source module with the <code>--LogWebcam=1</code> command line argument.
Compile the extension into your source module by enabling contributed extensions in your CMake configuration. In your root build folder, run <tt>Configure.sh.cmd</tt> in order to bring up the CMake GUI; there, enable EXTENSIONS_WEBCAMLOGGER.  Once the extension is built into the source module, enable it by starting the source module with the <code>--LogWebcam=1</code> command line argument.


==Usage==
==Usage==

Revision as of 15:01, 19 February 2019

Synopsis

An extension that records video from one or more webcams to an avi file, and stores frame numbers as state variables.

Location

http://www.bci2000.org/svn/trunk/src/contrib/Extensions/WebcamLogger

Versioning

Authors

Adam Wilson (adam.wilson@uc.edu) & Alex Belsten (belsten@neurotechcenter.org)

Version History

07/06/2011 - Full commit with support for MSVC and MinGW.

07/13/2011 - Bugfixes

11/28/2018 - Updated openCV to v2.4.3 for x32/x64 Windows and added functionality for recording from multiple cameras

Source Code Revisions

  • Initial development: --
  • Tested under: 5828
  • Known to compile under: 5828
  • Broken since: 5828 for MinGW

Functional Description

For many experiments, visual information about how a subject is behaving during an experiment is desired. This extension acquires video from most webcams, and writes to an AVI video file. It also records the current frame number as a state variable, so that the video can be synchronized with brain data with a resolution of the block size. Other options include the ability to overlay the date and time directly on the video (useful for long-term monitoring), and time decimation (i.e., save every Nth frame).

PROTIP: This module can also be used to perform screen capture with the proper virtual screencast webcam driver. Dubious website, but this product works well: http://www.pcwinsoft.com/screencamera/

Integration into BCI2000

Compile the extension into your source module by enabling contributed extensions in your CMake configuration. In your root build folder, run Configure.sh.cmd in order to bring up the CMake GUI; there, enable EXTENSIONS_WEBCAMLOGGER. Once the extension is built into the source module, enable it by starting the source module with the --LogWebcam=1 command line argument.

Usage

Webcams should be installed and configured per the device instructions. The Webcam logger uses the OpenCV (version 2.4.3) library for display and saving. Video is recorded in the resolution of the camera being used.

Camera options are found in the Source tab of the Configuration window.

Parameters

The Webcam logger is configured in the Source tab within the WebcamLogger section. The configurable parameters are:

LogWebcam

Enables/Disables logging of Webcam states.

CameraNumber

Used to select one camera to record from on systems with multiple cameras. Use value 0 for the default camera.

RecordAll

Enables the recording of cameras from StartIndex to EndIndex.

StartIndex

Index to start searching for cameras at.

EndIndex

Index to stop searching for cameras at.

Decimation

The decimation factor for saving and viewing video; the logger saves/displays every Nth frame.

DateTimeLocation

The location of the date/time overlay in saved video (0: none, 1: UpperRight, 2: UpperLeft, 3: LowerRight, 4: LowerLeft).

DisplayStream

Display the video stream from each connected camera. Display stream is identical to what is being recorded in the .avi file.

SelectCodec

Drop down menu to select what codec to use.

CodecFOURCC

Four character string that corresponds to a codec. Input is checked for length exclusively. If the provided string is does not correspond to a video codec that is installed on the system, video will not be recorded. Input of length less than four will have spaces added to the end of the string. See https://www.fourcc.org/ for more information.

Event Variables

WebcamFrame<0-n>

The frame number of the video recorded on camera with index i. i must be less than or equal to n due to the nature of event declarations. The default value of n is 3, allowing for the recording of up to 4 cameras. To record from more cameras, change the NUM_OF_WEBCAM_EVENTS macro in WebcamLogger.cpp to to number of cameras you want to record from and recompile. Event values can be used to synchronize the video with the recorded neural data. It is a 24-bit value, allowing 16,777,216 frames before overflowing. If the webcam can capture at 30 frame/sec, and is decimated at a factor of 5 (i.e., 6 frames/sec), this allows more than a month of video before it will go back to frame 0. In other words, this should not be an issue for most users.

See also

User Reference:Logging Input, Contributions:Extensions, Programming Reference:Events