def boundingRects(scale, contours):
for contour in contours:
epsilon = 0.1 * cv2.arcLength(contour, True)
approx = cv2.approxPolyDP(contour, epsilon, True)
x, y, w, h = cv2.boundingRect(approx)
yield [x * scale, y * scale, w * scale, h * scale]
评论列表
文章目录