This commit is contained in:
2505140092
2026-04-16 15:58:38 +08:00
parent bb1edce9c9
commit 4ed4364b14
2 changed files with 33 additions and 0 deletions

22
lx1 Normal file
View File

@@ -0,0 +1,22 @@
import numpy as np
image = np.array([
[100, 150, 200],
[80, 120, 180],
[60, 90, 140]
], dtype=np.uint8)
print("原图:")
print(image)
image_dark = image - 20
print("变暗20: ")
print(image_dark)
image_crop = image[0:2, 0:2]
print("裁剪左上角: ")
print(image_crop)
image_flip = np.fliplr(image)
print("水平翻转: ")
print(image_flip)

11
lx2 Normal file
View File

@@ -0,0 +1,11 @@
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)
white_count = np.sum(img == 255)
black_count = np.sum(img == 0)