path1=r'C:\Users\asdf\Desktop\AAAA.png'
path2=r'C:\Users\asdf\Desktop\BBBB.png'
img1=cv2.imread(path1)
img2=cv2.imread(path2)
print(img1.shape)
height=img1.shape[0]
width=img1.shape[1]
channels=img1.shape[2]
print("height:%s,widht:%s,channels:%s" % (height,width,channels))
print(img1.size)
img1=cv2.cvtColor(img1,cv2.COLOR_BGR2HSV)
# img_bright=cv2.inRange(img,(0,200,0),(255,255,255))
for row in range(height):
for col in range(width): #@print(row , "," , col , ":",img1[row][col], "," , img2[row][col])
if img1[row][col][0]<=5 and img1[row][col][1]>240 and img1[row][col][2]>80:
img1[row,col]=[0,255,255]
else:
img1[row,col]=[0,0,255]
img1=cv2.cvtColor(img1,cv2.COLOR_HSV2BGR)
cv2.imwrite(r'C:\Users\\DDDD.png',img1)
color
于 2023-03-15 19:02:17 首次发布