Class: CVFFI::SURF::Result

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kp, desc) ⇒ Result

Returns a new instance of Result.



17
18
19
20
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 17

def initialize( kp, desc )
  @kp = CVFFI::CvSURFPoint.new(kp)
  @desc = desc
end

Instance Attribute Details

#descObject

Returns the value of attribute desc.



16
17
18
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 16

def desc
  @desc
end

#kpObject

Returns the value of attribute kp.



16
17
18
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 16

def kp
  @kp
end

Instance Method Details

#distance_to(q) ⇒ Object



26
27
28
29
30
31
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 26

def distance_to( q )
  #  Here's the pure-Ruby way to do it
#  @desc.inject_with_index(0.0) { |x,d,i| x + (d-q.desc.d[i])**2  }
  
  CVFFI::VectorMath::L2distance( @desc, q.desc )
end

#ptObject



22
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 22

def pt; @kp.pt; end

#to_PointObject



37
38
39
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 37

def to_Point
  pt.to_Point
end

#to_vectorObject



33
34
35
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 33

def to_vector
  Vector.[]( x, y, 1 )
end

#xObject



23
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 23

def x;  pt.x; end

#yObject



24
# File 'lib/opencv-ffi-wrappers/features2d/surf.rb', line 24

def y;  pt.y; end