Module: CVFFI::SIFT

Extended by:
NiceFFI::Library
Defined in:
lib/opencv-ffi-ext/sift.rb

Defined Under Namespace

Classes: Params, Results, SiftDescriptor, SiftKeypoint, SiftParams, SiftResults

Constant Summary collapse

NUM_BINS =
36
FV_LENGTH =
128

Class Method Summary collapse

Class Method Details

.detect(image, params) ⇒ Object



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/opencv-ffi-ext/sift.rb', line 95

def self.detect( image, params )
  params = params.to_SiftParams unless params.is_a?( SiftParams )

  puts "Running SIFT algorithm with #{params.octaves} octaves and #{params.intervals} intervals."

  kps = siftDetectDescribe_real( image, params )

  # Unwrap the SiftKeypoints to an Array.
  keypoints = Array.new( kps.len ) { |i|
    SiftKeypoint.new( kps.kps + (i*SiftKeypoint.size))
  }
  descs = Array.new( kps.len ) { |i|
    SiftDescriptor.new( kps.descs + (i*SiftDescriptor.size) )
  }

  p keypoints[0]
  p descs[0]

  Results.new( keypoints, descs )
end