Class: OpenCV::Cv::KeyPoint

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

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



8545
8546
8547
8548
8549
8550
8551
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8545

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



8542
8543
8544
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8542

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



8537
8538
8539
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8537

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8481

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

    # wrapper for cv::KeyPoint::KeyPoint(float x, float y, float _size, float _angle=-1, float _response=0, int _octave=0, int _class_id=-1)
    @@cv_key_point_key_point2_defaults1 ||= [nil, nil, nil, -1, 0, 0, -1]
    if(args.size >= 3 && args.size <= 7)
        args.size.upto(6) do |i|
            args[i] = @@cv_key_point_key_point2_defaults1[i]
        end
        begin
            return Rbind::cv_key_point_key_point2(*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.



8525
8526
8527
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8525

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



8516
8517
8518
8519
8520
8521
8522
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8516

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



8531
8532
8533
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8531

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)


8556
8557
8558
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8556

def __owner__?
    @__obj_ptr__[:bowner]
end

#angleObject

wrapper for float angle



8593
8594
8595
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8593

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

#angle=(value) ⇒ Object

wrapper for float angle



8598
8599
8600
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8598

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

#class_idObject

wrapper for int class_id



8623
8624
8625
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8623

def class_id()
    Rbind::cv_key_point_get_class_id( self)
end

#class_id=(value) ⇒ Object

wrapper for int class_id



8628
8629
8630
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8628

def class_id=(value)
    Rbind::cv_key_point_set_class_id( self, value)
end

#octaveObject

wrapper for int octave



8613
8614
8615
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8613

def octave()
    Rbind::cv_key_point_get_octave( self)
end

#octave=(value) ⇒ Object

wrapper for int octave



8618
8619
8620
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8618

def octave=(value)
    Rbind::cv_key_point_set_octave( self, value)
end

#ptObject

methods wrapper for cv::Point2f pt



8570
8571
8572
8573
8574
8575
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8570

def pt()
    result = Rbind::cv_key_point_get_pt( 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

#pt=(value) ⇒ Object

wrapper for cv::Point2f pt



8578
8579
8580
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8578

def pt=(value)
    Rbind::cv_key_point_set_pt( self, value)
end

#responseObject

wrapper for float response



8603
8604
8605
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8603

def response()
    Rbind::cv_key_point_get_response( self)
end

#response=(value) ⇒ Object

wrapper for float response



8608
8609
8610
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8608

def response=(value)
    Rbind::cv_key_point_set_response( self, value)
end

#sizeObject

wrapper for float size



8583
8584
8585
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8583

def size()
    Rbind::cv_key_point_get_size( self)
end

#size=(value) ⇒ Object

wrapper for float size



8588
8589
8590
# File 'lib/ruby/ropencv/ropencv_types.rb', line 8588

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