Class: OpenCV::Cv::VideoCapture

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr) ⇒ VideoCapture

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



13597
13598
13599
13600
13601
13602
13603
# File 'lib/ruby/ropencv/ropencv_types.rb', line 13597

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



13594
13595
13596
# File 'lib/ruby/ropencv/ropencv_types.rb', line 13594

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



13589
13590
13591
# File 'lib/ruby/ropencv/ropencv_types.rb', line 13589

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
# File 'lib/ruby/ropencv/ropencv_types.rb', line 13520

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

    # wrapper for cv::VideoCapture::VideoCapture(const cv::String filename)
    @@cv_video_capture_video_capture2_defaults1 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        args.size.upto(0) do |i|
            args[i] = @@cv_video_capture_video_capture2_defaults1[i]
        end
        begin
            return Rbind::cv_video_capture_video_capture2(*args)
        rescue TypeError => e
            @error = e
        end
    end

    # wrapper for cv::VideoCapture::VideoCapture(int device)
    @@cv_video_capture_video_capture3_defaults2 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        args.size.upto(0) do |i|
            args[i] = @@cv_video_capture_video_capture3_defaults2[i]
        end
        begin
            return Rbind::cv_video_capture_video_capture3(*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.



13577
13578
13579
# File 'lib/ruby/ropencv/ropencv_types.rb', line 13577

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



13568
13569
13570
13571
13572
13573
13574
# File 'lib/ruby/ropencv/ropencv_types.rb', line 13568

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



13583
13584
13585
# File 'lib/ruby/ropencv/ropencv_types.rb', line 13583

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)


13608
13609
13610
# File 'lib/ruby/ropencv/ropencv_types.rb', line 13608

def __owner__?
    @__obj_ptr__[:bowner]
end

#get(prop_id) ⇒ Object

wrapper for double cv::VideoCapture::get(int propId)



13683
13684
13685
# File 'lib/ruby/ropencv/ropencv_types.rb', line 13683

def get(prop_id)
    Rbind::cv_video_capture_get( self, prop_id)
end

#grabObject

wrapper for bool cv::VideoCapture::grab()



13663
13664
13665
# File 'lib/ruby/ropencv/ropencv_types.rb', line 13663

def grab()
    Rbind::cv_video_capture_grab( self)
end

#is_openedObject

wrapper for bool cv::VideoCapture::isOpened()



13653
13654
13655
# File 'lib/ruby/ropencv/ropencv_types.rb', line 13653

def is_opened()
    Rbind::cv_video_capture_is_opened( self)
end

#open(*args) ⇒ Object

methods wrapper for overloaded method open

Raises:

  • (ArgumentError)


13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
# File 'lib/ruby/ropencv/ropencv_types.rb', line 13622

def open(*args)
    # wrapper for bool cv::VideoCapture::open(const cv::String filename)
    @@cv_video_capture_open_defaults0 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        args.size.upto(0) do |i|
            args[i] = @@cv_video_capture_open_defaults0[i]
        end
        begin
            return Rbind::cv_video_capture_open(self,*args)
        rescue TypeError => e
            @error = e
        end
    end

    # wrapper for bool cv::VideoCapture::open(int device)
    @@cv_video_capture_open2_defaults1 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        args.size.upto(0) do |i|
            args[i] = @@cv_video_capture_open2_defaults1[i]
        end
        begin
            return Rbind::cv_video_capture_open2(self,*args)
        rescue TypeError => e
            @error = e
        end
    end

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

#read(image) ⇒ Object

wrapper for bool cv::VideoCapture::read(cv::Mat image)



13673
13674
13675
# File 'lib/ruby/ropencv/ropencv_types.rb', line 13673

def read(image)
    Rbind::cv_video_capture_read( self, image)
end

#releaseObject

wrapper for void cv::VideoCapture::release()



13658
13659
13660
# File 'lib/ruby/ropencv/ropencv_types.rb', line 13658

def release()
    Rbind::cv_video_capture_release( self)
end

#retrieve(image, channel = 0) ⇒ Object

wrapper for bool cv::VideoCapture::retrieve(cv::Mat image, int channel=0)



13668
13669
13670
# File 'lib/ruby/ropencv/ropencv_types.rb', line 13668

def retrieve(image, channel = 0)
    Rbind::cv_video_capture_retrieve( self, image, channel)
end

#set(prop_id, value) ⇒ Object

wrapper for bool cv::VideoCapture::set(int propId, double value)



13678
13679
13680
# File 'lib/ruby/ropencv/ropencv_types.rb', line 13678

def set(prop_id, value)
    Rbind::cv_video_capture_set( self, prop_id, value)
end