0
A
답변
0
- 임계
- findContours
- approxPolyDP
#findContours
im2, contours, hierarchy = cv2.findContours(thresh,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
canvas = img.copy()
## draw approx contours
for cnt in contours:
arclen = cv2.arcLength(cnt, True)
approx = cv2.approxPolyDP(cnt, arclen*0.005, True)
#drawContours
cv2.drawContours(canvas, [approx], -1, (0,0,255), 1, cv2.LINE_AA)
cv2.imwrite("result.png", canvas)