Class: OpenCV::CvGBTrees

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

Constants collapse

SQUARED_LOSS =
0
ABSOLUTE_LOSS =
0+1
HUBER_LOSS =
3
DEVIANCE_LOSS =
3+1

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr) ⇒ CvGBTrees

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 CvGBTrees.



21537
21538
21539
21540
21541
21542
21543
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21537

def initialize(ptr)
    @__obj_ptr__ = if ptr.is_a? CvGBTreesStruct
                       ptr
                   else
                       CvGBTreesStruct.new(FFI::AutoPointer.new(ptr,CvGBTreesStruct.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.



21534
21535
21536
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21534

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



21529
21530
21531
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21529

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


21473
21474
21475
21476
21477
21478
21479
21480
21481
21482
21483
21484
21485
21486
21487
21488
21489
21490
21491
21492
21493
21494
21495
21496
21497
21498
21499
21500
21501
21502
21503
21504
21505
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21473

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

    # wrapper for CvGBTrees::CvGBTrees(const cv::Mat trainData, int tflag, const cv::Mat responses, const cv::Mat varIdx=cv::Mat(), const cv::Mat sampleIdx=cv::Mat(), const cv::Mat varType=cv::Mat(), const cv::Mat missingDataMask=cv::Mat(), const CvGBTreesParams params=CvGBTreesParams())
    @@cvgb_trees_cvgb_trees2_defaults1 ||= [nil, nil, nil, Cv::Mat.new(), Cv::Mat.new(), Cv::Mat.new(), Cv::Mat.new(), CvGBTreesParams.new()]
    if(args.size >= 3 && args.size <= 8)
        args.size.upto(7) do |i|
            args[i] = @@cvgb_trees_cvgb_trees2_defaults1[i]
        end
        begin
            return Rbind::cvgb_trees_cvgb_trees2(*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.



21517
21518
21519
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21517

def self.rbind_from_native(ptr,context)
    CvGBTrees.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.



21508
21509
21510
21511
21512
21513
21514
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21508

def self.rbind_to_native(obj,context)
    if obj.is_a? CvGBTrees
        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



21523
21524
21525
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21523

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)


21548
21549
21550
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21548

def __owner__?
    @__obj_ptr__[:bowner]
end

#clearObject

methods wrapper for void CvGBTrees::clear()



21566
21567
21568
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21566

def clear()
    Rbind::cvgb_trees_clear( self)
end

#load(filename, name = 0) ⇒ Object

wrapper for void CvGBTrees::load(c_string filename, c_string name=0)



21586
21587
21588
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21586

def load(filename, name = 0)
    Rbind::cvgb_trees_load( self, filename, name)
end

#predict(sample, missing = Cv::Mat.new(), slice = Cv::Range::all(), k = -1)) ⇒ Object

wrapper for float CvGBTrees::predict(const cv::Mat sample, const cv::Mat missing=cv::Mat(), const cv::Range slice=cv::Range::all(), int k=-1)



21576
21577
21578
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21576

def predict(sample, missing = Cv::Mat.new(), slice = Cv::Range::all(), k = -1)
    Rbind::cvgb_trees_predict( self, sample, missing, slice, k)
end

#save(filename, name = 0) ⇒ Object

wrapper for void CvGBTrees::save(c_string filename, c_string name=0)



21581
21582
21583
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21581

def save(filename, name = 0)
    Rbind::cvgb_trees_save( self, filename, name)
end

#train(train_data, tflag, responses, var_idx = Cv::Mat.new(), sample_idx = Cv::Mat.new(), var_type = Cv::Mat.new(), missing_data_mask = Cv::Mat.new(), params = CvGBTreesParams.new(), update = false) ⇒ Object

wrapper for bool CvGBTrees::train(const cv::Mat trainData, int tflag, const cv::Mat responses, const cv::Mat varIdx=cv::Mat(), const cv::Mat sampleIdx=cv::Mat(), const cv::Mat varType=cv::Mat(), const cv::Mat missingDataMask=cv::Mat(), const CvGBTreesParams params=CvGBTreesParams(), bool update=false)



21571
21572
21573
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21571

def train(train_data, tflag, responses, var_idx = Cv::Mat.new(), sample_idx = Cv::Mat.new(), var_type = Cv::Mat.new(), missing_data_mask = Cv::Mat.new(), params = CvGBTreesParams.new(), update = false)
    Rbind::cvgb_trees_train( self, train_data, tflag, responses, var_idx, sample_idx, var_type, missing_data_mask, params, update)
end