Class: CVFFI::SURF::ResultsArray
- Inherits:
-
Object
- Object
- CVFFI::SURF::ResultsArray
- Includes:
- Enumerable
- Defined in:
- lib/opencv-ffi-wrappers/features2d/surf.rb
Instance Attribute Summary collapse
-
#desc ⇒ Object
Returns the value of attribute desc.
-
#desc_type ⇒ Object
Returns the value of attribute desc_type.
-
#kp ⇒ Object
Returns the value of attribute kp.
-
#pool ⇒ Object
Returns the value of attribute pool.
Instance Method Summary collapse
- #[](i) ⇒ Object
- #each ⇒ Object
-
#initialize(kp, desc, pool, desc_type = Float64) ⇒ ResultsArray
constructor
A new instance of ResultsArray.
- #mark_on_image(img, opts) ⇒ Object
- #result(i) ⇒ Object
- #size ⇒ Object (also: #length)
Methods included from Enumerable
Constructor Details
#initialize(kp, desc, pool, desc_type = Float64) ⇒ ResultsArray
Returns a new instance of ResultsArray.
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 48 def initialize( kp, desc, pool, desc_type = Float64 ) @kp = Sequence.new(kp) @desc = Sequence.new(desc) @pool = pool @desc_type = desc_type @results = Array.new( @kp.length ) raise RuntimeError "SURF Keypoint and descriptor sequences different length (#{@kp.size} != #{@desc.size})" unless (@kp.size == @desc.size) destructor = Proc.new { poolPtr = FFI::MemoryPointer.new :pointer; poolPtr.putPointer( 0, @pool ); cvReleaseMemStorage( poolPtr ) } ObjectSpace.define_finalizer( self, destructor ) end |
Instance Attribute Details
#desc ⇒ Object
Returns the value of attribute desc.
45 46 47 |
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 45 def desc @desc end |
#desc_type ⇒ Object
Returns the value of attribute desc_type.
46 47 48 |
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 46 def desc_type @desc_type end |
#kp ⇒ Object
Returns the value of attribute kp.
45 46 47 |
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 45 def kp @kp end |
#pool ⇒ Object
Returns the value of attribute pool.
45 46 47 |
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 45 def pool @pool end |
Instance Method Details
#[](i) ⇒ Object
71 72 73 |
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 71 def [](i) result(i) end |
#each ⇒ Object
65 66 67 68 69 |
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 65 def each @results.each_index { |i| yield result(i) } end |
#mark_on_image(img, opts) ⇒ Object
80 81 82 83 84 |
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 80 def mark_on_image( img, opts ) each { |r| CVFFI::draw_circle( img, r.kp.pt, opts ) } end |
#result(i) ⇒ Object
61 62 63 |
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 61 def result(i) @results[i] ||= Result.new( @kp[i], @desc_type.new( @desc[i] ) ) end |
#size ⇒ Object Also known as: length
75 76 77 |
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 75 def size @kp.size end |