Class: OpenCV::Cv::StereoBM

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

Constants collapse

PREFILTER_NORMALIZED_RESPONSE =
0
PREFILTER_XSOBEL =
1
BASIC_PRESET =
0
FISH_EYE_PRESET =
1
NARROW_PRESET =
2

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr) ⇒ StereoBM

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



12976
12977
12978
12979
12980
12981
12982
# File 'lib/ruby/ropencv/ropencv_types.rb', line 12976

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



12973
12974
12975
# File 'lib/ruby/ropencv/ropencv_types.rb', line 12973

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



12968
12969
12970
# File 'lib/ruby/ropencv/ropencv_types.rb', line 12968

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
# File 'lib/ruby/ropencv/ropencv_types.rb', line 12912

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

    # wrapper for cv::StereoBM::StereoBM(int preset, int ndisparities=0, int SADWindowSize=21)
    @@cv_stereobm_stereobm2_defaults1 ||= [nil, 0, 21]
    if(args.size >= 1 && args.size <= 3)
        args.size.upto(2) do |i|
            args[i] = @@cv_stereobm_stereobm2_defaults1[i]
        end
        begin
            return Rbind::cv_stereobm_stereobm2(*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.



12956
12957
12958
# File 'lib/ruby/ropencv/ropencv_types.rb', line 12956

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



12947
12948
12949
12950
12951
12952
12953
# File 'lib/ruby/ropencv/ropencv_types.rb', line 12947

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



12962
12963
12964
# File 'lib/ruby/ropencv/ropencv_types.rb', line 12962

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)


12987
12988
12989
# File 'lib/ruby/ropencv/ropencv_types.rb', line 12987

def __owner__?
    @__obj_ptr__[:bowner]
end

#compute(left, right, disparity, disptype = CV_16S) ⇒ Object

methods wrapper for void cv::StereoBM::operator()(const cv::Mat left, const cv::Mat right, cv::Mat disparity, int disptype=CV_16S)



13006
13007
13008
# File 'lib/ruby/ropencv/ropencv_types.rb', line 13006

def compute(left, right, disparity, disptype = CV_16S)
    Rbind::cv_stereobm_compute( self, left, right, disparity, disptype)
end