Here is the code:
low = np.array([140, 140, 140]) high = np.array([255, 255, 255]) mask = cv2.inRange(img1, low, high) mask_off = cv2.threshold(mask, 10, 255