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)


22699
22700
22701
22702
22703
22704
22705
22706
22707
22708
22709
22710
22711
22712
22713
22714
22715
22716
22717
22718
22719
22720
22721
22722
22723
22724
22725
22726
22727
22728
22729
22730
22731
22732
22733
# File 'lib/ropencv/ropencv_types.rb', line 22699

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_rng_2_defaults1 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        targs = args.clone
        targs.size.upto(0) do |i|
            targs[i] = @@cv_rng_rng_2_defaults1[i]
        end
        begin
                return Rbind::cv_rng_rng_2(*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



22691
22692
22693
# File 'lib/ropencv/ropencv_types.rb', line 22691

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)


22887
22888
22889
22890
# File 'lib/ropencv/ropencv_types.rb', line 22887

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)


22895
22896
22897
22898
# File 'lib/ropencv/ropencv_types.rb', line 22895

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)


22812
22813
22814
22815
# File 'lib/ropencv/ropencv_types.rb', line 22812

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

#to_sObject

converts RNG into a string by crawling through all its attributes



22799
22800
22801
# File 'lib/ropencv/ropencv_types.rb', line 22799

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)


22833
22834
22835
22836
22837
22838
22839
22840
22841
22842
22843
22844
22845
22846
22847
22848
22849
22850
22851
22852
22853
22854
22855
22856
22857
22858
22859
22860
22861
22862
22863
22864
22865
22866
22867
22868
22869
22870
22871
22872
22873
22874
22875
22876
22877
22878
# File 'lib/ropencv/ropencv_types.rb', line 22833

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_uniform__2_defaults1 ||= [nil, nil]
    if(args.size >= 2 && args.size <= 2)
        targs = args.clone
        targs.size.upto(1) do |i|
            targs[i] = @@cv_rng_uniform__2_defaults1[i]
        end
        begin
                return Rbind::cv_rng_uniform__2(self,*targs)
        rescue TypeError => e
            @error = e
        end
    end

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

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