I have an image img
in the form
array([[ 0, 0, 0, ..., 255, 255, 255],
[ 0, 0, 0, ..., 255, 255, 0],
[ 0, 0, 0, ..., 255, 0, 0],
...,
[ 0, 0, 0, ..., 0, 0, 0],
[ 0, 0, 0, ..., 0, 0, 0],
[ 0, 0, 0, ..., 0, 0, 0]], dtype=uint8)
Is there any build in python function that convert images like that to 0,1 binarization?