Class: OpenCV::CvBoost

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

Constants collapse

DISCRETE =
0
REAL =
1
LOGIT =
2
GENTLE =
3
DEFAULT =
0
GINI =
1
MISCLASS =
3
SQERR =
4

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr) ⇒ CvBoost

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



21256
21257
21258
21259
21260
21261
21262
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21256

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



21253
21254
21255
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21253

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



21248
21249
21250
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21248

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


21192
21193
21194
21195
21196
21197
21198
21199
21200
21201
21202
21203
21204
21205
21206
21207
21208
21209
21210
21211
21212
21213
21214
21215
21216
21217
21218
21219
21220
21221
21222
21223
21224
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21192

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

    # wrapper for CvBoost::CvBoost(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 CvBoostParams params=CvBoostParams())
    @@cv_boost_cv_boost2_defaults1 ||= [nil, nil, nil, Cv::Mat.new(), Cv::Mat.new(), Cv::Mat.new(), Cv::Mat.new(), CvBoostParams.new()]
    if(args.size >= 3 && args.size <= 8)
        args.size.upto(7) do |i|
            args[i] = @@cv_boost_cv_boost2_defaults1[i]
        end
        begin
            return Rbind::cv_boost_cv_boost2(*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.



21236
21237
21238
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21236

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



21227
21228
21229
21230
21231
21232
21233
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21227

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



21242
21243
21244
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21242

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)


21267
21268
21269
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21267

def __owner__?
    @__obj_ptr__[:bowner]
end

#clearObject

wrapper for void CvBoost::clear()



21304
21305
21306
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21304

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

#load(filename, name = 0) ⇒ Object

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



21314
21315
21316
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21314

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

#predict(sample, missing = Cv::Mat.new(), slice = Cv::Range::all(), raw_mode = false, return_sum = false) ⇒ Object

wrapper for float CvBoost::predict(const cv::Mat sample, const cv::Mat missing=cv::Mat(), const cv::Range slice=cv::Range::all(), bool rawMode=false, bool returnSum=false)



21294
21295
21296
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21294

def predict(sample, missing = Cv::Mat.new(), slice = Cv::Range::all(), raw_mode = false, return_sum = false)
    Rbind::cv_boost_predict( self, sample, missing, slice, raw_mode, return_sum)
end

#prune(slice) ⇒ Object

wrapper for void CvBoost::prune(const CvSlice slice)



21299
21300
21301
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21299

def prune(slice)
    Rbind::cv_boost_prune( self, slice)
end

#save(filename, name = 0) ⇒ Object

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



21309
21310
21311
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21309

def save(filename, name = 0)
    Rbind::cv_boost_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 = CvBoostParams.new(), update = false) ⇒ Object

methods wrapper for bool CvBoost::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 CvBoostParams params=CvBoostParams(), bool update=false)



21289
21290
21291
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21289

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