标签:range 修改 write 遍历 route ack else users read
#Author C
import os
import cv2
list = []
for filename in os.listdir(r‘C:\Users\Uaena\Desktop\crack‘):
route = r‘C:\Users\Uaena\Desktop\crack\\‘ + filename
list.append(route)
print(list)
for n in range(len(list)):
img1=cv2.imread(list[n])
sq = img1.shape
l=sq[0]
width=sq[1]
for i in range(l):
for j in range(width):
if img1[i,j][0] == 0 and img1[i,j][1] ==0 and img1[i,j][2] == 0:
img1[i, j] = [0,0,0]
else:
# img1[i,j]=[0,0,0]
img1[i, j]=[255,255,255]
cv2.imwrite(r"C:\Users\Uaena\Desktop\bd\%d.jpg"%(n),img1)
标签:range 修改 write 遍历 route ack else users read
原文地址:https://www.cnblogs.com/mrc-369-com/p/9347914.html