From 64892df51185f09d09ea977ffe9fb338c4b5ac98 Mon Sep 17 00:00:00 2001 From: 2509165016 <2509165016@student.edu.cn> Date: Thu, 16 Apr 2026 15:29:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BD=9C=E4=B8=9A3-1-3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2509165016--1.py | 26 ++++++++++++++++++++++++++ 2509165016--2.py | 0 2509165016--3.py | 0 3 files changed, 26 insertions(+) create mode 100644 2509165016--1.py create mode 100644 2509165016--2.py create mode 100644 2509165016--3.py diff --git a/2509165016--1.py b/2509165016--1.py new file mode 100644 index 0000000..b7aaac2 --- /dev/null +++ b/2509165016--1.py @@ -0,0 +1,26 @@ +import numpy as np + +# 定义3x3灰度图像 +image = np.array([ + [100, 150, 200], + [80, 120, 180], + [60, 90, 140] +], dtype=np.uint8) + +print("原图:") +print(image) + +# 1. 变暗20:每个像素值减20(需确保数值非负,uint8会自动截断,这里手动保证) +image_dark = np.clip(image - 20, 0, 255) +print("\n变暗20后:") +print(image_dark) + +# 2. 裁剪左上角2x2区域 +image_crop = image[:2, :2] +print("\n裁剪左上角2x2区域:") +print(image_crop) + +# 3. 水平翻转 +image_flip = np.fliplr(image) +print("\n水平翻转:") +print(image_flip) \ No newline at end of file diff --git a/2509165016--2.py b/2509165016--2.py new file mode 100644 index 0000000..e69de29 diff --git a/2509165016--3.py b/2509165016--3.py new file mode 100644 index 0000000..e69de29