Class: OpenCV::CvERTrees

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) ⇒ CvERTrees

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



20975
20976
20977
20978
20979
20980
20981
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20975

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



20972
20973
20974
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20972

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



20967
20968
20969
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20967

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


20924
20925
20926
20927
20928
20929
20930
20931
20932
20933
20934
20935
20936
20937
20938
20939
20940
20941
20942
20943
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20924

def self.new(*args)
    if args.first.is_a?(FFI::Pointer) || args.first.is_a?(CvERTreesStruct)
        raise ArgumentError, "too many arguments for creating #{self.name} from Pointer" unless args.size == 1
        return super(args.first)
    end
    # wrapper for CvERTrees::CvERTrees()
    @@cver_trees_cver_trees_defaults0 ||= []
    if(args.size >= 0 && args.size <= 0)
        args.size.upto(-1) do |i|
            args[i] = @@cver_trees_cver_trees_defaults0[i]
        end
        begin
            return Rbind::cver_trees_cver_trees(*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.



20955
20956
20957
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20955

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



20946
20947
20948
20949
20950
20951
20952
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20946

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



20961
20962
20963
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20961

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)


20986
20987
20988
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20986

def __owner__?
    @__obj_ptr__[:bowner]
end

#clearObject

wrapper for void CvERTrees::clear()



21023
21024
21025
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21023

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

#get_var_importanceObject

wrapper for cv::Mat CvERTrees::getVarImportance()



21015
21016
21017
21018
21019
21020
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21015

def get_var_importance()
    result = Rbind::cver_trees_get_var_importance( 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

#load(filename, name = 0) ⇒ Object

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



21033
21034
21035
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21033

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

#predict(sample, missing = Cv::Mat.new()) ⇒ Object

wrapper for float CvERTrees::predict(const cv::Mat sample, const cv::Mat missing=cv::Mat())



21005
21006
21007
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21005

def predict(sample, missing = Cv::Mat.new())
    Rbind::cver_trees_predict( self, sample, missing)
end

#predict_prob(sample, missing = Cv::Mat.new()) ⇒ Object

wrapper for float CvERTrees::predict_prob(const cv::Mat sample, const cv::Mat missing=cv::Mat())



21010
21011
21012
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21010

def predict_prob(sample, missing = Cv::Mat.new())
    Rbind::cver_trees_predict_prob( self, sample, missing)
end

#save(filename, name = 0) ⇒ Object

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



21028
21029
21030
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21028

def save(filename, name = 0)
    Rbind::cver_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 = CvRTParams.new()) ⇒ Object

methods wrapper for bool CvERTrees::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 CvRTParams params=CvRTParams())



21000
21001
21002
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21000

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 = CvRTParams.new())
    Rbind::cver_trees_train( self, train_data, tflag, responses, var_idx, sample_idx, var_type, missing_data_mask, params)
end