How can I take snapshots from a webcam in ruby? I know the webcam device is on /dev/video0, but how do I get a picture from it?
I'm the developer of Hornetseye. You can capture images with the V4L2-interface of HornetsEye as follows.
require 'rubygems'
require 'hornetseye_v4l2'
require 'hornetseye_xorg'
require 'hornetseye_rmagick'
include Hornetseye
input = V4L2Input.new '/dev/video0'
img = X11Display.show { input.read }
img.to_ubytergb.save_ubytergb 'test.png'
Currently supported colourspaces are UYVY, YUYV, YUV420, GREY, RGB24. Note that other colourspaces such as MJPEG are not supported at the moment.
I've never actually used it but hornetseye looks good. This question has also already been asked here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With