4)统计[0-50] [50-100] [100-150] [150-200] [200-250] 频次
#遍历灰度图的所有像素num0_49 = 0num50_99 = 0num100_149 = 0num150_199 = 0num200_255 = 0numlist=[]print(gray)for row in gray: for col in row: if col < 40: #人为设置的超参数,表示0~39的灰度值为暗 dark_sum += 1 if (col < 50): #col in range[0, 50]: num0_49 += 1 if (50 <= col and col < 100): #col in range[50, 100]: num50_99 += 1 if (100 <= col and col < 150): #col in range[100, 150]: num100_149 += 1 if (150 <= col and col < 200): #col in range[150, 200]: num150_199 += 1 if (200 <= col and col < 255): #col in range[200, 250]: num200_255 += 1print(dark_sum)print(num0_49)print(num50_99)print(num100_149)print(num150_199)print(num200_255)