Class: OpenCV::Cv::Flann::Index

Inherits:
Object
  • Object
show all
Extended by:
FFI::DataConverter
Defined in:
lib/ropencv/ropencv_types.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.indexObject .index(features, params, dist_type = cvflann::FLANN_DIST_L2) ⇒ Object

Raises:

  • (ArgumentError)


21111
21112
21113
21114
21115
21116
21117
21118
21119
21120
21121
21122
21123
21124
21125
21126
21127
21128
21129
21130
21131
21132
21133
21134
21135
21136
21137
21138
21139
21140
21141
21142
21143
21144
21145
# File 'lib/ropencv/ropencv_types.rb', line 21111

def self.new(*args)
    if args.first.is_a?(FFI::Pointer) || args.first.is_a?(IndexStruct)
        raise ArgumentError, "too many arguments for creating #{self.name} from Pointer" unless args.size == 1
        return super(args.first)
    end
    # overloaded method wrapper for cv::flann::Index::Index()
    @@cv_flann_index_index_defaults0 ||= []
    if(args.size >= 0 && args.size <= 0)
        targs = args.clone
        targs.size.upto(-1) do |i|
            targs[i] = @@cv_flann_index_index_defaults0[i]
        end
        begin
                return Rbind::cv_flann_index_index(*targs)
        rescue TypeError => e
            @error = e
        end
    end

    # overloaded method wrapper for cv::flann::Index::Index(const cv::Mat features, const cv::flann::IndexParams params, const cvflann::flann_distance_t distType = cvflann::FLANN_DIST_L2)
    @@cv_flann_index_index__2_defaults1 ||= [nil, nil, cvflann::FLANN_DIST_L2]
    if(args.size >= 2 && args.size <= 3)
        targs = args.clone
        targs.size.upto(2) do |i|
            targs[i] = @@cv_flann_index_index__2_defaults1[i]
        end
        begin
                return Rbind::cv_flann_index_index__2(*targs)
        rescue TypeError => e
            @error = e
        end
    end

    raise ArgumentError, "no constructor for #{self}(#{args.inspect})"
end

.nullObject

returns a null pointer to the object



21101
21102
21103
# File 'lib/ropencv/ropencv_types.rb', line 21101

def self.null
    new(IndexStruct.new)
end

Instance Method Details

#build(features, params, dist_type = cvflann::FLANN_DIST_L2) ⇒ Void

Note:

method wrapper for void cv::flann::Index::build(const cv::Mat features, const cv::flann::IndexParams params, const cvflann::flann_distance_t distType = cvflann::FLANN_DIST_L2)

methods



21225
21226
21227
21228
# File 'lib/ropencv/ropencv_types.rb', line 21225

def build(features, params, dist_type = cvflann::FLANN_DIST_L2)
    __validate_pointer__
    Rbind::cv_flann_index_build( self, features, params, dist_type)
end

#get_algorithmCvflann::Flann_Algorithm_T Also known as: getAlgorithm

Note:

method wrapper for const cvflann::flann_algorithm_t cv::flann::Index::getAlgorithm()



21296
21297
21298
21299
21300
21301
21302
21303
21304
# File 'lib/ropencv/ropencv_types.rb', line 21296

def get_algorithm()
    __validate_pointer__
    result = Rbind::cv_flann_index_get_algorithm( self)
    if result.respond_to?(:__owner__?) && !result.__owner__?
    # store owner insight the pointer to not get garbage collected
        result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) 
    end
    result
end

#get_distanceCvflann::Flann_Distance_T Also known as: getDistance

Note:

method wrapper for const cvflann::flann_distance_t cv::flann::Index::getDistance()



21283
21284
21285
21286
21287
21288
21289
21290
21291
# File 'lib/ropencv/ropencv_types.rb', line 21283

def get_distance()
    __validate_pointer__
    result = Rbind::cv_flann_index_get_distance( self)
    if result.respond_to?(:__owner__?) && !result.__owner__?
    # store owner insight the pointer to not get garbage collected
        result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) 
    end
    result
end

#knn_search(query, indices, dists, knn, params = Cv::Flann::SearchParams.new()) ⇒ Void Also known as: knnSearch

Note:

method wrapper for void cv::flann::Index::knnSearch(const cv::Mat query, cv::Mat& indices, cv::Mat& dists, int knn, const cv::flann::SearchParams params = SearchParams())



21237
21238
21239
21240
# File 'lib/ropencv/ropencv_types.rb', line 21237

def knn_search(query, indices, dists, knn, params = Cv::Flann::SearchParams.new())
    __validate_pointer__
    Rbind::cv_flann_index_knn_search( self, query, indices, dists, knn, params)
end

#load(features, filename) ⇒ Bool

Note:

method wrapper for bool cv::flann::Index::load(const cv::Mat features, const std::string filename)



21269
21270
21271
21272
# File 'lib/ropencv/ropencv_types.rb', line 21269

def load(features, filename)
    __validate_pointer__
    Rbind::cv_flann_index_load( self, features, filename)
end

#radius_search(query, indices, dists, radius, max_results, params = Cv::Flann::SearchParams.new()) ⇒ Fixnum Also known as: radiusSearch

Note:

method wrapper for int cv::flann::Index::radiusSearch(const cv::Mat query, cv::Mat& indices, cv::Mat& dists, double radius, int maxResults, const cv::flann::SearchParams params = SearchParams())



21251
21252
21253
21254
# File 'lib/ropencv/ropencv_types.rb', line 21251

def radius_search(query, indices, dists, radius, max_results, params = Cv::Flann::SearchParams.new())
    __validate_pointer__
    Rbind::cv_flann_index_radius_search( self, query, indices, dists, radius, max_results, params)
end

#releaseVoid

Note:

method wrapper for void cv::flann::Index::release()



21276
21277
21278
21279
# File 'lib/ropencv/ropencv_types.rb', line 21276

def release()
    __validate_pointer__
    Rbind::cv_flann_index_release( self)
end

#save(filename) ⇒ Void

Note:

method wrapper for void cv::flann::Index::save(const std::string filename)



21260
21261
21262
21263
# File 'lib/ropencv/ropencv_types.rb', line 21260

def save(filename)
    __validate_pointer__
    Rbind::cv_flann_index_save( self, filename)
end

#to_sObject

converts Index into a string by crawling through all its attributes



21211
21212
21213
# File 'lib/ropencv/ropencv_types.rb', line 21211

def to_s
    "#<cv::flann::Index >"
end