hornetseye-xorg 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +1 -0
- data/COPYING +679 -0
- data/README.md +4 -0
- data/Rakefile +183 -0
- data/ext/error.hh +50 -0
- data/ext/frame.cc +69 -0
- data/ext/frame.hh +41 -0
- data/ext/init.cc +48 -0
- data/ext/rubyinc.hh +54 -0
- data/ext/rubytools.hh +33 -0
- data/ext/rubytools.tcc +32 -0
- data/ext/timer.cc +40 -0
- data/ext/timer.hh +37 -0
- data/ext/x11display.cc +269 -0
- data/ext/x11display.hh +64 -0
- data/ext/x11output.cc +92 -0
- data/ext/x11output.hh +45 -0
- data/ext/x11painter.hh +45 -0
- data/ext/x11window.cc +528 -0
- data/ext/x11window.hh +79 -0
- data/ext/ximagepainter.cc +152 -0
- data/ext/ximagepainter.hh +43 -0
- data/ext/xvideoimagepainter.cc +439 -0
- data/ext/xvideoimagepainter.hh +57 -0
- data/lib/hornetseye-xorg/frame.rb +29 -0
- data/lib/hornetseye-xorg/node.rb +29 -0
- data/lib/hornetseye-xorg/x11display.rb +95 -0
- data/lib/hornetseye-xorg/ximageoutput.rb +32 -0
- data/lib/hornetseye_xorg_ext.rb +22 -0
- metadata +147 -0
@@ -0,0 +1,57 @@
|
|
1
|
+
/* HornetsEye - Computer Vision with Ruby
|
2
|
+
Copyright (C) 2006, 2007 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
|
+
#ifndef HORNETSEYE_XVIDEOIMAGEPAINTER_HH
|
17
|
+
#define HORNETSEYE_XVIDEOIMAGEPAINTER_HH
|
18
|
+
|
19
|
+
#include <X11/extensions/Xv.h>
|
20
|
+
#include <X11/extensions/Xvlib.h>
|
21
|
+
#include <set>
|
22
|
+
#include "x11painter.hh"
|
23
|
+
|
24
|
+
class X11Window;
|
25
|
+
class XVideoOutput;
|
26
|
+
|
27
|
+
class XVideoImagePainter: public X11Painter
|
28
|
+
{
|
29
|
+
public:
|
30
|
+
XVideoImagePainter(void);
|
31
|
+
~XVideoImagePainter(void);
|
32
|
+
virtual void paint( bool x11Event ) throw (Error);
|
33
|
+
virtual void unregisterWindow(void);
|
34
|
+
virtual XVisualInfo *visualInfo( X11DisplayPtr display ) throw (Error);
|
35
|
+
static VALUE cRubyClass;
|
36
|
+
static VALUE rbHornetseye;
|
37
|
+
static VALUE registerRubyClass( VALUE module, VALUE cX11Output );
|
38
|
+
static VALUE wrapNew( VALUE rbClass );
|
39
|
+
protected:
|
40
|
+
Atom findAtom( const char *name ) throw (Error);
|
41
|
+
int selectFormat( const int preferredUID ) throw (Error);
|
42
|
+
FramePtr alignYV12( FramePtr frame );
|
43
|
+
static int typecodeToUID( std::string typecode );
|
44
|
+
static std::string uidToTypecode( int uid );
|
45
|
+
XVisualInfo m_visualInfo;
|
46
|
+
XvPortID m_port;
|
47
|
+
bool m_requireColourKey;
|
48
|
+
int m_colourKey;
|
49
|
+
X11DisplayPtr m_display;
|
50
|
+
XvImage *m_xvImage;
|
51
|
+
static std::set< XvPortID > grabbedPorts;
|
52
|
+
};
|
53
|
+
|
54
|
+
typedef boost::shared_ptr< XVideoImagePainter > XVideoImagePainterPtr;
|
55
|
+
|
56
|
+
#endif
|
57
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# hornetseye-xorg - Graphical output under X.Org
|
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 Frame_
|
21
|
+
|
22
|
+
def show( *args )
|
23
|
+
X11Display.show self, *args
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# hornetseye-xorg - Graphical output under X.Org
|
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 Node
|
21
|
+
|
22
|
+
def show( *args )
|
23
|
+
X11Display.show self, *args
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# hornetseye-xorg - Graphical output under X.Org
|
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 X11Display
|
21
|
+
|
22
|
+
class << self
|
23
|
+
|
24
|
+
alias_method :orig_new, :new
|
25
|
+
|
26
|
+
def new( name = ENV[ 'DISPLAY' ] )
|
27
|
+
if name.nil? and ENV[ 'DISPLAY' ].nil?
|
28
|
+
raise "DISPLAY variable was not set"
|
29
|
+
end
|
30
|
+
orig_new name
|
31
|
+
end
|
32
|
+
|
33
|
+
def show( *args, &action )
|
34
|
+
options = args.last.is_a?( Hash ) ? args.pop : {}
|
35
|
+
options = { :title => 'Hornetseye' }.merge options
|
36
|
+
unless action
|
37
|
+
options = { :output => XImageOutput }.merge options
|
38
|
+
frame, width, height = *args
|
39
|
+
width ||= frame.width
|
40
|
+
height ||= ( width.to_f * frame.height / frame.width ).round
|
41
|
+
display = new
|
42
|
+
output = options[ :output ].new
|
43
|
+
output.write frame
|
44
|
+
window = X11Window.new display, output, width, height
|
45
|
+
window.title = options[ :title ]
|
46
|
+
begin
|
47
|
+
window.show
|
48
|
+
display.event_loop
|
49
|
+
ensure
|
50
|
+
window.close
|
51
|
+
end
|
52
|
+
else
|
53
|
+
options = { :output => XVideoOutput }.merge options
|
54
|
+
width, height = *args
|
55
|
+
result = action.call
|
56
|
+
width ||= result.shape[0]
|
57
|
+
height ||= ( width.to_f * result.shape[1] / result.shape[0] ).round
|
58
|
+
display = new
|
59
|
+
output = options[ :output ].new
|
60
|
+
window = X11Window.new display, output, width, height
|
61
|
+
window.title = options[ :title ]
|
62
|
+
begin
|
63
|
+
window.show
|
64
|
+
t = Time.new.to_f
|
65
|
+
while true
|
66
|
+
t += 1.0 / options[ :frame_rate ] if options[ :frame_rate ]
|
67
|
+
output.write result
|
68
|
+
delay = t - Time.new.to_f
|
69
|
+
if delay > 0
|
70
|
+
display.event_loop delay
|
71
|
+
else
|
72
|
+
display.process_events
|
73
|
+
end
|
74
|
+
break unless display.status?
|
75
|
+
result = action.call
|
76
|
+
end
|
77
|
+
ensure
|
78
|
+
window.close
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
alias_method :orig_event_loop, :event_loop
|
86
|
+
|
87
|
+
def event_loop( timeout = INFINITE )
|
88
|
+
timeout *= 1000 unless timeout == INFINITE
|
89
|
+
orig_event_loop timeout
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# hornetseye-xorg - Graphical output under X.Org
|
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 XImageOutput
|
21
|
+
|
22
|
+
alias_method :orig_write, :write
|
23
|
+
|
24
|
+
def write( frame )
|
25
|
+
frame = frame.to_type UBYTERGB unless frame.typecode == UBYTERGB
|
26
|
+
orig_write frame
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# hornetseye-xorg - Graphical output under X.Org
|
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
|
+
require 'hornetseye_frame'
|
18
|
+
require 'hornetseye-xorg/x11display'
|
19
|
+
require 'hornetseye-xorg/ximageoutput'
|
20
|
+
require 'hornetseye-xorg/node'
|
21
|
+
require 'hornetseye-xorg/frame'
|
22
|
+
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hornetseye-xorg
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 0.2.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Jan Wedekind
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-10-05 00:00:00 +01:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: malloc
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 1
|
31
|
+
version: "1.1"
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: multiarray
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ~>
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
- 6
|
45
|
+
version: "0.6"
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: hornetseye-frame
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
- 3
|
59
|
+
version: "0.3"
|
60
|
+
type: :runtime
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rake
|
64
|
+
prerelease: false
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
version: "0"
|
73
|
+
type: :development
|
74
|
+
version_requirements: *id004
|
75
|
+
description: This Ruby extension provides graphical output under X.Org.
|
76
|
+
email: jan@wedesoft.de
|
77
|
+
executables: []
|
78
|
+
|
79
|
+
extensions:
|
80
|
+
- Rakefile
|
81
|
+
extra_rdoc_files: []
|
82
|
+
|
83
|
+
files:
|
84
|
+
- Rakefile
|
85
|
+
- README.md
|
86
|
+
- COPYING
|
87
|
+
- .document
|
88
|
+
- lib/hornetseye-xorg/frame.rb
|
89
|
+
- lib/hornetseye-xorg/ximageoutput.rb
|
90
|
+
- lib/hornetseye-xorg/node.rb
|
91
|
+
- lib/hornetseye-xorg/x11display.rb
|
92
|
+
- lib/hornetseye_xorg_ext.rb
|
93
|
+
- ext/xvideoimagepainter.cc
|
94
|
+
- ext/x11output.cc
|
95
|
+
- ext/timer.cc
|
96
|
+
- ext/x11window.cc
|
97
|
+
- ext/init.cc
|
98
|
+
- ext/frame.cc
|
99
|
+
- ext/ximagepainter.cc
|
100
|
+
- ext/x11display.cc
|
101
|
+
- ext/x11window.hh
|
102
|
+
- ext/frame.hh
|
103
|
+
- ext/rubytools.hh
|
104
|
+
- ext/x11display.hh
|
105
|
+
- ext/ximagepainter.hh
|
106
|
+
- ext/timer.hh
|
107
|
+
- ext/x11output.hh
|
108
|
+
- ext/rubyinc.hh
|
109
|
+
- ext/error.hh
|
110
|
+
- ext/x11painter.hh
|
111
|
+
- ext/xvideoimagepainter.hh
|
112
|
+
- ext/rubytools.tcc
|
113
|
+
has_rdoc: yard
|
114
|
+
homepage: http://wedesoft.github.com/hornetseye-xorg/
|
115
|
+
licenses: []
|
116
|
+
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options:
|
119
|
+
- --no-private
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
- ext
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
segments:
|
129
|
+
- 0
|
130
|
+
version: "0"
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
segments:
|
137
|
+
- 0
|
138
|
+
version: "0"
|
139
|
+
requirements: []
|
140
|
+
|
141
|
+
rubyforge_project: hornetseye
|
142
|
+
rubygems_version: 1.3.7
|
143
|
+
signing_key:
|
144
|
+
specification_version: 3
|
145
|
+
summary: Graphical output under X.Org
|
146
|
+
test_files: []
|
147
|
+
|