hornetseye-kinect 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rake/loaders/makefile'
7
7
  require 'rbconfig'
8
8
 
9
9
  PKG_NAME = 'hornetseye-kinect'
10
- PKG_VERSION = '0.4.0'
10
+ PKG_VERSION = '0.4.1'
11
11
  CFG = RbConfig::CONFIG
12
12
  CXX = ENV[ 'CXX' ] || 'g++'
13
13
  RB_FILES = FileList[ 'lib/**/*.rb' ]
@@ -27,7 +27,7 @@ EMAIL = %q{jan@wedesoft.de}
27
27
  HOMEPAGE = %q{http://wedesoft.github.com/hornetseye-kinect/}
28
28
 
29
29
  OBJ = CC_FILES.ext 'o'
30
- # $CXXFLAGS = "-DNDEBUG #{CFG[ 'CPPFLAGS' ]} #{CFG[ 'CFLAGS' ]}"
30
+ # $CXXFLAGS = "-DNDEBUG -DHAVE_CONFIG_H #{CFG[ 'CPPFLAGS' ]} #{CFG[ 'CFLAGS' ]}"
31
31
  $CXXFLAGS = "-g #{CFG[ 'CPPFLAGS' ]} #{CFG[ 'CFLAGS' ]}"
32
32
  if CFG[ 'rubyhdrdir' ]
33
33
  $CXXFLAGS = "#{$CXXFLAGS} -I#{CFG[ 'rubyhdrdir' ]} " +
@@ -47,7 +47,7 @@ desc 'Compile Ruby extension (default)'
47
47
  task :all => [ SO_FILE ]
48
48
 
49
49
  file SO_FILE => OBJ do |t|
50
- sh "#{CXX} -shared -o #{t.name} #{OBJ} -lfreenect #{$LIBRUBYARG}"
50
+ sh "#{CXX} -shared -o #{t.name} #{OBJ} -lfreenect -lusb-1.0 #{$LIBRUBYARG}"
51
51
  end
52
52
 
53
53
  task :test => [ SO_FILE ]
@@ -74,6 +74,32 @@ task :uninstall do
74
74
  end
75
75
  end
76
76
 
77
+ desc 'Create config.h'
78
+ task :config_h => 'ext/config.h'
79
+
80
+ def check_c_header( name )
81
+ check_program do |c|
82
+ c.puts <<EOS
83
+ extern "C" {
84
+ #include <#{name}>
85
+ }
86
+ int main(void) { return 0; }
87
+ EOS
88
+ end
89
+ end
90
+
91
+ file 'ext/config.h' do |t|
92
+ s = "/* config.h. Generated from Rakefile by rake. */\n"
93
+ if check_c_header 'libfreenect/libfreenect.h'
94
+ s << "#define HAVE_LIBFREENECT_INCDIR 1\n"
95
+ elsif check_c_header 'libfreenect.h'
96
+ s << "#undef HAVE_LIBFREENECT_INCDIR 1\n"
97
+ else
98
+ raise 'Cannot find swscale.h header file'
99
+ end
100
+ File.open(t.name, 'w') { |f| f.puts s }
101
+ end
102
+
77
103
  Rake::TestTask.new do |t|
78
104
  t.libs << 'ext'
79
105
  t.test_files = TC_FILES
@@ -181,5 +207,5 @@ end
181
207
  import ".depends.mf"
182
208
 
183
209
  CLEAN.include 'ext/*.o'
184
- CLOBBER.include SO_FILE, 'doc', '.yardoc', '.depends.mf'
210
+ CLOBBER.include SO_FILE, 'doc', '.yardoc', '.depends.mf', 'ext/config.h'
185
211
 
data/ext/kinectcontext.hh CHANGED
@@ -16,8 +16,16 @@
16
16
  #ifndef HORNETSEYE_KINECTCONTEXT_HH
17
17
  #define HORNETSEYE_KINECTCONTEXT_HH
18
18
 
19
+ #ifdef HAVE_CONFIG_H
20
+ #include "config.h"
21
+ #endif
22
+
19
23
  #include <boost/smart_ptr.hpp>
24
+ #ifdef HAVE_LIBFREENECT_INCDIR
20
25
  #include <libfreenect/libfreenect.h>
26
+ #else
27
+ #include <libfreenect.h>
28
+ #endif
21
29
  #include "error.hh"
22
30
  #include "rubyinc.hh"
23
31
 
data/ext/kinectinput.cc CHANGED
@@ -53,10 +53,10 @@ KinectInput::KinectInput( KinectContextPtr context, int node ) throw (Error):
53
53
  m_depth[i] = (char *)malloc( FREENECT_DEPTH_11BIT_SIZE );
54
54
  };
