From 4ed4364b14ded50109913a5dcf668b9d2ea9dbb8 Mon Sep 17 00:00:00 2001 From: 2505140092 <2505140092@student.edu.cn> Date: Thu, 16 Apr 2026 15:58:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lx1 | 22 ++++++++++++++++++++++ lx2 | 11 +++++++++++ 2 files changed, 33 insertions(+) create mode 100644 lx1 create mode 100644 lx2 diff --git a/lx1 b/lx1 new file mode 100644 index 0000000..1eb4b98 --- /dev/null +++ b/lx1 @@ -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) \ No newline at end of file diff --git a/lx2 b/lx2 new file mode 100644 index 0000000..4a6cfb0 --- /dev/null +++ b/lx2 @@ -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)