Created
January 19, 2017 13:58
-
-
Save scholich/0f74e5f3cae6946eafaee653823fd2b8 to your computer and use it in GitHub Desktop.
Video capture with adjustable exposure time and whiteness correction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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