Class: OpenCV::Cv::RNG

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

Constants collapse

UNIFORM =
0
NORMAL =
1

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.rngObject .rng(state) ⇒ Object

Overloads:

  • .rng(state) ⇒ Object

    Parameters:

    • state (Fixnum)

Raises:

  • (ArgumentError)


13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
# File 'lib/ropencv/ropencv_types.rb', line 13693

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
    # overloaded method wrapper for cv::RNG::RNG()
    @@cv_rng_rng_defaults0 ||= []
    if(args.size >= 0 && args.size <= 0)
        targs = args.clone
        targs.size.upto(-1) do |i|
            targs[i] = @@cv_rng_rng_defaults0[i]
        end
        begin
                return Rbind::cv_rng_rng(*targs)
        rescue TypeError => e
            @error = e
        end
    end

    # overloaded method wrapper for cv::RNG::RNG(uint64 state)
    @@cv_rng_rng2_defaults1 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        targs = args.clone
        targs.size.upto(0) do |i|
            targs[i] = @@cv_rng_rng2_defaults1[i]
        end
        begin
                return Rbind::cv_rng_rng2(*targs)
        rescue TypeError => e
            @error = e
        end
    end

    raise ArgumentError, "no constructor for #{self}(#{args.inspect})"
end

.nullObject

returns a null pointer to the object



13685
13686
13687
# File 'lib/ropencv/ropencv_types.rb', line 13685

def self.null
    new(RNGStruct.new)
end

Instance Method Details

#fill(mat, dist_type, a, b, saturate_range = false) ⇒ Void

Note:

method wrapper for void cv::RNG::fill(cv::Mat& mat, int distType, const cv::Mat a, const cv::Mat b, bool saturateRange = false)

Parameters:

Returns:

  • (Void)


13881
13882
13883
13884
# File 'lib/ropencv/ropencv_types.rb', line 13881

def fill(mat, dist_type, a, b, saturate_range = false)
    __validate_pointer__
    Rbind::cv_rng_fill( self, mat, dist_type, a, b, saturate_range)
end

#gaussian(sigma) ⇒ Double

Note:

method wrapper for double cv::RNG::gaussian(double sigma)

Parameters:

  • sigma (Double)

Returns:

  • (Double)


13889
13890
13891
13892
# File 'lib/ropencv/ropencv_types.rb', line 13889

def gaussian(sigma)
    __validate_pointer__
    Rbind::cv_rng_gaussian( self, sigma)
end

#stateFixnum Also known as: get_state

Note:

method wrapper for uint64 state

methods

Returns:

  • (Fixnum)


13806
13807
13808
13809
# File 'lib/ropencv/ropencv_types.rb', line 13806

def state()
    __validate_pointer__
    Rbind::cv_rng_get_state( self)
end

#to_sObject

converts RNG into a string by crawling through all its attributes



13793
13794
13795
# File 'lib/ropencv/ropencv_types.rb', line 13793

def to_s
    "#<cv::RNG state=#{self.state}>"
end

#uniform(a, b) ⇒ Fixnum #uniform(a, b) ⇒ Float #uniform(a, b) ⇒ Double

Note:

wrapper for overloaded method uniform

Overloads:

  • #uniform(a, b) ⇒ Fixnum

    Parameters:

    • a (Fixnum)
    • b (Fixnum)

    Returns:

    • (Fixnum)
  • #uniform(a, b) ⇒ Float

    Parameters:

    • a (Float)
    • b (Float)

    Returns:

    • (Float)
  • #uniform(a, b) ⇒ Double

    Parameters:

    • a (Double)
    • b (Double)

    Returns:

    • (Double)

Raises:

  • (ArgumentError)


13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
# File 'lib/ropencv/ropencv_types.rb', line 13827

def uniform(*args)
    __validate_pointer__
    # overloaded method wrapper for int cv::RNG::uniform(int a, int b)
    @@cv_rng_uniform_defaults0 ||= [nil, nil]
    if(args.size >= 2 && args.size <= 2)
        targs = args.clone
        targs.size.upto(1) do |i|
            targs[i] = @@cv_rng_uniform_defaults0[i]
        end
        begin
                return Rbind::cv_rng_uniform(self,*targs)
        rescue TypeError => e
            @error = e
        end
    end

    # overloaded method wrapper for float cv::RNG::uniform(float a, float b)
    @@cv_rng_uniform2_defaults1 ||= [nil, nil]
    if(args.size >= 2 && args.size <= 2)
        targs = args.clone
        targs.size.upto(1) do |i|
            targs[i] = @@cv_rng_uniform2_defaults1[i]
        end
        begin
                return Rbind::cv_rng_uniform2(self,*targs)
        rescue TypeError => e
            @error = e
        end
    end

    # overloaded method wrapper for double cv::RNG::uniform(double a, double b)
    @@cv_rng_uniform3_defaults2 ||= [nil, nil]
    if(args.size >= 2 && args.size <= 2)
        targs = args.clone
        targs.size.upto(1) do |i|
            targs[i] = @@cv_rng_uniform3_defaults2[i]
        end
        begin
                return Rbind::cv_rng_uniform3(self,*targs)
        rescue TypeError => e
            @error = e
        end
    end

    raise ArgumentError, "No overloaded signature fits to: #{args.map(&:class)}"
end