Algorithm to find the minimum-area-rectangle for given points in order to compute the major and minor axis length

前端 未结 6 1711
心在旅途
心在旅途 2020-12-04 13:21

I have a set of points (black dots in geographic coordinate value) derived from the convex hull (blue) of a polygon (red). see Figure:

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-04 14:23

    OpenCV has this. See this:

    http://docs.opencv.org/trunk/dd/d49/tutorial_py_contour_features.html

    7.b. Rotated Rectangle

    With

    cv2.minAreaRect(cnt)
    

    You can get the length and width of the rectangle as well as its angle. You can also compute the corners if you wish to draw it.

提交回复
热议问题