Class: OpenCV::CvCircle32f

Inherits:
Object
  • Object
show all
Defined in:
ext/opencv/cvcircle32f.cpp,
ext/opencv/cvcircle32f.cpp

Overview

Combination of center and radius.

see CvMat#hough_circles

Instance Method Summary collapse

Instance Method Details

#[]Number

Accesses to parameters of the circle by array-like interface ([X-coordinate, Y-coordinate, radius])

Parameters:

  • index (Integer)

    Index

Returns:

  • (Number)

    X-coordinate, Y-coordinate or radius of the circle



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'ext/opencv/cvcircle32f.cpp', line 64

VALUE
rb_aref(VALUE self, VALUE index)
{
  switch (NUM2INT(index)) {
  case 0:
    return DBL2NUM(CVCIRCLE32F(self)->center.x);
    break;
  case 1:
    return DBL2NUM(CVCIRCLE32F(self)->center.y);
    break;
  case 2:
    return DBL2NUM(CVCIRCLE32F(self)->radius);
    break;
  default:
    rb_raise(rb_eIndexError, "index should be 0...3");
    break;
  }
  return Qnil;
}

#centerCvPoint2D32f

Returns center point of the circle

Returns:



41
42
43
44
45
# File 'ext/opencv/cvcircle32f.cpp', line 41

VALUE
rb_center(VALUE self)
{
  return cCvPoint2D32f::new_object(CVCIRCLE32F(self)->center);
}

#radiusNumber

Returns radius of the circle

Returns:

  • (Number)

    Radius of the circle



52
53
54
55
56
# File 'ext/opencv/cvcircle32f.cpp', line 52

VALUE
rb_radius(VALUE self)
{
  return rb_float_new(CVCIRCLE32F(self)->radius);
}

#to_aryArray<CvPoint2D32f,Number> Also known as: to_a

Returns parameters of the circle as an array which contains [center<CvPoint2D32f>, radius<Number>]

Returns:

  • (Array<CvPoint2D32f,Number>)

    An array which contains [center, radius]



89
90
91
92
93
# File 'ext/opencv/cvcircle32f.cpp', line 89

VALUE
rb_to_ary(VALUE self)
{
  return rb_ary_new3(2, rb_center(self), rb_radius(self));
}