Class: CVFFI::SIFT::Results
- Inherits:
-
Object
- Object
- CVFFI::SIFT::Results
- Defined in:
- lib/opencv-ffi-ext/sift.rb
Instance Attribute Summary collapse
-
#descs ⇒ Object
Returns the value of attribute descs.
-
#kps ⇒ Object
Returns the value of attribute kps.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(k, d) ⇒ Results
constructor
A new instance of Results.
- #size ⇒ Object (also: #length)
- #to_a ⇒ Object
Constructor Details
#initialize(k, d) ⇒ Results
Returns a new instance of Results.
47 48 49 50 |
# File 'lib/opencv-ffi-ext/sift.rb', line 47 def initialize( k, d ) @kps = k @descs = d end |
Instance Attribute Details
#descs ⇒ Object
Returns the value of attribute descs.
45 46 47 |
# File 'lib/opencv-ffi-ext/sift.rb', line 45 def descs @descs end |
#kps ⇒ Object
Returns the value of attribute kps.
45 46 47 |
# File 'lib/opencv-ffi-ext/sift.rb', line 45 def kps @kps end |
Class Method Details
.from_a(a) ⇒ Object
69 70 71 72 73 74 75 76 |
# File 'lib/opencv-ffi-ext/sift.rb', line 69 def self.from_a( a ) a = YAML::load(a) if a.is_a? String raise "Don't know what to do" unless a.is_a? Array raise "Result isn't a two-element array" unless a.length == 2 kps = a[0] descs = a[1] end |
Instance Method Details
#size ⇒ Object Also known as: length
52 53 54 |
# File 'lib/opencv-ffi-ext/sift.rb', line 52 def size @kps.length end |
#to_a ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/opencv-ffi-ext/sift.rb', line 57 def to_a a = Array.new a << Array.new( size ) { |i| kp = kps[i] [ kp.x, kp.y, kp.mag, kp.orien, kp.num_bins, kp.scale ] } a << Array.new( size ) { |i| d = descs[i] [d.x, d.y, d.fv, d.fv_length] } end |