AIM:就是将一个包含255和0的矩阵中的255变为0,0变成255
方法一:
pic_matrix = numpy.array(expand_pic)
height, width = expand_pic.shape
for i in range(height):
for j in range(width):
pic_matrix[i, j] = 255 - img[i, j]
方法二:
where_0 = np.where(pic_matrix == 0)
where_255 = np.where(pic_matrix == 255)
pic_matrix[where_0] = 255
pic_matrix[where_255] = 0