Class: OpenCV::CvConnectedComp

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

Overview

Connected component see CvMat#flood_fill

Instance Method Summary collapse

Constructor Details

#new(area = nil, value = nil, rect = nil, contour = nil) ⇒ CvConnectedComp

Constructor

Parameters:

  • area (Number) (defaults to: nil)

    Area of the segmented component

  • value (CvScalar) (defaults to: nil)

    Average color of the connected component

  • rect (CvRect) (defaults to: nil)

    ROI of the segmented component

  • contour (CvSeq) (defaults to: nil)

    Optional component boundary



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'ext/opencv/cvconnectedcomp.cpp', line 44

VALUE
rb_initialize(int argc, VALUE *argv, VALUE self)
{
  VALUE area, value, rect, contour;
  rb_scan_args(argc, argv, "04", &area, &value, &rect, &contour);

  if (!NIL_P(area))
    CVCONNECTEDCOMP(self)->area = NUM2DBL(area);
  if (!NIL_P(value))
    CVCONNECTEDCOMP(self)->value = *CVSCALAR(value);
  if (!NIL_P(rect))
    CVCONNECTEDCOMP(self)->rect = *CVRECT(rect);
  if (!NIL_P(contour))
    CVCONNECTEDCOMP(self)->contour = CVSEQ(contour);
  return self;
}

Instance Method Details

#areaNumber

Returns area of connected component

Returns:

  • (Number)

    Area of the connected component



66
67
68
69
70
# File 'ext/opencv/cvconnectedcomp.cpp', line 66

VALUE
rb_area(VALUE self)
{
  return rb_float_new(CVCONNECTEDCOMP(self)->area);
}

#contourCvContour

Returns optional component boundary

Returns:

  • (CvContour)

    Optional component boundary



112
113
114
115
116
# File 'ext/opencv/cvconnectedcomp.cpp', line 112

VALUE
rb_contour(VALUE self)
{
  return REFER_OBJECT(cCvContour::rb_class(), &CVCONNECTEDCOMP(self)->contour, self);
}

#rectCvRect

Return ROI of the segmented component

Returns:

  • (CvRect)

    ROI of the segmented component



88
89
90
91
92
# File 'ext/opencv/cvconnectedcomp.cpp', line 88

VALUE
rb_rect(VALUE self)
{
  return REFER_OBJECT(cCvRect::rb_class(), &CVCONNECTEDCOMP(self)->rect, self);
}

#rect=CvRect

Set ROI of the segmented component

Parameters:

  • value (CvRect)

    ROI to set

Returns:

  • (CvRect)

    ROI of the segmented component



100
101
102
103
104
105
# File 'ext/opencv/cvconnectedcomp.cpp', line 100

VALUE
rb_set_rect(VALUE self, VALUE rect)
{
  CVCONNECTEDCOMP(self)->rect = VALUE_TO_CVRECT(rect);
  return self;
}

#valueCvScalar

Return average color of the connected component.

Returns:

  • (CvScalar)

    Average color of the connected component



77
78
79
80
81
# File 'ext/opencv/cvconnectedcomp.cpp', line 77

VALUE
rb_value(VALUE self)
{
  return REFER_OBJECT(cCvScalar::rb_class(), &CVCONNECTEDCOMP(self)->value, self);
}