Class: OpenCV::VectorMat
- Inherits:
-
Object
- Object
- OpenCV::VectorMat
- Extended by:
- FFI::DataConverter
- Includes:
- Enumerable
- Defined in:
- lib/ruby/ropencv/ropencv_types.rb
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
- #<<(val) ⇒ Object
-
#[](size) ⇒ Object
wrapper for cv::Mat vector_Mat::operator[](size_t size).
-
#__owner__? ⇒ Boolean
private
returns true if the underlying pointer is owner of the real object.
-
#at(size) ⇒ Object
wrapper for cv::Mat vector_Mat::at(size_t size).
-
#back ⇒ Object
wrapper for cv::Mat vector_Mat::back().
-
#capacity ⇒ Object
wrapper for size_t vector_Mat::capacity().
-
#data ⇒ Object
wrapper for void * vector_Mat::data().
- #each(&block) ⇒ Object
-
#empty ⇒ Object
wrapper for bool vector_Mat::empty().
-
#front ⇒ Object
wrapper for cv::Mat vector_Mat::front().
-
#initialize(ptr) ⇒ VectorMat
constructor
private
A new instance of VectorMat.
-
#pop_back ⇒ Object
wrapper for void vector_Mat::pop_back().
-
#push_back(other) ⇒ Object
wrapper for void vector_Mat::push_back(const cv::Mat other).
-
#reserve(size) ⇒ Object
wrapper for void vector_Mat::reserve(size_t size).
-
#resize(size, val = cv::Mat) ⇒ Object
methods wrapper for void vector_Mat::resize(size_t size, const cv::Mat val=cv::Mat).
-
#size ⇒ Object
wrapper for size_t vector_Mat::size().
-
#swap(other) ⇒ Object
wrapper for void vector_Mat::swap(vector_Mat other).
Constructor Details
#initialize(ptr) ⇒ VectorMat
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 VectorMat.
15464 15465 15466 15467 15468 15469 15470 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15464 def initialize(ptr) @__obj_ptr__ = if ptr.is_a? VectorMatStruct ptr else VectorMatStruct.new(FFI::AutoPointer.new(ptr,VectorMatStruct.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.
15461 15462 15463 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15461 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
15456 15457 15458 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15456 def self.from_native(ptr,context) rbind_from_native(ptr,context) end |
.new(*args) ⇒ Object
15400 15401 15402 15403 15404 15405 15406 15407 15408 15409 15410 15411 15412 15413 15414 15415 15416 15417 15418 15419 15420 15421 15422 15423 15424 15425 15426 15427 15428 15429 15430 15431 15432 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15400 def self.new(*args) if args.first.is_a?(FFI::Pointer) || args.first.is_a?(VectorMatStruct) raise ArgumentError, "too many arguments for creating #{self.name} from Pointer" unless args.size == 1 return super(args.first) end # wrapper for vector_Mat::vector_Mat() @@vector_mat_vector_mat_defaults0 ||= [] if(args.size >= 0 && args.size <= 0) args.size.upto(-1) do |i| args[i] = @@vector_mat_vector_mat_defaults0[i] end begin return Rbind::vector_mat_vector_mat(*args) rescue TypeError => e @error = e end end # wrapper for vector_Mat::vector_Mat(const vector_Mat other) @@vector_mat_vector_mat2_defaults1 ||= [nil] if(args.size >= 1 && args.size <= 1) args.size.upto(0) do |i| args[i] = @@vector_mat_vector_mat2_defaults1[i] end begin return Rbind::vector_mat_vector_mat2(*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.
15444 15445 15446 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15444 def self.rbind_from_native(ptr,context) VectorMat.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.
15435 15436 15437 15438 15439 15440 15441 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15435 def self.rbind_to_native(obj,context) if obj.is_a? VectorMat 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
15450 15451 15452 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15450 def self.to_native(obj,context) rbind_to_native(obj,context) end |
Instance Method Details
#<<(val) ⇒ Object
15491 15492 15493 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15491 def <<(val) push_back(val) end |
#[](size) ⇒ Object
wrapper for cv::Mat vector_Mat::operator[](size_t size)
15536 15537 15538 15539 15540 15541 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15536 def [](size) result = Rbind::vector_mat_operator_array( self, size) # store owner insight the pointer to not get garbage collected result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) if !result.__owner__? result end |
#__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
15475 15476 15477 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15475 def __owner__? @__obj_ptr__[:bowner] end |
#at(size) ⇒ Object
wrapper for cv::Mat vector_Mat::at(size_t size)
15544 15545 15546 15547 15548 15549 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15544 def at(size) result = Rbind::vector_mat_at( self, size) # store owner insight the pointer to not get garbage collected result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) if !result.__owner__? result end |
#back ⇒ Object
wrapper for cv::Mat vector_Mat::back()
15560 15561 15562 15563 15564 15565 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15560 def back() result = Rbind::vector_mat_back( self) # store owner insight the pointer to not get garbage collected result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) if !result.__owner__? result end |
#capacity ⇒ Object
wrapper for size_t vector_Mat::capacity()
15521 15522 15523 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15521 def capacity() Rbind::vector_mat_capacity( self) end |
#data ⇒ Object
wrapper for void * vector_Mat::data()
15568 15569 15570 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15568 def data() Rbind::vector_mat_data( self) end |
#each(&block) ⇒ Object
15481 15482 15483 15484 15485 15486 15487 15488 15489 15490 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15481 def each(&block) if block s = size 0.upto(s-1) do |i| yield self[i] end else Enumerator.new(self) end end |
#empty ⇒ Object
wrapper for bool vector_Mat::empty()
15526 15527 15528 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15526 def empty() Rbind::vector_mat_empty( self) end |
#front ⇒ Object
wrapper for cv::Mat vector_Mat::front()
15552 15553 15554 15555 15556 15557 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15552 def front() result = Rbind::vector_mat_front( self) # store owner insight the pointer to not get garbage collected result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) if !result.__owner__? result end |
#pop_back ⇒ Object
wrapper for void vector_Mat::pop_back()
15578 15579 15580 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15578 def pop_back() Rbind::vector_mat_pop_back( self) end |
#push_back(other) ⇒ Object
wrapper for void vector_Mat::push_back(const cv::Mat other)
15573 15574 15575 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15573 def push_back(other) Rbind::vector_mat_push_back( self, other) end |
#reserve(size) ⇒ Object
wrapper for void vector_Mat::reserve(size_t size)
15531 15532 15533 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15531 def reserve(size) Rbind::vector_mat_reserve( self, size) end |
#resize(size, val = cv::Mat) ⇒ Object
methods wrapper for void vector_Mat::resize(size_t size, const cv::Mat val=cv::Mat)
15511 15512 15513 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15511 def resize(size, val = cv::Mat) Rbind::vector_mat_resize( self, size, val) end |
#size ⇒ Object
wrapper for size_t vector_Mat::size()
15516 15517 15518 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15516 def size() Rbind::vector_mat_size( self) end |
#swap(other) ⇒ Object
wrapper for void vector_Mat::swap(vector_Mat other)
15583 15584 15585 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15583 def swap(other) Rbind::vector_mat_swap( self, other) end |