import numpy as np img = np.array([ [255, 255, 0, 0 ], [255, 255, 0, 0 ], [0, 0, 255, 255], [0, 0, 255, 255] ], dtype=np.uint8) print("原图:") print(img) print() white_pixels = np.sum(img == 255) black_pixels = np.sum(img == 0) print(f"白色像素(255)的数量:{white_pixels}") print(f"黑色像素(0)的数量:{black_pixels}") print() flipped_horizontal = np.fliplr(img) print("水平翻转后的图像:") print(flipped_horizontal) print() rotated_ccw = np.flipud(img.T) print("逆时针旋转90度后的图像:") print(rotated_ccw)