defjubuThreshold(input_img_file): image = input_img_file gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) binary = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY, 25, 10) cv2.destroyAllWindows() for y in binary : for x in y : if0 == x : print("0",end='') else: print("1",end='') print("")