Class: OpenCV::Cv::KDTree

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr) ⇒ KDTree

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of KDTree.



7400
7401
7402
7403
7404
7405
7406
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7400

def initialize(ptr)
    @__obj_ptr__ = if ptr.is_a? KDTreeStruct
                       ptr
                   else
                       KDTreeStruct.new(FFI::AutoPointer.new(ptr,KDTreeStruct.method(:release)))
                   end
end

Instance Attribute Details

#__obj_ptr__Object (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7397
7398
7399
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7397

def __obj_ptr__
  @__obj_ptr__
end

Class Method Details

.from_native(ptr, context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

can be overwritten by the user



7392
7393
7394
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7392

def self.from_native(ptr,context)
    rbind_from_native(ptr,context)
end

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7323

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

    # wrapper for cv::KDTree::KDTree(const cv::Mat points, bool copyAndReorderPoints=false)
    @@cv_kd_tree_kd_tree2_defaults1 ||= [nil, false]
    if(args.size >= 1 && args.size <= 2)
        args.size.upto(1) do |i|
            args[i] = @@cv_kd_tree_kd_tree2_defaults1[i]
        end
        begin
            return Rbind::cv_kd_tree_kd_tree2(*args)
        rescue TypeError => e
            @error = e
        end
    end

    # wrapper for cv::KDTree::KDTree(const cv::Mat points, const cv::Mat _labels, bool copyAndReorderPoints=false)
    @@cv_kd_tree_kd_tree3_defaults2 ||= [nil, nil, false]
    if(args.size >= 2 && args.size <= 3)
        args.size.upto(2) do |i|
            args[i] = @@cv_kd_tree_kd_tree3_defaults2[i]
        end
        begin
            return Rbind::cv_kd_tree_kd_tree3(*args)
        rescue TypeError => e
            @error = e
        end
    end

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

.rbind_from_native(ptr, context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7380
7381
7382
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7380

def self.rbind_from_native(ptr,context)
    KDTree.new(ptr)
end

.rbind_to_native(obj, context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7371
7372
7373
7374
7375
7376
7377
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7371

def self.rbind_to_native(obj,context)
    if obj.is_a? KDTree
        obj.__obj_ptr__
    else
        raise TypeError, "expected kind of #{name}, was #{obj.class}"
    end
end

.to_native(obj, context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

can be overwritten by the user



7386
7387
7388
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7386

def self.to_native(obj,context)
    rbind_to_native(obj,context)
end

Instance Method Details

#__owner__?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

returns true if the underlying pointer is owner of the real object

Returns:

  • (Boolean)


7411
7412
7413
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7411

def __owner__?
    @__obj_ptr__[:bowner]
end

#build(*args) ⇒ Object

wrapper for overloaded method build

Raises:

  • (ArgumentError)


7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7456

def build(*args)
    # wrapper for void cv::KDTree::build(const cv::Mat points, bool copyAndReorderPoints=false)
    @@cv_kd_tree_build_defaults0 ||= [nil, false]
    if(args.size >= 1 && args.size <= 2)
        args.size.upto(1) do |i|
            args[i] = @@cv_kd_tree_build_defaults0[i]
        end
        begin
            return Rbind::cv_kd_tree_build(self,*args)
        rescue TypeError => e
            @error = e
        end
    end

    # wrapper for void cv::KDTree::build(const cv::Mat points, const cv::Mat labels, bool copyAndReorderPoints=false)
    @@cv_kd_tree_build2_defaults1 ||= [nil, nil, false]
    if(args.size >= 2 && args.size <= 3)
        args.size.upto(2) do |i|
            args[i] = @@cv_kd_tree_build2_defaults1[i]
        end
        begin
            return Rbind::cv_kd_tree_build2(self,*args)
        rescue TypeError => e
            @error = e
        end
    end

    raise ArgumentError, "No overloaded signature fits to: #{args.map(&:class)}"
end

#dimsObject

wrapper for int cv::KDTree::dims()



7502
7503
7504
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7502

def dims()
    Rbind::cv_kd_tree_dims( self)
end

#find_nearest(vec, k, emax, neighbors_idx, neighbors = Cv::Mat.new(), dist = Cv::Mat.new(), labels = Cv::Mat.new()) ⇒ Object

wrapper for int cv::KDTree::findNearest(const cv::Mat vec, int K, int Emax, cv::Mat neighborsIdx, cv::Mat neighbors=Mat(), cv::Mat dist=Mat(), cv::Mat labels=Mat())



7487
7488
7489
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7487

def find_nearest(vec, k, emax, neighbors_idx, neighbors = Cv::Mat.new(), dist = Cv::Mat.new(), labels = Cv::Mat.new())
    Rbind::cv_kd_tree_find_nearest( self, vec, k, emax, neighbors_idx, neighbors, dist, labels)
end

#find_ortho_range(min_bounds, max_bounds, neighbors_idx, neighbors = Cv::Mat.new(), labels = Cv::Mat.new()) ⇒ Object

wrapper for void cv::KDTree::findOrthoRange(const cv::Mat minBounds, const cv::Mat maxBounds, cv::Mat neighborsIdx, cv::Mat neighbors=Mat(), cv::Mat labels=Mat())



7492
7493
7494
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7492

def find_ortho_range(min_bounds, max_bounds, neighbors_idx, neighbors = Cv::Mat.new(), labels = Cv::Mat.new())
    Rbind::cv_kd_tree_find_ortho_range( self, min_bounds, max_bounds, neighbors_idx, neighbors, labels)
end

#get_points(idx, pts, labels = Cv::Mat.new()) ⇒ Object

wrapper for void cv::KDTree::getPoints(const cv::Mat idx, cv::Mat pts, cv::Mat labels=Mat())



7497
7498
7499
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7497

def get_points(idx, pts, labels = Cv::Mat.new())
    Rbind::cv_kd_tree_get_points( self, idx, pts, labels)
end

#labelsObject

wrapper for const vector_int labels



7433
7434
7435
7436
7437
7438
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7433

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

#max_depthObject

wrapper for int maxDepth



7441
7442
7443
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7441

def max_depth()
    Rbind::cv_kd_tree_get_max_depth( self)
end

#norm_typeObject

wrapper for int normType



7446
7447
7448
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7446

def norm_type()
    Rbind::cv_kd_tree_get_norm_type( self)
end

#norm_type=(value) ⇒ Object

wrapper for int normType



7451
7452
7453
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7451

def norm_type=(value)
    Rbind::cv_kd_tree_set_norm_type( self, value)
end

#pointsObject

methods wrapper for const cv::Mat points



7425
7426
7427
7428
7429
7430
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7425

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