Class: OpenCV::CvRTrees
- Inherits:
-
Object
- Object
- OpenCV::CvRTrees
- Extended by:
- FFI::DataConverter
- Defined in:
- lib/ruby/ropencv/ropencv_types.rb
Instance Attribute Summary collapse
- #__obj_ptr__ ⇒ Object readonly private
Class Method Summary collapse
-
.from_native(ptr, context) ⇒ Object
private
can be overwritten by the user.
- .new(*args) ⇒ Object
- .rbind_from_native(ptr, context) ⇒ Object private
- .rbind_to_native(obj, context) ⇒ Object private
-
.to_native(obj, context) ⇒ Object
private
can be overwritten by the user.
Instance Method Summary collapse
-
#__owner__? ⇒ Boolean
private
returns true if the underlying pointer is owner of the real object.
-
#clear ⇒ Object
wrapper for void CvRTrees::clear().
-
#get_var_importance ⇒ Object
wrapper for cv::Mat CvRTrees::getVarImportance().
-
#initialize(ptr) ⇒ CvRTrees
constructor
private
A new instance of CvRTrees.
-
#load(filename, name = 0) ⇒ Object
wrapper for void CvRTrees::load(c_string filename, c_string name=0).
-
#predict(sample, missing = Cv::Mat.new()) ⇒ Object
wrapper for float CvRTrees::predict(const cv::Mat sample, const cv::Mat missing=cv::Mat()).
-
#predict_prob(sample, missing = Cv::Mat.new()) ⇒ Object
wrapper for float CvRTrees::predict_prob(const cv::Mat sample, const cv::Mat missing=cv::Mat()).
-
#save(filename, name = 0) ⇒ Object
wrapper for void CvRTrees::save(c_string filename, c_string name=0).
-
#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 CvRTrees::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()).
Constructor Details
#initialize(ptr) ⇒ CvRTrees
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 CvRTrees.
20836 20837 20838 20839 20840 20841 20842 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20836 def initialize(ptr) @__obj_ptr__ = if ptr.is_a? CvRTreesStruct ptr else CvRTreesStruct.new(FFI::AutoPointer.new(ptr,CvRTreesStruct.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.
20833 20834 20835 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20833 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
20828 20829 20830 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20828 def self.from_native(ptr,context) rbind_from_native(ptr,context) end |
.new(*args) ⇒ Object
20785 20786 20787 20788 20789 20790 20791 20792 20793 20794 20795 20796 20797 20798 20799 20800 20801 20802 20803 20804 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20785 def self.new(*args) if args.first.is_a?(FFI::Pointer) || args.first.is_a?(CvRTreesStruct) raise ArgumentError, "too many arguments for creating #{self.name} from Pointer" unless args.size == 1 return super(args.first) end # wrapper for CvRTrees::CvRTrees() @@cvr_trees_cvr_trees_defaults0 ||= [] if(args.size >= 0 && args.size <= 0) args.size.upto(-1) do |i| args[i] = @@cvr_trees_cvr_trees_defaults0[i] end begin return Rbind::cvr_trees_cvr_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.
20816 20817 20818 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20816 def self.rbind_from_native(ptr,context) CvRTrees.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.
20807 20808 20809 20810 20811 20812 20813 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20807 def self.rbind_to_native(obj,context) if obj.is_a? CvRTrees 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
20822 20823 20824 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20822 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
20847 20848 20849 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20847 def __owner__? @__obj_ptr__[:bowner] end |
#clear ⇒ Object
wrapper for void CvRTrees::clear()
20884 20885 20886 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20884 def clear() Rbind::cvr_trees_clear( self) end |
#get_var_importance ⇒ Object
wrapper for cv::Mat CvRTrees::getVarImportance()
20876 20877 20878 20879 20880 20881 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20876 def get_var_importance() result = Rbind::cvr_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 CvRTrees::load(c_string filename, c_string name=0)
20894 20895 20896 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20894 def load(filename, name = 0) Rbind::cvr_trees_load( self, filename, name) end |
#predict(sample, missing = Cv::Mat.new()) ⇒ Object
wrapper for float CvRTrees::predict(const cv::Mat sample, const cv::Mat missing=cv::Mat())
20866 20867 20868 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20866 def predict(sample, missing = Cv::Mat.new()) Rbind::cvr_trees_predict( self, sample, missing) end |
#predict_prob(sample, missing = Cv::Mat.new()) ⇒ Object
wrapper for float CvRTrees::predict_prob(const cv::Mat sample, const cv::Mat missing=cv::Mat())
20871 20872 20873 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20871 def predict_prob(sample, missing = Cv::Mat.new()) Rbind::cvr_trees_predict_prob( self, sample, missing) end |
#save(filename, name = 0) ⇒ Object
wrapper for void CvRTrees::save(c_string filename, c_string name=0)
20889 20890 20891 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20889 def save(filename, name = 0) Rbind::cvr_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 CvRTrees::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())
20861 20862 20863 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 20861 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::cvr_trees_train( self, train_data, tflag, responses, var_idx, sample_idx, var_type, missing_data_mask, params) end |