Class: OpenCV::CvContourTree

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

Overview

Contour tree

Instance Method Summary collapse

Methods inherited from CvSeq

#[], #clear, #each, #each_index, #empty?, #first, #h_next, #h_prev, #initialize, #insert, #last, #pop, #push, #remove, #shift, #total, #unshift, #v_next, #v_prev

Constructor Details

This class inherits a constructor from OpenCV::CvSeq

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);
}

#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);
}