OpenCV 形状拟合函数总结


Comments from the Wiki

void cvEllipse(CvArr* imgCvPoint centerCvSize axes, double angle, double start_angle, doubleend_angleCvScalar color, int thickness=1, int lineType=8, int shift=0)

Draws a simple or thick elliptic arc or an fills ellipse sector.

  • img – The image
  • center – Center of the ellipse
  • axes – Length of the ellipse axes
  • angle – Rotation angle
  • start_angle – Starting angle of the elliptic arc
  • end_angle – Ending angle of the elliptic arc.
  • color – Ellipse color
  • thickness – Thickness of the ellipse arc outline if positive, otherwise this indicates that a filled ellipse sector is to be drawn
  • lineType – Type of the ellipse boundary, see Line description
  • shift – Number of fractional bits in the center coordinates and axes’ values

The function draws a simple or thick elliptic arc or fills an ellipse sector. The arc is clipped by the ROI rectangle. A piecewise-linear approximation is used for antialiased arcs and thick arcs. All the angles are given in degrees. The picture below explains the meaning of the parameters.

Parameters of Elliptic Arc



Comments from the Wiki

CvBox2D cvMinAreaRect2(const CvArr* pointsCvMemStorage* storage=NULL)

Finds the circumscribed rectangle of minimal area for a given 2D point set.

  • points – Sequence or array of points
  • storage – Optional temporary memory storage

The function finds a circumscribed rectangle of the minimal area for a 2D point set by building aconvex hull for the set and applying the rotating calipers technique to the hull.

Picture. Minimal-area bounding rectangle for contour