Options
All
  • Public
  • Public/Protected
  • All
Menu

Each rectangle is specified by the center point (mass center), length of each side (represented by Size2f structure) and the rotation angle in degrees.

The sample below demonstrates how to use RotatedRect:

    Mat test_image(200, 200, CV_8UC3, Scalar(0));
    RotatedRect rRect = RotatedRect(Point2f(100,100), Size2f(100,50), 30);

    Point2f vertices[4];
    rRect.points(vertices);
    for (int i = 0; i < 4; i++)
        line(test_image, vertices[i], vertices[(i+1)%4], Scalar(0,255,0), 2);

    Rect brect = rRect.boundingRect();
    rectangle(test_image, brect, Scalar(255,0,0), 2);

    imshow("rectangles", test_image);
    waitKey(0);

CamShift, fitEllipse, minAreaRect, CvBox2D

Source: opencv2/core/types.hpp.

Hierarchy

  • RotatedRect

Index

Constructors

Properties

Methods

Constructors

constructor

  • full constructor Any 3 end points of the [RotatedRect]. They must be given in order (either clockwise or anticlockwise).

    Returns RotatedRect

  • full constructor

    Parameters

    • center: Point2f

      The rectangle mass center.

    • size: Size2f

      Width and height of the rectangle.

    • angle: float

      The rotation angle in a clockwise direction. When the angle is 0, 90, 180, 270 etc., the rectangle becomes an up-right rectangle.

    Returns RotatedRect

  • Any 3 end points of the [RotatedRect]. They must be given in order (either clockwise or anticlockwise).

    Parameters

    • point1: Point2f
    • point2: Point2f
    • point3: Point2f

    Returns RotatedRect

Properties

angle

angle: float

center

center: Point2f

size

size: Size2f

Methods

boundingRect

  • boundingRect(): Rect

boundingRect2f

  • boundingRect2f(): Rect_

points

  • points(pts: Point2f): Point2f
  • returns 4 vertices of the rectangle

    Parameters

    • pts: Point2f

      The points array for storing rectangle vertices. The order is bottomLeft, topLeft, topRight, bottomRight.

    Returns Point2f

Generated using TypeDoc