spyglass 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/.rspec +6 -0
  4. data/.travis.yml +11 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE +20 -0
  7. data/README.md +28 -0
  8. data/Rakefile +5 -0
  9. data/examples/background_subtractor.rb +35 -0
  10. data/examples/cascade_classifier.rb +21 -0
  11. data/examples/contours.rb +24 -0
  12. data/examples/images/apple.jpg +0 -0
  13. data/examples/images/beach.jpg +0 -0
  14. data/examples/video_capture.rb +15 -0
  15. data/ext/spyglass/background_subtractor.cc +78 -0
  16. data/ext/spyglass/background_subtractor.h +18 -0
  17. data/ext/spyglass/cascade_classifier.cc +70 -0
  18. data/ext/spyglass/cascade_classifier.h +18 -0
  19. data/ext/spyglass/color.cc +83 -0
  20. data/ext/spyglass/color.h +22 -0
  21. data/ext/spyglass/color_space.cc +39 -0
  22. data/ext/spyglass/color_space.h +13 -0
  23. data/ext/spyglass/contour.cc +92 -0
  24. data/ext/spyglass/contour.h +22 -0
  25. data/ext/spyglass/extconf.rb +6 -0
  26. data/ext/spyglass/gui.cc +27 -0
  27. data/ext/spyglass/gui.h +15 -0
  28. data/ext/spyglass/image.cc +482 -0
  29. data/ext/spyglass/image.h +46 -0
  30. data/ext/spyglass/point.cc +78 -0
  31. data/ext/spyglass/point.h +23 -0
  32. data/ext/spyglass/prelude.h +42 -0
  33. data/ext/spyglass/rect.cc +131 -0
  34. data/ext/spyglass/rect.h +30 -0
  35. data/ext/spyglass/size.cc +89 -0
  36. data/ext/spyglass/size.h +25 -0
  37. data/ext/spyglass/spyglass.cc +35 -0
  38. data/ext/spyglass/spyglass.h +29 -0
  39. data/ext/spyglass/video_capture.cc +96 -0
  40. data/ext/spyglass/video_capture.h +20 -0
  41. data/ext/spyglass/window.cc +93 -0
  42. data/ext/spyglass/window.h +23 -0
  43. data/lib/spyglass.rb +6 -0
  44. data/lib/spyglass/color_space.rb +12 -0
  45. data/lib/spyglass/version.rb +3 -0
  46. data/spec/fixtures/haarcascade_frontalface_default.xml +35712 -0
  47. data/spec/fixtures/lena.jpg +0 -0
  48. data/spec/matchers/close_to.rb +6 -0
  49. data/spec/spec_helper.rb +8 -0
  50. data/spec/spyglass/background_subtractor_spec.rb +23 -0
  51. data/spec/spyglass/cascade_classifier_spec.rb +28 -0
  52. data/spec/spyglass/color_space_spec.rb +13 -0
  53. data/spec/spyglass/color_spec.rb +54 -0
  54. data/spec/spyglass/contour_spec.rb +26 -0
  55. data/spec/spyglass/gui/window_spec.rb +21 -0
  56. data/spec/spyglass/image_spec.rb +116 -0
  57. data/spec/spyglass/point_spec.rb +41 -0
  58. data/spec/spyglass/rect_spec.rb +103 -0
  59. data/spec/spyglass/size_spec.rb +52 -0
  60. data/spyglass.gemspec +26 -0
  61. data/tasks/compile.rake +6 -0
  62. data/tasks/gem.rake +2 -0
  63. data/tasks/rspec.rake +21 -0
  64. metadata +177 -0
