Class: OpenCV::CvHuMoments

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

Overview

Hu invariants

Instance Method Summary collapse

Constructor Details

#new(src_moments) ⇒ CvHuMoments

Calculates the seven Hu invariants

Parameters:

  • src_moments (CvMoment)

    Input moments

See Also:


43
44
45
46
47
48
49
50
51
52
53
# File 'ext/opencv/cvhumoments.cpp', line 43

VALUE
rb_initialize(VALUE self, VALUE src_moments)
{
  try {
    cvGetHuMoments(CVMOMENTS(src_moments), CVHUMOMENTS(self));
  }
  catch (cv::Exception& e) {
    raise_cverror(e);
  }
  return self;      
}

Instance Method Details

#hu1Number

Returns hu1 invariant

Returns:

  • (Number)

    hu1 invariant


60
61
62
# File 'ext/opencv/cvhumoments.cpp', line 60

VALUE rb_hu1(VALUE self) {
  return DBL2NUM(CVHUMOMENTS(self)->hu1);
}

#hu2Number

Returns hu2 invariant

Returns:

  • (Number)

    hu2 invariant


69
70
71
# File 'ext/opencv/cvhumoments.cpp', line 69

VALUE rb_hu2(VALUE self) {
  return DBL2NUM(CVHUMOMENTS(self)->hu2);
}

#hu3Number

Returns hu3 invariant

Returns:

  • (Number)

    hu3 invariant


78
79
80
# File 'ext/opencv/cvhumoments.cpp', line 78

VALUE rb_hu3(VALUE self) {
  return DBL2NUM(CVHUMOMENTS(self)->hu3);
}

#hu4Number

Returns hu4 invariant

Returns:

  • (Number)

    hu4 invariant


87
88
89
# File 'ext/opencv/cvhumoments.cpp', line 87

VALUE rb_hu4(VALUE self) {
  return DBL2NUM(CVHUMOMENTS(self)->hu4);
}

#hu5Number

Returns hu5 invariant

Returns:

  • (Number)

    hu5 invariant


96
97
98
# File 'ext/opencv/cvhumoments.cpp', line 96

VALUE rb_hu5(VALUE self) {
  return DBL2NUM(CVHUMOMENTS(self)->hu5);
}

#hu6Number

Returns hu6 invariant

Returns:

  • (Number)

    hu6 invariant


105
106
107
# File 'ext/opencv/cvhumoments.cpp', line 105

VALUE rb_hu6(VALUE self) {
  return DBL2NUM(CVHUMOMENTS(self)->hu6);
}

#hu7Number

Returns hu7 invariant

Returns:

  • (Number)

    hu7 invariant


114
115
116
# File 'ext/opencv/cvhumoments.cpp', line 114

VALUE rb_hu7(VALUE self) {
  return DBL2NUM(CVHUMOMENTS(self)->hu7);
}

#to_aryArray<Number> Also known as: to_a

Returns hu invaliants as an Array

Returns:

  • (Array<Number>)

    Hu invaliants


123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'ext/opencv/cvhumoments.cpp', line 123

VALUE
rb_to_ary(VALUE self)
{
  CvHuMoments *hu_moments = CVHUMOMENTS(self);
  return rb_ary_new3(7,
		     rb_float_new(hu_moments->hu1),
		     rb_float_new(hu_moments->hu2),
		     rb_float_new(hu_moments->hu3),
		     rb_float_new(hu_moments->hu4),
		     rb_float_new(hu_moments->hu5),
		     rb_float_new(hu_moments->hu6),
		     rb_float_new(hu_moments->hu7));
}