Reputation: 25
Edit: i just want to change black pixel outside hull to white while keeping the black pixel inside hull.
contours, hierarchy = cv.findContours(morph, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_NONE)
mask = np.zeros_like(frame)
for hull in [cv.convexHull(cnt) for cnt in contours]:
cv.drawContours(mask, [hull], -1, (255, 255, 255), -1)
inverted= cv.bitwise_not(mask)
k = cv.bitwise_or(mask, inverted)
return k
just like this example img, i want to change the outside of hull to white and keeping the black inside it. Like the image above. But when i tried it show all white pixel and the black pixel inside hull also get white
Upvotes: 0
Views: 152