posted by 심재형 2017. 11. 15. 13:42

minAreaRect

Finds a rotated rectangle of the minimum area enclosing the input 2D point set.

C++: RotatedRect minAreaRect(InputArray points)
Python: cv2.minAreaRect(points) → retval
C: CvBox2D cvMinAreaRect2(const CvArr* points, CvMemStorage* storage=NULL )
Python: cv.MinAreaRect2(points, storage=None) → Box2D
Parameters:points –

Input vector of 2D points, stored in:

  • std::vector<> or Mat (C++ interface)
  • CvSeq* or CvMat* (C interface)
  • Nx2 numpy array (Python interface)

The function calculates and returns the minimum-area bounding rectangle (possibly rotated) for a specified point set. See the OpenCV sample minarea.cpp . Developer should keep in mind that the returned rotatedRect can contain negative indices when data is close the the containing Mat element boundary.