Class: Vector

Inherits:
Object
  • Object
show all
Defined in:
lib/opencv-ffi-wrappers/core/mat.rb,
lib/opencv-ffi-wrappers/matrix.rb

Overview

Monkey with Matrix and Vector’s coercion functions

Instance Method Summary collapse

Instance Method Details

#coerce(other) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/opencv-ffi-wrappers/core/mat.rb', line 11

def coerce(other)
  case other
  when CvMat
    nil
  else
    coerce_orig(other)
  end
end

#coerce_origObject



10
# File 'lib/opencv-ffi-wrappers/core/mat.rb', line 10

alias :coerce_orig :coerce

#to_CvMat(opts = {}) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/opencv-ffi-wrappers/matrix.rb', line 26

def to_CvMat( opts = {} )
  type = opts[:type] || :CV_32F
  a = CVFFI::cvCreateMat( size, 1,  type )
  size.times { |i|
    CVFFI::cvSetReal1D( a, i, element(i))
  }
  a
end

#to_VectorObject



22
23
24
# File 'lib/opencv-ffi-wrappers/matrix.rb', line 22

def to_Vector
  self
end