上传文件至 /
This commit is contained in:
22
hh.py
Normal file
22
hh.py
Normal file
@@ -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)
|
||||
Reference in New Issue
Block a user