Class: OpenCV::CvLine

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

Overview

Line parameters represented by a two-element (rho, theta) for CvMat#hough_lines

Instance Method Summary collapse

Instance Method Details

#[](index) ⇒ Number

Returns value of rho, theta

Parameters:

  • index (Integer)

    Index

Returns:

  • (Number)

    If index = 0, returns rho, else if index = 1, returns theta.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'ext/opencv/cvline.cpp', line 87

VALUE
rb_aref(VALUE self, VALUE index)
{
  switch (NUM2INT(index)) {
  case 0:
    return DBL2NUM(CVLINE(self)->rho);
    break;
  case 1:
    return DBL2NUM(CVLINE(self)->theta);
    break;
  default:
    rb_raise(rb_eIndexError, "index should be 0...2");
    break;
  }
  return Qnil;
}

#[]=(index, value) ⇒ Number

Set value of rho, theta

Parameters:

  • index (Integer)

    Index

  • value (Number)

    Value

Returns:

  • (Number)

    If index = 0, set rho, else if index = 1, set theta.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'ext/opencv/cvline.cpp', line 111

VALUE
rb_aset(VALUE self, VALUE index, VALUE value)
{
  switch (NUM2INT(index)) {
  case 0:
    CVLINE(self)->rho = NUM2DBL(value);
    break;
  case 1:
    CVLINE(self)->theta = NUM2DBL(value);
    break;
  default:
    rb_raise(rb_eIndexError, "index should be 0...2");
    break;
  }
  return value;
}

#rhoNumber

Returns distance from the coordinate origin (0, 0)

Returns:

  • (Number)

    Distance from the coordinate origin



40
41
42
43
44
# File 'ext/opencv/cvline.cpp', line 40

VALUE
rb_rho(VALUE self)
{
  return rb_float_new(CVLINE(self)->rho);
}

#rho=(value) ⇒ Object

Set distance from the coordinate origin (0, 0)

Parameters:

  • value (Number)

    Distance from the coordinate origin



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

VALUE
rb_set_rho(VALUE self, VALUE rho)
{
  CVLINE(self)->rho = NUM2DBL(rho);
  return self;
}

#thetaNumber

Returns line rotation angle in radians

Returns:

  • (Number)

    Line rotation angle in radians



63
64
65
66
67
# File 'ext/opencv/cvline.cpp', line 63

VALUE
rb_theta(VALUE self)
{
  return rb_float_new(CVLINE(self)->theta);
}

#theta=(value) ⇒ Object

Set line rotation angle in radians

Parameters:

  • value (Number)

    Line rotation angle



74
75
76
77
78
79
# File 'ext/opencv/cvline.cpp', line 74

VALUE
rb_set_theta(VALUE self, VALUE theta)
{
  CVLINE(self)->theta = NUM2DBL(theta);
  return self;
}