hornetseye-v4l2 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +43 -0
- data/Rakefile +2 -2
- data/lib/hornetseye-v4l2/v4l2input.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -2,3 +2,46 @@ hornetseye-v4l2
|
|
2
2
|
======
|
3
3
|
This Ruby extension provides camera input using Video for Linux version 2.
|
4
4
|
|
5
|
+
**Author**: Jan Wedekind
|
6
|
+
**Copyright**: 2010
|
7
|
+
**License**: GPL
|
8
|
+
|
9
|
+
Synopsis
|
10
|
+
--------
|
11
|
+
|
12
|
+
This Ruby extension provides the class {Hornetseye::V4L2Input} for capturing video frames using Video for Linux version 2 (V4L2).
|
13
|
+
|
14
|
+
Installation
|
15
|
+
------------
|
16
|
+
*hornetseye-v4l2* requires the V4L2 heasers. If you are running Debian or (K)ubuntu, you can install them like this:
|
17
|
+
|
18
|
+
$ sudo aptitude install linux-libc-dev
|
19
|
+
|
20
|
+
To install this Ruby extension, use the following command:
|
21
|
+
|
22
|
+
$ sudo gem install hornetseye-v4l2
|
23
|
+
|
24
|
+
Alternatively you can build and install the Ruby extension from source as follows:
|
25
|
+
|
26
|
+
$ rake
|
27
|
+
$ sudo rake install
|
28
|
+
|
29
|
+
Usage
|
30
|
+
-----
|
31
|
+
|
32
|
+
Simply run Interactive Ruby:
|
33
|
+
|
34
|
+
$ irb
|
35
|
+
|
36
|
+
You can open a V4L2-compatible camera as shown below. This example will open the camera and switch to a resolution selected by the user. Finally the camera input is displayed in a window. This example requires *hornetseye-xorg* in addition to this Ruby extension.
|
37
|
+
|
38
|
+
require 'rubygems'
|
39
|
+
require 'hornetseye_v4l2'
|
40
|
+
require 'hornetseye_xorg'
|
41
|
+
include Hornetseye
|
42
|
+
camera = V4L2Input.new '/dev/video' do |modes|
|
43
|
+
modes.each_with_index { |mode,i| puts "#{i + 1}: #{mode}" }
|
44
|
+
modes[ STDIN.readline.to_i - 1 ]
|
45
|
+
end
|
46
|
+
X11Display.show { camera.read }
|
47
|
+
|
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ require 'rake/loaders/makefile'
|
|
7
7
|
require 'rbconfig'
|
8
8
|
|
9
9
|
PKG_NAME = 'hornetseye-v4l2'
|
10
|
-
PKG_VERSION = '0.2.
|
10
|
+
PKG_VERSION = '0.2.1'
|
11
11
|
CFG = RbConfig::CONFIG
|
12
12
|
CXX = ENV[ 'CXX' ] || 'g++'
|
13
13
|
RB_FILES = FileList[ 'lib/**/*.rb' ]
|
@@ -46,7 +46,7 @@ desc 'Compile Ruby extension (default)'
|
|
46
46
|
task :all => [ SO_FILE ]
|
47
47
|
|
48
48
|
file SO_FILE => OBJ do |t|
|
49
|
-
sh "#{CXX} -shared -o #{t.name} #{OBJ}
|
49
|
+
sh "#{CXX} -shared -o #{t.name} #{OBJ} #{$LIBRUBYARG}"
|
50
50
|
end
|
51
51
|
|
52
52
|
task :test => [ SO_FILE ]
|
@@ -40,7 +40,7 @@ module Hornetseye
|
|
40
40
|
end
|
41
41
|
desired = action.call frame_types
|
42
42
|
unless frame_types.member? desired
|
43
|
-
raise "Frame type #{desired} not supported by camera"
|
43
|
+
raise "Frame type #{desired.inspect} not supported by camera"
|
44
44
|
end
|
45
45
|
index[ frame_types.index( desired ) ]
|
46
46
|
end
|