def get_corners(contour):
"""
Given a contour that should have a rectangular convex hull, produce a sorted list of corners for the bounding rectangle
:param contour:
:return:
"""
hull = cv2.convexHull(contour)
hull_poly = cv2.approxPolyDP(hull, 0.05 * cv2.arcLength(hull, True), True)
return sort_corners(hull_poly)
评论列表
文章目录