Class: HWPing::Webcam
- Inherits:
-
Object
- Object
- HWPing::Webcam
- Defined in:
- lib/hwping/webcam.rb,
ext/hwping/webcam.cpp
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Webcam
constructor
A new instance of Webcam.
- #save ⇒ Object
- #write(file) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Webcam
Returns a new instance of Webcam.
5 6 7 8 |
# File 'lib/hwping/webcam.rb', line 5 def initialize( = {}) @dir = .fetch('path', './tmp') @path = 'image.jpg' end |
Class Method Details
.panorama(images, options = {}) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/hwping/webcam.rb', line 15 def self.panorama(images, = {}) pano = stitch(images) pano.instance_variable_set(:@dir, .fetch('path', './tmp')) pano.instance_variable_set(:@path, 'image.jpg') pano end |
.stitch(snapshots) ⇒ Object
58 59 60 61 |
# File 'ext/hwping/webcam.cpp', line 58
static VALUE rb_stitch_snapshots(VALUE self, VALUE snapshots) {
Mat *image = (Mat*) rb_thread_call_without_gvl(stitch_without_gvl, (void*) &snapshots, RUBY_UBF_IO, NULL);
return Data_Wrap_Struct(self, NULL, destroy_snapshot, image);
}
|
Instance Method Details
#save ⇒ Object
10 11 12 13 |
# File 'lib/hwping/webcam.rb', line 10 def save write(File.join(@dir, @path)) @path end |
#write(file) ⇒ Object
52 53 54 55 56 |
# File 'ext/hwping/webcam.cpp', line 52
static VALUE rb_save_snapshot(VALUE self, VALUE file) {
Mat *image;
Data_Get_Struct(self, Mat, image);
return INT2NUM(imwrite(StringValuePtr(file), *image));
}
|