From 4821f205d2d817622c5d075f4c0ef9521e506a00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E6=96=87=E6=9D=B0?= <2509165027@student.example.com> Date: Thu, 16 Apr 2026 16:03:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 260416-2509165027.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 260416-2509165027.py diff --git a/260416-2509165027.py b/260416-2509165027.py new file mode 100644 index 0000000..6c3eef1 --- /dev/null +++ b/260416-2509165027.py @@ -0,0 +1,34 @@ +#练习1---------- +import numpy as np +image=np.array([ + [100,150, 200], + [80, 120, 180], + [60, 90, 140] +],dtype=np.uint8) +print("原图:") +print(image) +darker=image-20 +print(darker) +top_left=image[0:2, 0:2] +print(top_left) +flipped=np.fliplr(image) +print(flipped) +#练习2----------- +import numpy as np +image=np.array([ + [255, 255, 0, 0], + [255, 255, 0, 0], + [ 0, 0, 255, 255], + [ 0, 0, 255, 255] +],dtype=np.uint8) + +#练习3----------- +import numpy as np +feature_map1=np.array([[1, 0, 1], [0, 1, 0], [1, 0, 1]]) +feature_map2=np.array([[1, 1, 1], [1, 0, 0], [1, 0, 0]]) + +vector1=feature_map1.flatten() +vector2=feature_map2.flatten() + +print("vector1", vector1) +print("vector2", vector2) \ No newline at end of file