https://github.com/adaptivemotorcontrollab/camera_control

a Python API to record video & system timestamps from Imaging Source USB cameras

https://github.com/adaptivemotorcontrollab/camera_control

Science Score: 20.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    2 of 3 committers (66.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.4%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

a Python API to record video & system timestamps from Imaging Source USB cameras

Basic Info
  • Host: GitHub
  • Owner: AdaptiveMotorControlLab
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 2.07 MB
Statistics
  • Stars: 66
  • Watchers: 7
  • Forks: 14
  • Open Issues: 5
  • Releases: 0
Created about 7 years ago · Last pushed over 3 years ago
Metadata Files
Readme License

README.md

cam cntrl

record video and system timestamps from Imaging Source USB3 cameras

Python GUI + scripts to record video sync'ed to behavior. Can record from multiple imaging source camera feeds while simultaneously grabbing system timestamps for each recorded frame. One can also record timestamps from one NIDAQ card signal to sync with a behavioral task (records timestamp on the rising edge of a TTL signal).

This software package was written by Gary Kane, post-doctoral fellow @ the Adaptive Motor Control Lab.

Prerequisite Software: 1. Windows 10 2. Anaconda 3. Git

Required Hardware: 1. Imaging Source USB cameras 2. (Optional) NIDAQ card. Necessary to record timestamps from a behavioral task. Signal must be a TTL wired to digital input channel that is not dual-PFI (one that has hardware interrupt capabilities).

Instructions for Installation:

  1. Install the latest driver for your camera. You can find the driver from The Imaging Source website: https://www.theimagingsource.com/products/. If you add new cameras to an existing system, make sure to update the driver!

  2. Clone this repository. Open command prompt (type "cmd" into the search bar and hit enter), then type:

    git clone https://github.com/AdaptiveMotorControlLab/Camera_Control

  3. Open the camera control directory, right-click 'install1.bat' and select 'Run as administrator'

    This script will install imaging source libraries, ffmpeg for command prompt, and create a new conda environment 'camera36'. Upon completion, the window will close suddenly.

  4. Download and install IC Capture from imaging source: https://www.theimagingsource.com/support/downloads-for-windows/end-user-software/iccapture/. Launch it with your camera plugged in. Go to Device/Properties/Exposure and untoggle all 'auto' parameters. Otherwise the camera exposure won't be adjustable from the GUI.

  5. Run 'install2.bat'.

    This script will finish setting up the conda environment and create a desktop shortcut to open the GUI.

  6. Edit the 'writecameradetails.py' script according to your system's camera configuration. A template is provided (writecameradetailsTEMPLATE.py), please do not edit the template. The 'writecameradetails.py' script will write a dictionary to the file 'cameradetails.json' containing the following fields:

    • a dictionary for each imaging source camera with the fields:

      • name = camera name
      • crop = cropping parameters
      • rotate = rotation angle of image
      • exposure = exposure in ms; can edit this in the GUI
      • output_dir = default directory to save videos; can edit this in the GUI
      • Example:

        cam0 = {'name' : 'Cog Rig', 'crop' : {'top' : 150, 'left' : 225, 'height' : 250, 'width' : 300}, 'rotate' : 0, 'exposure' : .003, 'outputdir' : 'C:/Users/user1/Desktop/video'}

- subjects = a list of experimental subjects to select. Can be manually entered in GUI
- labview = a list of labview channels to select, e.g. ['Dev1/port0/line0'] (optional). Can be manually entered in GUI <br/><br/>

To Run the Program:

Double click the cameraGUI.bat file on the Desktop or open command prompt, navigate to the cameracontrol directory, and run: ``python cameracontrol_GUI.py``

  1. Select the number of cameras to record from
  2. Select and initialize each cameras
  3. Select subject, frame rate and output directory, then click 'Set Up Video'
    • Will default to the output directory from 'camera_details.json'
    • Drop down menus for subject and output directory are populated via 'camera_details.json'
  4. To start recording, click the On button. Recording can be turned Off/On multiple times -- frames, system timestamps, and timestamps from the nidaq card will be stored only when 'Record' is set to 'On'.
  5. Once finished recording, click 'Save Video', 'Compress & Save Video', or 'Delete Video'
    • 'Save Video' saves an .avi file using the DIVX codec to 'outputdir/CameraNameSubjectDate.avi' and timestamp files to 'outputdir/TIMESTAMPSCameraNameSubjectDate.npy' and (if applicable) 'outputdir/LABVIEWSubjectDate.npy'. There will be one timestamps file per camera, but only one labview timestamp file per session.
    • 'Compress & Save Video' saves as above, but also saves an .mp4 file using ffmpeg compression to 'outputdir/CameraNameSubject_Date.mp4'
    • 'Delete Video' will not save any videos of timestamp files. Preliminary video files will be deleted.
  6. To record more videos, return to step iii.

LICENSE:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please see here for more information. GitHub

Citation:

If you find this software useful for your research, please cite: DOI

Owner

  • Name: Mathis Lab | Adaptive Motor Control
  • Login: AdaptiveMotorControlLab
  • Kind: organization
  • Email: mackenzie@post.harvard.edu
  • Location: Swiss Federal Institute of Technology

Mechanisms underlying adaptive behavior in intelligent systems

GitHub Events

Total
  • Watch event: 1
  • Fork event: 1
Last Year
  • Watch event: 1
  • Fork event: 1

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 12
  • Total Committers: 3
  • Avg Commits per committer: 4.0
  • Development Distribution Score (DDS): 0.333
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
gkane26 g****e@r****u 8
Mackenzie Mathis m****s@r****u 3
hausmanns s****n@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 9
  • Total pull requests: 2
  • Average time to close issues: 9 months
  • Average time to close pull requests: 4 months
  • Total issue authors: 6
  • Total pull request authors: 2
  • Average comments per issue: 2.33
  • Average comments per pull request: 0.5
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • hausmanns (3)
  • NadineKGut (2)
  • Alberto100591 (1)
  • Wulin-Tan (1)
  • cgutierrez-Ibanez (1)
  • luciedescamps (1)
Pull Request Authors
  • hausmanns (1)
  • MMathisLab (1)
Top Labels
Issue Labels
usage questions (1)
Pull Request Labels