Project

rb_webcam

0.02
No commit activity in last 3 years
No release in over 3 years
Crossplatform video capture library for Ruby (Powered by OpenCV)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.2.9

Runtime

>= 0.3
 Project Readme

rb_webcam

Crossplatform video capture library for Ruby. Powered by OpenCV.

Platform

Windows, Mac OS X, Linux, etc...(OpenCV capable systems)

Dependency

  • nice-ffi >= 0.3
  • OpenCV Library >= 2.0.0 (e.g.: brew install homebrew/science/opencv --HEAD on macOS)

Install

gem install rb_webcam

Usage

To save image:

capture = Webcam.new
image = capture.grab
image.save("image.jpg")
capture.close

# Or

camera_id = 0
Webcam.open(camera_id) { |capture| capture.grab.save("image.jpg") }

# Or

capture = Webcam.new
image = capture.grab
capture.close

Using the ruby-opencv gem

require "opencv"

capture = OpenCV::CvCapture.open
sleep 1 # Warming up the webcam
capture.query.save("image.jpg")
capture.close

TODO

  • specity size at initialize, or anytime.

LICENSE

The MIT License Copyright (c) 2010 Hirotoshi YOSHITAKA. See LICENSE for details.