Class: OpenCV::Std::Vector

Inherits:
Object
  • Object
show all
Defined in:
lib/ropencv/ropencv_types.rb,
lib/ropencv/ropencv_ruby.rb

Overview

template std::vector

Defined Under Namespace

Classes: Char, Cv_DMatch, Cv_Detail_CameraParams, Cv_Detail_ImageFeatures, Cv_Detail_MatchesInfo, Cv_KeyPoint, Cv_Mat, Cv_Point, Cv_Point2d, Cv_Point2f, Cv_Point3d, Cv_Point3f, Cv_Range, Cv_Rect, Cv_Scalar, Cv_Size, Cv_UMat, Cv_Vec4f, Cv_Vec4i, Cv_Vec6f, Double, Float, Int, Int64_T, Int8_T, Std_String, Std_Vector_Char, Std_Vector_Cv_DMatch, Std_Vector_Cv_KeyPoint, Std_Vector_Cv_Point, Std_Vector_Cv_Point2d, Std_Vector_Cv_Point2f, Uchar, Uint32_T, Uint64_T

Constant Summary collapse

Fixnum =
Int

Specializing collapse

Class Method Details

.new(type, *args) ⇒ Object

Raises:

  • (ArgumentError)


78366
78367
78368
78369
78370
78371
78372
78373
78374
78375
78376
78377
78378
78379
78380
78381
78382
78383
78384
# File 'lib/ropencv/ropencv_types.rb', line 78366

def self.new(type,*args)
klass,elements = if type.class == Class
                    [type.name,[]]
                else
                    e = Array(type) + args.flatten
                    args = []
                    [type.class.name,e]
                end
#remove module name
klass = klass.split("::")
klass.shift if klass.size > 1
klass = klass.join("_")
raise ArgumentError,"no std::vector defined for #{type}" unless self.const_defined?(klass)
v = self.const_get(klass).new(*args)
elements.each do |e|
    v << e
end
v
end