本文整理匯總了Python中cv2.CHAIN_APPROX_TC89_L1屬性的典型用法代碼示例。如果您正苦於以下問題:Python cv2.CHAIN_APPROX_TC89_L1屬性的具體用法?Python cv2.CHAIN_APPROX_TC89_L1怎麽用?Python cv2.CHAIN_APPROX_TC89_L1使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類cv2
的用法示例。
在下文中一共展示了cv2.CHAIN_APPROX_TC89_L1屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _findContours
# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import CHAIN_APPROX_TC89_L1 [as 別名]
def _findContours(self):
contours = []
masks = self.masks.detach().numpy()
for mask in masks:
mask = cv2.UMat(mask)
contour, hierarchy = cv2.findContours(
mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_TC89_L1
)
reshaped_contour = []
for entity in contour:
assert len(entity.shape) == 3
assert entity.shape[1] == 1, "Hierarchical contours are not allowed"
reshaped_contour.append(entity.reshape(-1).tolist())
contours.append(reshaped_contour)
return contours
示例2: _findContours
# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import CHAIN_APPROX_TC89_L1 [as 別名]
def _findContours(self):
contours = []
masks = self.masks.detach().numpy()
for mask in masks:
mask = cv2.UMat(mask)
contour, hierarchy = cv2_util.findContours(
mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_TC89_L1
)
reshaped_contour = []
for entity in contour:
assert len(entity.shape) == 3
assert (
entity.shape[1] == 1
), "Hierarchical contours are not allowed"
reshaped_contour.append(entity.reshape(-1).tolist())
contours.append(reshaped_contour)
return contours