55
55
  instances[ m_device ] = this;
56
- // freenect_set_depth_format( m_device, FREENECT_DEPTH_11BIT );
57
- // freenect_set_video_format( m_device, FREENECT_VIDEO_RGB );
58
- freenect_set_video_mode(m_device, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB));
59
- freenect_set_depth_mode(m_device, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT));
56
+ freenect_set_depth_format( m_device, FREENECT_DEPTH_11BIT );
57
+ freenect_set_video_format( m_device, FREENECT_VIDEO_RGB );
58
+ // freenect_set_video_mode(m_device, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB));
59
+ // freenect_set_depth_mode(m_device, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT));
60
60
  freenect_set_depth_buffer( m_device, m_rgb[0] );
61
61
  freenect_set_video_buffer( m_device, m_rgb[0] );
62
62
  freenect_set_depth_callback( m_device, staticDepthCallBack );
@@ -200,7 +200,7 @@ int KinectInput::getTiltStatus(void) throw (Error)
200
200
  {
201
201
  ERRORMACRO( m_device != NULL, Error, , "Kinect device is not open. "
202
202
  "Did you call \"close\" before?" );
203
- return (int)freenect_get_tilt_status( freenect_get_tilt_state( m_device ) );
203
+ return (int)(freenect_get_tilt_state( m_device )->tilt_status);
204
204
  }
205
205
 
206
206
  void KinectInput::depthCallBack( void *depth, unsigned int timestamp )
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hornetseye-kinect
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 13
4
5
  prerelease:
5
- version: 0.4.0
6
+ segments:
7
+ - 0
8
+ - 4
9
+ - 1
10
+ version: 0.4.1
6
11
  platform: ruby
7
12
  authors:
8
13
  - Jan Wedekind
@@ -10,7 +15,7 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-11-04 00:00:00 Z
18
+ date: 2012-05-19 00:00:00 Z
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: malloc
@@ -20,6 +25,10 @@ dependencies:
20
25
  requirements:
21
26
  - - ~>
22
27
  - !ruby/object:Gem::Version
28
+ hash: 13
29
+ segments:
30
+ - 1
31
+ - 1
23
32
  version: "1.1"
24
33
  type: :runtime
25
34
  version_requirements: *id001
@@ -31,6 +40,10 @@ dependencies:
31
40
  requirements:
32
41
  - - ~>
33
42
  - !ruby/object:Gem::Version
43
+ hash: 37
44
+ segments:
45
+ - 0
46
+ - 23
34
47
  version: "0.23"
35
48
  type: :runtime
36
49
  version_requirements: *id002
@@ -42,6 +55,10 @@ dependencies:
42
55
  requirements:
43
56
  - - ~>
44
57
  - !ruby/object:Gem::Version
58
+ hash: 29
59
+ segments:
60
+ - 0
61
+ - 11
45
62
  version: "0.11"
46
63
  type: :runtime
47
64
  version_requirements: *id003
@@ -53,6 +70,9 @@ dependencies:
53
70
  requirements:
54
71
  - - ">="
55
72
  - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
56
76
  version: "0"
57
77
  type: :development
58
78
  version_requirements: *id004
@@ -96,17 +116,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
116
  requirements:
97
117
  - - ">="
98
118
  - !ruby/object:Gem::Version
119
+ hash: 3
120
+ segments:
121
+ - 0
99
122
  version: "0"
100
123
  required_rubygems_version: !ruby/object:Gem::Requirement
101
124
  none: false
102
125
  requirements:
103
126
  - - ">="
104
127
  - !ruby/object:Gem::Version
128
+ hash: 3
129
+ segments:
130
+ - 0
105
131
  version: "0"
106
132
  requirements: []
107
133
 
108
134
  rubyforge_project: hornetseye
109
- rubygems_version: 1.8.5
135
+ rubygems_version: 1.8.15
110
136
  signing_key:
111
137
  specification_version: 3
112
138
  summary: Acquisition of images and depth maps using libfreenect