diff --git a/hh.py b/hh.py new file mode 100644 index 0000000..5e4377b --- /dev/null +++ b/hh.py @@ -0,0 +1,22 @@ +import numpy as np + +# 4x4 灰度图像 +image = np.array([ + [255, 200, 150, 100], + [180, 140, 110, 80], + [120, 90, 60, 40], + [50, 30, 20, 10] +]) + +# 3x3 彩色图像(RGB三通道) +color_image = np.array([ + [[255, 0, 0], [0, 255, 0], [0, 0, 255]], # 红、绿、蓝 + [[255, 255, 0], [0, 255, 255], [255, 0, 255]], # 黄、青、紫 + [[128, 128, 128], [100, 100, 100], [50, 50, 50]] # 灰度 +]) + +# 打印结果,让终端有输出 +print("=== 灰度图像数组 ===") +print(image) +print("\n=== 彩色图像数组 ===") +print(color_image) \ No newline at end of file