Class: OpenCV::CvNormalBayesClassifier

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

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



19792
19793
19794
19795
19796
19797
19798
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19792

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



19789
19790
19791
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19789

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



19784
19785
19786
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19784

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


19728
19729
19730
19731
19732
19733
19734
19735
19736
19737
19738
19739
19740
19741
19742
19743
19744
19745
19746
19747
19748
19749
19750
19751
19752
19753
19754
19755
19756
19757
19758
19759
19760
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19728

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

    # wrapper for CvNormalBayesClassifier::CvNormalBayesClassifier(const cv::Mat trainData, const cv::Mat responses, const cv::Mat varIdx=cv::Mat(), const cv::Mat sampleIdx=cv::Mat())
    @@cv_normal_bayes_classifier_cv_normal_bayes_classifier2_defaults1 ||= [nil, nil, Cv::Mat.new(), Cv::Mat.new()]
    if(args.size >= 2 && args.size <= 4)
        args.size.upto(3) do |i|
            args[i] = @@cv_normal_bayes_classifier_cv_normal_bayes_classifier2_defaults1[i]
        end
        begin
            return Rbind::cv_normal_bayes_classifier_cv_normal_bayes_classifier2(*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.



19772
19773
19774
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19772

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



19763
19764
19765
19766
19767
19768
19769
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19763

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



19778
19779
19780
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19778

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)


19803
19804
19805
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19803

def __owner__?
    @__obj_ptr__[:bowner]
end

#clearObject

methods wrapper for void CvNormalBayesClassifier::clear()



19817
19818
19819
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19817

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

#load(filename, name = 0) ⇒ Object

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



19837
19838
19839
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19837

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

#predict(samples, results = 0) ⇒ Object

wrapper for float CvNormalBayesClassifier::predict(const cv::Mat samples, cv::Mat *results=0)



19827
19828
19829
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19827

def predict(samples, results = 0)
    Rbind::cv_normal_bayes_classifier_predict( self, samples, results)
end

#save(filename, name = 0) ⇒ Object

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



19832
19833
19834
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19832

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

#train(train_data, responses, var_idx = Cv::Mat.new(), sample_idx = Cv::Mat.new(), update = false) ⇒ Object

wrapper for bool CvNormalBayesClassifier::train(const cv::Mat trainData, const cv::Mat responses, const cv::Mat varIdx=cv::Mat(), const cv::Mat sampleIdx=cv::Mat(), bool update=false)



19822
19823
19824
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19822

def train(train_data, responses, var_idx = Cv::Mat.new(), sample_idx = Cv::Mat.new(), update = false)
    Rbind::cv_normal_bayes_classifier_train( self, train_data, responses, var_idx, sample_idx, update)
end