import cv2 as cv
file_path = 'E:/Python/pythonProject_4/1.jpg'
def blackAndwhite_screen(file_path):
img = cv.imread(file_path)
rows=img.shape[0]
cols=img.shape[1]
n=0
for r in range(0,rows):
for c in range(0,cols):
if img[r,c,0] == img[r,c,1] == img[r,c,2] <= 100:
n+=1
elif img[r,c,0] == img[r,c,1] == img[r,c,2] >= 200:
n+=1
if n>=rows*cols*0.3:
#print(0)
return False
else:
#print(1)
return True
result = blackAndwhite_screen(file_path)
print(result)