true false array to black and white 1

true false array to black and white

#should convert true false to black white first with this
mask = true_false_array.astype('uint8')*255
#then mask
cv2.bitwise_and(img, img, mask = mask)

Here is what the above code is Doing:
1. Convert the image to grayscale
2. Apply a threshold to the image
3. Convert the image to a boolean array
4. Convert the boolean array to an array of uint8s
5. Apply the mask

Similar Posts