jeudi 28 juillet 2016

Fill the outside of contours OpenCV

I am trying to color in black the outside region of a contours using openCV and python language. Here is my code :

contours, hierarchy = cv2.findContours(copy.deepcopy(img_copy),cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
areas = [cv2.contourArea(c) for c in contours]
max_index = np.argmax(areas)
cnt=contours[max_index]
# how to fill of black the outside of the contours cnt please? `

Aucun commentaire:

Enregistrer un commentaire