Skip to content

Commit 77320a8

Browse files
committed
Unify calls of drawContours
1 parent c7124a4 commit 77320a8

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/python/model_api/models/segmentation.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -220,25 +220,13 @@ def get_contours(
220220
continue
221221

222222
mask = np.zeros(prediction.resultImage.shape, dtype=np.uint8)
223-
cv2.drawContours(
224-
mask,
225-
np.asarray([contour]),
226-
contourIdx=-1,
227-
color=1,
228-
thickness=-1,
229-
)
223+
cv2.drawContours(mask, contours, contourIdx=i, color=1, thickness=-1)
230224

231225
children = []
232226
next_child_idx = hierarchy[i][2]
233227
while next_child_idx >= 0:
234228
children.append(contours[next_child_idx])
235-
cv2.drawContours(
236-
mask,
237-
np.asarray([contours[next_child_idx]]),
238-
contourIdx=-1,
239-
color=0,
240-
thickness=-1,
241-
)
229+
cv2.drawContours(mask, contours, contourIdx=next_child_idx, color=0, thickness=-1)
242230
next_child_idx = hierarchy[next_child_idx][0]
243231

244232
probability = cv2.mean(current_label_soft_prediction, mask)[0]

0 commit comments

Comments
 (0)