1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
-----Ruby-V4l-----
-- Description --
Ruby-V4l is a Ruby extension library that provides a class for using
Video4Linux Capture API.
-- Installation --
$ ruby extconf.rb
$ make
# make install
-- Testing --
* test/shot.rb
Take a picture from camera and write it to shot.ppm.
* test/webcam.rb
Webcam viewer using Ruby-V4l and OpenGL.
-- API --
**** Class V4l, Parent Object ****
** Class methods **
* new(device) -> V4l
device -> String: file name of the device (example: "/dev/video")
Raise an Exception on Video4Linux or IO error.
** Instance methods **
* name() -> String
Get the name of the device.
* width() -> Fixnum
* width=(Fixnum) -> self
* height() -> Fixnum
* height=(Fixnum) -> self
Get and set capture area dimensions.
* channels() -> Array
Get the list of channels available for the device.
* channel() -> Fixnum
* channel=(Fixnum) -> self
Get and set current channel.
* brightness() -> Fixnum
* brightness=(Fixnum) -> self
* contrast() -> Fixnum
* contrast=(Fixnum) -> self
* hue() -> Fixnum
* hue=(Fixnum) -> self
* color() -> Fixnum
* color=(Fixnum) -> self
Get and set the brightness, contrast, hue and color of the picture.
Values can vary between 0 and 65535.
* get_frame() -> String
Get a video frame from device. Returns a string in the format:
8-bit R, 8-bit G, 8-bit B.
* capture() {|frame| } -> self
Get frames and yields a block.
* write_file(path, [data]) -> self
Write a file in PPM format to path. Optionally, use data from the
argument, in the same format that is outputed by get_frame(), else
use data from the last frame captured.
* close() -> self
Closes the device.
* closed?() -> true or false
Returns true if device was closed using close().
-- License --
LGPL
Paulo Matias <syscoder _a t_ gmail _d o t_ com>
|