Class: CVFFI::STAR::ResultsArray

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/opencv-ffi-wrappers/features2d/star.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Enumerable

#inject_with_index

Constructor Details

#initialize(kp) ⇒ ResultsArray

Returns a new instance of ResultsArray.



41
42
43
44
# File 'lib/opencv-ffi-wrappers/features2d/star.rb', line 41

def initialize( kp )
  @kp = Sequence.new(kp)
  @results = Array.new( @kp.length )
end

Instance Attribute Details

#kpObject

Returns the value of attribute kp.



39
40
41
# File 'lib/opencv-ffi-wrappers/features2d/star.rb', line 39

def kp
  @kp
end

Instance Method Details

#[](i) ⇒ Object



56
57
58
# File 'lib/opencv-ffi-wrappers/features2d/star.rb', line 56

def [](i)
  result(i)
end

#eachObject



50
51
52
53
54
# File 'lib/opencv-ffi-wrappers/features2d/star.rb', line 50

def each
  @results.each_index { |i| 
    yield result(i) 
  }
end

#mark_on_image(img, opts) ⇒ Object



65
66
67
68
69
# File 'lib/opencv-ffi-wrappers/features2d/star.rb', line 65

def mark_on_image( img, opts )
  each { |r|
    CVFFI::draw_circle( img, r.kp.pt, opts )
  }
end

#result(i) ⇒ Object



46
47
48
# File 'lib/opencv-ffi-wrappers/features2d/star.rb', line 46

def result(i)
  @results[i] ||= Result.new( @kp[i] )
end

#sizeObject Also known as: length



60
61
62
# File 'lib/opencv-ffi-wrappers/features2d/star.rb', line 60

def size
  @kp.size
end