Class: OpenCV::CvSURFParams

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

Overview

C structure is here.

typedef struct CvSURFParams {
  int extended;
  double hessianThreshold;
  int nOctaves;
  int nOctaveLayers;
} CvSURFParams;

Instance Method Summary collapse

Constructor Details

#CvSURFParams.new(hessian_threshold, extended = false, n_octaves = 3, n_octave_layers = 4) ⇒ Object

Create a CvSURFParams

Parameters:

  • hessian_threshold (Number)
  • extended (Boolean) (defaults to: false)

    If true, exteneded descriptors (128 elements each), otherwise basic descriptors (64 elements each)

  • n_octaves (Integer) (defaults to: 3)

    Number of octaves to be used for extraction

  • n_octave_layers (Integer) (defaults to: 4)

    Number of layers within each octave



50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'ext/opencv/cvsurfparams.cpp', line 50

VALUE
rb_initialize(int argc, VALUE *argv, VALUE self)
{
  CvSURFParams *self_ptr = CVSURFPARAMS(self);
  VALUE h_thresh, ext, noct, noctl;
  rb_scan_args(argc, argv, "13", &h_thresh, &ext, &noct, &noctl);

  self_ptr->hessianThreshold = NUM2DBL(h_thresh);
  self_ptr->extended = NIL_P(ext) ? 0 : BOOL2INT(ext);
  self_ptr->nOctaves = NIL_P(noct) ? 3 : NUM2INT(noct);
  self_ptr->nOctaveLayers = NIL_P(noctl) ? 4 : NUM2INT(noctl);
    
  return self;
}

Instance Method Details

#contour(criteria = 0) ⇒ CvContour

Restores the contour from its binary tree representation.

The parameter criteria determines the accuracy and/or the number of tree levels used for reconstruction, so it is possible to build approximated contour.

Parameters:

  • criteria (Integer) (defaults to: 0)

    Criteria, where to stop reconstruction

Returns:



61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'ext/opencv/cvcontourtree.cpp', line 61

VALUE
rb_contour(VALUE self, VALUE criteria)
{
  VALUE storage = cCvMemStorage::new_object();
  CvSeq *contour = NULL;
  try {
    contour = cvContourFromContourTree(CVCONTOURTREE(self), CVMEMSTORAGE(storage),
				       VALUE_TO_CVTERMCRITERIA(criteria));
  }
  catch (cv::Exception& e) {
    raise_cverror(e);
  }
  return cCvSeq::new_sequence(cCvContour::rb_class(), contour, cCvPoint::rb_class(), storage);
}

#extendedBoolean

Return the type of descripters

false: basic descriptors (64 elements each)
true : exteneded descriptors (128 elements each)

Returns:

  • (Boolean)


96
97
98
99
100
# File 'ext/opencv/cvsurfparams.cpp', line 96

VALUE
rb_get_extended(VALUE self)
{
  return INT2BOOL(CVSURFPARAMS(self)->extended);
}

#extended=(value) ⇒ Object

Set the type of descripters

false: basic descriptors (64 elements each)
true : exteneded descriptors (128 elements each)


109
110
111
112
113
114
# File 'ext/opencv/cvsurfparams.cpp', line 109

VALUE
rb_set_extended(VALUE self, VALUE value)
{
  CVSURFPARAMS(self)->extended = BOOL2INT(value);
  return self;
}

#hessian_thresholdNumeric

Return threshold of hessian

Returns:

  • (Numeric)


70
71
72
73
74
# File 'ext/opencv/cvsurfparams.cpp', line 70

VALUE
rb_get_hessian_threshold(VALUE self)
{
  return DBL2NUM(CVSURFPARAMS(self)->hessianThreshold);
}

#hessian_threshold=(value) ⇒ Object

Set threshold of hessian to value



82
83
84
85
86
87
# File 'ext/opencv/cvsurfparams.cpp', line 82

VALUE
rb_set_hessian_threshold(VALUE self, VALUE value)
{
  CVSURFPARAMS(self)->hessianThreshold = NUM2DBL(value);
  return self;
}

#n_octave_layersFixnum

Return the number of layers within each octave

Returns:

  • (Fixnum)


144
145
146
147
148
# File 'ext/opencv/cvsurfparams.cpp', line 144

VALUE
rb_get_n_octave_layers(VALUE self)
{
  return INT2NUM(CVSURFPARAMS(self)->nOctaveLayers);
}

#n_octave_layers=(value) ⇒ Object

Set the number of layers within each octave



155
156
157
158
159
160
# File 'ext/opencv/cvsurfparams.cpp', line 155

VALUE
rb_set_n_octave_layers(VALUE self, VALUE value)
{
  CVSURFPARAMS(self)->nOctaveLayers = NUM2INT(value);
  return self;
}

#n_octavesFixnum

Return the number of octaves to be used for extraction

Returns:

  • (Fixnum)


121
122
123
124
125
# File 'ext/opencv/cvsurfparams.cpp', line 121

VALUE
rb_get_n_octaves(VALUE self)
{
  return INT2NUM(CVSURFPARAMS(self)->nOctaves);
}

#n_octaves=(value) ⇒ Object

Set the number of octaves to be used for extraction



132
133
134
135
136
137
# File 'ext/opencv/cvsurfparams.cpp', line 132

VALUE
rb_set_n_octaves(VALUE self, VALUE value)
{
  CVSURFPARAMS(self)->nOctaves = NUM2INT(value);
  return self;
}

#p1CvPoint

Returns the first point of the binary tree root segment

Returns:

  • (CvPoint)

    First point of the binary tree root segment



34
35
36
37
38
# File 'ext/opencv/cvcontourtree.cpp', line 34

VALUE
rb_p1(VALUE self)
{
  return REFER_OBJECT(cCvPoint::rb_class(), &CVCONTOURTREE(self)->p1, self);
}

#p2CvPoint

Returns the last point of the binary tree root segment

Returns:

  • (CvPoint)

    Last point of the binary tree root segment



45
46
47
48
49
# File 'ext/opencv/cvcontourtree.cpp', line 45

VALUE
rb_p2(VALUE self)
{
  return REFER_OBJECT(cCvPoint::rb_class(), &CVCONTOURTREE(self)->p2, self);
}