@@ -0,0 +1,52 @@
1
+ require 'spec_helper'
2
+
3
+ describe Spyglass::Size do
4
+ let(:square) { Spyglass::Size.new(256, 512) }
5
+
6
+ describe '.new' do
7
+ it 'should require two arguments' do
8
+ expect { Spyglass::Size.new }.to raise_error ArgumentError
9
+ expect( square ).to be_a Spyglass::Size
10
+ end
11
+ end
12
+
13
+ describe 'accessors' do
14
+ describe '#width' do
15
+ it 'should return the correct width' do
16
+ expect( square.width ).to eq(256)
17
+ end
18
+ end
19
+
20
+ describe '#height' do
21
+ it 'should return the correct height' do
22
+ expect( square.height ).to eq(512)
23
+ end
24
+ end
25
+
26
+ describe '#area' do
27
+ it 'should return `width * height`' do
28
+ expect( square.area ).to eq(131_072)
29
+ end
30
+ end
31
+ end
32
+
33
+ describe 'setters' do
34
+ describe '#width=' do
35
+ it 'should set the width correctly' do
36
+ square.width = 512
37
+
38
+ expect( square.width ).to eq(512)
39
+ expect( square.area ).to eq(262_144)
40
+ end
41
+ end
42
+
43
+ describe '#height=' do
44
+ it 'should set the height correctly' do
45
+ square.height = 1024
46
+
47
+ expect( square.height ).to eq(1024)
48
+ expect( square.area ).to eq(262_144)
49
+ end
50
+ end
51
+ end
52
+ end
data/spyglass.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'spyglass/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "spyglass"
8
+ spec.version = Spyglass::VERSION
9
+ spec.authors = ["André Medeiros"]
10
+ spec.email = ["me@andremedeiros.info"]
11
+ spec.extensions = ["ext/spyglass/extconf.rb"]
12
+ spec.description = %q{OpenCV in ruby, made simple.}
13
+ spec.summary = %q{OpenCV in ruby, made simple.}
14
+ spec.homepage = "http://github.com/andremedeiros/spyglass"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "rake-compiler"
25
+ spec.add_development_dependency "rspec"
26
+ end
@@ -0,0 +1,6 @@
1
+ require "rake/extensiontask"
2
+
3
+ Rake::ExtensionTask.new("spyglass") do |extension|
4
+ extension.lib_dir = "lib/spyglass"
5
+ end
6
+
data/tasks/gem.rake ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/tasks/rspec.rake ADDED
@@ -0,0 +1,21 @@
1
+ require "rspec/core/rake_task"
2
+ namespace :spec do
3
+ desc "Run all examples with Valgrind"
4
+ task :valgrind do
5
+ VALGRIND_OPTS = %w{
6
+ --num-callers=50
7
+ --error-limit=no
8
+ --partial-loads-ok=yes
9
+ --undef-value-errors=no
10
+ --trace-children=yes
11
+ }
12
+
13
+ cmd = "valgrind #{VALGRIND_OPTS.join(' ')} bundle exec rake spec"
14
+ puts cmd
15
+ system cmd
16
+ end
17
+ end
18
+
19
+ RSpec::Core::RakeTask.new('spec') do |t|
20
+ t.verbose = true
21
+ end
metadata ADDED
@@ -0,0 +1,177 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spyglass
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - André Medeiros
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake-compiler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: OpenCV in ruby, made simple.
70
+ email:
71
+ - me@andremedeiros.info
72
+ executables: []
73
+ extensions:
74
+ - ext/spyglass/extconf.rb
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - .rspec
79
+ - .travis.yml
80
+ - Gemfile
81
+ - LICENSE
82
+ - README.md
83
+ - Rakefile
84
+ - examples/background_subtractor.rb
85
+ - examples/cascade_classifier.rb
86
+ - examples/contours.rb
87
+ - examples/images/apple.jpg
88
+ - examples/images/beach.jpg
89
+ - examples/video_capture.rb
90
+ - ext/spyglass/background_subtractor.cc
91
+ - ext/spyglass/background_subtractor.h
92
+ - ext/spyglass/cascade_classifier.cc
93
+ - ext/spyglass/cascade_classifier.h
94
+ - ext/spyglass/color.cc
95
+ - ext/spyglass/color.h
96
+ - ext/spyglass/color_space.cc
97
+ - ext/spyglass/color_space.h
98
+ - ext/spyglass/contour.cc
99
+ - ext/spyglass/contour.h
100
+ - ext/spyglass/extconf.rb
101
+ - ext/spyglass/gui.cc
102
+ - ext/spyglass/gui.h
103
+ - ext/spyglass/image.cc
104
+ - ext/spyglass/image.h
105
+ - ext/spyglass/point.cc
106
+ - ext/spyglass/point.h
107
+ - ext/spyglass/prelude.h
108
+ - ext/spyglass/rect.cc
109
+ - ext/spyglass/rect.h
110
+ - ext/spyglass/size.cc
111
+ - ext/spyglass/size.h
112
+ - ext/spyglass/spyglass.cc
113
+ - ext/spyglass/spyglass.h
114
+ - ext/spyglass/video_capture.cc
115
+ - ext/spyglass/video_capture.h
116
+ - ext/spyglass/window.cc
117
+ - ext/spyglass/window.h
118
+ - lib/spyglass.rb
119
+ - lib/spyglass/color_space.rb
120
+ - lib/spyglass/version.rb
121
+ - spec/fixtures/haarcascade_frontalface_default.xml
122
+ - spec/fixtures/lena.jpg
123
+ - spec/matchers/close_to.rb
124
+ - spec/spec_helper.rb
125
+ - spec/spyglass/background_subtractor_spec.rb
126
+ - spec/spyglass/cascade_classifier_spec.rb
127
+ - spec/spyglass/color_space_spec.rb
128
+ - spec/spyglass/color_spec.rb
129
+ - spec/spyglass/contour_spec.rb
130
+ - spec/spyglass/gui/window_spec.rb
131
+ - spec/spyglass/image_spec.rb
132
+ - spec/spyglass/point_spec.rb
133
+ - spec/spyglass/rect_spec.rb
134
+ - spec/spyglass/size_spec.rb
135
+ - spyglass.gemspec
136
+ - tasks/compile.rake
137
+ - tasks/gem.rake
138
+ - tasks/rspec.rake
139
+ homepage: http://github.com/andremedeiros/spyglass
140
+ licenses:
141
+ - MIT
142
+ metadata: {}
143
+ post_install_message:
144
+ rdoc_options: []
145
+ require_paths:
146
+ - lib
147
+ required_ruby_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - '>='
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - '>='
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ requirements: []
158
+ rubyforge_project:
159
+ rubygems_version: 2.0.7
160
+ signing_key:
161
+ specification_version: 4
162
+ summary: OpenCV in ruby, made simple.
163
+ test_files:
164
+ - spec/fixtures/haarcascade_frontalface_default.xml
165
+ - spec/fixtures/lena.jpg
166
+ - spec/matchers/close_to.rb
167
+ - spec/spec_helper.rb
168
+ - spec/spyglass/background_subtractor_spec.rb
169
+ - spec/spyglass/cascade_classifier_spec.rb
170
+ - spec/spyglass/color_space_spec.rb
171
+ - spec/spyglass/color_spec.rb
172
+ - spec/spyglass/contour_spec.rb
173
+ - spec/spyglass/gui/window_spec.rb
174
+ - spec/spyglass/image_spec.rb
175
+ - spec/spyglass/point_spec.rb
176
+ - spec/spyglass/rect_spec.rb
177
+ - spec/spyglass/size_spec.rb