Skip to content

Instantly share code, notes, and snippets.

@scholich
Created January 19, 2017 13:58
Show Gist options
  • Save scholich/0f74e5f3cae6946eafaee653823fd2b8 to your computer and use it in GitHub Desktop.
Save scholich/0f74e5f3cae6946eafaee653823fd2b8 to your computer and use it in GitHub Desktop.
Video capture with adjustable exposure time and whiteness correction
"""Lightweight module for video capture: imageio that can talk to ffmpeg
"""
from pylab import plt
import imageio
import os
# list devices
os.system('ffmpeg -f dshow -list_devices true -i ""')
# adjust video properties
device_name = "Integrated Camera"
os.system('ffmpeg -f dshow -show_video_device_dialog true -i video="{device_name}"'.format(device_name=device_name))
# capture from video device
stream = imageio.get_reader('<video0>', 'ffmpeg')
plt.imshow(stream.get_next_data())
stream.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment