Class: OpenCV::Cv::RotatedRect

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) ⇒ RotatedRect

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



4443
4444
4445
4446
4447
4448
4449
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4443

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



4440
4441
4442
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4440

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



4435
4436
4437
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4435

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4379

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

    # wrapper for cv::RotatedRect::RotatedRect(const cv::Point2f center, const cv::Size2f size, float angle)
    @@cv_rotated_rect_rotated_rect2_defaults1 ||= [nil, nil, nil]
    if(args.size >= 3 && args.size <= 3)
        args.size.upto(2) do |i|
            args[i] = @@cv_rotated_rect_rotated_rect2_defaults1[i]
        end
        begin
            return Rbind::cv_rotated_rect_rotated_rect2(*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.



4423
4424
4425
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4423

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



4414
4415
4416
4417
4418
4419
4420
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4414

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



4429
4430
4431
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4429

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)


4454
4455
4456
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4454

def __owner__?
    @__obj_ptr__[:bowner]
end

#angleObject

wrapper for float angle



4494
4495
4496
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4494

def angle()
    Rbind::cv_rotated_rect_get_angle( self)
end

#angle=(value) ⇒ Object

wrapper for float angle



4499
4500
4501
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4499

def angle=(value)
    Rbind::cv_rotated_rect_set_angle( self, value)
end

#bounding_rectObject

wrapper for cv::Rect cv::RotatedRect::boundingRect()



4504
4505
4506
4507
4508
4509
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4504

def bounding_rect()
    result = Rbind::cv_rotated_rect_bounding_rect( 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

#centerObject

methods wrapper for cv::Point2f center



4468
4469
4470
4471
4472
4473
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4468

def center()
    result = Rbind::cv_rotated_rect_get_center( 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

#center=(value) ⇒ Object

wrapper for cv::Point2f center



4476
4477
4478
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4476

def center=(value)
    Rbind::cv_rotated_rect_set_center( self, value)
end

#sizeObject

wrapper for cv::Size2f size



4481
4482
4483
4484
4485
4486
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4481

def size()
    result = Rbind::cv_rotated_rect_get_size( 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

#size=(value) ⇒ Object

wrapper for cv::Size2f size



4489
4490
4491
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4489

def size=(value)
    Rbind::cv_rotated_rect_set_size( self, value)
end