Class: OpenCV::Cv::RNG
- Inherits:
-
Object
- Object
- OpenCV::Cv::RNG
- Extended by:
- FFI::DataConverter
- Defined in:
- lib/ruby/ropencv/ropencv_types.rb
Constants collapse
- UNIFORM =
0
- NORMAL =
1
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.
-
#fill(mat, dist_type, a, b, saturate_range = false) ⇒ Object
wrapper for void cv::RNG::fill(cv::Mat mat, int distType, const cv::Mat a, const cv::Mat b, bool saturateRange=false).
-
#gaussian(sigma) ⇒ Object
wrapper for double cv::RNG::gaussian(double sigma).
-
#initialize(ptr) ⇒ RNG
constructor
private
A new instance of RNG.
-
#state ⇒ Object
methods wrapper for uint64 state.
-
#uniform(*args) ⇒ Object
wrapper for overloaded method uniform.
Constructor Details
#initialize(ptr) ⇒ RNG
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 RNG.
7161 7162 7163 7164 7165 7166 7167 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7161 def initialize(ptr) @__obj_ptr__ = if ptr.is_a? RNGStruct ptr else RNGStruct.new(FFI::AutoPointer.new(ptr,RNGStruct.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.
7158 7159 7160 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7158 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
7153 7154 7155 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7153 def self.from_native(ptr,context) rbind_from_native(ptr,context) end |
.new(*args) ⇒ Object
7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7097 def self.new(*args) if args.first.is_a?(FFI::Pointer) || args.first.is_a?(RNGStruct) raise ArgumentError, "too many arguments for creating #{self.name} from Pointer" unless args.size == 1 return super(args.first) end # wrapper for cv::RNG::RNG() @@cv_rng_rng_defaults0 ||= [] if(args.size >= 0 && args.size <= 0) args.size.upto(-1) do |i| args[i] = @@cv_rng_rng_defaults0[i] end begin return Rbind::cv_rng_rng(*args) rescue TypeError => e @error = e end end # wrapper for cv::RNG::RNG(uint64 state) @@cv_rng_rng2_defaults1 ||= [nil] if(args.size >= 1 && args.size <= 1) args.size.upto(0) do |i| args[i] = @@cv_rng_rng2_defaults1[i] end begin return Rbind::cv_rng_rng2(*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.
7141 7142 7143 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7141 def self.rbind_from_native(ptr,context) RNG.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.
7132 7133 7134 7135 7136 7137 7138 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7132 def self.rbind_to_native(obj,context) if obj.is_a? RNG 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
7147 7148 7149 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7147 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
7172 7173 7174 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7172 def __owner__? @__obj_ptr__[:bowner] end |
#fill(mat, dist_type, a, b, saturate_range = false) ⇒ Object
wrapper for void cv::RNG::fill(cv::Mat mat, int distType, const cv::Mat a, const cv::Mat b, bool saturateRange=false)
7237 7238 7239 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7237 def fill(mat, dist_type, a, b, saturate_range = false) Rbind::cv_rng_fill( self, mat, dist_type, a, b, saturate_range) end |
#gaussian(sigma) ⇒ Object
wrapper for double cv::RNG::gaussian(double sigma)
7242 7243 7244 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7242 def gaussian(sigma) Rbind::cv_rng_gaussian( self, sigma) end |
#state ⇒ Object
methods wrapper for uint64 state
7188 7189 7190 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7188 def state() Rbind::cv_rng_get_state( self) end |
#uniform(*args) ⇒ Object
wrapper for overloaded method uniform
7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7193 def uniform(*args) # wrapper for int cv::RNG::uniform(int a, int b) @@cv_rng_uniform_defaults0 ||= [nil, nil] if(args.size >= 2 && args.size <= 2) args.size.upto(1) do |i| args[i] = @@cv_rng_uniform_defaults0[i] end begin return Rbind::cv_rng_uniform(self,*args) rescue TypeError => e @error = e end end # wrapper for float cv::RNG::uniform(float a, float b) @@cv_rng_uniform2_defaults1 ||= [nil, nil] if(args.size >= 2 && args.size <= 2) args.size.upto(1) do |i| args[i] = @@cv_rng_uniform2_defaults1[i] end begin return Rbind::cv_rng_uniform2(self,*args) rescue TypeError => e @error = e end end # wrapper for double cv::RNG::uniform(double a, double b) @@cv_rng_uniform3_defaults2 ||= [nil, nil] if(args.size >= 2 && args.size <= 2) args.size.upto(1) do |i| args[i] = @@cv_rng_uniform3_defaults2[i] end begin return Rbind::cv_rng_uniform3(self,*args) rescue TypeError => e @error = e end end raise ArgumentError, "No overloaded signature fits to: #{args.map(&:class)}" end |