hornetseye-dc1394 0.3.2 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +45 -1
- data/Rakefile +1 -1
- data/ext/dc1394input.cc +14 -0
- data/ext/dc1394input.hh +4 -0
- data/lib/hornetseye-dc1394/dc1394input.rb +20 -1
- data/lib/hornetseye-dc1394/docs.rb +100 -0
- metadata +4 -3
data/README.md
CHANGED
@@ -1,3 +1,47 @@
|
|
1
1
|
hornetseye-dc1394
|
2
|
-
|
2
|
+
=================
|
3
3
|
This Ruby extension provides camera input for DC1394 compatible firewire cameras using libdc1394 2.x.
|
4
|
+
|
5
|
+
**Author**: Jan Wedekind
|
6
|
+
**Copyright**: 2010
|
7
|
+
**License**: GPL
|
8
|
+
|
9
|
+
Synopsis
|
10
|
+
--------
|
11
|
+
|
12
|
+
This Ruby extension provides the class {Hornetseye::DC1394Input} for capturing video frames using a DC1394-compatible firewire camera.
|
13
|
+
|
14
|
+
Installation
|
15
|
+
------------
|
16
|
+
*hornetseye-dc1394* requires the V4L2 headers. If you are running Debian or (K)ubuntu, you can install them like this:
|
17
|
+
|
18
|
+
$ sudo aptitude install libdc1394-22-dev
|
19
|
+
|
20
|
+
To install this Ruby extension, use the following command:
|
21
|
+
|
22
|
+
$ sudo gem install hornetseye-dc1394
|
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 DC1394-compatible firewire 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_dc1394'
|
40
|
+
require 'hornetseye_xorg'
|
41
|
+
include Hornetseye
|
42
|
+
camera = DC1394Input.new 0 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
data/ext/dc1394input.cc
CHANGED
@@ -395,6 +395,8 @@ VALUE DC1394Input::registerRubyClass( VALUE module )
|
|
395
395
|
INT2NUM( DC1394_FEATURE_MODE_ONE_PUSH_AUTO ) );
|
396
396
|
rb_define_singleton_method( cRubyClass, "new", RUBY_METHOD_FUNC( wrapNew ), 5 );
|
397
397
|
rb_define_method( cRubyClass, "close", RUBY_METHOD_FUNC( wrapClose ), 0 );
|
398
|
+
rb_define_method( cRubyClass, "width", RUBY_METHOD_FUNC( wrapWidth ), 0 );
|
399
|
+
rb_define_method( cRubyClass, "height", RUBY_METHOD_FUNC( wrapHeight ), 0 );
|
398
400
|
rb_define_method( cRubyClass, "read", RUBY_METHOD_FUNC( wrapRead ), 0 );
|
399
401
|
rb_define_method( cRubyClass, "status?", RUBY_METHOD_FUNC( wrapStatus ), 0 );
|
400
402
|
rb_define_method( cRubyClass, "feature_read",
|
@@ -474,6 +476,18 @@ VALUE DC1394Input::wrapStatus( VALUE rbSelf )
|
|
474
476
|
return (*self)->status() ? Qtrue : Qfalse;
|
475
477
|
}
|
476
478
|
|
479
|
+
VALUE DC1394Input::wrapWidth( VALUE rbSelf )
|
480
|
+
{
|
481
|
+
DC1394InputPtr *self; Data_Get_Struct( rbSelf, DC1394InputPtr, self );
|
482
|
+
return INT2NUM((*self)->width());
|
483
|
+
}
|
484
|
+
|
485
|
+
VALUE DC1394Input::wrapHeight( VALUE rbSelf )
|
486
|
+
{
|
487
|
+
DC1394InputPtr *self; Data_Get_Struct( rbSelf, DC1394InputPtr, self );
|
488
|
+
return INT2NUM((*self)->height());
|
489
|
+
}
|
490
|
+
|
477
491
|
VALUE DC1394Input::wrapFeatureGetValue( VALUE rbSelf, VALUE rbFeature )
|
478
492
|
{
|
479
493
|
VALUE rbRetVal = Qnil;
|
data/ext/dc1394input.hh
CHANGED
@@ -33,6 +33,8 @@ public:
|
|
33
33
|
FramePtr read(void) throw (Error);
|
34
34
|
bool status(void) const;
|
35
35
|
std::string inspect(void) const;
|
36
|
+
int width(void) const { return m_width; }
|
37
|
+
int height(void) const { return m_height; }
|
36
38
|
unsigned int featureGetValue( dc1394feature_t feature ) throw (Error);
|
37
39
|
void featureSetValue( dc1394feature_t feature, unsigned int value ) throw (Error);
|
38
40
|
bool featureIsPresent( dc1394feature_t feature ) throw (Error);
|
@@ -54,6 +56,8 @@ public:
|
|
54
56
|
static VALUE wrapClose( VALUE rbSelf );
|
55
57
|
static VALUE wrapRead( VALUE rbSelf );
|
56
58
|
static VALUE wrapStatus( VALUE rbSelf );
|
59
|
+
static VALUE wrapWidth( VALUE rbSelf );
|
60
|
+
static VALUE wrapHeight( VALUE rbSelf );
|
57
61
|
static VALUE wrapFeatureGetValue( VALUE rbSelf, VALUE rbFeature );
|
58
62
|
static VALUE wrapFeatureSetValue( VALUE rbSelf, VALUE rbFeature, VALUE rbValue );
|
59
63
|
static VALUE wrapFeatureIsPresent( VALUE rbSelf, VALUE rbFeature );
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# hornetseye-
|
1
|
+
# hornetseye-dc1394 - Capture from DC1394 compatible firewire camera
|
2
2
|
# Copyright (C) 2010 Jan Wedekind
|
3
3
|
#
|
4
4
|
# This program is free software: you can redistribute it and/or modify
|
@@ -17,14 +17,33 @@
|
|
17
17
|
# Namespace of Hornetseye computer vision library
|
18
18
|
module Hornetseye
|
19
19
|
|
20
|
+
# Class for handling a DC1394-compatible firewire camera
|
21
|
+
#
|
22
|
+
# This Ruby-extension is based on libdc1394.
|
23
|
+
#
|
24
|
+
# @see http://damien.douxchamps.net/ieee1394/libdc1394/
|
20
25
|
class DC1394Input
|
21
26
|
|
22
27
|
class << self
|
23
28
|
|
29
|
+
# DC1394 handle
|
30
|
+
#
|
31
|
+
# @private
|
24
32
|
@@dc1394 = nil
|
25
33
|
|
34
|
+
# Alias for overriding native method
|
35
|
+
#
|
36
|
+
# @private
|
26
37
|
alias_method :orig_new, :new
|
27
38
|
|
39
|
+
# Open the firewire camera
|
40
|
+
#
|
41
|
+
# @param [Integer] node Camera node to open.
|
42
|
+
# @param [Integer] speed Firewire bus speed.
|
43
|
+
# @param [Integer,NilClass] frame_rate Desired frame rate.
|
44
|
+
# @param [Proc] action Optional block for selecting the desired video mode.
|
45
|
+
#
|
46
|
+
# return [DC1394Input] An object for accessing the firewire camera.
|
28
47
|
def new( node = 0, speed = SPEED_400, frame_rate = nil, &action )
|
29
48
|
dc1394 = @@dc1394 || DC1394.new
|
30
49
|
begin
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# hornetseye-dc1394 - Capture from DC1394 compatible firewire camera
|
2
|
+
# Copyright (C) 2010 Jan Wedekind
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
# Namespace of Hornetseye computer vision library
|
18
|
+
module Hornetseye
|
19
|
+
|
20
|
+
# Class for handling a DC1394-compatible firewire camera
|
21
|
+
#
|
22
|
+
# This Ruby-extension is based on libdc1394.
|
23
|
+
#
|
24
|
+
# @see http://damien.douxchamps.net/ieee1394/libdc1394/
|
25
|
+
class DC1394Input
|
26
|
+
|
27
|
+
class << self
|
28
|
+
|
29
|
+
# Close the video device
|
30
|
+
#
|
31
|
+
# @return [DC1394Input] Returns +self+.
|
32
|
+
def close
|
33
|
+
end
|
34
|
+
|
35
|
+
# Read a video frame
|
36
|
+
#
|
37
|
+
# @return [MultiArray,Frame_] The video frame.
|
38
|
+
def read
|
39
|
+
end
|
40
|
+
|
41
|
+
# Check whether device is not closed
|
42
|
+
#
|
43
|
+
# @return [Boolean] Returns +true+ as long as device is open.
|
44
|
+
def status?
|
45
|
+
end
|
46
|
+
|
47
|
+
# Width of video input
|
48
|
+
#
|
49
|
+
# @return [Integer] Width of video frames.
|
50
|
+
def width
|
51
|
+
end
|
52
|
+
|
53
|
+
# Height of video input
|
54
|
+
#
|
55
|
+
# @return [Integer] Width of video frames.
|
56
|
+
def height
|
57
|
+
end
|
58
|
+
|
59
|
+
def feature_read( id )
|
60
|
+
end
|
61
|
+
|
62
|
+
def feature_write( id, value )
|
63
|
+
end
|
64
|
+
|
65
|
+
def feature_exist?( id )
|
66
|
+
end
|
67
|
+
|
68
|
+
def feature_readable?( id )
|
69
|
+
end
|
70
|
+
|
71
|
+
def feature_switchable?( id )
|
72
|
+
end
|
73
|
+
|
74
|
+
def feature_on?( id )
|
75
|
+
end
|
76
|
+
|
77
|
+
def feature_on( id, value )
|
78
|
+
end
|
79
|
+
|
80
|
+
def feature_modes( id )
|
81
|
+
end
|
82
|
+
|
83
|
+
def feature_mode_read( id )
|
84
|
+
end
|
85
|
+
|
86
|
+
def feature_mode_write( id, mode )
|
87
|
+
end
|
88
|
+
|
89
|
+
def feature_min( id )
|
90
|
+
end
|
91
|
+
|
92
|
+
def feature_max( id )
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 4
|
9
|
+
version: 0.3.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jan Wedekind
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-11-
|
17
|
+
date: 2010-11-22 00:00:00 +00:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- .document
|
88
88
|
- lib/hornetseye_dc1394_ext.rb
|
89
89
|
- lib/hornetseye-dc1394/dc1394input.rb
|
90
|
+
- lib/hornetseye-dc1394/docs.rb
|
90
91
|
- ext/dc1394input.cc
|
91
92
|
- ext/dc1394select.cc
|
92
93
|
- ext/init.cc
|