Module: CVFFI::OpenSURF

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

Defined Under Namespace

Classes: OpenSURFParams, OpenSURFPoint, Params, Result, ResultArray

Class Method Summary collapse

Class Method Details

.describe(img, points, params) ⇒ Object

Descriptor takes x,y, scale. Apparently not laplcian Sets orientation, descriptor

Raises:

  • (ArgumentError)


199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/opencv-ffi-ext/opensurf.rb', line 199

def self.describe( img, points, params )
  params = params.to_OpenSurfParams unless params.is_a?( OpenSURFParams ) 
  raise ArgumentError unless params.is_a?( OpenSURFParams ) 

  img = img.ensure_greyscale

  puts "Extracting #{points.length} features"

  kp = points.to_CvSeq

  openSurfDescribe( img, kp, params )

  points.reset(kp)
  points
end

.detect(img, params) ⇒ Object

Detection sets x,y,scale, laplacian

Raises:

  • (ArgumentError)


185
186
187
188
189
190
191
192
193
194
195
# File 'lib/opencv-ffi-ext/opensurf.rb', line 185

def self.detect( img, params )
  params = params.to_OpenSurfParams unless params.is_a?( OpenSURFParams ) 
  raise ArgumentError unless params.is_a?( OpenSURFParams ) 

  mem_storage = CVFFI::cvCreateMemStorage( 0 )

  img = img.ensure_greyscale
  kp = CVFFI::CvSeq.new openSurfDetect( img, mem_storage, params )

  ResultArray.new( kp, mem_storage )
end