My code is this.
a = cv2.imread('img_directory',0)/255
a0 = np.zeros_like(a)
a0[a<0.9] = 1.0
a0[a>0.5] = 0.0
Here, I want to take values of a that is larger than 0.5, and smaller than 0.9. But I see that this code does not work properly. First I tried
a=[a<0.9 and a>0.5] =1.0
and this did not work. How should I make a code to fulfill my task ?